Class TLcdGXYGeoBufferPainter
- All Implemented Interfaces:
ILcdCloneable
,ILcdPropertyChangeSource
,ILcdGXYEditor
,ILcdGXYEditorProvider
,ILcdGXYPainter
,ILcdGXYPainterProvider
,Serializable
,Cloneable
ILcdGXYView
.
Visualization
This painter can visualizeTLcdLonLatBuffer
, TLcdLonLatHeightBuffer
, ILcdVariableGeoBuffer
,
and ILcdGeoBuffer
with a base shape of the following types:
ILcdPoint
ILcdPolyline
ILcdPolygon
ILcdComplexPolygon
TLcdGeodeticPen
on the layer, its straightLineMode
property
should be disabled to ensure a correct visualization of the buffer axis.
Body
This painter provides three paint modes to paint the body of a buffer. The mode
property can be set using the method setMode
and allows the buffer to be painted
as:
|
|
|||
An outlined buffer (OUTLINED ) |
|
A filled buffer (FILLED ) |
|
A filled and outlined buffer (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.
Handles
Every point of the buffer axis is regarded as a handle of the buffer. The following image clarifies the handle location, the handles are represented by red points.
For
ILcdVariableGeoBuffer
objects, additional circular handles are placed on every
point of the buffer axis, to control the width for every axis point.
Snap targets
Every point of the axis can be returned on the condition that
- it is touched, see
getTouchedPointAxis
, - it is rendered, either by drawing the axis (see
isDrawAxis()
) or the axis points (seeisDrawAxisPoints()
), or if snapping to invisible points is enabled (seeisSnapToInvisiblePoints()
).
snapIcon
.
Styling options
The visualization of a buffer 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.
Locating a buffer in a view
Anchor point
The location of the anchor point can be set using setAnchorPointLocation(int)
to the
middle of the buffer's bounds or to the middle of the buffer itself. By default the anchor point
is located at the center point of the bounds, calculated by boundsSFCT
.
When is a buffer touched
Depending on the paint mode, a buffer is touched when either the contour, one of the handles, the axis segments, or the internal area (when filled) of the buffer is touched.
Visually editing and creating a buffer
For editing, the buffer object must implement or extendTLcdLonLatBuffer
, TLcdLonLatHeightBuffer
,
ILcd2DEditableGeoBuffer
, or ILcd2DEditableVariableGeoBuffer
.
For the latter two interfaces, the base shape must be an ILcd2DEditableShape
or an ILcdEditableComplexPolygon
that contains only editable polygons.
Modifying
This editor provides the following edit functionality for the different render modes:
RESHAPED
: a point is added to or removed from the buffer axis, depending on whether an axis point or an axis segment of the buffer is touched, or the width of the buffer is changed if the contour is touched.TRANSLATED
: a single axis point or the whole buffer is translated, depending on whether an axis point, an axis segment or the filled interior of the buffer is touched. ForILcdVariableGeoBuffer
objects, the width of the buffer can be adjusted for every axis point by touching the respective contour handle.
Creating
When initializing a buffer via interaction through the view, a new point will be appended to the buffer axis
when calling edit
with
either START_CREATION
, CREATING
or END_CREATION
mode.
The number of points in the buffer axis is not limited. The initial width of a new buffer can be controlled
through setCreationBufferWidth
. If a negative
value is specified, the buffer width will be proportional to the length of the first buffer segment;
if a positive value is specified, the buffer width will be equal to the value.
Accepted snap targets
All points are accepted as snap target as long as:
- the point can be transformed to the reference of the buffer
with the
model to model transformation
, - the point is not the last axis point of the current object.
Additional properties
Caching
This painter implementation supports caching for objects implementing ILcdCache
.
Caching can be turned on/off with the setPaintCache
method.
Drawing the axis
The drawAxis
and drawAxisWhenSelected
properties define when the axis needs to be painted. If the axis is painted, it can
be touched, moved,...
Drawing the axis points
The drawAxisPoints
and drawAxisPointsWhenSelected
properties define when the axis points needs to be painted. If the axis points are painted, they can
be touched, moved,...
- Since:
- 8.1
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Draw the area defined by the buffer filled with the foreground color.static final int
Constant value indicating that the anchor point should be chosen as the anchor point of the geo buffer.static final int
Constant value indicating that the anchor point should be chosen in the middle of the buffer's bounds, calculated byboundsSFCT
.static final int
Constant value indicating that the anchor point should be chosen in the middle of the buffer's middle segment.static final int
Draw only the outline of the buffer.static final int
Draw the buffer as an outlined and filled area.Fields inherited from class com.luciad.view.gxy.ALcdGXYPainter
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
Fields inherited from interface com.luciad.view.gxy.ILcdGXYEditor
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATED
Fields inherited from interface com.luciad.view.gxy.ILcdGXYPainter
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdGXYGeoBufferPainter
and sets the display name to "Buffer". -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptSnapTarget
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns whether the object set to the editor can be edited so that (part of) the object snaps to the object passed as snap target in the context.void
anchorPointSFCT
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) Moves the specifiedaPointSFCT
to the anchor point of the buffer, as specified bygetAnchorPointLocation()
.void
boundsSFCT
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object in the given mode taking into account the given context.clone()
MakesObject.clone()
public.boolean
edit
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) This implementation editsILcd2DEditableGeoBuffer
andILcd2DEditableGeoBuffer
objects, otherwise aClassCastException
will be thrown.int
Returns the location of the anchor point (by default: MIDDLE_OF_BOUNDS).double
Returns the buffer width set for creation of a new buffer.int
Returns the number of user interactions required to complete the initialization of anILcd2DEditableGeoBuffer
orILcd2DEditableVariableGeoBuffer
object set to this editor.getCursor
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Returns aCursor
that clarifies the render mode and context this painter is operating in.getGXYEditor
(Object aObject) Returns this instance as editor for editing the specifiedObject
.int
Returns the minimum pixel distance the input device (a mouse, for example) must move before editing the shape.Returns the object that can currently be painted or edited by this painter/editor.boolean
Returns whether caching is used when painting this painter's object.Returns the icon that is used to paint snap target points of the object set to this painter.Returns the line style that is used to visualize visual aid lines when editing a variable geo buffer.boolean
Returns whether the axis of the buffer should be displayed.boolean
Returns whether the axis points of the buffer should be displayed.boolean
Returns whether the axis points of the buffer should be displayed when it is painted in selected mode.boolean
Returns whether the axis of the buffer should be displayed when it is painted in selected mode.boolean
Returns whether the painter allows snapping to the invisible points of the shape.boolean
isTouched
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Depending on the rendering mode, returns whether the contour, one of the axis points, axis segments or the interior of the buffer is touched.boolean
Deprecated.This method has been deprecated.void
paint
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Displays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.void
setAnchorPointLocation
(int aAnchorPointLocation) Sets the preferred anchor point location.void
setCreationBufferWidth
(double aBufferWidth) Sets the width of the buffer to be set at creation time.void
setDrawAxis
(boolean aDrawAxis) Sets whether the axis of the buffer should be displayed or not.void
setDrawAxisPoints
(boolean aDrawAxisPoints) Sets whether the axis points of the buffer should be displayed or not.void
setDrawAxisPointsWhenSelected
(boolean aDrawAxisPointsWhenSelected) Sets whether the axis points of the buffer should be displayed when it is painted in selected mode or not.void
setDrawAxisWhenSelected
(boolean aDrawAxisWhenSelected) Sets whether the axis of the buffer should be displayed when it is painted in selected mode or not.void
setMinimumEditDelta
(int aDelta) Sets the minimum pixel distance the input device (a mouse, for example) must move before editing the shape.void
setModelModelTransformationClass
(Class aModel2ModelTransformationClass) Sets the transformation class that should be used when snapping to points that are defined in a different reference than the reference of this painter's object.void
Sets the object to paint and edit.void
setPaintCache
(boolean aPaintCache) Turns caching of the representation of the object on or off.void
setSnapIcon
(ILcdIcon aSnapIcon) Sets the icon that marks snap targets of the object currently set to this painter.void
setSnapToInvisiblePoints
(boolean aSnapToInvisiblePoints) Sets whether the other shapes can snap to invisible points of this shape.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
setVisualAidLineStyle
(ILcdGXYPainterStyle aLineStyle) Sets the line style that is used to visualize visual aid lines when editing a variable geo buffer.snapTarget
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns one of the axis or contour points of the buffer if it is touched.boolean
supportSnap
(Graphics aGraphics, ILcdGXYContext aGXYContext) This implementation supports snapping, always returnstrue
.Methods inherited from class com.luciad.view.gxy.painter.ALcdGXYAreaPainter
getEditMode, getFillStyle, getLineStyle, getMode, getSelectionMode, setEditMode, setFillStyle, setLineStyle, setMode, setSelectionMode
Methods inherited from class com.luciad.view.gxy.ALcdGXYPainter
addPropertyChangeListener, firePropertyChangeEvent, firePropertyChangeEvent, getDisplayName, getGXYPainter, removePropertyChangeListener, setClassTraceOn, setDisplayName
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.gxy.ILcdGXYEditor
getDisplayName
Methods inherited from interface com.luciad.view.gxy.ILcdGXYPainter
getDisplayName
Methods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
-
Field Details
-
OUTLINED
public static final int OUTLINEDDraw only the outline of the buffer.- See Also:
-
FILLED
public static final int FILLEDDraw the area defined by the buffer filled with the foreground color.- See Also:
-
OUTLINED_FILLED
public static final int OUTLINED_FILLEDDraw the buffer as an outlined and filled area.- See Also:
-
MIDDLE_OF_BOUNDS
public static final int MIDDLE_OF_BOUNDSConstant value indicating that the anchor point should be chosen in the middle of the buffer's bounds, calculated byboundsSFCT
.- See Also:
-
FOCUS_POINT
public static final int FOCUS_POINTConstant value indicating that the anchor point should be chosen as the anchor point of the geo buffer. If this point cannot be retrieved, theMIDDLE_OF_BOUNDS
method is used to calculate the anchor point.- See Also:
-
MIDDLE_OF_BUFFER
public static final int MIDDLE_OF_BUFFERConstant value indicating that the anchor point should be chosen in the middle of the buffer's middle segment.- See Also:
-
-
Constructor Details
-
TLcdGXYGeoBufferPainter
public TLcdGXYGeoBufferPainter()Creates a newTLcdGXYGeoBufferPainter
and sets the display name to "Buffer".
-
-
Method Details
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Overrides:
setTraceOn
in classALcdGXYPainter
- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Overrides:
isTraceOn
in classALcdGXYPainter
- Returns:
- true if tracing is enabled for this class, false otherwise.
-
setObject
Sets the object to paint and edit. See the class javadoc for the supported objects. This painter/editor can be used to paint the object without using the edit functionality.
When this painter is used as editor with an object that does not implement one of the
ILcd2DEditableGeoBuffer
/ILcd2DEditableGeoBuffer
interfaces, or its base shape is not editable, theedit
method shall throw an exception.- Specified by:
setObject
in interfaceILcdGXYEditor
- Specified by:
setObject
in interfaceILcdGXYPainter
- Parameters:
aObject
- The object to paint and edit.- Throws:
IllegalArgumentException
- if the visualization of the object is not supported- See Also:
-
getObject
Returns the object that can currently be painted or edited by this painter/editor.- Specified by:
getObject
in interfaceILcdGXYEditor
- Specified by:
getObject
in interfaceILcdGXYPainter
- Returns:
- the object that can currently be painted or edited by this painter/editor.
- See Also:
-
setPaintCache
public void setPaintCache(boolean aPaintCache) Turns caching of the representation of the object on or off. Caching greatly reduces the time to paint an object but requires more memory. The representation of an object can only be cached for objects which implementILcdCache
. By default, caching is turned on.- Parameters:
aPaintCache
- A flag indicating whether to use caching when painting an object.- See Also:
-
getPaintCache
public boolean getPaintCache()Returns whether caching is used when painting this painter's object.- Returns:
true
if caching is used to paint this painter's object,false
otherwise.- See Also:
-
setCreationBufferWidth
public void setCreationBufferWidth(double aBufferWidth) Sets the width of the buffer to be set at creation time. If a negative value is specified the buffer width will be proportional to the length of the first buffer segment. By default, a negative value is specified.- Parameters:
aBufferWidth
- the width of the buffer to be set at creation time.- See Also:
-
getCreationBufferWidth
public double getCreationBufferWidth()Returns the buffer width set for creation of a new buffer.- Returns:
- the buffer width set for creation of a new buffer.
- See Also:
-
setDrawAxis
public void setDrawAxis(boolean aDrawAxis) Sets whether the axis of the buffer should be displayed or not. The default value of this property isfalse
. This setting has an influence on the methodsboundsSFCT
,isTouched
and snapping.- Parameters:
aDrawAxis
- A flag indicating whether the axis of the buffer should be displayed or not.- See Also:
-
isDrawAxis
public boolean isDrawAxis()Returns whether the axis of the buffer should be displayed.- Returns:
- whether the axis of the buffer should be displayed.
- See Also:
-
setDrawAxisWhenSelected
public void setDrawAxisWhenSelected(boolean aDrawAxisWhenSelected) Sets whether the axis of the buffer should be displayed when it is painted in selected mode or not. The default value of this property istrue
. This setting has an influence on the methodsboundsSFCT
,isTouched
and snapping.- Parameters:
aDrawAxisWhenSelected
- A flag indicating whether the axis of the buffer should be displayed when it is painted in selected mode or not.- See Also:
-
isDrawAxisWhenSelected
public boolean isDrawAxisWhenSelected()Returns whether the axis of the buffer should be displayed when it is painted in selected mode.- Returns:
- whether the axis of the buffer should be displayed when it is painted in selected mode.
- See Also:
-
setDrawAxisPoints
public void setDrawAxisPoints(boolean aDrawAxisPoints) Sets whether the axis points of the buffer should be displayed or not. The default value of this property isfalse
. This setting has an influence on the methodsboundsSFCT
,isTouched
and snapping.- Parameters:
aDrawAxisPoints
- A flag indicating whether the axis points of the buffer should be displayed or not.- See Also:
-
isDrawAxisPoints
public boolean isDrawAxisPoints()Returns whether the axis points of the buffer should be displayed.- Returns:
- whether the axis points of the buffer should be displayed.
- See Also:
-
setDrawAxisPointsWhenSelected
public void setDrawAxisPointsWhenSelected(boolean aDrawAxisPointsWhenSelected) Sets whether the axis points of the buffer should be displayed when it is painted in selected mode or not. The default value of this property istrue
. This setting has an influence on the methodsboundsSFCT
,isTouched
and snapping.- Parameters:
aDrawAxisPointsWhenSelected
- A flag indicating whether the axis points of the buffer should be displayed when it is painted in selected mode or not.- See Also:
-
isDrawAxisPointsWhenSelected
public boolean isDrawAxisPointsWhenSelected()Returns whether the axis points of the buffer should be displayed when it is painted in selected mode.- Returns:
- whether the axis points of the buffer should be displayed when it is painted in selected mode.
- See Also:
-
setSnapToInvisiblePoints
public void setSnapToInvisiblePoints(boolean aSnapToInvisiblePoints) Sets whether the other shapes can snap to invisible points of this shape. For a buffer, all axis points are invisible points if they are not drawn. The default value isfalse
.- Parameters:
aSnapToInvisiblePoints
- A flag indicating whether snapping to the invisible points is allowed.- See Also:
-
isSnapToInvisiblePoints
public boolean isSnapToInvisiblePoints()Returns whether the painter allows snapping to the invisible points of the shape.- Returns:
- whether the painter allows snapping to the invisible points of the shape.
- See Also:
-
setSnapIcon
Sets the icon that marks snap targets of the object currently set to this painter. This icon is painted when thepaint
method is called with the render modeILcdGXYPainter.SNAPS
.- Parameters:
aSnapIcon
- The icon that should be used to paint snap target points.- See Also:
-
getSnapIcon
Returns the icon that is used to paint snap target points of the object set to this painter.- Returns:
- the icon that is used to paint snap target points of the object set to this painter.
- See Also:
-
setVisualAidLineStyle
Sets the line style that is used to visualize visual aid lines when editing a variable geo buffer.- Parameters:
aLineStyle
- the line style that is used to visualize visual aid lines when editing a variable geo buffer.- See Also:
-
getVisualAidLineStyle
Returns the line style that is used to visualize visual aid lines when editing a variable geo buffer.- Returns:
- the line style that is used to visualize visual aid lines when editing a variable geo buffer.
- See Also:
-
setMinimumEditDelta
public void setMinimumEditDelta(int aDelta) Sets the minimum pixel distance the input device (a mouse, for example) must move before editing the shape. A larger value ensures that the object easily "snaps" back in place, a small value allows fine editing.- Parameters:
aDelta
- the minimum pixel distance the input device should move in either the X or Y direction
-
getMinimumEditDelta
public int getMinimumEditDelta()Returns the minimum pixel distance the input device (a mouse, for example) must move before editing the shape. A larger value ensures that the object easily "snaps" back in place, a small value allows fine editing. The default value is 3 pixels.- Returns:
- the minimum pixel distance the input device should move in either the X or Y direction
-
getCursor
Returns aCursor
that clarifies the render mode and context this painter is operating in. When no specificCursor
is required,null
is returned.A non-null cursor is returned only if the mode is equal to
ILcdGXYPainter.RESHAPING
orILcdGXYPainter.TRANSLATING
. The kind of cursor that is returned depends on location of the mouse. InILcdGXYPainter.RESHAPING
mode:- Cursor.CROSSHAIR_CURSOR, if an axis point is touched,
- Cursor.MOVE_CURSOR, if an axis segment is touched,
- Cursor.N_RESIZE_CURSOR, Cursor.NE_RESIZE_CURSOR, etc.. if the contour is touched; the actual cursor depends on the orientation of the contour segment.
ILcdGXYPainter.TRANSLATING
mode:- Cursor.CROSSHAIR_CURSOR, if an axis point is touched,
- Cursor.MOVE_CURSOR, if a part of the buffer is touched
(see
isTouched(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
).
- Specified by:
getCursor
in interfaceILcdGXYPainter
- Overrides:
getCursor
in classALcdGXYPainter
- Parameters:
aGraphics
- The graphics on which the object is painted.aMode
- The mode to render the object in.aGXYContext
- The context in which the object is rendered.- Returns:
- a cursor to indicate the type of operating mode and context. Returns
null
if no particular cursor is required.
-
getGXYEditor
Returns this instance as editor for editing the specifiedObject
. If thisObject
is not the same as theObject
set to this painter, thesetObject(Object)
method is called to update the object set to the painter.- Specified by:
getGXYEditor
in interfaceILcdGXYEditorProvider
- Parameters:
aObject
- the object to be edited.- Returns:
- this instance as editor for editing the specified
Object
.
-
isTouched
Depending on the rendering mode, returns whether the contour, one of the axis points, axis segments or the interior of the buffer is touched.This implementation will use the specified
paint mode
to determine how the object is represented. Depending on the representation of the buffer, the object is touched if the contour, one of the axis points, one of the axis segments or, when it is painted filled, its interior space is touched. The coordinate for which the check is done is derived from the context passed as argument.- Specified by:
isTouched
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context in which the object is rendered.- Returns:
- whether the contour, one of the axis points, axis segments or the interior of the buffer is touched.
- See Also:
-
getCreationClickCount
public int getCreationClickCount()Returns the number of user interactions required to complete the initialization of anILcd2DEditableGeoBuffer
orILcd2DEditableVariableGeoBuffer
object set to this editor. This implementation always returns-2
, meaning that an unlimited number of points can be used.- Specified by:
getCreationClickCount
in interfaceILcdGXYEditor
- Returns:
-2
, meaning that an unlimited number of points can be used, with a minimum of two.
-
getAnchorPointLocation
public int getAnchorPointLocation()Returns the location of the anchor point (by default: MIDDLE_OF_BOUNDS).- Returns:
- one of
MIDDLE_OF_BOUNDS
,FOCUS_POINT
,MIDDLE_OF_BUFFER
-
setAnchorPointLocation
public void setAnchorPointLocation(int aAnchorPointLocation) Sets the preferred anchor point location.- Parameters:
aAnchorPointLocation
- one ofMIDDLE_OF_BOUNDS
,FOCUS_POINT
,MIDDLE_OF_BUFFER
-
anchorPointSFCT
public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException Moves the specified
aPointSFCT
to the anchor point of the buffer, as specified bygetAnchorPointLocation()
.- Specified by:
anchorPointSFCT
in interfaceILcdGXYPainter
- Overrides:
anchorPointSFCT
in classALcdGXYPainter
- Parameters:
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context to render the object in.aPointSFCT
- The point that needs to be updated.- Throws:
TLcdNoBoundsException
- if the buffer doesn't have a valid anchor point, e.g. if it is always invisible in the current projection.- See Also:
-
paint
Displays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.This implementation will use the specified render mode to determine how the object needs to be rendered. The object is rendered as shown in the images of the class documentation.
- Specified by:
paint
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context to render the object in.
-
edit
This implementation edits
ILcd2DEditableGeoBuffer
andILcd2DEditableGeoBuffer
objects, otherwise aClassCastException
will be thrown.In
ILcdGXYEditor.TRANSLATED
render mode, the buffer is edited as follows:- While touching an axis point, the point gets translated.
- While touching an axis segment, the buffer gets translated as a whole.
- While touching a contour handle point of a variable buffer, the width of the buffer at that point is adjusted.
- While touching the interior and the selected buffer is painted as filled, the buffer gets translated as a whole.
In
ILcdGXYEditor.RESHAPED
render mode, the buffer is edited as follows:- While touching an axis point and moving the mouse pointer, the point gets translated.
- While touching an axis point and not moving the mouse pointer, the point gets removed.
- While touching an axis segment, a new point is added beneath the mouse pointer.
- While touching the interior, the object remains unchanged.
- While touching the contour, the width of the buffer is changed.
If, in all render modes, a snap target is found for a moved or created point, the snap target location is used for the moved/created point.
- Specified by:
edit
in interfaceILcdGXYEditor
- Parameters:
aGraphics
- The graphics to edit the object on.aMode
- The editing mode, which contains eitherILcdGXYEditor.TRANSLATED
orILcdGXYEditor.RESHAPED
.aGXYContext
- The context to edit the buffer in- Returns:
- true if the buffer was actually changed.
- Throws:
ClassCastException
- if the painter's object does not implementILcd2DEditableGeoBuffer
orILcd2DEditableVariableGeoBuffer
.- See Also:
-
boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException Description copied from interface:ILcdGXYPainter
Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object in the given mode taking into account the given context.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.- Specified by:
boundsSFCT
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- 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.- Throws:
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.- See Also:
-
supportSnap
This implementation supports snapping, always returnstrue
.- Specified by:
supportSnap
in interfaceILcdGXYPainter
- Overrides:
supportSnap
in classALcdGXYPainter
- Parameters:
aGraphics
- the graphics on which is worked.aGXYContext
- the context of the snapping.- Returns:
true
.
-
snapTarget
Returns one of the axis or contour points of the buffer if it is touched. If none of the axis or contour points are touched,
null
is returned. Note that axis points are only returned if they are drawn (seeisDrawAxisPoints()
), if the axis is drawn (seeisDrawAxis()
) or when snapping to invisible points is enabled (seeisSnapToInvisiblePoints()
).- Specified by:
snapTarget
in interfaceILcdGXYPainter
- Overrides:
snapTarget
in classALcdGXYPainter
- Parameters:
aGraphics
- the graphics on which is worked.aGXYContext
- the context of the snapping.- Returns:
- the snappable
ILcdPoint
that is touched,null
otherwise. - See Also:
-
setModelModelTransformationClass
Sets the transformation class that should be used when snapping to points that are defined in a different reference than the reference of this painter's object. The transformation will be instantiated and setup to transform points from the model of the snap layer to points in the model which contains the current object of this painter. The default value is the
TLcdGeoReference2GeoReference
class.This property allows the painter to snap to points defined in a different model reference.
Instances of this specified class should implement
ILcdModelModelTransformation
, otherwise the snapping functionality to different model references will not work.- Parameters:
aModel2ModelTransformationClass
- the transformation used as described above.
-
acceptSnapTarget
Returns whether the object set to the editor can be edited so that (part of) the object snaps to the object passed as snap target in the context. If the snap target is accepted, a call to theedit
method with this context passed should edit the object so that (part of) the object snaps to the object passed as snap target in the context.The context contains information on the user interaction at hand: the current location of the user interaction, given by its
This editor can snap the current buffer to the given snap target if the following conditions are met:X
andY
coordinates, and thedistance in X direction
anddistance in Y direction
over which the user interaction is taking place. For example,getX
andgetY
may contain the current mouse location whilegetDeltaX
andgetDeltaY
contain the distance over which the mouse has been dragged. The context also contains the candidatesnap target
and thelayer the snap target is contained in
.- The snap target is an
ILcdPoint
whose coordinates are expressed in the same coordinate system as the current objects coordinate system or the model to model transformation can transform the point to a point in the objects coordinate system. - The axis doesn't contain any points or one of its axis points is touched. The axis points can be
touched if they are painted (see
isDrawAxisPoints()
orisDrawAxisPointsWhenSelected()
) or when the axis itself is drawn (seeisDrawAxis()
orisDrawAxisWhenSelected()
)
- Specified by:
acceptSnapTarget
in interfaceILcdGXYEditor
- Parameters:
aGraphics
- the graphics on which the snap target should be checked.aGXYContext
- the context in which the snap target should be checked.- Returns:
true
if the above conditions are met,false
otherwise.- See Also:
- The snap target is an
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.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 ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Specified by:
clone
in interfaceILcdGXYEditorProvider
- Specified by:
clone
in interfaceILcdGXYPainterProvider
- Overrides:
clone
in classALcdGXYAreaPainter
- Returns:
- a clone of this painter provider.
- See Also:
-