/** @(#) Shapes.java 1.0 99/11/20 Larry Rodrigues
 **/
package com.vistech.shapes;
import java.awt.*;
import java.awt.geom.*;
/** An abstract class that represents an interactively drawable shape.
  * A shape extends this class and typically implements one of the Drawable,
  * Fillabe, and Typable.
  * @version 1.0  20 Nov 1999
  * @author Larry Rodrigues
  **/
abstract public class Shapes implements java.io.Serializable, Cloneable{
   public Point st = new Point(0,0);
   public Point cur = new Point(0,0);
   public Color drawingColor =  Color.green.brighter();
   public Color fillColor = Color.blue;
   public Font font =  new Font("Helvetica", Font.BOLD,10);
   public Stroke basicStroke;
   public int shapeCount =0;
   public boolean fillOn = false;
   public boolean smallRectsOn = false;

   public GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);

   public void setDrawingColor(Color col) { drawingColor = col;}
   public Color getDrawingColor() { return drawingColor;}

   public void setFillColor(Color col) { fillColor = col;}
   public Color getFillColor() { return fillColor;}

   public void setStartPosition(Point stp){
      st = stp; cur = stp;
   }
   public Point getStartPosition(){ return st;}

   public void setCurrentPosition(Point cp){ cur = cp;}
   public Point getCurrentPosition(){ return cur;}

   public void setFont(Font fnt) { font = fnt;}
   public Font getFont() { return font;}

   public void setStroke(Stroke stk){ basicStroke = stk;}
   public Stroke getStroke(){ return basicStroke;}

   public void setShapeCount(int count){shapeCount = count;}
   public int getShapeCount(){ return shapeCount;}

   public void setGeneralPath(GeneralPath pt){path=pt;}
   public GeneralPath getGeneralPath(){return path;}

   public void setSmallRectsOn(boolean onOrOff) {smallRectsOn = onOrOff;}
   public boolean getSmallRectsOn() { return smallRectsOn;}

   public void setFillOn(boolean onOrOff){ fillOn = onOrOff;}
   public boolean getFillOn() { return fillOn;}

   public boolean contains(int x, int y){
      return path.contains((double)x, (double)y);
   }

   public Object copy() throws CloneNotSupportedException{
      return clone();
   }

   abstract public void init(int x, int y);
   /** Vhecks whether the specified point contained in the shape. 
     * @param g the graphics context on which the shape was drawn.
     * @param x the coordinate of the point that is being checked for containment.
     * @param y the coordinate of the point that is being checked for containment.
     **/
   abstract public boolean contains(Graphics2D g, int x, int y);
   /** Draws small rectangle at the shape corners to indicate that
     * the shape is active. For example, a shape that is being moved is
     * surrounded by small rectagles at the shape corners.
     * small rectab
     * @param g the graphics context on which the shape was drawn.
     */
   abstract public void drawSmallRects(Graphics2D g);
}
















