Package com.itextpdf.kernel.geom
Class Subpath
- java.lang.Object
-
- com.itextpdf.kernel.geom.Subpath
-
public class Subpath extends java.lang.Object
As subpath is a part of a path comprising a sequence of connected segments.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
closed
private java.util.List<IShape>
segments
private Point
startPoint
-
Constructor Summary
Constructors Constructor Description Subpath()
Creates a new SubPath instance.Subpath(float startPointX, float startPointY)
Constructs a new subpath starting at the given point.Subpath(Point startPoint)
Constructs a new subpath starting at the given point.Subpath(Subpath subpath)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSegment(IShape segment)
Adds a segment to the subpath.Point
getLastPoint()
java.util.List<Point>
getPiecewiseLinearApproximation()
java.util.List<IShape>
getSegments()
Point
getStartPoint()
boolean
isClosed()
Returns aboolean
value indicating whether the subpath must be closed or not.boolean
isDegenerate()
Returns aboolean
indicating whether the subpath is degenerate or not.boolean
isEmpty()
Checks whether subpath is empty or not.boolean
isSinglePointClosed()
boolean
isSinglePointOpen()
void
setClosed(boolean closed)
SeeisClosed()
void
setStartPoint(float x, float y)
Sets the start point of the subpath.void
setStartPoint(Point startPoint)
Sets the start point of the subpath.
-
-
-
Constructor Detail
-
Subpath
public Subpath()
Creates a new SubPath instance.
-
Subpath
public Subpath(Subpath subpath)
Copy constructor.
-
Subpath
public Subpath(Point startPoint)
Constructs a new subpath starting at the given point.- Parameters:
startPoint
- the point this subpath starts at
-
Subpath
public Subpath(float startPointX, float startPointY)
Constructs a new subpath starting at the given point.- Parameters:
startPointX
- x-coordinate of the start point of subpathstartPointY
- y-coordinate of the start point of subpath
-
-
Method Detail
-
setStartPoint
public void setStartPoint(Point startPoint)
Sets the start point of the subpath.- Parameters:
startPoint
- the point this subpath starts at
-
setStartPoint
public void setStartPoint(float x, float y)
Sets the start point of the subpath.- Parameters:
x
- x-coordinate of the start pinty
- y-coordinate of the start pint
-
getStartPoint
public Point getStartPoint()
- Returns:
- The point this subpath starts at.
-
getLastPoint
public Point getLastPoint()
- Returns:
- The last point of the subpath.
-
addSegment
public void addSegment(IShape segment)
Adds a segment to the subpath. Note: each new segment shall start at the end of the previous segment.- Parameters:
segment
- new segment.
-
getSegments
public java.util.List<IShape> getSegments()
- Returns:
List
comprising all the segments the subpath made on.
-
isEmpty
public boolean isEmpty()
Checks whether subpath is empty or not.- Returns:
- true if the subpath is empty, false otherwise.
-
isSinglePointOpen
public boolean isSinglePointOpen()
- Returns:
true
if this subpath contains only one point and it is not closed,false
otherwise
-
isSinglePointClosed
public boolean isSinglePointClosed()
- Returns:
true
if this subpath contains only one point and it is closed,false
otherwise
-
isClosed
public boolean isClosed()
Returns aboolean
value indicating whether the subpath must be closed or not. Ignore this value if the subpath is a rectangle because in this case it is already closed (of course if you paint the path usingre
operator)- Returns:
boolean
value indicating whether the path must be closed or not.
-
setClosed
public void setClosed(boolean closed)
SeeisClosed()
- Parameters:
closed
-boolean
value indicating whether the path is closed or not.
-
isDegenerate
public boolean isDegenerate()
Returns aboolean
indicating whether the subpath is degenerate or not. A degenerate subpath is the subpath consisting of a single-point closed path or of two or more points at the same coordinates.- Returns:
boolean
value indicating whether the path is degenerate or not.
-
getPiecewiseLinearApproximation
public java.util.List<Point> getPiecewiseLinearApproximation()
- Returns:
List
containing points of piecewise linear approximation for this subpath.
-
-