public class TLcdGeneralPath extends Object implements ILcdGeneralPath
ILcdGeneralPath
.
Like a Vector, each TLcdGeneralPath tries to optimize storage management by maintaining a capacity and a capacityIncrementFraction, in this case for storing all of its points. The capacity is always at least as large as the number of stored points. It is usually larger, because as points are added to the path, the path's storage increases by a factor of capacityIncrementFraction. Note that this is a relative increment (e.g. 0.5 for 50%), unlike the increment for Vector, which is absolute. An application can ensure a certain capacity of a path before inserting a large number of points; this reduces the amount of incremental reallocation. An application can also trim the capacity to the actual size of the path after having inserted a set of points; this reduces the eventual memory usage.
Constructor and Description |
---|
TLcdGeneralPath() |
TLcdGeneralPath(int aInitialCapacity) |
TLcdGeneralPath(int aInitialCapacity,
double aCapacityIncrementFraction) |
Modifier and Type | Method and Description |
---|---|
void |
breakLine()
Appends a line break to the path.
|
void |
breakPolygon()
Appends a polygon break to the path.
|
void |
calculateWorldBoundsSFCT(ILcd2DEditableBounds aBoundsSFCT)
Returns a bounding box of this
ILcdGeneralPath (in world
coordinates) in the side effect parameter aBoundsSFCT . |
void |
closePolygon()
Closes the current polygon.
|
void |
ensureCapacity(int aMinimumCapacity)
Ensures a given point capacity for this TLcdGeneralPath.
|
double |
getX(int aSubpathIndex,
int aPointIndex) |
double |
getY(int aSubpathIndex,
int aPointIndex) |
void |
lineTo(double aX,
double aY)
Appends a line to the world point
(aX, aY) . |
int |
maxSubpathLength() |
void |
moveTo(double aX,
double aY)
Breaks the current line and moves to the world point
(aX, aY) . |
boolean |
polygonContains(double aX,
double aY)
Checks whether the given point is contained by the polygon represented by
this
ILcdGeneralPath . |
void |
reset()
Resets the path.
|
boolean |
subPathBreaksLine(int aSubpathIndex) |
boolean |
subPathBreaksPolygon(int aSubpathIndex) |
boolean |
subPathClosesPolygon(int aSubpathIndex) |
int |
subPathCount() |
int |
subPathLength(int aSubpathIndex) |
void |
trimToSize()
Trims this TLcdAWTPath so that it occupies as little memory as possible.
|
public TLcdGeneralPath()
public TLcdGeneralPath(int aInitialCapacity)
public TLcdGeneralPath(int aInitialCapacity, double aCapacityIncrementFraction)
public void reset()
ILcdGeneralPath
reset
in interface ILcdGeneralPath
public void moveTo(double aX, double aY)
ILcdGeneralPath
(aX, aY)
.moveTo
in interface ILcdGeneralPath
public void lineTo(double aX, double aY)
ILcdGeneralPath
(aX, aY)
.lineTo
in interface ILcdGeneralPath
public void breakLine()
ILcdGeneralPath
breakLine
in interface ILcdGeneralPath
public void breakPolygon()
ILcdGeneralPath
breakPolygon
in interface ILcdGeneralPath
public void closePolygon()
ILcdGeneralPath
closePolygon
in interface ILcdGeneralPath
public void ensureCapacity(int aMinimumCapacity)
aMinimumCapacity
- the minimum number of points this TLcdGeneralPath
should be able to store without reallocating memory.public void trimToSize()
public int subPathCount()
subPathCount
in interface ILcdGeneralPath
public int subPathLength(int aSubpathIndex)
subPathLength
in interface ILcdGeneralPath
public boolean subPathBreaksLine(int aSubpathIndex)
subPathBreaksLine
in interface ILcdGeneralPath
public boolean subPathBreaksPolygon(int aSubpathIndex)
subPathBreaksPolygon
in interface ILcdGeneralPath
public boolean subPathClosesPolygon(int aSubpathIndex)
subPathClosesPolygon
in interface ILcdGeneralPath
public int maxSubpathLength()
public double getX(int aSubpathIndex, int aPointIndex)
getX
in interface ILcdGeneralPath
public double getY(int aSubpathIndex, int aPointIndex)
getY
in interface ILcdGeneralPath
public void calculateWorldBoundsSFCT(ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException
ILcdGeneralPath
ILcdGeneralPath
(in world
coordinates) in the side effect parameter aBoundsSFCT
.calculateWorldBoundsSFCT
in interface ILcdGeneralPath
TLcdNoBoundsException
- if no bounds are availablepublic boolean polygonContains(double aX, double aY)
ILcdGeneralPath
ILcdGeneralPath
.polygonContains
in interface ILcdGeneralPath