All Packages Class Hierarchy This Package Previous Next Index
Class CH.ifa.draw.contrib.PolygonFigure
java.lang.Object
|
+----CH.ifa.draw.standard.AbstractFigure
|
+----CH.ifa.draw.figures.AttributeFigure
|
+----CH.ifa.draw.contrib.PolygonFigure
- public class PolygonFigure
- extends AttributeFigure
A scalable, rotatable polygon with an arbitrary number of points
-
fPoly
-
-
PolygonFigure()
-
-
PolygonFigure(int, int)
-
-
PolygonFigure(Polygon)
-
-
addPoint(int, int)
- Adds a node to the list of points.
-
basicDisplayBox(Point, Point)
- Sets the display box of a figure.
-
basicMoveBy(int, int)
- Moves the figure.
-
bounds(Polygon)
- replacement for builtin Polygon.getBounds that doesn't always update?
-
center()
- Gets the center of a figure.
-
center(Polygon)
-
-
chop(Point)
-
-
chop(Polygon, Point)
-
-
connectorAt(int, int)
- Returns the Figures connector for the specified location.
-
containsPoint(int, int)
- Checks if a point is inside the figure.
-
displayBox()
- Gets the display box of a figure.
-
distanceFromLine(int, int, int, int, int, int)
- 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
-
drawBackground(Graphics)
- Draws the background of the figure.
-
drawFrame(Graphics)
- Draws the frame of the figure.
-
findSegment(int, int)
- Gets the segment that is hit by the given point.
-
getPolygon()
- return a copy of the raw polygon
-
handles()
- Returns the handles of a Figure that can be used
to manipulate some of its attributes.
-
insertPointAt(Point, int)
- Insert a node at the given point.
-
isEmpty()
- Checks if the figure is empty.
-
locator(int)
- Creates a locator for the point with the given index.
-
outermostPoint()
- Return the point on the polygon that is furthest from the center
-
pointAt(int)
-
-
pointCount()
-
-
points()
-
-
read(StorableInput)
- Reads the Figure from a StorableInput.
-
removePointAt(int)
-
-
scaleRotate(Point, Polygon, Point)
- Scale and rotate relative to anchor
-
setPointAt(Point, int)
- Changes the position of a node.
-
smoothPoints()
- Remove points that are nearly colinear with others
-
splitSegment(int, int)
- Splits the segment at the given point if a segment was hit.
-
write(StorableOutput)
- Stores the Figure to a StorableOutput.
fPoly
protected Polygon fPoly
PolygonFigure
public PolygonFigure()
PolygonFigure
public PolygonFigure(int x,
int y)
PolygonFigure
public PolygonFigure(Polygon p)
displayBox
public Rectangle displayBox()
- Gets the display box of a figure.
- Overrides:
- displayBox in class AbstractFigure
isEmpty
public boolean isEmpty()
- Checks if the figure is empty.
- Overrides:
- isEmpty in class AbstractFigure
handles
public Vector handles()
- Returns the handles of a Figure that can be used
to manipulate some of its attributes.
- Overrides:
- handles in class AbstractFigure
basicDisplayBox
public void basicDisplayBox(Point origin,
Point corner)
- Sets the display box of a figure.
- Overrides:
- basicDisplayBox in class AbstractFigure
getPolygon
public Polygon getPolygon()
- return a copy of the raw polygon
center
public Point center()
- Gets the center of a figure.
- Overrides:
- center in class AbstractFigure
points
public Enumeration points()
pointCount
public int pointCount()
basicMoveBy
public void basicMoveBy(int dx,
int dy)
- Moves the figure.
- Overrides:
- basicMoveBy in class AbstractFigure
drawBackground
public void drawBackground(Graphics g)
- Draws the background of the figure.
- Overrides:
- drawBackground in class AttributeFigure
drawFrame
public void drawFrame(Graphics g)
- Draws the frame of the figure.
- Overrides:
- drawFrame in class AttributeFigure
containsPoint
public boolean containsPoint(int x,
int y)
- Checks if a point is inside the figure.
- Overrides:
- containsPoint in class AbstractFigure
connectorAt
public Connector connectorAt(int x,
int y)
- Returns the Figures connector for the specified location.
- Overrides:
- connectorAt in class AbstractFigure
addPoint
public void addPoint(int x,
int y)
- Adds a node to the list of points.
setPointAt
public void setPointAt(Point p,
int i)
- Changes the position of a node.
insertPointAt
public void insertPointAt(Point p,
int i)
- Insert a node at the given point.
removePointAt
public void removePointAt(int i)
scaleRotate
public void scaleRotate(Point anchor,
Polygon originalPolygon,
Point p)
- Scale and rotate relative to anchor
smoothPoints
public void smoothPoints()
- Remove points that are nearly colinear with others
splitSegment
public int splitSegment(int x,
int y)
- Splits the segment at the given point if a segment was hit.
- Returns:
- the index of the segment or -1 if no segment was hit.
pointAt
public Point pointAt(int i)
outermostPoint
public Point outermostPoint()
- Return the point on the polygon that is furthest from the center
findSegment
public int findSegment(int x,
int y)
- Gets the segment that is hit by the given point.
- Returns:
- the index of the segment or -1 if no segment was hit.
chop
public Point chop(Point p)
write
public void write(StorableOutput dw)
- Stores the Figure to a StorableOutput.
- Overrides:
- write in class AttributeFigure
read
public void read(StorableInput dr) throws IOException
- Reads the Figure from a StorableInput.
- Overrides:
- read in class AttributeFigure
locator
public static Locator locator(int pointIndex)
- Creates a locator for the point with the given index.
distanceFromLine
public 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
bounds
public static Rectangle bounds(Polygon p)
- replacement for builtin Polygon.getBounds that doesn't always update?
center
public static Point center(Polygon p)
chop
public static Point chop(Polygon poly,
Point p)
All Packages Class Hierarchy This Package Previous Next Index