Synergy Home Page

au.edu.swin.synergy.shapes
Class BPolygon

java.lang.Object
  |
  +--au.edu.swin.synergy.plugin.diagram.BDrawable
        |
        +--au.edu.swin.synergy.shapes.BPolygon

public class BPolygon
extends BDrawable
implements BSaveable

See Also:
Serialized Form

Field Summary
protected  boolean doFill
           
protected  boolean doOutline
           
protected  Color fillColour
           
protected static String kDefaultDoFill
           
protected static String kDefaultDoOutline
           
protected static String kDefaultFillColor
           
protected static String kDefaultLineColor
           
protected static String kDefaultOutlineColor
           
protected static String kDefaultShapeStyle
           
protected static String kDefaultUseFillColor
           
protected static String kDefaultUseOutlineColor
           
protected static String kKeyDoFill
           
protected static String kKeyDoOutline
           
protected static String kKeyFillColor
           
protected static String kKeyLineColor
           
protected static String kKeyOutlineColor
           
protected static String kKeyShapeStyle
           
protected static String kKeyUseFillColor
           
protected static String kKeyUseOutlineColor
           
protected  Color lineColour
           
protected  Color outlineColour
           
protected  Vector points
           
protected  int sizerNum
           
protected  BasicStroke stroke
           
protected  BScalarPoint tmpView
           
protected  boolean useFillColour
           
protected  boolean useOutlineColour
           
protected  int[] xVals
           
protected  int[] yVals
           
 
Fields inherited from class au.edu.swin.synergy.plugin.diagram.BDrawable
bounds, iconOOZ, kBackward, kDefaultName, kDefaultStatus, kEmptyFlag, kForward, kHighlightFlag, kHitBounds, kHitSizer, kKeyName, kKeyStatus, kNotHit, kSelectedFlag, kSizerCtrlPoint1, kSizerCtrlPoint2, kSizerEndArc, kSizerHalfH, kSizerHalfW, kSizerNorthEast, kSizerNorthWest, kSizerSouthEast, kSizerSouthWest, kSizerStartArc, lastFrame, name, paintCount, pos, sizerColour, statusFlag, tmpBounds
 
Constructor Summary
BPolygon()
           
BPolygon(BPolygon line)
           
BPolygon(int x1, int y1, int x2, int y2)
           
 
Method Summary
 int checkSizerHit(Point pt)
          Checks to see if a sizer has been hit by a point Works on xformed values.
 int checkXFormBounds(Point pt)
          Checks to see if a point has hit the transformed bounds of this object
 void continueAdd(BScalarPoint pt)
          continue adding this drawable...
 void copy(BPolygon src)
          copies the data from the src BRectShape into this one.
 void dragAdd(BScalarPoint deltaXY)
          called when the user is drag adding the line...
 void dragResize(BScalarPoint deltaXY)
           
 Color getFillColour()
           
 Color getLineColour()
           
 String getName()
          Returns the name of this drawable object
 BPropPanel getPropertyPanel()
           
 BasicStroke getStroke()
           
 Integer getStyle()
           
 boolean load(BDataFile file)
          Loads the BDrawable from a file
 BDrawable newInstance()
          Creates and returns a new instance of the BDrawable object
 void paintIcon(Component c, Graphics g, int x, int y)
           
 void render(Graphics2D g2)
          Renders the transformed coordinates of the line to a Graphics2D
protected  void renderFill(Graphics2D g2)
           
 void renderOutlineAndSizers(Graphics2D g2)
           
protected  void renderShape(Graphics2D g2)
           
 boolean save(BDataFile file)
          Saves the BDrawable to a file
 void setDoFill(boolean doFill)
           
 void setFillColour(Color colour)
           
 void setLineColour(Color colour)
           
 void setOutlineColour(Color colour)
           
 void setStroke(BasicStroke stroke)
           
 void setStyle(Integer style)
           
 void startAdd()
          called when the drawable is about to be added..
 void startResize(int sizerNum)
           
 void stopAdd()
          called when the drawable has finished being added..
 void stopResize()
           
 void transform(BView viewport, BScalarPoint parentPos, int frameCounter)
          Transforms the coordinates of the rectshape to a new coordinate space, as defined by the viewport and parent pos.
 void updateBounds()
          updates the bounding region of the drawable Called when something requires the bounds of the drawable to be updated.
 
Methods inherited from class au.edu.swin.synergy.plugin.diagram.BDrawable
checkXFormHit, contains, copy, delete, doPasted, dragMove, getBasicStroke, getBounds, getColour, getIconHeight, getIconWidth, getPos, incPos, intersects, isDeletable, isHighlighted, isInside, isSelected, isStatusFlag, isTransformed, setFlag, setHighlighted, setName, setPos, setPos, setSelected, snapToGrid, startMove, stopMove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

doFill

protected boolean doFill

doOutline

protected boolean doOutline

useFillColour

protected boolean useFillColour

useOutlineColour

protected boolean useOutlineColour

fillColour

protected Color fillColour

outlineColour

protected Color outlineColour

lineColour

protected Color lineColour

stroke

protected BasicStroke stroke

points

protected Vector points

tmpView

protected BScalarPoint tmpView

xVals

protected int[] xVals

yVals

protected int[] yVals

sizerNum

protected int sizerNum

kKeyDoFill

protected static final String kKeyDoFill

kDefaultDoFill

protected static final String kDefaultDoFill

kKeyUseFillColor

protected static final String kKeyUseFillColor

kDefaultUseFillColor

protected static final String kDefaultUseFillColor

kKeyFillColor

protected static final String kKeyFillColor

kDefaultFillColor

protected static final String kDefaultFillColor

kKeyDoOutline

protected static final String kKeyDoOutline

kDefaultDoOutline

protected static final String kDefaultDoOutline

kKeyUseOutlineColor

protected static final String kKeyUseOutlineColor

kDefaultUseOutlineColor

protected static final String kDefaultUseOutlineColor

kKeyOutlineColor

protected static final String kKeyOutlineColor

kDefaultOutlineColor

protected static final String kDefaultOutlineColor

kKeyShapeStyle

protected static final String kKeyShapeStyle

kDefaultShapeStyle

protected static final String kDefaultShapeStyle

kKeyLineColor

protected static final String kKeyLineColor

kDefaultLineColor

protected static final String kDefaultLineColor
Constructor Detail

BPolygon

public BPolygon(int x1,
                int y1,
                int x2,
                int y2)

BPolygon

public BPolygon(BPolygon line)

BPolygon

public BPolygon()
Method Detail

setDoFill

public void setDoFill(boolean doFill)

setFillColour

public void setFillColour(Color colour)

getFillColour

public Color getFillColour()

setOutlineColour

public void setOutlineColour(Color colour)

setLineColour

public void setLineColour(Color colour)

getLineColour

public Color getLineColour()

setStroke

public void setStroke(BasicStroke stroke)

setStyle

public void setStyle(Integer style)

getStyle

public Integer getStyle()

getStroke

public BasicStroke getStroke()

getPropertyPanel

public BPropPanel getPropertyPanel()
Overrides:
getPropertyPanel in class BDrawable

render

public void render(Graphics2D g2)
Renders the transformed coordinates of the line to a Graphics2D
Parameters:
Graphics2D - g2 - the place to render the object to.
Overrides:
render in class BDrawable

renderFill

protected void renderFill(Graphics2D g2)

renderShape

protected void renderShape(Graphics2D g2)

renderOutlineAndSizers

public void renderOutlineAndSizers(Graphics2D g2)

newInstance

public BDrawable newInstance()
Creates and returns a new instance of the BDrawable object
Returns:
a new instance of this BDrawable object.
Overrides:
newInstance in class BDrawable

startAdd

public void startAdd()
called when the drawable is about to be added..
Overrides:
startAdd in class BDrawable

dragAdd

public void dragAdd(BScalarPoint deltaXY)
called when the user is drag adding the line...
Overrides:
dragAdd in class BDrawable

continueAdd

public void continueAdd(BScalarPoint pt)
continue adding this drawable...
Overrides:
continueAdd in class BDrawable

stopAdd

public void stopAdd()
called when the drawable has finished being added..
Overrides:
stopAdd in class BDrawable

transform

public void transform(BView viewport,
                      BScalarPoint parentPos,
                      int frameCounter)
Transforms the coordinates of the rectshape to a new coordinate space, as defined by the viewport and parent pos.
Parameters:
BView - viewport - the viewport that this object is going to be drawn in
Point - parentPos - coordinates of any parent object
Overrides:
transform in class BDrawable

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Overrides:
paintIcon in class BDrawable

load

public boolean load(BDataFile file)
Loads the BDrawable from a file
Specified by:
load in interface BSaveable
Parameters:
BDataFile - file - the file to load from
Returns:
boolean - true on success, false on failure.
Overrides:
load in class BDrawable

save

public boolean save(BDataFile file)
Saves the BDrawable to a file
Specified by:
save in interface BSaveable
Parameters:
BDataFile - file - the file to save to
Returns:
boolean - true on success, false on failure.
Overrides:
save in class BDrawable

startResize

public void startResize(int sizerNum)
Overrides:
startResize in class BDrawable

dragResize

public void dragResize(BScalarPoint deltaXY)
Overrides:
dragResize in class BDrawable

stopResize

public void stopResize()
Overrides:
stopResize in class BDrawable

updateBounds

public void updateBounds()
updates the bounding region of the drawable Called when something requires the bounds of the drawable to be updated. Subclasses should determine a suitable way to update themselves.
Overrides:
updateBounds in class BDrawable

copy

public void copy(BPolygon src)
copies the data from the src BRectShape into this one.
Parameters:
BRectShape - src - the sourc BRectShape..

getName

public String getName()
Returns the name of this drawable object
Returns:
String - the name of the object..
Overrides:
getName in class BDrawable

checkXFormBounds

public int checkXFormBounds(Point pt)
Checks to see if a point has hit the transformed bounds of this object
Parameters:
Point - pt - the point to check the hit against..
Returns:
kNotHit - not hit
Overrides:
checkXFormBounds in class BDrawable

checkSizerHit

public int checkSizerHit(Point pt)
Checks to see if a sizer has been hit by a point Works on xformed values. Subclasses should determine appropriate places for the sizer..
Parameters:
Point - pt - the point to check the hit against
Returns:
kNotHit - not hit
Overrides:
checkSizerHit in class BDrawable

Synergy Home Page