|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCH.ifa.draw.standard.AbstractFigure
CH.ifa.draw.figures.AttributeFigure
CH.ifa.draw.contrib.PolygonFigure
public class PolygonFigure
A scalable, rotatable polygon with an arbitrary number of points
Field Summary | |
---|---|
protected java.awt.Polygon |
fPoly
|
Fields inherited from interface CH.ifa.draw.framework.Figure |
---|
POPUP_MENU |
Constructor Summary | |
---|---|
PolygonFigure()
|
|
PolygonFigure(int x,
int y)
|
|
PolygonFigure(java.awt.Polygon p)
|
Method Summary | |
---|---|
void |
addPoint(int x,
int y)
Adds a node to the list of points. |
void |
basicDisplayBox(java.awt.Point origin,
java.awt.Point corner)
Sets the display box of a figure. |
void |
basicMoveBy(int dx,
int dy)
Moves the figure. |
static java.awt.Rectangle |
bounds(java.awt.Polygon p)
replacement for builtin Polygon.getBounds that doesn't always update? |
java.awt.Point |
center()
Gets the center of a figure. |
static java.awt.Point |
center(java.awt.Polygon p)
|
java.awt.Point |
chop(java.awt.Point p)
|
static java.awt.Point |
chop(java.awt.Polygon poly,
java.awt.Point p)
|
Connector |
connectorAt(int x,
int y)
Returns the Figures connector for the specified location. |
boolean |
containsPoint(int x,
int y)
Checks if a point is inside the figure. |
java.awt.Rectangle |
displayBox()
Gets the display box of a figure. |
static double |
distanceFromLine(int xa,
int ya,
int xb,
int yb,
int xc,
int yc)
compute distance of point from line segment, or Double.MAX_VALUE if perpendicular projection is outside segment; or If pts on line are same, return distance from point |
void |
drawBackground(java.awt.Graphics g)
Draws the background of the figure. |
void |
drawFrame(java.awt.Graphics g)
Draws the frame of the figure. |
int |
findSegment(int x,
int y)
Gets the segment that is hit by the given point. |
java.awt.Polygon |
getPolygon()
return a copy of the raw polygon |
java.util.Vector |
handles()
Returns the handles of a Figure that can be used to manipulate some of its attributes. |
void |
insertPointAt(java.awt.Point p,
int i)
Insert a node at the given point. |
boolean |
isEmpty()
Checks if the figure is empty. |
static Locator |
locator(int pointIndex)
Creates a locator for the point with the given index. |
java.awt.Point |
outermostPoint()
Return the point on the polygon that is furthest from the center |
java.awt.Point |
pointAt(int i)
|
int |
pointCount()
|
java.util.Enumeration |
points()
|
void |
read(StorableInput dr)
Reads the Figure from a StorableInput. |
void |
removePointAt(int i)
|
void |
scaleRotate(java.awt.Point anchor,
java.awt.Polygon originalPolygon,
java.awt.Point p)
Scale and rotate relative to anchor |
void |
setPointAt(java.awt.Point p,
int i)
Changes the position of a node. |
void |
smoothPoints()
Remove points that are nearly colinear with others |
int |
splitSegment(int x,
int y)
Splits the segment at the given point if a segment was hit. |
void |
write(StorableOutput dw)
Stores the Figure to a StorableOutput. |
Methods inherited from class CH.ifa.draw.figures.AttributeFigure |
---|
draw, getAttribute, getDefaultAttribute, getFillColor, getFrameColor, setAttribute |
Methods inherited from class CH.ifa.draw.standard.AbstractFigure |
---|
addFigureChangeListener, addToContainer, canConnect, changed, clone, connectedTextLocator, connectionInsets, connectorVisibility, decompose, displayBox, displayBox, figures, findFigureInside, includes, invalidate, listener, moveBy, release, removeFigureChangeListener, removeFromContainer, size, willChange |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.Polygon fPoly
Constructor Detail |
---|
public PolygonFigure()
public PolygonFigure(int x, int y)
public PolygonFigure(java.awt.Polygon p)
Method Detail |
---|
public java.awt.Rectangle displayBox()
AbstractFigure
displayBox
in interface Figure
displayBox
in class AbstractFigure
Figure.basicDisplayBox(java.awt.Point, java.awt.Point)
public boolean isEmpty()
AbstractFigure
isEmpty
in interface Figure
isEmpty
in class AbstractFigure
Figure.isEmpty()
public java.util.Vector handles()
AbstractFigure
handles
in interface Figure
handles
in class AbstractFigure
Handle
public void basicDisplayBox(java.awt.Point origin, java.awt.Point corner)
AbstractFigure
basicDisplayBox
in interface Figure
basicDisplayBox
in class AbstractFigure
origin
- the new origincorner
- the new cornerAbstractFigure.displayBox(java.awt.Point, java.awt.Point)
public java.awt.Polygon getPolygon()
public java.awt.Point center()
AbstractFigure
center
in interface Figure
center
in class AbstractFigure
public java.util.Enumeration points()
public int pointCount()
public void basicMoveBy(int dx, int dy)
AbstractFigure
basicMoveBy
in class AbstractFigure
AbstractFigure.moveBy(int, int)
public void drawBackground(java.awt.Graphics g)
AttributeFigure
drawBackground
in class AttributeFigure
AttributeFigure.draw(java.awt.Graphics)
public void drawFrame(java.awt.Graphics g)
AttributeFigure
drawFrame
in class AttributeFigure
AttributeFigure.draw(java.awt.Graphics)
public boolean containsPoint(int x, int y)
AbstractFigure
containsPoint
in interface Figure
containsPoint
in class AbstractFigure
public Connector connectorAt(int x, int y)
AbstractFigure
connectorAt
in interface Figure
connectorAt
in class AbstractFigure
ChopBoxConnector
public void addPoint(int x, int y)
public void setPointAt(java.awt.Point p, int i)
public void insertPointAt(java.awt.Point p, int i)
public void removePointAt(int i)
public void scaleRotate(java.awt.Point anchor, java.awt.Polygon originalPolygon, java.awt.Point p)
public void smoothPoints()
public int splitSegment(int x, int y)
public java.awt.Point pointAt(int i)
public java.awt.Point outermostPoint()
public int findSegment(int x, int y)
public java.awt.Point chop(java.awt.Point p)
public void write(StorableOutput dw)
AttributeFigure
write
in interface Storable
write
in class AttributeFigure
public void read(StorableInput dr) throws java.io.IOException
AttributeFigure
read
in interface Storable
read
in class AttributeFigure
java.io.IOException
public static Locator locator(int pointIndex)
public static double distanceFromLine(int xa, int ya, int xb, int yb, int xc, int yc)
public static java.awt.Rectangle bounds(java.awt.Polygon p)
public static java.awt.Point center(java.awt.Polygon p)
public static java.awt.Point chop(java.awt.Polygon poly, java.awt.Point p)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |