simtools.shapes
Class BasicShape

java.lang.Object
  extended by simtools.shapes.AbstractShape
      extended by simtools.shapes.BasicShape
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, Resizable, NamedProperties

public class BasicShape
extends AbstractShape
implements java.io.Serializable, java.lang.Cloneable, Resizable

A class to draw basic shapes such as rectangle, ellipse, arc and round rectangle The drawing includes the definition of the color for both the bounds and the filling

Version:
1.0 2001
Author:
Claude Cazenave
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape
AbstractShape.AbstractShapePropertiesNames
 
Field Summary
protected  java.awt.Color _bColor
           
protected  java.awt.Color _fColor
           
protected  java.awt.geom.RectangularShape _shape
           
static int ARC
           
static int ELLIPSE
           
static int RECTANGLE
           
static int ROUND_RECTANGLE
           
 
Fields inherited from class simtools.shapes.AbstractShape
_h, _ox, _oy, _propertyNames, _w, _x, _y, ANTI_ALIASING, currentDialogBox, FONT_NAMES, listeners, REFRESH_PERIOD
 
Constructor Summary
BasicShape(int type, int ox, int oy, int width, int height, double param1, double param2)
          Creates a new shape
 
Method Summary
protected  AbstractShape cloneShape()
          Performs a copy of the shape
 void draw(java.awt.Graphics2D g)
          Draws the shape
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
           
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
           
 void resize(int dx, int dy)
          Resizes the shape
 void setAnchor(java.awt.Point p)
          Sets shape anchor
 java.awt.Color setBorderColor()
          Get border color
 void setBorderColor(java.awt.Color c)
          Set border color
 java.awt.Color setFillerColor()
          Get filler color
 void setFillerColor(java.awt.Color c)
          Set filler color
 void translate(int dx, int dy)
          Translates the shape
 
Methods inherited from class simtools.shapes.AbstractShape
addListener, contains, contains, contains, contains, getAnchor, getBounds, getBounds2D, getInnerProperties, getMax, getMaxTranslated, getMin, getPropertyNames, getPropertyValue, intersects, intersects, notifyChange, notifyChange, refresh, removeListener, setAnchor, setProperties, setPropertyValue, wipeOff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECTANGLE

public static final int RECTANGLE
See Also:
Constant Field Values

ELLIPSE

public static final int ELLIPSE
See Also:
Constant Field Values

ARC

public static final int ARC
See Also:
Constant Field Values

ROUND_RECTANGLE

public static final int ROUND_RECTANGLE
See Also:
Constant Field Values

_shape

protected java.awt.geom.RectangularShape _shape

_bColor

protected java.awt.Color _bColor

_fColor

protected java.awt.Color _fColor
Constructor Detail

BasicShape

public BasicShape(int type,
                  int ox,
                  int oy,
                  int width,
                  int height,
                  double param1,
                  double param2)
Creates a new shape

Method Detail

cloneShape

protected AbstractShape cloneShape()
Performs a copy of the shape

Overrides:
cloneShape in class AbstractShape
Returns:
a copy of the shape

setBorderColor

public void setBorderColor(java.awt.Color c)
Set border color

Parameters:
the - color

setBorderColor

public java.awt.Color setBorderColor()
Get border color

Returns:
the color

setFillerColor

public void setFillerColor(java.awt.Color c)
Set filler color

Parameters:
the - color

setFillerColor

public java.awt.Color setFillerColor()
Get filler color

Returns:
the color

resize

public void resize(int dx,
                   int dy)
Resizes the shape

Specified by:
resize in interface Resizable
Parameters:
dx - value on x axis
dy - value on y axis

setAnchor

public void setAnchor(java.awt.Point p)
Sets shape anchor

Overrides:
setAnchor in class AbstractShape
Parameters:
p - the origin

translate

public void translate(int dx,
                      int dy)
Translates the shape

Overrides:
translate in class AbstractShape

draw

public void draw(java.awt.Graphics2D g)
Draws the shape

Specified by:
draw in class AbstractShape
Parameters:
g - the graphics context

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
Specified by:
getPathIterator in interface java.awt.Shape
Overrides:
getPathIterator in class AbstractShape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at,
                                                  double flatness)
Specified by:
getPathIterator in interface java.awt.Shape
Overrides:
getPathIterator in class AbstractShape