Package com.itextpdf.kernel.geom
Class Subpath
java.lang.Object
com.itextpdf.kernel.geom.Subpath
As subpath is a part of a path comprising a sequence of connected segments.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSegment(IShape segment) Adds a segment to the subpath.booleanisClosed()Returns abooleanvalue indicating whether the subpath must be closed or not.booleanReturns abooleanindicating whether the subpath is degenerate or not.booleanisEmpty()Checks whether subpath is empty or not.booleanbooleanvoidsetClosed(boolean closed) SeeisClosed()voidsetStartPoint(float x, float y) Sets the start point of the subpath.voidsetStartPoint(Point startPoint) Sets the start point of the subpath.
-
Constructor Details
-
Subpath
public Subpath()Creates a new SubPath instance. -
Subpath
Copy constructor. -
Subpath
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 subpath -
startPointY- y-coordinate of the start point of subpath
-
-
Method Details
-
setStartPoint
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 pint -
y- y-coordinate of the start pint
-
getStartPoint
- Returns:
- The point this subpath starts at.
-
getLastPoint
- Returns:
- The last point of the subpath.
-
addSegment
Adds a segment to the subpath. Note: each new segment shall start at the end of the previous segment.- Parameters:
-
segment- new segment.
-
getSegments
- Returns:
-
Listcomprising 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:
-
trueif this subpath contains only one point and it is not closed,falseotherwise
-
isSinglePointClosed
public boolean isSinglePointClosed()- Returns:
-
trueif this subpath contains only one point and it is closed,falseotherwise
-
isClosed
public boolean isClosed()Returns abooleanvalue 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 usingreoperator)- Returns:
-
booleanvalue indicating whether the path must be closed or not.
-
setClosed
public void setClosed(boolean closed) SeeisClosed()- Parameters:
-
closed-booleanvalue indicating whether the path is closed or not.
-
isDegenerate
public boolean isDegenerate()Returns abooleanindicating 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:
-
booleanvalue indicating whether the path is degenerate or not.
-
getPiecewiseLinearApproximation
- Returns:
-
Listcontaining points of piecewise linear approximation for this subpath.
-