Class TLcdGeneralPath
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionTLcdGeneralPath(int aInitialCapacity) TLcdGeneralPath(int aInitialCapacity, double aCapacityIncrementFraction) -
Method Summary
Modifier and TypeMethodDescriptionvoidAppends a line break to the path.voidAppends a polygon break to the path.voidcalculateWorldBoundsSFCT(ILcd2DEditableBounds aBoundsSFCT) Returns a bounding box of thisILcdGeneralPath(in world coordinates) in the side effect parameteraBoundsSFCT.voidCloses the current polygon.voidensureCapacity(int aMinimumCapacity) Ensures a given point capacity for this TLcdGeneralPath.doublegetX(int aSubpathIndex, int aPointIndex) doublegetY(int aSubpathIndex, int aPointIndex) voidlineTo(double aX, double aY) Appends a line to the world point(aX, aY).intvoidmoveTo(double aX, double aY) Breaks the current line and moves to the world point(aX, aY).booleanpolygonContains(double aX, double aY) Checks whether the given point is contained by the polygon represented by thisILcdGeneralPath.voidreset()Resets the path.booleansubPathBreaksLine(int aSubpathIndex) booleansubPathBreaksPolygon(int aSubpathIndex) booleansubPathClosesPolygon(int aSubpathIndex) intintsubPathLength(int aSubpathIndex) voidTrims this TLcdAWTPath so that it occupies as little memory as possible.
-
Constructor Details
-
TLcdGeneralPath
public TLcdGeneralPath() -
TLcdGeneralPath
public TLcdGeneralPath(int aInitialCapacity) -
TLcdGeneralPath
public TLcdGeneralPath(int aInitialCapacity, double aCapacityIncrementFraction)
-
-
Method Details
-
reset
public void reset()Description copied from interface:ILcdGeneralPathResets the path. The path becomes empty, containing no subpaths and thus no points.- Specified by:
resetin interfaceILcdGeneralPath
-
moveTo
public void moveTo(double aX, double aY) Description copied from interface:ILcdGeneralPathBreaks the current line and moves to the world point(aX, aY).- Specified by:
moveToin interfaceILcdGeneralPath
-
lineTo
public void lineTo(double aX, double aY) Description copied from interface:ILcdGeneralPathAppends a line to the world point(aX, aY).- Specified by:
lineToin interfaceILcdGeneralPath
-
breakLine
public void breakLine()Description copied from interface:ILcdGeneralPathAppends a line break to the path. Subsequent points will define a new polyline. The points will continue to define the same current polygon, however. For example, when a polygon in a model is represented by more than 1 polygon in world coordinates. This is possible in some projections where the polygon is at the edge of the projection and wraps around to the other edge.- Specified by:
breakLinein interfaceILcdGeneralPath
-
breakPolygon
public void breakPolygon()Description copied from interface:ILcdGeneralPathAppends a polygon break to the path. Subsequent points will define a detached polygonal piece of the current polygon.- Specified by:
breakPolygonin interfaceILcdGeneralPath
-
closePolygon
public void closePolygon()Description copied from interface:ILcdGeneralPathCloses the current polygon. Subsequent points will define a new polygon or hole.- Specified by:
closePolygonin interfaceILcdGeneralPath
-
ensureCapacity
public void ensureCapacity(int aMinimumCapacity) Ensures a given point capacity for this TLcdGeneralPath.- Parameters:
aMinimumCapacity- the minimum number of points this TLcdGeneralPath should be able to store without reallocating memory.
-
trimToSize
public void trimToSize()Trims this TLcdAWTPath so that it occupies as little memory as possible. -
subPathCount
public int subPathCount()- Specified by:
subPathCountin interfaceILcdGeneralPath- Returns:
- the number of subpaths.
-
subPathLength
public int subPathLength(int aSubpathIndex) - Specified by:
subPathLengthin interfaceILcdGeneralPath- Returns:
- the length of the subpath at the given index.
-
subPathBreaksLine
public boolean subPathBreaksLine(int aSubpathIndex) - Specified by:
subPathBreaksLinein interfaceILcdGeneralPath- Returns:
- whether the subpath at the given index represents a broken line.
-
subPathBreaksPolygon
public boolean subPathBreaksPolygon(int aSubpathIndex) - Specified by:
subPathBreaksPolygonin interfaceILcdGeneralPath- Returns:
- whether the subpath at the given index represents a broken part of a polygon.
-
subPathClosesPolygon
public boolean subPathClosesPolygon(int aSubpathIndex) - Specified by:
subPathClosesPolygonin interfaceILcdGeneralPath- Returns:
- whether the subpath at the given index represents a closing part of a polygon.
-
maxSubpathLength
public int maxSubpathLength() -
getX
public double getX(int aSubpathIndex, int aPointIndex) - Specified by:
getXin interfaceILcdGeneralPath- Returns:
- the x coordinate of the subpath point at the given indices.
-
getY
public double getY(int aSubpathIndex, int aPointIndex) - Specified by:
getYin interfaceILcdGeneralPath- Returns:
- the y coordinate of the subpath point at the given indices.
-
calculateWorldBoundsSFCT
Description copied from interface:ILcdGeneralPathReturns a bounding box of thisILcdGeneralPath(in world coordinates) in the side effect parameteraBoundsSFCT.- Specified by:
calculateWorldBoundsSFCTin interfaceILcdGeneralPath- Throws:
TLcdNoBoundsException- if no bounds are available
-
polygonContains
public boolean polygonContains(double aX, double aY) Description copied from interface:ILcdGeneralPathChecks whether the given point is contained by the polygon represented by thisILcdGeneralPath.- Specified by:
polygonContainsin interfaceILcdGeneralPath
-