Package com.itextpdf.awt.geom
Class PolylineShape
- java.lang.Object
-
- com.itextpdf.awt.geom.PolylineShape
-
- All Implemented Interfaces:
java.awt.Shape
public class PolylineShape extends java.lang.Object implements java.awt.Shape
Class that defines a Polyline shape. This class was originally written by wil - amristar.com.au and integrated into iText by Bruno.
-
-
Constructor Summary
Constructors Constructor Description PolylineShape(int[] x, int[] y, int nPoints)
Creates a PolylineShape.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(double x, double y)
A polyline can't contain a point.boolean
contains(double x, double y, double w, double h)
A polyline can't contain a point.boolean
contains(java.awt.geom.Point2D p)
A polyline can't contain a point.boolean
contains(java.awt.geom.Rectangle2D r)
A polyline can't contain a point.java.awt.Rectangle
getBounds()
Returns the bounding box of this polyline.java.awt.geom.Rectangle2D
getBounds2D()
Returns the bounding box of this polyline.java.awt.geom.PathIterator
getPathIterator(java.awt.geom.AffineTransform at)
Returns an iteration object that defines the boundary of the polyline.java.awt.geom.PathIterator
getPathIterator(java.awt.geom.AffineTransform at, double flatness)
There's no difference with getPathIterator(AffineTransform at); we just need this method to implement the Shape interface.boolean
intersects(double x, double y, double w, double h)
Checks if one of the lines in the polyline intersects with a given rectangle.boolean
intersects(java.awt.geom.Rectangle2D r)
Checks if one of the lines in the polyline intersects with a given rectangle.private int[]
rect()
Calculates the origin (X, Y) and the width and height of a rectangle that contains all the segments of the polyline.
-
-
-
Method Detail
-
getBounds2D
public java.awt.geom.Rectangle2D getBounds2D()
Returns the bounding box of this polyline.- Specified by:
getBounds2D
in interfacejava.awt.Shape
- Returns:
- a
Rectangle2D
that is the high-precision bounding box of this line. - See Also:
Shape.getBounds2D()
-
getBounds
public java.awt.Rectangle getBounds()
Returns the bounding box of this polyline.- Specified by:
getBounds
in interfacejava.awt.Shape
- See Also:
Shape.getBounds()
-
rect
private int[] rect()
Calculates the origin (X, Y) and the width and height of a rectangle that contains all the segments of the polyline.
-
contains
public boolean contains(double x, double y)
A polyline can't contain a point.- Specified by:
contains
in interfacejava.awt.Shape
- See Also:
Shape.contains(double, double)
-
contains
public boolean contains(java.awt.geom.Point2D p)
A polyline can't contain a point.- Specified by:
contains
in interfacejava.awt.Shape
- See Also:
Shape.contains(java.awt.geom.Point2D)
-
contains
public boolean contains(double x, double y, double w, double h)
A polyline can't contain a point.- Specified by:
contains
in interfacejava.awt.Shape
- See Also:
Shape.contains(double, double, double, double)
-
contains
public boolean contains(java.awt.geom.Rectangle2D r)
A polyline can't contain a point.- Specified by:
contains
in interfacejava.awt.Shape
- See Also:
Shape.contains(java.awt.geom.Rectangle2D)
-
intersects
public boolean intersects(double x, double y, double w, double h)
Checks if one of the lines in the polyline intersects with a given rectangle.- Specified by:
intersects
in interfacejava.awt.Shape
- See Also:
Shape.intersects(double, double, double, double)
-
intersects
public boolean intersects(java.awt.geom.Rectangle2D r)
Checks if one of the lines in the polyline intersects with a given rectangle.- Specified by:
intersects
in interfacejava.awt.Shape
- See Also:
Shape.intersects(java.awt.geom.Rectangle2D)
-
getPathIterator
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
Returns an iteration object that defines the boundary of the polyline.- Specified by:
getPathIterator
in interfacejava.awt.Shape
- Parameters:
at
- the specifiedAffineTransform
- Returns:
- a
PathIterator
that defines the boundary of this polyline. - See Also:
Shape.intersects(java.awt.geom.Rectangle2D)
-
getPathIterator
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
There's no difference with getPathIterator(AffineTransform at); we just need this method to implement the Shape interface.- Specified by:
getPathIterator
in interfacejava.awt.Shape
-
-