Class TLcdGXYShapePainter
- All Implemented Interfaces:
ILcdCloneable
,ILcdPropertyChangeSource
,ILcdGXYEditor
,ILcdGXYEditorProvider
,ILcdGXYPainter
,ILcdGXYPainterProvider
,ILcdGXYPathPainter
,Serializable
,Cloneable
A painter and editor for all supported shape types.
Supported objects
All objects implementing or pointing to one of the followingILcdShape
subtypes:
ILcdCircleBy3Points
,ILcdCircle
, andILcdEllipse
ILcdGeoBuffer
,ILcdVariableGeoBuffer
,TLcdLonLatBuffer
, andTLcdLonLatHeightBuffer
ILcdPolygon
,ILcdComplexPolygon
, andTLcdRoundedPolygon
ILcdPolyline
andTLcdRoundedPolyline
ILcdArcBand
,ILcdArc
,ILcdCircularArcBy3Points
,ILcdCircularArcByBulge
, andILcdCircularArcByCenterPoint
ILcdText
ILcdBounds
ILcdShapeList
ILcdCurve
,ILcdRing
, andILcdCompositeCurve
ILcdExtrudedShape
(2D representation only)
ILcdCircle
over ILcdCurve
).
ILcdPointList
is also supported as a fallback, and interpreted as an ILcdPolyline
.
Styling
The styling can be configured (for all shape types at once) by using one of the following methods:
setLineStyle
, when painting line shapes.setFillStyle
, when painting area shapes.setFontStyle
, when painting text shapes.setIconProvider
, when painting point objects.setSelectedIconProvider
, when painting selected point objects.setAntiAliased
- Since:
- 2013.0
- See Also:
-
Field Summary
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 new painter/editor provider with default settings. -
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
addPropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListener
to be notified when this object's properties change.void
anchorPointSFCT
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) Moves the Point passed to the location (in view coordinates, pixels) of the anchor point of the representation of the object in the given mode taking into account the given context.boolean
appendAWTPath
(ILcdGXYContext aGXYContext, int aRenderMode, ILcdAWTPath aAWTPathSFCT) Appends a discretized representation in view coordinates to the given path.boolean
appendGeneralPath
(ILcdGXYContext aGXYContext, int aRenderMode, ILcdGeneralPath aGeneralPathSFCT) Appends a discretized representation in world coordinates to the given path.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()
RedefinesObject.clone
to make it public.boolean
edit
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Defines how an object shall be edited by this editor, taking into account the mode and the context passed.int
Returns the number user interactions required to complete the initialization of an object set to this editor.getCursor
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Returns a cursor that clarifies the mode and context the painter is operating in.Returns a textual representation of this painter.int
Returns how shapes are painted when edited.Returns the fill style.Returns the font style that is used when painting text objects.getGXYEditor
(Object aObject) Finds anILcdGXYEditor
that can be used to edit the object passed.getGXYPainter
(Object aObject) Finds anILcdGXYPainter
that can be used to paint or locate the object passed.getIcon()
Returns the icon to use when painting points.Returns the icon provider to use when painting points.Returns the style for the outline of shapes.int
getMode()
Returns the mode used to decide how to paint an object.Returns the Object for which the representation is currently being handled by this painter.boolean
Returns whether the world representation of the shapes are cached if possible.double
Returns the roundness factor that is used to render corners of polygons or polylines.double
getScale()
Returns the current size factor.Returns the current icon scaling mode.Returns the icon to use when painting selected points.Returns the icon provider to use when painting selected points.int
Returns how shapes are painted when selected.Returns the snapping icon.boolean
Returns if anti-aliasing is enabled.boolean
isTouched
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Checks if the representation of the object in the given mode is touched at the location as defined in the supplied context.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 supplied context.void
removePropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListener
from receiving property change events for this object.void
setAntiAliased
(boolean aAntiAliased) Enable or disable anti-aliasing.void
setEditMode
(int aEditModel) Sets whether to draw shape outlines and/or whether to fill shapes when edited.void
setFillStyle
(ILcdGXYPainterStyle aFillStyle) Sets the fill style.void
setFontStyle
(ILcdGXYPainterStyle aFontStyle) Sets the font style that is used when painting text objects.void
Sets the icon to use when painting points.void
setIconProvider
(ILcdObjectIconProvider aIconProvider) Sets the icon provider to use when painting points.void
setLineStyle
(ILcdGXYPainterStyle aLineStyle) Sets the style for the outline of shapes.void
setMode
(int aMode) Sets the mode to decide how to paint an object.void
Sets the Object for which the representation shall be handled by this painter.void
setPaintCache
(boolean aPaintCache) Sets whether to cache the world representation of the shapes.void
setRoundness
(double aRoundness) Sets the roundness factor that should be used to render corners of polygons or polylines.void
setScale
(double aScale) Sets the new size factor for the icons (Only applicable for points).void
setScalingMode
(TLcdGXYIconPainter.ScalingMode aScalingMode) Sets the icon scaling mode, which determines how thesetScale(double)
property is interpreted.void
setSelectedIcon
(ILcdIcon aIcon) Sets the icon to use when painting selected points.void
setSelectedIconProvider
(ILcdObjectIconProvider aIconProvider) Sets the icon provider to use when painting selected points.void
setSelectionMode
(int aSelectionMode) Sets whether to draw shape outlines and/or whether to fill shapes when selected.void
setSnapIcon
(ILcdIcon aSnapIcon) Sets the snapping icon.snapTarget
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns an object that can be used as snapping target when graphically editing an object.boolean
supportSnap
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns whether the painter can provide a snap target based on the representation of the object in the given context.
-
Constructor Details
-
Method Details
-
setAntiAliased
public void setAntiAliased(boolean aAntiAliased) Enable or disable anti-aliasing. By default, anti-aliasing is enabled.
See also
ILcdGXYView.isAntiAliased()
.- Parameters:
aAntiAliased
- true to enable anti-aliasing.- See Also:
-
isAntiAliased
public boolean isAntiAliased()Returns if anti-aliasing is enabled.- Returns:
- if anti-aliasing is enabled.
- See Also:
-
getSnapIcon
Returns the snapping icon.- Returns:
- the snapping icon.
-
setSnapIcon
Sets the snapping icon.- Parameters:
aSnapIcon
- the icon to display when close to a target for snapping.
-
getLineStyle
Returns the style for the outline of shapes. This style is used if the painter isconfigured
to draw the outlines of shapes.- Returns:
- the line style.
-
setLineStyle
Sets the style for the outline of shapes. This style is used if the painter isconfigured
to draw the outlines of shapes.- Parameters:
aLineStyle
- the style to apply when rendering lines
-
getFillStyle
Returns the fill style. This style is used when the painter isconfigured
to fill areas.- Returns:
- the fill style.
-
setFillStyle
Sets the fill style. This style is used when the painter isconfigured
to fill areas.- Parameters:
aFillStyle
- the style to apply when filling areas
-
getRoundness
public double getRoundness()Returns the roundness factor that is used to render corners of polygons or polylines. This factor is a value in the interval [0.0, 1.0].By default, 0.0 is used.
- Returns:
- the roundness factor for polygon and polyline corners.
- See Also:
-
setRoundness
public void setRoundness(double aRoundness) Sets the roundness factor that should be used to render corners of polygons or polylines. This factor must be a value in the interval [0.0, 1.0], with 0.0 indicating no rounding and 1.0 indicating a maximum rounding, which results in a very smooth corner.- Parameters:
aRoundness
- the roundness (or rounding) factor for polygon and polyline corners.- Throws:
IllegalArgumentException
- ifaRoundness < 0 || aRoundness > 1.0
.
-
getIconProvider
Returns the icon provider to use when painting points.- Returns:
- the icon provider to use when painting points.
-
setIconProvider
Sets the icon provider to use when painting points. If an icon provider is set that can provide an icon for the object, it overrides the icon that is set withsetIcon
for painting.- Parameters:
aIconProvider
- an icon provider.
-
getIcon
Returns the icon to use when painting points.- Returns:
- the icon to use when painting points.
-
setIcon
Sets the icon to use when painting points. If an icon provider is set that can provide an icon for the object, it overrides the icon that is set with this method for painting.- Parameters:
aIcon
- an icon
-
getSelectedIconProvider
Returns the icon provider to use when painting selected points.- Returns:
- the icon provider to use when painting selected points.
- See Also:
-
setSelectedIconProvider
Sets the icon provider to use when painting selected points. If an icon provider is set that can provide an icon for the object, it overrides the icon that is set withsetSelectedIcon
for painting.- Parameters:
aIconProvider
- an icon provider.- See Also:
-
getSelectedIcon
Returns the icon to use when painting selected points.- Returns:
- the icon to use when painting selected points.
-
setSelectedIcon
Sets the icon to use when painting selected points. If an icon provider is set that can provide an icon for the selected object, it overrides the icon that is set with this method for painting.- Parameters:
aIcon
- an icon.
-
getFontStyle
Returns the font style that is used when painting text objects.- Returns:
- the font style that is used when painting text objects.
-
setFontStyle
Sets the font style that is used when painting text objects.- Parameters:
aFontStyle
- the font style. For exampleTLcdGXYPainterFontStyle
.
-
getPaintCache
public boolean getPaintCache()Returns whether the world representation of the shapes are cached if possible.- Returns:
- true if caching is used where possible
-
setPaintCache
public void setPaintCache(boolean aPaintCache) Sets whether to cache the world representation of the shapes.- Parameters:
aPaintCache
- true to use caching where possible
-
getMode
public int getMode()Returns the mode used to decide how to paint an object.
Possible modes are:- Returns:
- the painting mode.
-
setMode
public void setMode(int aMode) Sets the mode to decide how to paint an object.
Possible modes are: By default, the mode isOUTLINED_FILLED
.- Parameters:
aMode
- the fill/outline mode
-
getSelectionMode
public int getSelectionMode()Returns how shapes are painted when selected. Possible modes are:- Returns:
- the painting mode.
-
setSelectionMode
public void setSelectionMode(int aSelectionMode) Sets whether to draw shape outlines and/or whether to fill shapes when selected. Possible modes are: By default, the mode isOUTLINED_FILLED
.- Parameters:
aSelectionMode
- the fill/outline mode
-
getEditMode
public int getEditMode()Returns how shapes are painted when edited. Possible modes are:- Returns:
- the painting mode.
-
setEditMode
public void setEditMode(int aEditModel) Sets whether to draw shape outlines and/or whether to fill shapes when edited. Possible modes are: By default, the mode isOUTLINED_FILLED
.- Parameters:
aEditModel
- the fill/outline mode
-
setScalingMode
Sets the icon scaling mode, which determines how thesetScale(double)
property is interpreted. (Only applicable for points).- Parameters:
aScalingMode
- the new icon scaling mode- See Also:
-
getScalingMode
Returns the current icon scaling mode.- Returns:
- the current icon scaling mode
- See Also:
-
setScale
public void setScale(double aScale) Sets the new size factor for the icons (Only applicable for points). The interpretation of this value depends on the value ofgetScalingMode()
.- Parameters:
aScale
- the new size factor- See Also:
-
getScale
public double getScale()Returns the current size factor.- Returns:
- the current size factor
- See Also:
-
clone
Description copied from interface:ILcdGXYPainterProvider
RedefinesObject.clone
to make it public.- Specified by:
clone
in interfaceILcdCloneable
- Specified by:
clone
in interfaceILcdGXYEditorProvider
- Specified by:
clone
in interfaceILcdGXYPainterProvider
- Overrides:
clone
in classObject
- Returns:
- a clone of this painter provider.
- See Also:
-
getGXYPainter
Finds anILcdGXYPainter
that can be used to paint or locate the object passed.The painter provider is responsible for setting the object to the painter before returning the painter. An implementation should therefore have the following structure:
public ILcdGXYPainter getGXYPainter(Object aObject) { ILcdGXYPainter painter = ... // find the painter for the object if (painter != null) { painter.setObject(aObject); } return painter; } This method checks the type of the given object, and returns a default painter for it. See also the class doc.
- Specified by:
getGXYPainter
in interfaceILcdGXYPainterProvider
- Parameters:
aObject
- the object to find a painter for- Returns:
- a painter that can be used to paint or locate the object; or null if no painter could be found for the given object, or the object could not be set on the retrieved painter.
-
getGXYEditor
Finds anILcdGXYEditor
that can be used to edit the object passed.The editor provider is responsible for setting the object to the editor before returning the editor. An implementation should therefore have the following structure:
public ILcdGXYEditor getGXYEditor(Object aObject) { ILcdGXYEditor editor = ... // find the editor for the object editor.setObject( aObject ); return editor; } This method checks the type of the given object, and returns a default editor for it. See also the class doc.
- Specified by:
getGXYEditor
in interfaceILcdGXYEditorProvider
- Parameters:
aObject
- the object to find a painter for- Returns:
- an editor that can be used to edit the object.
-
edit
Description copied from interface:ILcdGXYEditor
Defines how an object shall be edited by this editor, taking into account the mode and the context passed.The mode passed indicates how the interaction should be interpreted. It can be one of the following:
TRANSLATED
RESHAPED
START_CREATION
CREATING
END_CREATION
The first two modes designate that the object should be modified, the last three modes are passed when initializing an object. From an implementation point of view there is no difference between TRANSLATED and RESHAPED. These constants only differ in semantics. For
ILcdShape
objects TRANSLATED can be seen as the mode that will be passed when the shape as a whole is moved. RESHAPED is used more often for moving part of a shape.The context contains information on the user interaction at hand. The methods
getX
andgetY
contain the location(s) of the user interaction. The methodsgetDeltaX
andgetDeltaY
contain the distance(s) 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 editing behavior can take into account multiple locations, to respond to, for example, multi-touch input.When a snap target is accepted, the implementation of this method should take that fact into account when editing or initializing an object.
- Specified by:
edit
in interfaceILcdGXYEditor
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- indicates how the user interaction should be interpreted. Is one of the following:TRANSLATED
,RESHAPED
,START_CREATION
,CREATING
,END_CREATION
.
aGXYContext
- contains information on the user interaction and the transformations to transform from view space to the object model space.- Returns:
- true if the object has changed when this method returns, false otherwise.
- See Also:
-
getCreationClickCount
public int getCreationClickCount()Description copied from interface:ILcdGXYEditor
Returns the number user interactions required to complete the initialization of an object set to this editor. For example, for a circle this can be two: one to determine the center point of the circle and one to determine the radius of the circle. A negative number indicates that there is no upper limit to the number of user interactions. For example, for a polyline this could be -2: it requires a minimum of two clicks to establish a polyline, but there is no upper limit on the number of polyline points.- Specified by:
getCreationClickCount
in interfaceILcdGXYEditor
- Returns:
- the number of user interactions required to initialize the object set to this editor.
-
acceptSnapTarget
Description copied from interface:ILcdGXYEditor
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
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
.- Specified by:
acceptSnapTarget
in interfaceILcdGXYEditor
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaGXYContext
- the context containing the information on the user interaction and the snap target.- 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.
- See Also:
-
setObject
Description copied from interface:ILcdGXYPainter
Sets the Object for which the representation shall be handled by this painter.Setting the object on the painter may have an effect on the internal state of the painter, for example, the color to use.
When the object is set to a painter, the context parameter in subsequent calls to methods in this class must contain a layer that contains this object and for which the painter for this object is this painter.
- Specified by:
setObject
in interfaceILcdGXYEditor
- Specified by:
setObject
in interfaceILcdGXYPainter
- Parameters:
aObject
- the object for which the representation shall be handled by this painter.- See Also:
-
getObject
Description copied from interface:ILcdGXYPainter
Returns the Object for which the representation is currently being handled by this painter.- Specified by:
getObject
in interfaceILcdGXYEditor
- Specified by:
getObject
in interfaceILcdGXYPainter
- Returns:
- the Object for which the representation is currently being handled by this painter.
- See Also:
-
paint
Description copied from interface:ILcdGXYPainter
Displays the representation of the object in the given mode on the Graphics passed, taking into account the supplied context.The visual representation of an object depends on the context. Depending on the context (e.g. is the location covered by the view), an object may or may not have a representation. The context contains:
- transformations which allow to compute the location in view space of points and bounds given in model, space
- a pen which can connect points with a line or create arcs around a point,
- the view for which the object's representation must be painted. This can be useful when the painted object depends on the scale of the view, or the presence of other layers in the view.
- the current location(s) of the mouse or input device and the last location(s) the mouse or input device was pressed.
The mode passed in this method indicates what part of the object must be painted, whether it should be painted as selected or not, and whether user interaction (via mouse movements) must be taken into account.
When the mode passed contains either TRANSLATING, RESHAPING or CREATING, this method is also responsible for interpreting interaction on the representation of an object and modifying the representation of the object accordingly. The painter is not responsible for modifying the object itself, this is done by a corresponding
ILcdGXYEditor
. Implementations ofILcdGXYPainter
andILcdGXYEditor
interfaces must be consistent for an object: the painter must display the result of the user interaction on the object, while the editor is responsible for modifying the object as a result of the user interaction. A good practice to ensure a consistent implementation is to implement both theILcdGXYPainter
andILcdGXYEditor
interfaces in a single class.When the mode passed includes SNAPS, the part of the representation which corresponds to the object returned as snap target by the method
snapTarget
must be painted in order to provide the user with a visual indication of the snap target.The Graphics passed in this method can be different from the Graphics returned by a view due to techniques such as double buffering (as applied in Swing). Basic drawing operations must always be performed on the Graphics passed as an argument in this method.
- Specified by:
paint
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).aGXYContext
- theILcdGXYContext
the drawing depends on.
-
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:
-
isTouched
Description copied from interface:ILcdGXYPainter
Checks if the representation of the object in the given mode is touched at the location as defined in the supplied context.The location that must be taken into account to check whether the representation is touched can be retrieved from the context passed with the methods
ILcdGXYContext.getX()
andILcdGXYContext.getY()
. If the check is part of an ongoing operation of user interaction, for example, when the mouse is being dragged, the location of the start of the operation can also be taken into account using the methodsILcdGXYContext.getDeltaX()
andILcdGXYContext.getDeltaY()
. The context contains the transformations required to convert this location into the equivalent location in model space. Implementations of this interface usually follow either of the following patterns:- transform the location of the interaction back to model space and compare the coordinates with the object in model space.
- transform the location to world space and compare with a world representation of the object. This forces the painter into caching a world representation of the object. Caching a view representation of an object is not very practical as it would have to change whenever the view's scale changes or when it is panned. A world representation of an object only changes when the view's XYWorldReference changes, which happens less frequently.
As the mode influences the way an object is represented, it must also be taken into account when checking whether that representation is being touched. When the mode contains CREATING, RESHAPING or TRANSLATING which indicate that the object must be represented in a state for an ongoing operation, the location of the start of the operation may be taken into account as mentioned above. The painting result can take into account multiple locations, to respond to, for example, multi-touch input. When the mode contains SELECTED, the painter should also check if the non-selected representation is touched, since these are always painted on top of each other.
The
boundsSFCT
is often used to speed up the performance of this method as a location outside these bounds can never touch the representation of the object.Note that this method does not give an indication of what part of the object is touched. It is up to the painter implementations to provide methods to make this distinction. The method does also not indicate what sensitivity must be applied when checking if an object is touched. It is up to the implementation to decide what should be the maximum distance between the location given in the context and the closest relevant point or area of the representation of the object.
- Specified by:
isTouched
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is represented inaGXYContext
- contains the location of the interaction and the transformations to convert this location into model coordinates- Returns:
- true if the representation of the object in the given mode is touched by the location as defined in the context passed, false otherwise
- See Also:
-
anchorPointSFCT
public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException Description copied from interface:ILcdGXYPainter
Moves the Point passed to the location (in view coordinates, pixels) of the anchor point of the representation of the object in the given mode taking into account the given context.The anchor point is an important point of the representation, typically the point which would be used when the object would be represented as a single point. The anchor point is mostly used to attach extra information to the representation of an object, for example, using labels. A typical implementation of this method for painters which can handle
ILcdShape
objects is the location of the focus point of the shape.- Specified by:
anchorPointSFCT
in interfaceILcdGXYPainter
- 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:
-
supportSnap
Description copied from interface:ILcdGXYPainter
Returns whether the painter can provide a snap target based on the representation of the object in the given context.- Specified by:
supportSnap
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaGXYContext
- the context in which this object is represented and in which the editing of an object occurs.- Returns:
- true if an object can be returned that can be used to snap to in the given context, false otherwise.
-
snapTarget
Description copied from interface:ILcdGXYPainter
Returns an object that can be used as snapping target when graphically editing an object. For example, an object which is beneath the current mouse position (as given in the context).This method must only be called when
supportSnap
returns true for the given context.- Specified by:
snapTarget
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaGXYContext
- the context in which this object is represented and in which the editing of an object occurs.- Returns:
- an object that can be used as snapping target when graphically editing an object. It must be defined in the same model reference as the object set to this painter.
- See Also:
-
getCursor
Description copied from interface:ILcdGXYPainter
Returns a cursor that clarifies the mode and context the painter is operating in. For example, when the mode isTRANSLATING
, the cursor could be the MOVE cursor. When no specific cursor is required implementations must return null.- Specified by:
getCursor
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the rendering mode to return the cursor for.aGXYContext
- the context in which the rendering occurs.- Returns:
- a
Cursor
to indicate the type of operatingaMode
andaGXYContext
. Returnsnull
if no particularCursor
is required.
-
getDisplayName
Description copied from interface:ILcdGXYPainter
Returns a textual representation of this painter. This can be useful when different representations of an object are handled by different painter implementations. Having a textual representation can facilitate choosing between different painter implementations.- Specified by:
getDisplayName
in interfaceILcdGXYEditor
- Specified by:
getDisplayName
in interfaceILcdGXYPainter
- Returns:
- a textual representation of this painter.
-
addPropertyChangeListener
Description copied from interface:ILcdPropertyChangeSource
Registers the given
PropertyChangeListener
to be notified when this object's properties change.In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a
ALcdWeakPropertyChangeListener
instance as property change listener.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- The listener to be notified- See Also:
-
removePropertyChangeListener
Description copied from interface:ILcdPropertyChangeSource
De-registers the given
PropertyChangeListener
from receiving property change events for this object.If the listener was added more than once, it will be notified one less time after being removed. If the listener is
null
, or was never added, no exception is thrown and no action is taken.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener that should no longer be notified of changes of this object's properties- See Also:
-
appendAWTPath
Description copied from interface:ILcdGXYPathPainter
Appends a discretized representation in view coordinates to the given path.- Specified by:
appendAWTPath
in interfaceILcdGXYPathPainter
- Parameters:
aGXYContext
- the graphics contextaRenderMode
- the rendering modeaAWTPathSFCT
- the path to append to- Returns:
- true if a discretization of the shape could be successfully appended to the path
-
appendGeneralPath
public boolean appendGeneralPath(ILcdGXYContext aGXYContext, int aRenderMode, ILcdGeneralPath aGeneralPathSFCT) Description copied from interface:ILcdGXYPathPainter
Appends a discretized representation in world coordinates to the given path.- Specified by:
appendGeneralPath
in interfaceILcdGXYPathPainter
- Parameters:
aGXYContext
- the graphics contextaRenderMode
- the rendering modeaGeneralPathSFCT
- the path to append to- Returns:
- true if a discretization of the shape could be successfully appended to the path
-