// (c) MIT 2003.  All rights reserved.

package rec.core.widgets;

import java.awt.*;
import java.awt.geom.*;
import rec.util.*;
import rec.geo.*;
import rec.sys.*;
import edu.mit.sketch.geom.Spiral;
import edu.mit.sketch.geom.Point;

public class WToolkitSpiral extends VisibleWidget
{
    private GToolkitSpiral m_Spiral;

    public WToolkitSpiral (Spiral spiral)
    {
	setEnglishName( "Spiral" );
	m_Spiral = new GToolkitSpiral(spiral);
    }

    public WToolkitSpiral( GToolkitSpiral spiral )
    {
	setEnglishName( "Spiral" );
	m_Spiral = spiral;
    }

    public GToolkitSpiral getSpiral(){
	return (GToolkitSpiral) m_Spiral.copy();
    }
         
    public boolean getClockwise(){
	return m_Spiral.getClockwise();
    }

    public double getRotations(){
	return m_Spiral.getRotations();
    }

    public void draw( Graphics g )
    {
	m_Spiral.display( g );
    }
    
    public boolean includes( GPoint gp, double offset )
    {
	boolean returnme = m_Spiral.includes(gp, offset );
	
	return returnme;
    }
    
    public boolean contains( GPoint gp )
    {
	//System.out.println("CONTAINS");
	return( m_Spiral.contains( gp ) );
    }

    public void move( GPoint gp )
    {
	double xtran = gp.x - getLocation().getCenter().x;
	double ytran = gp.y - getLocation().getCenter().y;

	m_Spiral.translate(xtran,ytran);
	
    }
    
    public void translate( GPoint gp )
    {
	m_Spiral.translate( gp.x, gp.y );
    }
    
    public void rotate( GPoint gp, double angle )
    {
	m_Spiral.rotate(gp, angle);
    }
    
    public Location getLocation()
    {
	return( new Location( m_Spiral.getBounds() ) );
    }
    
    public Rectangle getBounds()
    {
	return( m_Spiral.getBounds() );
    }
    
    public Object clone()
    {
	return( new WToolkitSpiral( m_Spiral ) );
    }
    
    public double size()
    {
	//System.out.println("Spiral - size");
	return 0;
    }
    
    public void resize( double scaleFactor )
    {
	m_Spiral.resize(scaleFactor);
    }
}
