|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--uci.gef.Fig
|
+--uci.gef.FigPoly
Primitive Fig to paint Polygons on a LayerDiagram. FigPolys contain a set of points that define the polygon, a boolean to determine if the polygon should be constrained to rectilinear (strict horizontal and vertical) segments, and a number of handles that cannot be moved by user dragging. A FigPoly is not closed unless the last point equals the first point. Thus, FigPolys can be used to represent polylines such as FigEdgeRectilinear.
ActionRemoveVertex,
ActionInsertVertex,
FigEdgeRectilinear, Serialized Form| Field Summary | |
protected int |
_fixedHandles
The number of handles at each end of the polygon that cannot be dragged by the user. |
boolean |
_isComplete
Flag to indicate when the polygon is completed |
protected boolean |
_isSelfLoop
Flag to indicate when the polygon is used as a self-loop for a node |
protected int |
_npoints
The total number of points. |
protected boolean |
_rectilinear
Flag to control how the polygon is drawn |
protected int[] |
_xpoints
The array of x coordinates. |
protected int[] |
_ypoints
The array of y coordinates. |
protected static double |
FUDGEFACTOR
The radian angle at which a point can be deleted. |
| Fields inherited from class uci.gef.Fig |
_dashes,
_fillColor,
_filled,
_group,
_h,
_layer,
_lineColor,
_lineWidth,
_locked,
_w,
_x,
_y,
BORDER,
DASH_ARRAYS,
DASHED_CHOICES,
MIN_SIZE |
| Constructor Summary | |
FigPoly()
Construct a new FigPoly. |
|
FigPoly(Color lineColor)
Construct a new FigPoly w/ the given line color. |
|
FigPoly(Color lineColor,
Color fillColor)
Construct a new FigPoly w/ the given line color and fill color. |
|
FigPoly(int x,
int y)
Construct a new FigPoly w/ the given point. |
|
| Method Summary | |
void |
addPoint(int x,
int y)
Add a point to this polygon. |
void |
addPoint(Point p)
Add a point to this polygon. |
protected void |
appendTwoPoints()
Add two points at the end of the polygon. |
void |
calcBounds()
Update the bounding box. |
protected boolean |
canMoveVertex(int i,
boolean ov)
Reply true if the point at the given index can be moved. |
void |
cleanUp()
|
Object |
clone()
|
boolean |
contains(int x,
int y)
Reply true iff the given point is inside this FigPoly. |
protected int |
countCornersContained(int x,
int y,
int w,
int h)
Return the number of corners of the given rectangle that are conatined within this polygon. |
protected void |
drawDashedPerimeter(Graphics g)
A faster implementation of drawDashedPerimeter for polygons. |
protected int |
findHandle(int x,
int y)
Reply the index of the vertex that the given mouse point is near. |
Point |
getClosestPoint(Point anotherPt)
Returns the point that other connected Figs should attach to. |
Point |
getFirstPoint()
|
int |
getFixedHandles()
Reply the number of fixed handles. |
Vector |
getGravityPoints()
|
Point |
getLastPoint()
|
int |
getNumPoints()
Return the number of points in this polygon |
int |
getPerimeterLength()
Returns the length of the perimeter of the polygon, which is the sum of all the lengths of its segments. |
Point |
getPoints(int i)
return the point at index i. |
Vector |
getPointsVector()
|
Vector |
getPointsVectorNotFirst()
|
Polygon |
getPolygon()
Get the current vector of points as a java.awt.Polygon. |
boolean |
getRectilinear()
Return true if the polygon should be constrained to rectilinear segments. |
int[] |
getXs()
Returns the array of X coordinates of points |
int[] |
getYs()
Returns the array of Y coordinates of points |
protected void |
growIfNeeded()
Increase the memory used to store polygon points, if needed. |
boolean |
hit(Rectangle r)
|
void |
insertPoint(int i,
int x,
int y)
Inserts a point at index i. |
boolean |
isReshapable()
|
boolean |
isResizable()
FigPolys are resizeable and reshapable, but not rotatable (yet). |
boolean |
isRotatable()
|
void |
moveVertex(Handle h,
int x,
int y,
boolean ov)
Move the point indicated by the given Handle object to the given location. |
boolean |
OK()
Class invarient to make sure this object is in a valid state. |
void |
paint(Graphics g)
Paint the FigPoly on the given Graphics |
protected void |
prependTwoPoints()
Add two points to the front of the list of points. |
void |
removePoint(int i)
Removes the point at index i. |
void |
setBounds(int x,
int y,
int w,
int h)
Sets the FigPoly's bounding box to the given coordinates. |
void |
setEndPoints(Point start,
Point end)
Set the end points of this polygon, regardless of the number of fixed handles. |
void |
setFixedHandles(int n)
Set the number of points near each end of the polygon that cannot be dragged by the user. |
void |
setPoints(Handle h,
int mX,
int mY)
When the user drags the handles, move individual points |
void |
setPolygon(Polygon p)
Set the current vector of points. |
void |
setRectilinear(boolean r)
Set the rectilinear flag. |
void |
stuffPointAlongPerimeter(int dist,
Point res)
Returns a point along the perimeter at distance dist from the start of the polygon. |
void |
translate(int dx,
int dy)
Change the position of the object from were it is to were it is plus dx or dy. |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected static final double FUDGEFACTOR
protected int _npoints
protected int[] _xpoints
protected int[] _ypoints
protected boolean _rectilinear
public boolean _isComplete
protected boolean _isSelfLoop
protected int _fixedHandles
| Constructor Detail |
public FigPoly(Color lineColor)
public FigPoly(Color lineColor,
Color fillColor)
public FigPoly()
public FigPoly(int x,
int y)
| Method Detail |
public Object clone()
public boolean OK()
public Polygon getPolygon()
public void setPolygon(Polygon p)
public int getNumPoints()
public boolean getRectilinear()
public void setRectilinear(boolean r)
public int getFixedHandles()
public void setFixedHandles(int n)
public void setEndPoints(Point start,
Point end)
public void translate(int dx,
int dy)
public void addPoint(int x,
int y)
public final void addPoint(Point p)
protected boolean canMoveVertex(int i,
boolean ov)
public void moveVertex(Handle h,
int x,
int y,
boolean ov)
protected void prependTwoPoints()
protected void appendTwoPoints()
public void removePoint(int i)
public void insertPoint(int i,
int x,
int y)
protected void growIfNeeded()
public Point getPoints(int i)
public Vector getPointsVector()
public Vector getPointsVectorNotFirst()
public Point getFirstPoint()
public Point getLastPoint()
public void setPoints(Handle h,
int mX,
int mY)
public void cleanUp()
public Point getClosestPoint(Point anotherPt)
public Vector getGravityPoints()
public void paint(Graphics g)
protected void drawDashedPerimeter(Graphics g)
protected int findHandle(int x,
int y)
public boolean contains(int x,
int y)
public int[] getXs()
public int[] getYs()
public void setBounds(int x,
int y,
int w,
int h)
public int getPerimeterLength()
public void stuffPointAlongPerimeter(int dist,
Point res)
public boolean isResizable()
public boolean isReshapable()
public boolean isRotatable()
protected int countCornersContained(int x,
int y,
int w,
int h)
Fig.hit(java.awt.Rectangle)public boolean hit(Rectangle r)
public void calcBounds()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||