Class TLcdGXYIconPainter
- All Implemented Interfaces:
ILcdCloneable
,ILcdPropertyChangeSource
,ILcdGXYEditor
,ILcdGXYEditorProvider
,ILcdGXYPainter
,ILcdGXYPainterProvider
,Serializable
,Cloneable
- Direct Known Subclasses:
TLcdGXYAISIconProviderPainter
,TLcdGXYEditableLabelPainter
,TLcdVPFPointPainter
ILcdShape
objects as points and enables visual editing of
ILcd2DEditableShape
objects as points in an ILcdGXYView
.
Painting an ILcdShape
Body
This painter paints ILcdShape
objects by painting an ILcdIcon
at the location of
the shapes focus point. Two icons are used, one to be used as default icon and one to be used when selected.
When the object is being edited, the selection icon is used. If the ILcdShape
implements ILcdOriented
, the top of the icon can be
automatically rotated
according to the orientation. If an icon implements
ILcdAnchoredIcon, the painter maps its anchor point on the object's focus point. If not, the center
of the icon is mapped to the object's focus point. In addition, the icon can be
automatically scaled
.
The painter has the ability to add a halo effect around the painted icons. For a more detailed explanation
of halos, please refer to TLcdGXYHaloLabelPainter
. The methods that control the appearance of the
halos are equivalent to those in TLcdGXYHaloLabelPainter
.
It is possible to use an ILcdObjectIconProvider
for the default icon and the selection icon with
setIconProvider(ILcdObjectIconProvider)
and setSelectionIconProvider(ILcdObjectIconProvider)
.
If an icon provider is set, the icon getIcon()
is used only as a fallback icon when the
icon provider cannot provide an icon for the current object. The method getIcon()
always
returns the fallback icon, and this is not always the icon that will be painted.
For the selection icon, similar functionality and methods are used.
The method getIcon(int)
returns the icon that will be actually painted for the given rendering mode,
so this method may also return the icon given by the icon provider for the current object.
Handles
The icon displayed acts as a handle. Since this is already painted in ILcdGXYPainter.BODY
mode, no additional
handles are painted.
Snap targets
The focus point of the ILcdShape
object can be returned on the condition that it is touched,
see isTouched
. If the focus
point is defined as snap target, it will be highlighted with the snapIcon
.
Styling options
The visualization of the ILcdShape
object is governed by the icon
and selection icon
set to this painter.
Locating an ILcdShape in a view
Anchor point of an ILcdShape
The anchor point is located at the focus point of the ILcdShape
object.
When is an ILcdShape touched
An ILcdShape
object is touched when the mouse position is over the painted icon.
Visually editing and creating an ILcd2DEditableShape
Modifying an ILcd2DEditableShape
This editor will move the ILcd2DEditableShape
in both RESHAPED
and
TRANSLATED
mode. The shape is moved to the location of the mouse pointer.
Creating an ILcd2DEditableShape
When initializing an ILcd2DEditableShape
object via interaction through the view, the
ILcdShape
object will be moved when calling edit
with START_CREATION
mode. The shape is moved to the location of the
mouse pointer. In CREATING
or END_CREATION
mode, the object
will not be updated.
Accepted snap targets
All points are accepted as snap target as long as:
- the point can be transformed to the reference of the
ILcdShape
object with themodel to model transformation
, - the point is not the focus point of the
ILcdShape
object set to this painter.
Additional properties
Caching
This painter implementation may cache images of the icons used. Image caching can be turned on/off with the
setUseImageCache
method.
Halo effect
The painter has the ability to add a halo effect around the painted icons. For a more detailed explanation
of halos, please refer to TLcdGXYHaloLabelPainter
. The methods that control the appearance of the
halos are equivalent to those in TLcdGXYHaloLabelPainter
.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Possible icon scaling modes. -
Field Summary
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
ConstructorDescriptionConstructs a defaultTLcdGXYIconPainter
and sets the display name to "Point".TLcdGXYIconPainter
(String aDisplayName) Constructs a defaultTLcdGXYIconPainter
with the given display name. -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptSnapTarget
(Graphics aGraphics, ILcdGXYContext aGXYContext) Determines whether a snap target should be accepted or not.void
anchorPointSFCT
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) ImplementsILcdGXYPainter.anchorPointSFCT
.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 in the given mode taking into account the given context.void
Clears the entire image cache.void
clearImageCache
(Object aObject) Clears the icon image cache for the given object.clone()
Creates and returns a copy of this object.boolean
edit
(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) This implementation edits theILcdShape
object set to the painter.protected void
firePropertyChangeEvent
(PropertyChangeEvent aPropertyChangeEvent) Fires aPropertyChangeEvent
to all PropertyChangeListeners that have been registered to thisILcdGXYPainter
.int
Returns1
as the number of required user interactions.getCursor
(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Returns a translationCursor
when appropriate, ornull
otherwise.getGXYEditor
(Object aObject) Returns this instance as editor for editing the specifiedObject
.Returns the algorithm that is used for rendering halo's.Returns the color of the halo effect.int
Returns the thickness of the halo effect.getIcon()
Returns theILcdIcon
used for painting in default mode.protected ILcdIcon
getIcon
(int aRenderMode) Returns the icon that needs to be painted for the specified rendering mode.Returns theILcdIconProvider
used for painting in default mode.final Object
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.double
getScale()
Returns the current size factor.Returns the current icon scaling mode.Returns theILcdIcon
used for painting in selected mode.Returns theILcdIconProvider
used for painting in selected mode.Returns the icon that is used to paint snap target points of the object set to this painter.boolean
Returns whether the painter will add a halo effect around the icons.boolean
isTouched
(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Returns whether the mouse position in the given context is touching the painted icon.boolean
Returnstrue
when icon halo image caching is enabled,false
otherwise.boolean
Returns if the icon will be rotated when the painted object implementsILcdOriented
.void
paint
(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Displays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.protected void
paintSnap
(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called when this painter needs to paint its object in the rendering modeILcdGXYPainter.SNAPS
.void
setHaloAlgorithm
(TLcdHaloAlgorithm aHaloAlgorithm) Sets the algorithm to be used for rendering halo's.void
setHaloColor
(Color aHaloColor) Sets the color of the halo effect.void
setHaloEnabled
(boolean aHaloEnabled) Determines whether the painter will add a halo effect around the icons.void
setHaloThickness
(int aHaloThickness) Sets the thickness defined in pixels of the halo effect.void
Sets theILcdIcon
used for painting in default mode.void
setIconProvider
(ILcdObjectIconProvider aIconProvider) Sets theILcdIconProvider
used for painting in default mode.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 object location on or off.void
setScale
(double aScale) Sets the new size factor for the icons.void
setScalingMode
(TLcdGXYIconPainter.ScalingMode aScalingMode) Sets the icon scaling mode, which determines how thesetScale(double)
property is interpreted.void
setSelectionIcon
(ILcdIcon aSelectionIcon) Sets theILcdIcon
used for painting in selected mode.void
setSelectionIconProvider
(ILcdObjectIconProvider aSelectionIconProvider) Sets theILcdIconProvider
used for painting in selected mode.void
setSnapIcon
(ILcdIcon aSnapIcon) Sets the icon that marks snap targets of the object currently set to this painter.void
setUseImageCache
(boolean aUseImageCache) Enables or disables the caching of icons with halo as images.void
setUseOrientation
(boolean aUseOrientation) Sets whether to paint a rotated icon when the painted object implementsILcdOriented
.snapTarget
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns the focus point of theILcdShape
object if the point is touched.boolean
supportSnap
(Graphics aGraphics, ILcdGXYContext aGXYContext) Supports snapping when theILcdShape
object set to this painter is visible in the view.Methods inherited from class com.luciad.view.gxy.ALcdGXYPainter
addPropertyChangeListener, firePropertyChangeEvent, getDisplayName, getGXYPainter, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn
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
-
Constructor Details
-
TLcdGXYIconPainter
public TLcdGXYIconPainter()Constructs a defaultTLcdGXYIconPainter
and sets the display name to "Point". -
TLcdGXYIconPainter
Constructs a defaultTLcdGXYIconPainter
with the given display name.- Parameters:
aDisplayName
- The display name for this painter, used for textual representation of this painter.
-
-
Method Details
-
firePropertyChangeEvent
Fires aPropertyChangeEvent
to all PropertyChangeListeners that have been registered to thisILcdGXYPainter
.This implementation will also clear the image cache when a property change event is fired.
- Overrides:
firePropertyChangeEvent
in classALcdGXYPainter
- Parameters:
aPropertyChangeEvent
- The PropertyChangeEvent object.
-
anchorPointSFCT
public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException Description copied from class:ALcdGXYPainter
ImplementsILcdGXYPainter.anchorPointSFCT
.aPointSFCT
will be set to the center of the bounds calculated by boundsSFCT.- Specified by:
anchorPointSFCT
in interfaceILcdGXYPainter
- Overrides:
anchorPointSFCT
in classALcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is painted in (see class documentation)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.aPointSFCT
- the point that has to be moved to the location of the anchor point of the representation of the object. This point must not be taken into account when the method has thrown a TLcdNoBoundsException.- Throws:
TLcdNoBoundsException
- if no anchor point can be determined for the representation of the object. This can be 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 projection as set in the views world reference.- See Also:
-
setObject
Sets the object to paint and edit. The object should be an instance of or
refer to
an instance ofILcdShape
for painting andILcd2DEditableShape
for editing.This painter/editor can be used to paint the object without using the edit functionality. This method shall therefore only check if the object implements
ILcdShape
and shall throw aClassCastException
if it does not.When this painter is used as editor with an object that does not implement the interface
ILcd2DEditableShape
, theedit
method shall throw the necessary exception.- Specified by:
setObject
in interfaceILcdGXYEditor
- Specified by:
setObject
in interfaceILcdGXYPainter
- Parameters:
aObject
- The object to paint and edit.- Throws:
ClassCastException
- when the object does not implementILcdShape
.- 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 object location on or off. Caching greatly reduces the time to paint an object but requires more memory. The location 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:
-
setIcon
Sets theILcdIcon
used for painting in default mode. For painting, this is a fallback icon, it is only painted if there is no icon provider set or the icon provider can't provide an icon for the current object. When the given icon implements ILcdAnchoredIcon, the painter maps its anchor point on the object's focus point. If not, the center of the icon is mapped to the object's focus point.- Parameters:
aIcon
- the icon to paint in default mode.- See Also:
-
getIcon
Returns theILcdIcon
used for painting in default mode. For painting, this is a fallback icon, it is only painted if there is no icon provider set or the icon provider can't provide an icon for the current object.- Returns:
- the
ILcdIcon
used for painting in default mode. - See Also:
-
setSelectionIcon
Sets theILcdIcon
used for painting in selected mode. For painting, this is a fallback icon, it is only painted if there is no selection icon provider set or the selection icon provider can't provide an icon for the current object. When the given icon implements ILcdAnchoredIcon, the painter maps its anchor point on the object's focus point. If not, the center of the icon is mapped to the object's focus point.- Parameters:
aSelectionIcon
- theILcdIcon
used for painting in selected mode.- See Also:
-
getSelectionIcon
Returns theILcdIcon
used for painting in selected mode. For painting, this is a fallback icon, it is only painted if there is no selection icon provider set or the selection icon provider can't provide an icon for the current object.- Returns:
- the
ILcdIcon
used for painting in selected mode. - 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
. When the given icon implements ILcdAnchoredIcon, the painter maps its anchor point on the object's focus point. If not, the center of the icon is mapped to the object's focus point.- 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:
-
setIconProvider
Sets the
ILcdIconProvider
used for painting in default mode.If an icon provider is set that can provide an icon for the object, it overrides the icon that is set with
setIcon(ILcdIcon)
for painting.- Parameters:
aIconProvider
- the icon provider to paint in default mode.- Since:
- 10.0
- See Also:
-
getIconProvider
Returns theILcdIconProvider
used for painting in default mode.- Returns:
- the
ILcdIconProvider
used for painting in default mode. - Since:
- 10.0
- See Also:
-
setSelectionIconProvider
Sets theILcdIconProvider
used for painting in selected mode.If a selection icon provider is set that can provide an icon for the object, it overrides the icon that is set with
setSelectionIcon(ILcdIcon)
for painting.- Parameters:
aSelectionIconProvider
- theILcdIconProvider
used for painting in selected mode.- Since:
- 10.0
- See Also:
-
getSelectionIconProvider
Returns theILcdIconProvider
used for painting in selected mode.- Returns:
- the
ILcdIconProvider
used for painting in selected mode. - Since:
- 10.0
- See Also:
-
isHaloEnabled
public boolean isHaloEnabled()Returns whether the painter will add a halo effect around the icons.- Returns:
- whether the painter will add a halo effect around the icons.
- See Also:
-
setHaloEnabled
public void setHaloEnabled(boolean aHaloEnabled) Determines whether the painter will add a halo effect around the icons. By default, this property is set tofalse
.- Parameters:
aHaloEnabled
- a flag indicating whether to add a halo effect around the icons.- See Also:
-
getHaloThickness
public int getHaloThickness()Returns the thickness of the halo effect.- Returns:
- the thickness of the halo effect.
- See Also:
-
setHaloThickness
public void setHaloThickness(int aHaloThickness) Sets the thickness defined in pixels of the halo effect. By default, this property is set to1
.- Parameters:
aHaloThickness
- the thickness defined in pixels of the halo effect.- See Also:
-
getHaloColor
Returns the color of the halo effect.- Returns:
- the color of the halo effect.
- See Also:
-
setHaloColor
Sets the color of the halo effect. By default, this property is set toColor.white
.- Parameters:
aHaloColor
- the color of the halo effect.- See Also:
-
setHaloAlgorithm
Sets the algorithm to be used for rendering halo's. The choice of the halo algorithm may have a major impact on the overall performance of this painter. SeeTLcdHaloAlgorithm
for more information on the available algorithms.- Parameters:
aHaloAlgorithm
- the algorithm to be used for rendering halo's.- See Also:
-
getHaloAlgorithm
Returns the algorithm that is used for rendering halo's.- Returns:
- the algorithm that is used for rendering halo's.
- See Also:
-
isUseImageCache
public boolean isUseImageCache()Returnstrue
when icon halo image caching is enabled,false
otherwise.- Returns:
true
when icon halo image caching is enabled,false
otherwise.
-
setUseImageCache
public void setUseImageCache(boolean aUseImageCache) Enables or disables the caching of icons with halo as images. By default, image caching is turned on. This setting does not have any effect if halo painting is disabled.- Parameters:
aUseImageCache
- a flag indicating whether image caching should be enabled.- See Also:
-
clearImageCache
public void clearImageCache()Clears the entire image cache.
To remove a single item from the cache, use
clearImageCache(Object)
.- See Also:
-
clearImageCache
Clears the icon image cache for the given object. The next time this object is painted, a new image will be created and cached for it. To remove all cached images at once, useclearImageCache()
.- Parameters:
aObject
- the object for which the cache to be cleared.- 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 method
getIcon(int)
with the specified render mode to determine how the object needs to be rendered. InILcdGXYPainter.RESHAPING
andILcdGXYPainter.TRANSLATING
mode, theILcdShape
object is rendered as if the point was moved along the same distance in view coordinates as passed in the context.If the halo effect is enabled, a halo effect will be added around the icon. Note that the halo effect will only be added when the rendering mode does not contain the mode
SELECTED
.- Specified by:
paint
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- The graphics to paint the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.
-
paintSnap
Called when this painter needs to paint its object in the rendering modeILcdGXYPainter.SNAPS
.- Parameters:
aGraphics
- The graphics to paint the object on.aRenderMode
- The mode to render the object in,ILcdGXYPainter.SNAPS
included.aGXYContext
- The context to render the object in.
-
getScale
public double getScale()Returns the current size factor.- Returns:
- the current size factor
- See Also:
-
setScale
public void setScale(double aScale) Sets the new size factor for the icons. The interpretation of this value depends on the value ofgetScalingMode()
.- Parameters:
aScale
- the new size factor- See Also:
-
getScalingMode
Returns the current icon scaling mode.- Returns:
- the current icon scaling mode
- See Also:
-
setScalingMode
Sets the icon scaling mode, which determines how thesetScale(double)
property is interpreted.- Parameters:
aScalingMode
- the new icon scaling mode- See Also:
-
isUseOrientation
public boolean isUseOrientation()Returns if the icon will be rotated when the painted object implementsILcdOriented
.- Returns:
- true if the icon is rotated when the painted object implements
ILcdOriented
, false if the icon is painted without applying rotation.
-
setUseOrientation
public void setUseOrientation(boolean aUseOrientation) Sets whether to paint a rotated icon when the painted object implementsILcdOriented
.- Parameters:
aUseOrientation
- if true, and if the painted object implementsILcdOriented
, the icon is rotated so that the top of the original icon follows the orientation with respect to the north
-
getIcon
Returns the icon that needs to be painted for the specified rendering mode. This implementation will return the selection icon if the rendering mode contains
SELECTED
. If the mode containsBODY
orDEFAULT
, the default icon is returned. The method returnsnull
in all other cases.The default icon is the icon returned by
getIconProvider()
if the icon provider is not null and the icon it returns for the current object is not null, otherwise it is the fallback icon, gotten withgetIcon()
The selection icon is the icon returned by
*getSelectionIconProvider()
if the icon provider is not null and the icon it returns for the current object is not null, otherwise it is the fallback selection icon, gotten withgetSelectionIcon()
- Parameters:
aRenderMode
- The mode to render the object in.- Returns:
- the default icon for painting, the selection icon for painting or
null
. - See Also:
-
isTouched
Returns whether the mouse position in the given context is touching the painted icon.
This implementation will use the method
getIcon(int)
with the specified render mode to determine which icon needs to be touched.- Specified by:
isTouched
in interfaceILcdGXYPainter
- Parameters:
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.- Returns:
- whether the focus point of the
ILcdShape
object is touched. - See Also:
-
getCursor
Returns a translationCursor
when appropriate, ornull
otherwise.- Specified by:
getCursor
in interfaceILcdGXYPainter
- Overrides:
getCursor
in classALcdGXYPainter
- Parameters:
aGraphics
- The graphics on which the object is painted.aRenderMode
- 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.
-
boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException 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 to paint the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.aBoundsSFCT
- The bounds to update.- 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
Supports snapping when the
ILcdShape
object set to this painter is visible in the view.- 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
if theILcdShape
object is visible in the view,false
otherwise.
-
snapTarget
Returns the focus point of the
ILcdShape
object if the point is touched. If not,null
will be returned.- 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 focus point of the
ILcdShape
object if the point is touched,null
otherwise. - See Also:
-
edit
This implementation edits the
ILcdShape
object set to the painter. The object needs to implement the interfaceILcd2DEditableShape
otherwise aClassCastException
will be thrown.In
ILcdGXYEditor.START_CREATION
,ILcdGXYEditor.TRANSLATED
andILcdGXYEditor.RESHAPED
render mode, the focus point of theILcdShape
object is moved to the location beneath the mouse pointer.If, in all render modes, a snap target is found for the moved point, the snap target location is used for the moved point.
- Specified by:
edit
in interfaceILcdGXYEditor
- Parameters:
aGraphics
- The graphics to edit the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.- Returns:
- true if the object has changed when this method returns, false otherwise.
- Throws:
ClassCastException
- if the painter's object does not implementILcd2DEditableShape
.- See Also:
-
getCreationClickCount
public int getCreationClickCount()Returns1
as the number of required user interactions.- Specified by:
getCreationClickCount
in interfaceILcdGXYEditor
- Returns:
1
.
-
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
Determines whether a snap target should be accepted or not. A snap target is accepted if the following conditions are met:
- The current object is an
ILcd2DEditableShape
. - 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 snap object is not the focus point of the current object. If this is wanted, override the function and return true if the snap object is the focus point.
- The current object is touched. This avoids that when multiple points are edited at once, they all snap to the same point. This would give the impression that the other points disappeared.
- 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 current object is an
-
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
.
-
clone
Creates and returns a copy of this object. Deep copies are made of fallback icons (getIcon()
andgetSelectionIcon()
) and the snap icon but shallow copies are made of the icon providers.- Specified by:
clone
in interfaceILcdCloneable
- Specified by:
clone
in interfaceILcdGXYEditorProvider
- Specified by:
clone
in interfaceILcdGXYPainterProvider
- Overrides:
clone
in classALcdGXYPainter
- Returns:
- a clone of this instance.
- See Also:
-