|
JHotDraw 7.5.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jhotdraw.geom.Polygon2D
org.jhotdraw.geom.Polygon2D.Float
public static class Polygon2D.Float
The Float class defines a polygon with
coordinates stored in float precision floating point.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jhotdraw.geom.Polygon2D |
|---|
Polygon2D.Double, Polygon2D.Float |
| Field Summary | |
|---|---|
protected java.awt.geom.Rectangle2D.Float |
bounds
The bounds of this Polygon. |
float[] |
xpoints
The array of X coordinates. |
float[] |
ypoints
The array of Y coordinates. |
| Fields inherited from class org.jhotdraw.geom.Polygon2D |
|---|
npoints |
| Constructor Summary | |
|---|---|
Polygon2D.Float()
|
|
Polygon2D.Float(float[] xpoints,
float[] ypoints,
int npoints)
Constructs and initializes a Polygon from the specified
parameters. |
|
| Method Summary | |
|---|---|
void |
addPoint(double x,
double y)
Appends the specified coordinates to this Polygon. |
void |
addPoint(float x,
float y)
|
boolean |
contains(double x,
double y)
|
boolean |
contains(double x,
double y,
double w,
double h)
|
boolean |
contains(float x,
float y)
|
boolean |
contains(float x,
float y,
float w,
float h)
|
java.awt.Rectangle |
getBounds()
Gets the bounding box of this Polygon. |
java.awt.geom.Rectangle2D |
getBounds2D()
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at)
Returns an iterator object that iterates along the boundary of this Polygon and provides access to the geometry
of the outline of this Polygon. |
boolean |
intersects(double x,
double y,
double w,
double h)
|
boolean |
intersects(float x,
float y,
float w,
float h)
|
void |
invalidate()
Invalidates or flushes any internally-cached data that depends on the vertex coordinates of this Polygon. |
void |
translate(double deltaX,
double deltaY)
Translates the vertices of the Polygon by
deltaX along the x axis and by
deltaY along the y axis. |
void |
translate(float deltaX,
float deltaY)
|
| Methods inherited from class org.jhotdraw.geom.Polygon2D |
|---|
add, contains, contains, contains, contains, getPathIterator, intersects, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public float[] xpoints
Polygon. The extra elements allow new points
to be added to this Polygon without re-creating this
array. The value of npoints is equal to the
number of valid points in this Polygon.
public float[] ypoints
Polygon. The extra elements allow new points
to be added to this Polygon without re-creating this
array. The value of npoints is equal to the
number of valid points in this Polygon.
protected java.awt.geom.Rectangle2D.Float bounds
Polygon.
This value can be null.
| Constructor Detail |
|---|
public Polygon2D.Float()
public Polygon2D.Float(float[] xpoints,
float[] ypoints,
int npoints)
Polygon from the specified
parameters.
xpoints - an array of X coordinatesypoints - an array of Y coordinatesnpoints - the total number of points in the
Polygon
java.lang.NegativeArraySizeException - if the value of
npoints is negative.
java.lang.IndexOutOfBoundsException - if npoints is
greater than the length of xpoints
or the length of ypoints.
java.lang.NullPointerException - if xpoints or
ypoints is null.| Method Detail |
|---|
public void translate(double deltaX,
double deltaY)
Polygon by
deltaX along the x axis and by
deltaY along the y axis.
translate in class Polygon2DdeltaX - the amount to translate along the X axisdeltaY - the amount to translate along the Y axis
public void translate(float deltaX,
float deltaY)
public void invalidate()
Polygon2DPolygon.
This method should be called after any direct manipulation
of the coordinates in the xpoints or
ypoints arrays to avoid inconsistent results
from methods such as getBounds or contains
that might cache data from earlier computations relating to
the vertex coordinates.
invalidate in class Polygon2DPolygon.getBounds()
public boolean contains(double x,
double y)
Polygon2D
contains in interface java.awt.Shapecontains in class Polygon2D
public boolean contains(float x,
float y)
public boolean intersects(double x,
double y,
double w,
double h)
Polygon2D
intersects in interface java.awt.Shapeintersects in class Polygon2D
public boolean intersects(float x,
float y,
float w,
float h)
public void addPoint(double x,
double y)
Polygon2DPolygon.
If an operation that calculates the bounding box of this
Polygon has already been performed, such as
getBounds or contains, then this
method updates the bounding box.
addPoint in class Polygon2Dx - the specified X coordinatey - the specified Y coordinatePolygon.getBounds(),
Polygon.contains(java.awt.Point)
public void addPoint(float x,
float y)
public java.awt.Rectangle getBounds()
Polygon2DPolygon.
The bounding box is the smallest Rectangle whose
sides are parallel to the x and y axes of the
coordinate space, and can completely contain the Polygon.
getBounds in interface java.awt.ShapegetBounds in class Polygon2DRectangle that defines the bounds of this
Polygon.public java.awt.geom.Rectangle2D getBounds2D()
Polygon2D
getBounds2D in interface java.awt.ShapegetBounds2D in class Polygon2D
public boolean contains(double x,
double y,
double w,
double h)
Polygon2D
contains in interface java.awt.Shapecontains in class Polygon2D
public boolean contains(float x,
float y,
float w,
float h)
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
Polygon2DPolygon and provides access to the geometry
of the outline of this Polygon. An optional
AffineTransform can be specified so that the coordinates
returned in the iteration are transformed accordingly.
getPathIterator in interface java.awt.ShapegetPathIterator in class Polygon2Dat - an optional AffineTransform to be applied to the
coordinates as they are returned in the iteration, or
null if untransformed coordinates are desired
PathIterator object that provides access to the
geometry of this Polygon.
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||