public final class TLcdProjectionPen extends ALcdGXYPen implements ILcdGXYPen
ILcdGXYPen
that paints and edits elementary shapes as if they were defined in the
geodetic reference system of the
world reference
.
The given model coordinates are assumed to be latitude longitude coordinates (the height is not used).
The straightLineMode
property allows to control the level
of accuracy versus the time efficiency of the line drawing.
If true, only a coarse approximation of a geodesic is computed as straight lines
between the end points of the line in the view reference system. This is the default mode.
If false, a much better approximation of the geodesic is computed by adaptively calculating
intermediate points on the true geodesic. Furthermore, lines, polylines and polygons are correctly
broken if they cross a border of the projection area. Polygons are automatically broken into
subpolygons if they cross one side and continue on the other
side of the projection area.TLcdGXYPen
,
TLcdGeodeticPen
,
Serialized FormALcdGXYPen.Quality
BEGIN_ARROW_TYPE, END_AND_BEGIN_ARROW_TYPE, END_ARROW_TYPE, fAccumulatedAWTPath, fHotPointColor, fHotPointShape, fHotPointSize, fLastModelPoint, fLastViewPoint, fLastWorldPoint, fValidMove, MIDDLE_BOTH_ARROW_TYPE, MIDDLE_TO_BEGIN_ARROW_TYPE, MIDDLE_TO_END_ARROW_TYPE
CIRCLE, FILLED_CIRCLE, FILLED_SQUARE, HORIZONTAL_CROSS, VERTICAL_CROSS
Constructor and Description |
---|
TLcdProjectionPen()
Default constructor.
|
TLcdProjectionPen(boolean aStraightLineMode)
Constructor that sets the line drawing mode to
aStraightLineMode . |
TLcdProjectionPen(TLcdProjectionPen aProjectionPen)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
appendArc(ILcdPoint aCenter,
double aA,
double aB,
double aRotAngle,
double aStartAngle,
double aArcAngle,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGeneralPath aGeneralPathSFCT)
Appends a polyline approximation of the given arc to the given
ILcdGeneralPath . |
void |
appendArc(ILcdPoint aCenter,
double aA,
double aB,
double aRotAngle,
double aStartAngle,
double aArcAngle,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation,
ILcdAWTPath aAWTPathSFCT)
Appends a polyline approximation of the given arc to the given
ILcdAWTPath . |
void |
appendHorizontalLineTo(double aDeltaX,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGeneralPath aGeneralPathSFCT)
Appends a horizontal line starting from the current position to the given
ILcdGeneralPath . |
void |
appendHorizontalLineTo(double aDeltaX,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation,
ILcdAWTPath aAWTPathSFCT)
Appends a horizontal line starting from the current position to the given
ILcdAWTPath . |
void |
appendLineTo(ILcdPoint aPoint,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGeneralPath aGeneralPathSFCT)
Appends a line from the current position to the given model point to the given
ILcdGeneralPath . |
void |
appendLineTo(ILcdPoint aPoint,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation,
ILcdAWTPath aAWTPathSFCT)
Appends a line from the current position to the given model point to the given
ILcdAWTPath . |
void |
appendPointList(ILcdPointList aPointList,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGeneralPath aGeneralPathSFCT)
Appends a polyline to the given
ILcdGeneralPath . |
void |
appendPointList(ILcdPointList aPointList,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation,
ILcdAWTPath aAWTPathSFCT)
Appends a polyline to the given
ILcdAWTPath . |
void |
appendVerticalLineTo(double aDeltaY,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGeneralPath aGeneralPathSFCT)
Appends a vertical line starting from the current position to the given
ILcdGeneralPath . |
void |
appendVerticalLineTo(double aDeltaY,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation,
ILcdAWTPath aAWTPathSFCT)
Appends a vertical line starting from the current position to the given
ILcdAWTPath . |
Object |
clone()
Makes
Object.clone() public. |
void |
drawArc(double aCenterX,
double aCenterY,
double aStartX,
double aStartY,
double aArcAngle,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation,
Graphics aGraphics)
Draws a circular arc onto the given
Graphics . |
boolean |
equals(Object aObject) |
boolean |
isLineTouched(ILcdPoint aPoint1,
ILcdPoint aPoint2,
double aX,
double aY,
boolean aIncludeHotPoint,
int aSensitivity,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation)
Tests if a given line is touched by clicking at the given AWT point.
|
boolean |
isStraightLineMode()
Returns the current line drawing mode.
|
double |
modelDistance(double aX1,
double aY1,
double aX2,
double aY2,
ILcdModelXYWorldTransformation aModelXYWorldTransformation,
ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation)
Calculates the model distance between the two given points expressed in AWT coordinates.
|
void |
setStraightLineMode(boolean aStraightLineMode)
Sets the line drawing mode.
|
accumulateArc, accumulateAWTPoint, accumulateHorizontalLineTo, accumulateLineTo, accumulatePointList, accumulateSplit, accumulateVerticalLineTo, appendCartesianArc, appendCartesianArc, appendCartesianLineTo, appendCartesianLineTo, appendCartesianPolyline, appendCartesianPolyline, appendCurve, appendCurve, appendGeneralPath, appendParameterizedPath, appendParameterizedPath, arcBoundsSFCT, AWTPathContains, calculateAccumulatedAWTBounds, cartesianModelDistance, contains, create, create, drawAccumulatedPolygon, drawAccumulatedPolyline, drawArc, drawCartesianArc, drawHorizontalLineTo, drawHotPoint, drawHotPoint, drawHotPoint, drawHotPoint, drawHotPoint, drawLine, drawLine, drawLineTo, drawLineTo, drawLineTo, drawLineWithArrow, drawPolygon, drawPolyline, drawVerticalLineTo, emptyAccumulated, fillAccumulatedPolygon, fillPolygon, getAngleThreshold, getHotPointColor, getHotPointIcon, getHotPointShape, getHotPointSize, getMaxRecursionDepth, getMinRecursionDepth, getTouchedSegment, getViewDistanceThreshold, getWorldDistanceThreshold, getX, getXAsDouble, getY, getYAsDouble, isAccumulatedPolylineTouched, isArcTouched, isCartesianArcTouched, isCartesianLineTouched, isHorizontalLineTouched, isTouched, isTouched, isVerticalLineTouched, isViewLineTouched, lineBoundsSFCT, moveTo, moveTo, moveTo, polylineBoundsSFCT, resetPosition, setAngleThreshold, setHotPointColor, setHotPointIcon, setHotPointShape, setHotPointSize, setMaxRecursionDepth, setMinRecursionDepth, setViewDistanceThreshold, setWorldDistanceThreshold, translateOf
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accumulateArc, accumulateHorizontalLineTo, accumulateLineTo, accumulatePointList, accumulateVerticalLineTo, appendGeneralPath, arcBoundsSFCT, contains, drawAccumulatedPolygon, drawAccumulatedPolyline, drawArc, drawHorizontalLineTo, drawHotPoint, drawHotPoint, drawLine, drawLineTo, drawLineTo, drawPolygon, drawPolyline, drawVerticalLineTo, emptyAccumulated, fillAccumulatedPolygon, fillPolygon, getHotPointShape, getHotPointSize, getTouchedSegment, getX, getXAsDouble, getY, getYAsDouble, isArcTouched, isHorizontalLineTouched, isTouched, isVerticalLineTouched, lineBoundsSFCT, moveTo, moveTo, moveTo, polylineBoundsSFCT, resetPosition, setHotPointShape, setHotPointSize, translateOf
public TLcdProjectionPen()
public TLcdProjectionPen(boolean aStraightLineMode)
aStraightLineMode
.aStraightLineMode
- boolean indicating whether straight lines are sufficient to approximate
geodesic lines.public TLcdProjectionPen(TLcdProjectionPen aProjectionPen)
aProjectionPen
- the projection pen which has to be clonedpublic void setStraightLineMode(boolean aStraightLineMode)
true
, only a coarse approximation of a geodesic is computed as straight lines
between the end points of the line in the view reference system.
If set to false
, a better approximation of the geodesic is computed by adaptively calculating
intermediate points on the true geodesic.aStraightLineMode
- a boolean indicating whether to approximate geodesic lines with straight
lines or not.isStraightLineMode()
public boolean isStraightLineMode()
setStraightLineMode(boolean)
public void appendLineTo(ILcdPoint aPoint, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation, ILcdAWTPath aAWTPathSFCT)
ILcdGXYPen
ILcdAWTPath
.
The given model coordinates of the end point of the line are transformed
to AWT coordinates by means of the given ILcdModelXYWorldTransformation
and
ILcdGXYViewXYWorldTransformation
. If this model point is outside the valid area of
the given ILcdModelXYWorldTransformation
, a line break is appended to the given
ILcdAWTPath
.appendLineTo
in interface ILcdGXYPen
aPoint
- the end point (specified in model coordinates) of the lineaModelXYWorldTransformation
- the transformation between model and world coordinatesaGXYViewXYWorldTransformation
- the transformation between world and view coordinatesaAWTPathSFCT
- the AWT path to which the line is appendedpublic void appendHorizontalLineTo(double aDeltaX, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation, ILcdAWTPath aAWTPathSFCT)
ILcdGXYPen
ILcdAWTPath
.
The model coordinates of the end point of this line are obtained by translating the
model x coordinate of the current position by the given amount. The model coordinates
of the end point of the line are transformed to AWT coordinates by means of the given
ILcdModelXYWorldTransformation
and ILcdGXYViewXYWorldTransformation
.
If this model point is outside the valid area of the given ILcdModelXYWorldTransformation
,
a line break is appended to the given ILcdAWTPath
. In case the current position is
undefined, nothing is appended.appendHorizontalLineTo
in interface ILcdGXYPen
aDeltaX
- the amount by which the model x coordinate of the current position is translatedaModelXYWorldTransformation
- the transformation between model and world coordinatesaGXYViewXYWorldTransformation
- the transformation between world and view coordinatesaAWTPathSFCT
- the AWT path to which the line is appendedpublic void appendVerticalLineTo(double aDeltaY, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation, ILcdAWTPath aAWTPathSFCT)
ILcdGXYPen
ILcdAWTPath
.
The model coordinates of the end point of this line are obtained by translating the
model y coordinate of the current position by the given amount. The model coordinates
of the end point of the line are transformed to AWT coordinates by means of the given
ILcdModelXYWorldTransformation
and ILcdGXYViewXYWorldTransformation
.
If this model point is outside the valid area of the given ILcdModelXYWorldTransformation
,
a line break is appended to the given ILcdAWTPath
. In case the current position is
undefined, nothing is appended.appendVerticalLineTo
in interface ILcdGXYPen
aDeltaY
- the amount by which the model y coordinate of the current position is translatedaModelXYWorldTransformation
- the transformation between model and world coordinatesaGXYViewXYWorldTransformation
- the transformation between world and view coordinatesaAWTPathSFCT
- the AWT path to which the line is appendedpublic void appendPointList(ILcdPointList aPointList, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation, ILcdAWTPath aAWTPathSFCT)
ILcdGXYPen
ILcdAWTPath
.
The polyline is given as an ILcdPointList
of which the points are specified in
model coordinates. These model coordinates are transformed to AWT coordinates by means of the given
ILcdModelXYWorldTransformation
and ILcdGXYViewXYWorldTransformation
.
If a model point is outside the valid area of the given ILcdModelXYWorldTransformation
,
a line break is appended to the given ILcdAWTPath
so that the polyline is split.appendPointList
in interface ILcdGXYPen
aPointList
- the point list (specified in model coordinates)aModelXYWorldTransformation
- the transformation between model and world coordinatesaGXYViewXYWorldTransformation
- the transformation between world and view coordinatesaAWTPathSFCT
- the AWT path to which the given point list is appendedpublic void appendArc(ILcdPoint aCenter, double aA, double aB, double aRotAngle, double aStartAngle, double aArcAngle, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation, ILcdAWTPath aAWTPathSFCT) throws TLcdOutOfBoundsException
ILcdGXYPen
ILcdAWTPath
.
The arc is specified as a segment of the circumference of an ellipse. The given
ILcdModelXYWorldTransformation
and ILcdGXYViewXYWorldTransformation
are used to transform model coordinates to AWT coordinates.appendArc
in interface ILcdGXYPen
aCenter
- the center of the ellipse (specified in model coordinates)aA
- the semi-major axis of the ellipseaB
- the semi-minor axis of the ellipseaRotAngle
- the rotation angle of the major axis of the ellipse (expressed in degrees).
Positive angles are measured counter-clockwise from the line at 3 o'clock.aStartAngle
- the start angle of the arc (expressed in degrees). Positive angles are measured
counter-clockwise from the line at 3 o'clock.aArcAngle
- the span of the arc (expressed in degrees), increasing counterclockwise from
the start angleaModelXYWorldTransformation
- the transformation between model and world coordinatesaGXYViewXYWorldTransformation
- the transformation between world and view coordinatesaAWTPathSFCT
- the AWT path to which the polyline approximation of the given arc is appendedTLcdOutOfBoundsException
- Some implementations may throw an exception in case the center
of the ellipse is outside the valid area of the transformation but this could be avoided by more
advanced implementations.ILcdArc
public void appendLineTo(ILcdPoint aPoint, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGeneralPath aGeneralPathSFCT)
ILcdGXYPen
ILcdGeneralPath
.
The given model coordinates of the end point of the line are transformed
to world coordinates by means of the given ILcdModelXYWorldTransformation
.
If this point is outside the valid area of the transformation, a line break is appended to the
given ILcdGeneralPath
.appendLineTo
in interface ILcdGXYPen
aPoint
- the end point (specified in model coordinates) of the lineaModelXYWorldTransformation
- the transformation between model and world coordinatesaGeneralPathSFCT
- the general path to which the line is appendedpublic void appendHorizontalLineTo(double aDeltaX, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGeneralPath aGeneralPathSFCT)
ILcdGXYPen
ILcdGeneralPath
.
The model coordinates of the end point of this line are obtained by translating the
model x coordinate of the current position by the given amount. The model coordinates
of the end point of the line are transformed to world coordinates by means of the given
ILcdModelXYWorldTransformation
. If this point is outside the valid area of this
transformation, a line break is appended to the given ILcdGeneralPath
. In case the
current position is undefined, nothing is appended.appendHorizontalLineTo
in interface ILcdGXYPen
aDeltaX
- the amount by which the model x coordinate of the current position is translatedaModelXYWorldTransformation
- the transformation between model and world coordinatesaGeneralPathSFCT
- the general path to which the line is appendedpublic void appendVerticalLineTo(double aDeltaY, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGeneralPath aGeneralPathSFCT)
ILcdGXYPen
ILcdGeneralPath
.
The model coordinates of the end point of this line are obtained by translating the
model y coordinate of the current position by the given amount. The model coordinates
of the end point of the line are transformed to world coordinates by means of the given
ILcdModelXYWorldTransformation
. If this point is outside the valid area of this
transformation, a line break is appended to the given ILcdGeneralPath
. In case the
current position is undefined, nothing is appended.appendVerticalLineTo
in interface ILcdGXYPen
aDeltaY
- the amount by which the model y coordinate of the current position is translatedaModelXYWorldTransformation
- the transformation between model and world coordinatesaGeneralPathSFCT
- the general path to which the line is appendedpublic void appendPointList(ILcdPointList aPointList, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGeneralPath aGeneralPathSFCT)
ILcdGXYPen
ILcdGeneralPath
.
The polyline is given as an ILcdPointList
of which the points are specified in
model coordinates. These model coordinates are transformed to world coordinates by means of the
given ILcdModelXYWorldTransformation
. If a model point is outside the valid area
of this transformation, a line break is appended to the given ILcdGeneralPath
so that
the polyline is split.appendPointList
in interface ILcdGXYPen
aPointList
- the point list (specified in model coordinates)aModelXYWorldTransformation
- the transformation between model and world coordinatesaGeneralPathSFCT
- the general path to which the given point list is appendedpublic void appendArc(ILcdPoint aCenter, double aA, double aB, double aRotAngle, double aStartAngle, double aArcAngle, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGeneralPath aGeneralPathSFCT) throws TLcdOutOfBoundsException
ILcdGXYPen
ILcdGeneralPath
.
The arc is specified as a segment of the circumference of an ellipse. The given
ILcdModelXYWorldTransformation
is used to transform model coordinates to world coordinates.appendArc
in interface ILcdGXYPen
aCenter
- the center of the ellipse (specified in model coordinates)aA
- the semi-major axis of the ellipseaB
- the semi-minor axis of the ellipseaRotAngle
- the rotation angle of the major axis of the ellipse (expressed in degrees).
Positive angles are measured counter-clockwise from the line at 3 o'clock.aStartAngle
- the start angle of the arc (expressed in degrees). Positive angles are measured
counter-clockwise from the line at 3 o'clock.aArcAngle
- the span of the arc (expressed in degrees), increasing counterclockwise from
the start angleaModelXYWorldTransformation
- the transformation between model and world coordinatesaGeneralPathSFCT
- the general path to which the polyline approximation of the given arc is appendedTLcdOutOfBoundsException
- Some implementations may throw an exception in case the center
of the ellipse is outside the valid area of the transformation but this could be avoided by more
advanced implementations.ILcdArc
public void drawArc(double aCenterX, double aCenterY, double aStartX, double aStartY, double aArcAngle, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation, Graphics aGraphics) throws TLcdOutOfBoundsException
ILcdGXYPen
Graphics
.
The circular arc is specified by the center of the circle, a point on the circumference of the circle
which denotes the start point of the arc and the angle spanned by the arc.
The given ILcdModelXYWorldTransformation
and ILcdGXYViewXYWorldTransformation
are used to transform between model coordinates and AWT coordinates.drawArc
in interface ILcdGXYPen
aCenterX
- the AWT x coordinate of the center of the circleaCenterY
- the AWT y coordinate of the center of the circleaStartX
- the AWT x coordinate of the start point of the arcaStartY
- the AWT y coordinate of the start point of the arcaArcAngle
- the span of the arc (expressed in degrees), increasing counterclockwise from
the start angleaModelXYWorldTransformation
- the transformation between model and world coordinatesaGXYViewXYWorldTransformation
- the transformation between world and view coordinatesaGraphics
- the Graphics onto which the arc is drawnTLcdOutOfBoundsException
- Some implementations may throw an exception in case one of the defining
points of the circular arc and/or one of the points of the arc is outside the valid area of the transformation
but this could be avoided by more advanced implementations.public double modelDistance(double aX1, double aY1, double aX2, double aY2, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation) throws TLcdOutOfBoundsException
ILcdGXYPen
ILcdModelXYWorldTransformation
and ILcdGXYViewXYWorldTransformation
.modelDistance
in interface ILcdGXYPen
aX1
- the x-coordinate of the first AWT pointaY1
- the y-coordinate of the first AWT pointaX2
- the x-coordinate of the second AWT pointaY2
- the y-coordinate of the second AWT pointaModelXYWorldTransformation
- the transformation between model and world coordinatesaGXYViewXYWorldTransformation
- the transformation between world and view coordinatesTLcdOutOfBoundsException
- If one of the two given points is outside the valid area of the
given ILcdModelXYWorldTransformation
.public boolean isLineTouched(ILcdPoint aPoint1, ILcdPoint aPoint2, double aX, double aY, boolean aIncludeHotPoint, int aSensitivity, ILcdModelXYWorldTransformation aModelXYWorldTransformation, ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation)
ILcdGXYPen
ILcdModelXYWorldTransformation
and
ILcdGXYViewXYWorldTransformation
. The user can specify the allowed tolerance
(aSensitivity
) and whether the test should include the hot points
(aIncludeHotPoint
).isLineTouched
in interface ILcdGXYPen
isLineTouched
in class ALcdGXYPen
aPoint1
- the start point of the line (specified in model coordinates)aPoint2
- the end point of the line (specified in model coordinates)aX
- the x-coordinate of the AWT pointaY
- the y-coordinate of the AWT pointaIncludeHotPoint
- boolean indicating whether to include the hot pointsaSensitivity
- the allowed tolerance (expressed in pixels)aModelXYWorldTransformation
- the transformation between model and world coordinatesaGXYViewXYWorldTransformation
- the transformation between world and view coordinatespublic Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in interface ILcdGXYPen
clone
in class ALcdGXYPen
Object.clone()