Package diva.util.java2d
Class Polyline2D.Float
- java.lang.Object
-
- diva.util.java2d.Polyline2D
-
- diva.util.java2d.Polyline2D.Float
-
- All Implemented Interfaces:
java.awt.Shape
- Enclosing class:
- Polyline2D
public static class Polyline2D.Float extends Polyline2D
The concrete Polyline class that stores coordinates internally as floats.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class diva.util.java2d.Polyline2D
Polyline2D.Double, Polyline2D.Float
-
-
Field Summary
-
Fields inherited from class diva.util.java2d.Polyline2D
_coordCount
-
-
Constructor Summary
Constructors Constructor Description Float()Create a new polyline with no vertices.Float(float x1, float y1, float x2, float y2)Create a new polyline with two vertices.Float(int initSize)Create a new polyline with "initSize" number of vertices.Float(Polyline2D in)Copy constructor for efficient copying of Polyline2D.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Rectangle2DgetBounds2D()Get the floating-point bounds of the polyline.doublegetX(int index)Get the given X-coordinatedoublegetY(int index)Get the given Y-coordinatevoidlineTo(double x, double y)Add a new vertex to the end of the line.voidmoveTo(double x, double y)Move the start point of the vertex to the given position.voidsetX(int index, double x)Set the given X-coordinate.voidsetY(int index, double y)Set the given Y-coordinatevoidtransform(java.awt.geom.AffineTransform at)Transform the polyline with the given transform.voidtranslate(double x, double y)Translate the polyline the given distance.-
Methods inherited from class diva.util.java2d.Polyline2D
contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, getVertexCount, intersects, intersects, reset, toString
-
-
-
-
Constructor Detail
-
Float
public Float()
Create a new polyline with no vertices.
-
Float
public Float(int initSize)
Create a new polyline with "initSize" number of vertices.
-
Float
public Float(Polyline2D in)
Copy constructor for efficient copying of Polyline2D.
-
Float
public Float(float x1, float y1, float x2, float y2)Create a new polyline with two vertices.
-
-
Method Detail
-
getBounds2D
public java.awt.geom.Rectangle2D getBounds2D()
Get the floating-point bounds of the polyline.- Specified by:
getBounds2Din interfacejava.awt.Shape- Specified by:
getBounds2Din classPolyline2D
-
getX
public double getX(int index)
Get the given X-coordinate- Specified by:
getXin classPolyline2D- Throws:
java.lang.IndexOutOfBoundsException- The index is out of bounds.
-
getY
public double getY(int index)
Get the given Y-coordinate- Specified by:
getYin classPolyline2D- Throws:
java.lang.IndexOutOfBoundsException- The index is out of bounds.
-
lineTo
public void lineTo(double x, double y)Add a new vertex to the end of the line.- Specified by:
lineToin classPolyline2D
-
moveTo
public void moveTo(double x, double y)Move the start point of the vertex to the given position.- Specified by:
moveToin classPolyline2D- Throws:
java.lang.UnsupportedOperationException- The polyline already has vertices
-
setX
public void setX(int index, double x)Set the given X-coordinate.- Specified by:
setXin classPolyline2D- Throws:
java.lang.IndexOutOfBoundsException- The index is out of bounds.
-
setY
public void setY(int index, double y)Set the given Y-coordinate- Specified by:
setYin classPolyline2D- Throws:
java.lang.IndexOutOfBoundsException- The index is out of bounds.
-
transform
public void transform(java.awt.geom.AffineTransform at)
Transform the polyline with the given transform.- Specified by:
transformin classPolyline2D
-
translate
public void translate(double x, double y)Translate the polyline the given distance.- Specified by:
translatein classPolyline2D
-
-