public class TLcdGXYRoundedPointListPainter extends TLcdGXYPointListPainter
ILcdPointList
, TLcdRoundedPolyline
, and TLcdRoundedPolygon
objects.
TLcdGXYPointListPainter.POLYLINE
mode is used. The amount of roundness used for the
corners can be controlled through the method setRoundness(double)
.
Note that the spline is calculated in world coordinates, so the rendering can vary for different
geographic projections.
The same five paint modes as in TLcdGXYPointListPainter are provided by this painter, which allow the point list to be painted as:
![]() |
|
![]() |
||
A set of points (TLcdGXYPointListPainter.POINT ) |
|
A polyline (TLcdGXYPointListPainter.POLYLINE ) |
||
|
||||
![]() |
|
![]() |
|
![]() |
An outlined polygon (TLcdGXYPointListPainter.POLYGON ) |
|
A filled polygon (TLcdGXYPointListPainter.FILLED ) |
|
A filled and outlined polygon (TLcdGXYPointListPainter.OUTLINED_FILLED ) |
Objects that are selected or that are being edited, are painted as defined by the selectionMode
and editMode properties, respectively. The same values as above can be used for both mode
properties. These properties are not taken into account when an object needs to
be painted in the paint mode POINT
or POLYLINE
.
Every point of the source point list is regarded as a handle of the point list. The following image clarifies the handle location, the points are represented by red points.
POINT
, the points are more than only a
handle. They are also the only visible part of the shape and should therefore always be painted
independent of the render mode.
Every point of the source point list can be returned on the condition that it is touched (see
getTouchedPoint
) and that
the roundness set on this painter (see getRoundness()
) equals 0. The point returned as
a snap target is highlighted with the snapIcon
.
The visualization of the ILcdPointList
object is governed by the line style and fill
style set to this painter. Depending on the paint mode chosen one or both of these will be taken
into account.
When the ILcdPointList
is also an ILcdShape
, the anchor point is located at
the focus point of the shape. Otherwise the anchor point is located at the center point of the source
point list.
Depending on the paint mode, the object is touched when either
the painted point list, or the internal area of the painted point list is touched.
The methods
getTouchedPoint
,
getTouchedSegment(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
getTouchedSegment}
and
insidePolygon
provide information
on which part of the object is being touched.
AREA, COORDINATES_AVERAGE, END_OF_CURVE, FILLED, FIRST_POSSIBLE_POINT, FOCUS_POINT, INSIDE_POLYGON, MEDIAN_POINT, MIDDLE_OF_BOUNDS, MIDDLE_OF_CURVE, OUTLINE_AREA, OUTLINED_FILLED, POINT, POLYGON, POLYLINE, START_OF_CURVE
OUTLINED
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATED
BODY, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
Constructor and Description |
---|
TLcdGXYRoundedPointListPainter()
Constructs a default
TLcdGXYRoundedPointListPainter in a POLYLINE mode
and with display name "Polypoint". |
TLcdGXYRoundedPointListPainter(int aPointListMode)
Constructs a
TLcdGXYRoundedPointListPainter in the given mode
and with display name "Polypoint". |
TLcdGXYRoundedPointListPainter(String aDisplayName)
Constructs a default
TLcdGXYRoundedPointListPainter in a POLYLINE mode
and with display name aDisplayName . |
TLcdGXYRoundedPointListPainter(String aDisplayName,
int aPointListMode)
Constructs a
TLcdGXYRoundedPointListPainter in the given mode
and with display name aDisplayName . |
Modifier and Type | Method and Description |
---|---|
void |
boundsSFCT(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext,
ILcd2DEditableBounds aBoundsSFCT)
Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object
and its handles (the source point list) in the given mode taking into account the given context.
|
Object |
clone()
Makes
Object.clone() public. |
Object |
getObject()
Returns the object that can currently be painted or edited by this painter/editor.
|
double |
getRoundness()
Returns the roundness factor that is used to render corners of polygons or polylines.
|
int |
getTouchedSegment(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
Returns the index of the segment in the
ILcdPointList object that has been touched according
to the coordinates in the context, or -1 if none of the segments were touched. |
boolean |
isTouched(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
Depending on the render mode and paint mode, returns whether one of the handles (the source point list),
the painted point list or the interior of the point list is touched.
|
protected ILcdPointList |
retrievePointList(Object aObject)
Extracts an
ILcdPointList from the given object. |
void |
setObject(Object aObject)
Sets the object to paint or edit.
|
void |
setRoundness(double aRoundness)
Sets the roundness factor that should be used to render corners of polygons or polylines.
|
boolean |
supportSnap(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Supports snapping when the
ILcdPointList object set to this painter contains at least
one point and getRoundness() equals 0. |
acceptSnapTarget, anchorPointSFCT, append2DPoint, appendAWTPath, appendGeneralPath, edit, getAnchorPointLocation, getCreationClickCount, getCursor, getFillSelection, getGXYEditor, getMinimumEditDelta, getMode, getModeName, getPaintCache, getSnapIcon, getTouchedPoint, getTouchedSegment, getWindingRule, insert2DPoint, insidePolygon, isMoveOnlyOnEdit, isTraceOn, linkToSnapTarget, move2DPoint, paint, removePointAt, retrieveMinimalPointcount, setAnchorPointLocation, setFillSelection, setMinimumEditDelta, setMode, setModelModelTransformationClass, setMoveOnlyOnEdit, setPaintCache, setSnapIcon, setTraceOn, setupGraphicsForFill, setupGraphicsForLine, setupGraphicsForPoint, setWindingRule, snapTarget, translate2D, translate2DPoint
getEditMode, getFillStyle, getLineStyle, getSelectionMode, setEditMode, setFillStyle, setLineStyle, setSelectionMode
addPropertyChangeListener, firePropertyChangeEvent, firePropertyChangeEvent, getDisplayName, getGXYPainter, removePropertyChangeListener, setClassTraceOn, setDisplayName
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayName
getDisplayName
addPropertyChangeListener, removePropertyChangeListener
public TLcdGXYRoundedPointListPainter()
TLcdGXYRoundedPointListPainter
in a POLYLINE mode
and with display name "Polypoint". The default roundness factor is 0.5.public TLcdGXYRoundedPointListPainter(String aDisplayName)
TLcdGXYRoundedPointListPainter
in a POLYLINE mode
and with display name aDisplayName
. The default roundness factor is 0.5.aDisplayName
- the display name for this painter, used for textual representation of this painter.public TLcdGXYRoundedPointListPainter(int aPointListMode)
TLcdGXYRoundedPointListPainter
in the given mode
and with display name "Polypoint". The default roundness factor is 0.5.aPointListMode
- the mode for the default representation of the point lists.
The value should be one of POINT, POLYLINE, POLYGON, FILLED, OUTLINED_FILLED.TLcdGXYPointListPainter.setMode(int)
,
ALcdGXYAreaPainter.setSelectionMode(int)
,
ALcdGXYAreaPainter.setEditMode(int)
public TLcdGXYRoundedPointListPainter(String aDisplayName, int aPointListMode)
TLcdGXYRoundedPointListPainter
in the given mode
and with display name aDisplayName
. The default roundness factor is 0.5.aDisplayName
- the display name for this painter, used for textual representation of this painter.aPointListMode
- the mode for the default representation of the point lists.
The value should be one of POINT, POLYLINE, POLYGON, FILLED, OUTLINED_FILLED.TLcdGXYPointListPainter.setMode(int)
,
ALcdGXYAreaPainter.setSelectionMode(int)
,
ALcdGXYAreaPainter.setEditMode(int)
public void setObject(Object aObject)
TLcdGXYPointListPainter
ILcdPointList
for painting and (optionally) an ILcd2DEditablePointList
for editing.
You can change how the ILcdPointList
is derived from the object by overriding
TLcdGXYPointListPainter.retrievePointList(java.lang.Object)
.setObject
in interface ILcdGXYEditor
setObject
in interface ILcdGXYPainter
setObject
in class TLcdGXYPointListPainter
aObject
- The object to paint and edit.TLcdGXYPointListPainter.getObject()
protected ILcdPointList retrievePointList(Object aObject)
TLcdGXYPointListPainter
ILcdPointList
from the given object.
The default implementation simply casts the object to an ILcdPointList
.
Re-define this method to obtain the ILcdPointList
by other means.retrievePointList
in class TLcdGXYPointListPainter
TLcdGXYPointListPainter.setObject(java.lang.Object)
public Object getObject()
TLcdGXYPointListPainter
getObject
in interface ILcdGXYEditor
getObject
in interface ILcdGXYPainter
getObject
in class TLcdGXYPointListPainter
TLcdGXYPointListPainter.setObject(Object)
public double getRoundness()
setRoundness(double)
public void setRoundness(double aRoundness)
TLcdRoundedPolyline
or TLcdRoundedPolygon
,
because these shapes impose their own roundness.aRoundness
- the roundness (or rounding) factor for polygon and polyline corners.IllegalArgumentException
- if aRoundness < 0 || aRoundness > 1.0.public void boundsSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException
If this method returns without exception the bounds argument must encompass the representation of the object. A point outside the bounds will not be contained within the painted object.
The bounds returned in this method can be seen as the equivalent in the view space of the bounds in the model
space for ILcdBounded
objects.
boundsSFCT
in interface ILcdGXYPainter
boundsSFCT
in class TLcdGXYPointListPainter
aGraphics
- the Graphics on which the representation of the object is paintedaRenderMode
- the mode the object is represented in (see class documentation). For example, an object may be
represented differently in SELECTED mode compared to DEFAULT mode. The returned bounds of the representation
must take this different representation into account.aGXYContext
- the context for which the representation of the object is painted. It contains amongst others
the transformations from model to world and world to view.aBoundsSFCT
- the bounds that must be adapted to encompass the representation of the object in the given
mode and context. These bounds must not be taken into account when the method has thrown an exception.TLcdNoBoundsException
- if no bounds can be determined for the representation of the object.
This can happen when the object does not have a representation in the given context, for example when it is located
in a part of the world which is not visible in the current view.isTouched
public boolean supportSnap(Graphics aGraphics, ILcdGXYContext aGXYContext)
Supports snapping when the ILcdPointList
object set to this painter contains at least
one point and getRoundness()
equals 0.
supportSnap
in interface ILcdGXYPainter
supportSnap
in class TLcdGXYPointListPainter
aGraphics
- the graphics on which is worked.aGXYContext
- the context of the snapping.true
if the ILcdPointList
object contains at least one point and
getRoundness()
equals 0, false
otherwise.public 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 ILcdGXYEditorProvider
clone
in interface ILcdGXYPainterProvider
clone
in class TLcdGXYPointListPainter
Object.clone()
public int getTouchedSegment(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
TLcdGXYPointListPainter
Returns the index of the segment in the ILcdPointList
object that has been touched according
to the coordinates in the context, or -1
if none of the segments were touched.
If more than one segment of the ILcdPointList
object is touched, the index of the one
with the smaller index is returned.
getTouchedSegment
in class TLcdGXYPointListPainter
aGraphics
- The graphics to paint the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context in which the object is rendered.public boolean isTouched(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
This implementation will use the specified paint mode
to determine how
the object is represented. Depending on the representation of the ILcdPointList
object,
the object is touched when
TLcdGXYPointListPainter.FILLED
,
ILcdGXYPainter.SELECTED
.
The method insidePolygon
determines whether the current mouse position
is located inside the ILcdPointList
object or not.
It is not possible to derive from this method which part of the point list has been touched.
To determine which part of the ILcdPointList
object is touched, the methods getTouchedPoint
and getTouchedSegment
will return
the required information.
isTouched
in interface ILcdGXYPainter
isTouched
in class TLcdGXYPointListPainter
aGraphics
- The graphics to paint the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context in which the object is rendered.TLcdGXYPointListPainter.getMode()