public class TLcdGXYCirclePainter extends ALcdGXYAreaPainter implements ILcdGXYPainter, ILcdGXYEditor, ILcdGXYEditorProvider, ILcdGXYPathPainter
ILcdCircle
objects and enables visual editing of
ILcd2DEditableCircle
objects in an ILcdGXYView
.
This painter provides three paint modes to paint the body of an ILcdCircle
object. The mode
property can be set using the method setMode
and allows the circle to be painted
as:
|
||||
![]() |
|
![]() |
|
![]() |
An outlined circle (OUTLINED ) |
|
A filled circle (FILLED ) |
|
A filled and outlined circle (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.
This painter does not define a handle for ILcdCircle
objects. Note that the center point
of the circle is painted in BODY
mode depending on the drawCenter
property. When painted, it can be used as a handle to edit the object.
If the center point is painted (see isDrawCenter()
) or when snapping to invisible points is
enabled (see isSnapToInvisiblePoints()
), the center point can also be returned. The point
returned as a snap target is highlighted with the snapIcon
.
The visualization of the ILcdCircle
object is governed by the line style and fill style
set to this painter. Depending on the paint mode chosen one or both of these will be taken into account.
The anchor point of the ILcdCircle
object is located at the center point of the bounds,
calculated by boundsSFCT
.
Depending on the paint mode, a circle is touched when either the contour, the center point, or the internal area (when filled) of the circle is touched. Note that the center point can only be touched if it is painted.
This editor provides the following edit functionality for the different render modes:
RESHAPED
: the contour of the circle is reshaped, depending on whether it is touched.
The image below illustrates the editing behavior. The small black arrow indicates the path of the mouse
cursor while reshaping the circle. ![]() |
Moving the contour. |
TRANSLATED
: the whole circle is translated, depending on whether the contour or
the interior is touched. The images below illustrate the editing behavior. The small black arrow indicates
the path of the mouse cursor while translating the circle. ![]() |
|
![]() |
Moving the contour. | |
Moving the interior. |
When initializing a circle via interaction through the view, 2
user interactions are required
to complete the initialization. The first point defines the center point of the circle and the second the
radius of the circle.
All points are accepted as snap target as long as:
ILcdCircle
object with the model to model
transformation
,ILcdCircle
object set
to this painter.
This painter implementation supports caching for objects implementing ILcdCache
.
Caching can be turned on/off with the setPaintCache
method.
The drawCenter
and drawCenterWhenSelected
properties define when the center point needs to be painted. If the center point is painted, it can
be touched, moved,...
A number of properties can be set to configure the representation of the editing labels. The editing
labels are drawn depending on the property editingLabel
and on the rendering
mode specified in the paint
method. The labels display the location of the center point
of the circle when it is dragged, or the radius of circle when its size is changed.
Modifier and Type | Field and Description |
---|---|
static int |
CENTER_POINT
Constant value indicating that the anchor point should be chosen as the center point of the
circle.
|
static int |
FILLED
Draw the
ILcdCircle object as a filled circle, only the area of
the circle defined by the ILcdCircle is painted. |
static int |
FOCUS_POINT
Constant value indicating that the anchor point should be chosen as the focus point of the
circle.
|
static int |
MIDDLE_OF_BOUNDS
Constant value indicating that the anchor point should be chosen in the middle of the
bounds, calculated by
boundsSFCT . |
static int |
OUTLINED
Draw the
ILcdCircle object as an outlined circle, only the contour
of the circle defined by the ILcdCircle is painted. |
static int |
OUTLINED_FILLED
Draw the
ILcdCircle object as an outlined and filled circle, both
the area and the contour of the circle defined by the ILcdCircle
are painted. |
static Cursor[] |
sCursorResizing
Cursor to return to indicate the object will be reshaped.
|
static Cursor |
sCursorTranslating
Cursor to return to indicate the object will be translated.
|
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATED
DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
Constructor and Description |
---|
TLcdGXYCirclePainter()
Constructs a default
TLcdGXYCirclePainter in the default mode OUTLINED and sets the display name to "Circle". |
Modifier and Type | Method and Description |
---|---|
boolean |
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)
Implements
ILcdGXYPainter.anchorPointSFCT . |
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 aRenderMode,
ILcdGXYContext aGXYContext,
ILcd2DEditableBounds aBoundsSFCT)
Computes the bounds of the representation of an
ILcdCircle in AWT coordinates. |
Object |
clone()
Makes
Object.clone() public. |
boolean |
edit(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
This implementation edits the
ILcdCircle object set to the painter. |
int |
getAnchorPointLocation()
Returns the location of the anchor point (by default: MIDDLE_OF_BOUNDS).
|
ILcdIcon |
getCenterIcon()
Returns the icon for the center point's default representation, used
if
isDrawCenter() returns true. |
ILcdIcon |
getCenterIconWhenSelected()
Returns the icon for the center point's selected representation, used
if
isDrawCenterWhenSelected() returns true. |
int |
getCreationClickCount()
Returns
2 as the number of required user interactions. |
Cursor |
getCursor(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
Returns a
Cursor that clarifies the render mode and context this painter is operating
in. |
Format |
getDistanceFormat()
Returns the format used when displaying the circle radius while it is being reshaped.
|
Color |
getEditingLabelBackground()
Returns the background color used when displaying the editing labels.
|
Font |
getEditingLabelFont()
Returns the font used when displaying the editing labels.
|
Color |
getEditingLabelForeground()
Returns the foreground color (text color) used when displaying the editing labels.
|
ILcdGXYEditor |
getGXYEditor(Object aObject)
Returns this instance as editor for editing the specified
Object . |
int |
getMinimumEditDelta()
Returns the minimum pixel distance the input device (a mouse, for example) must move before editing the shape.
|
Object |
getObject()
Returns the object that can currently be painted or edited by this painter/editor.
|
boolean |
getPaintCache()
Returns whether caching is used when painting this painter's object.
|
Format |
getPointFormat()
Returns the format used when displaying the center point while it is being moved.
|
ILcdIcon |
getSnapIcon()
Returns the icon that is used to paint snap target points of the object set to this painter.
|
boolean |
isDisplayCenter()
Deprecated.
Use
isDrawCenter() instead. |
boolean |
isDisplayCenterOnSelection()
Deprecated.
Use
isDrawCenterWhenSelected() instead. |
boolean |
isDrawCenter()
Returns whether the center point of the circle should be displayed.
|
boolean |
isDrawCenterWhenSelected()
Returns whether the center point of the circle should be displayed when it is painted in selected mode.
|
boolean |
isEditingLabel()
Returns whether the editing labels are drawn or not.
|
boolean |
isEditingLabelFilled()
Returns whether the frame around an editing label is filled or not.
|
boolean |
isEditingLabelFrame()
Returns whether the frame around an editing label is drawn or not.
|
boolean |
isSnapToInvisiblePoints()
Returns whether the painter allows snapping to the invisible points of the shape.
|
boolean |
isTouched(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
Depending on the rendering mode, returns whether the contour, the center point, or the interior of the circle
is touched.
|
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
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.
|
void |
paintEditingLabels(Graphics aGraphics,
ILcdCircle aCircle,
int aRenderMode,
ILcdGXYContext aGXYContext)
Called by the
paint method when editing an ILcd2DEditableCircle . |
void |
setAnchorPointLocation(int aAnchorPointLocation)
Sets the preferred anchor point location.
|
void |
setCenterIcon(ILcdIcon aIcon)
Sets the icon for the center point's default representation,
if
isDrawCenter() returns true. |
void |
setCenterIconWhenSelected(ILcdIcon aIcon)
Sets the icon for the center point's selected representation,
if
isDrawCenterWhenSelected() returns true. |
void |
setDisplayCenter(boolean aDrawCenter)
Deprecated.
Use
setDrawCenter(boolean) instead. |
void |
setDisplayCenterOnSelection(boolean aDrawCenterWhenSelected)
Deprecated.
Use
setDrawCenterWhenSelected(boolean) instead. |
void |
setDistanceFormat(Format aDistanceFormat)
Set the distance
Format to use for formatting the circle radius in the editing
label. |
void |
setDrawCenter(boolean aDrawCenter)
Sets whether the center point of the circle should be displayed or not.
|
void |
setDrawCenterWhenSelected(boolean aDrawCenterWhenSelected)
Sets whether the center point of the circle should be displayed when it is painted in selected
mode or not.
|
void |
setEditingLabel(boolean aEditingLabel)
Sets whether the editing labels should be drawn or not.
|
void |
setEditingLabelBackground(Color aEditingLabelBackground)
Sets the background color that will be used to display the editing labels.
|
void |
setEditingLabelFilled(boolean aEditingLabelFilled)
Sets whether the frame around an editing labels needs to be filled or not.
|
void |
setEditingLabelFont(Font aEditingLabelFont)
Sets the font that will be used to display the editing labels.
|
void |
setEditingLabelForeground(Color aEditingLabelForeground)
Sets the foreground color (text color) that will be used to display the editing labels.
|
void |
setEditingLabelFrame(boolean aEditingLabelFrame)
Sets whether the frame around an editing labels needs to be drawn 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 |
setObject(Object aObject)
Sets the object to paint and edit.
|
void |
setPaintCache(boolean aPaintCache)
Turns caching of the representation of the object on or off.
|
void |
setPointFormat(Format aPointFormat)
Set the
Format used for formatting the coordinates of the center point as a
String . |
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. It is recommended to use the
standard Java logging framework directly.
|
protected void |
setupGraphicsForFill(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
Called just before filling circles on the specified
Graphics object. |
protected void |
setupGraphicsForLine(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
Called just before painting a line on the specified
Graphics object. |
Object |
snapTarget(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns the center point of the
ILcdCircle if it is touched. |
boolean |
supportSnap(Graphics aGraphics,
ILcdGXYContext aGXYContext)
This implementation supports snapping, always returns
true . |
getEditMode, getFillStyle, getLineStyle, getMode, getSelectionMode, setEditMode, setFillStyle, setLineStyle, setMode, setSelectionMode
addPropertyChangeListener, firePropertyChangeEvent, firePropertyChangeEvent, getDisplayName, getGXYPainter, removePropertyChangeListener, setClassTraceOn, setDisplayName
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayName
getDisplayName
addPropertyChangeListener, removePropertyChangeListener
public static final int OUTLINED
ILcdCircle
object as an outlined circle, only the contour
of the circle defined by the ILcdCircle
is painted.public static final int FILLED
ILcdCircle
object as a filled circle, only the area of
the circle defined by the ILcdCircle
is painted.public static final int OUTLINED_FILLED
ILcdCircle
object as an outlined and filled circle, both
the area and the contour of the circle defined by the ILcdCircle
are painted.public static volatile Cursor sCursorTranslating
public static Cursor[] sCursorResizing
public static final int MIDDLE_OF_BOUNDS
boundsSFCT
.public static final int FOCUS_POINT
MIDDLE_OF_BOUNDS
method is used to
calculate the anchor point.public static final int CENTER_POINT
MIDDLE_OF_BOUNDS
method is used to
calculate the anchor point.public TLcdGXYCirclePainter()
TLcdGXYCirclePainter
in the default mode OUTLINED
and sets the display name to "Circle".public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.setTraceOn
in class ALcdGXYPainter
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.public boolean isTraceOn()
true
if tracing is enabled for this class.isTraceOn
in class ALcdGXYPainter
public void setObject(Object aObject)
Sets the object to paint and edit. The object should be an instance of ILcdCircle
for painting and an instance of ILcd2DEditableCircle
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 ILcdCircle
and shall throw
a ClassCastException
if it does not.
When this painter is used as editor with an object that does not implement the interface ILcd2DEditableCircle
, the edit
method shall throw the necessary exception.
setObject
in interface ILcdGXYEditor
setObject
in interface ILcdGXYPainter
aObject
- The object to paint and edit.ClassCastException
- when the object does not implement ILcdCircle
.getObject()
public final Object getObject()
getObject
in interface ILcdGXYEditor
getObject
in interface ILcdGXYPainter
setObject(Object)
public void setPaintCache(boolean aPaintCache)
ILcdCache
. By default, caching
is turned on.aPaintCache
- A flag indicating whether to use caching when painting an object.getPaintCache()
public boolean getPaintCache()
true
if caching is used to paint this painter's object, false
otherwise.setPaintCache(boolean)
public void setDisplayCenter(boolean aDrawCenter)
setDrawCenter(boolean)
instead.public boolean isDisplayCenter()
isDrawCenter()
instead.public void setDisplayCenterOnSelection(boolean aDrawCenterWhenSelected)
setDrawCenterWhenSelected(boolean)
instead.public boolean isDisplayCenterOnSelection()
isDrawCenterWhenSelected()
instead.public void setDrawCenter(boolean aDrawCenter)
false
. This setting has an influence on the methods boundsSFCT
, isTouched
and snapping.
Regardless of this setting, the center point is always displayed as a handle in HANDLES mode
to allow editing.aDrawCenter
- A flag indicating whether the center point should be displayed or not.isDrawCenter()
,
setDrawCenterWhenSelected(boolean)
public boolean isDrawCenter()
setDrawCenter(boolean)
public void setDrawCenterWhenSelected(boolean aDrawCenterWhenSelected)
true
. This setting has an influence
on the methods boundsSFCT
, isTouched
and snapping.
Regardless of this setting, the center point is always displayed as a handle in HANDLES mode
to allow editing.aDrawCenterWhenSelected
- A flag indicating whether the center point should be displayed
when it is painted in selected mode or not.isDrawCenterWhenSelected()
,
setDrawCenter(boolean)
public boolean isDrawCenterWhenSelected()
setDrawCenterWhenSelected(boolean)
public void setCenterIcon(ILcdIcon aIcon)
isDrawCenter()
returns true.aIcon
- the icon for the center point's default representationsetDrawCenter(boolean)
,
setCenterIconWhenSelected(com.luciad.gui.ILcdIcon)
public ILcdIcon getCenterIcon()
isDrawCenter()
returns true.public void setCenterIconWhenSelected(ILcdIcon aIcon)
isDrawCenterWhenSelected()
returns true.aIcon
- the icon for the center point's selected representationsetDrawCenterWhenSelected(boolean)
,
setCenterIcon(com.luciad.gui.ILcdIcon)
public ILcdIcon getCenterIconWhenSelected()
isDrawCenterWhenSelected()
returns true.public void setSnapToInvisiblePoints(boolean aSnapToInvisiblePoints)
ILcdCircle
object, there's only one invisible point, being the center point of the circle when it is not drawn.
The default value is false
.aSnapToInvisiblePoints
- A flag indicating whether snapping to the invisible points is allowed.isSnapToInvisiblePoints()
public boolean isSnapToInvisiblePoints()
setSnapToInvisiblePoints(boolean)
public void setSnapIcon(ILcdIcon aSnapIcon)
paint
method is called with the render mode ILcdGXYPainter.SNAPS
.aSnapIcon
- The icon that should be used to paint snap target points.getSnapIcon()
public ILcdIcon getSnapIcon()
setSnapIcon(ILcdIcon)
public void setMinimumEditDelta(int aDelta)
aDelta
- the minimum pixel distance the input device should move in either the X or Y directionpublic int getMinimumEditDelta()
public int getAnchorPointLocation()
MIDDLE_OF_BOUNDS
, FOCUS_POINT
, CENTER_POINT
.public void setAnchorPointLocation(int aAnchorPointLocation)
aAnchorPointLocation
- one of MIDDLE_OF_BOUNDS
, FOCUS_POINT
,
CENTER_POINT
.protected void setupGraphicsForLine(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
Called just before painting a line on the specified Graphics
object. It can be
redefined in order to set specific Graphics
properties like Color
,
etc...
This implementation calls ILcdGXYPainterStyle.setupGraphics(java.awt.Graphics, java.lang.Object, int, com.luciad.view.gxy.ILcdGXYContext)
on the lineStyle property
if a line style has been set to this instance.
aGraphics
- The graphics to paint the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.protected void setupGraphicsForFill(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
Called just before filling circles on the specified Graphics
object. It can be
redefined in order to set specific Graphics
properties like Color
,
etc...
This implementation calls ILcdGXYPainterStyle.setupGraphics(java.awt.Graphics, java.lang.Object, int, com.luciad.view.gxy.ILcdGXYContext)
on the fillStyle property
if a fill style has been set to this instance.
aGraphics
- The graphics to paint the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.public void paint(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
This implementation will use the specified render mode to determine how the object needs to be
rendered. In ILcdGXYPainter.CREATING
, ILcdGXYPainter.RESHAPING
and ILcdGXYPainter.TRANSLATING
mode, the object is
painted using the edit paint mode (ALcdGXYAreaPainter.getEditMode()
). The object is rendered as shown in
the images of the class documentation.
In the render mode ILcdGXYPainter.SELECTED
, the object is painted using the selection paint mode
(ALcdGXYAreaPainter.getSelectionMode()
). In all other render modes, the paint mode (ALcdGXYAreaPainter.getMode()
)
is used.
paint
in interface ILcdGXYPainter
aGraphics
- The graphics to paint the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.public boolean appendAWTPath(ILcdGXYContext aGXYContext, int aRenderMode, ILcdAWTPath aAWTPathSFCT)
ILcdGXYPathPainter
appendAWTPath
in interface ILcdGXYPathPainter
aGXYContext
- the graphics contextaRenderMode
- the rendering modeaAWTPathSFCT
- the path to append topublic boolean appendGeneralPath(ILcdGXYContext aGXYContext, int aRenderMode, ILcdGeneralPath aGeneralPathSFCT)
ILcdGXYPathPainter
appendGeneralPath
in interface ILcdGXYPathPainter
aGXYContext
- the graphics contextaRenderMode
- the rendering modeaGeneralPathSFCT
- the path to append topublic boolean edit(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
This implementation edits the ILcdCircle
object set to the painter. The object needs to
implement the interface ILcd2DEditableCircle
otherwise a ClassCastException
will be thrown.
In ILcdGXYEditor.TRANSLATED
render mode, the ILcdCircle
object is edited as follows:
In ILcdGXYEditor.RESHAPED
render mode, the ILcdCircle
object is edited as follows:
In the creation render modes, the first action defines the center point of the circle and the second the radius of the circle.
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.
edit
in interface ILcdGXYEditor
aGraphics
- The graphics to edit the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.ClassCastException
- if the painter's object does not implement ILcd2DEditableCircle
.ILcdGXYContext
,
acceptSnapTarget
public void paintEditingLabels(Graphics aGraphics, ILcdCircle aCircle, int aRenderMode, ILcdGXYContext aGXYContext)
Called by the paint
method when editing an ILcd2DEditableCircle
.
It draws labels indicating the values of properties being changed. For example, the coordinates of
the center point or the radius of the circle. This method draws the default labels but it can
be redefined for specific needs.
aGraphics
- The graphics to paint the object on.aCircle
- The circle that is being edited.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.public int getCreationClickCount()
2
as the number of required user interactions.getCreationClickCount
in interface ILcdGXYEditor
2
.public boolean isTouched(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
This implementation will use the specified paint mode
to determine how the object is
represented. Depending on the representation of the ILcdCircle
object, the object is touched if
the contour, the center point (when painted) or, its interior space (when it is painted filled) is touched.
The coordinate for which the check is done is derived from the context passed as argument.
isTouched
in interface ILcdGXYPainter
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.boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException
ILcdCircle
in AWT coordinates.boundsSFCT
in interface ILcdGXYPainter
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.TLcdNoBoundsException
- if no bounds 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.isTouched
public 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. 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.
aModel2ModelTransformationClass
- the transformation used as described above.public boolean acceptSnapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext)
Determines whether a snap target should be accepted or not. A snap target is accepted if the following conditions are met:
ILcd2DEditableCircle
.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.0
. This enables snapping
when creating a circle.acceptSnapTarget
in interface ILcdGXYEditor
aGraphics
- the graphics on which the snap target should be checked.aGXYContext
- the context in which the snap target should be checked.true
if the above conditions are met, false
otherwise.setModelModelTransformationClass(Class)
public boolean supportSnap(Graphics aGraphics, ILcdGXYContext aGXYContext)
true
.supportSnap
in interface ILcdGXYPainter
supportSnap
in class ALcdGXYPainter
aGraphics
- the graphics on which is worked.aGXYContext
- the context of the snapping.true
.public Object snapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext)
Returns the center point of the ILcdCircle
if it is touched. If it was not touched,
null
will be returned. Note that the center point is only returned if the center
point is drawn (see isDrawCenter()
) or when snapping to invisible points is enabled (see
isSnapToInvisiblePoints()
).
snapTarget
in interface ILcdGXYPainter
snapTarget
in class ALcdGXYPainter
aGraphics
- the graphics on which is worked.aGXYContext
- the context of the snapping.ILcdCircle
if it is touched, null
otherwise.supportSnap
public Cursor getCursor(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
Cursor
that clarifies the render mode and context this painter is operating
in. When no specific Cursor
is required, null
is returned.getCursor
in interface ILcdGXYPainter
getCursor
in class ALcdGXYPainter
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.null
if
no particular cursor is required.public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException
ALcdGXYPainter
ILcdGXYPainter.anchorPointSFCT
.
aPointSFCT
will be set to the center of the
bounds calculated by boundsSFCT.anchorPointSFCT
in interface ILcdGXYPainter
anchorPointSFCT
in class ALcdGXYPainter
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.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.paint
public ILcdGXYEditor getGXYEditor(Object aObject)
Object
. If this
Object
is not the same as the Object
set to this painter, the
setObject(Object)
method is called to update the object set to the painter.getGXYEditor
in interface ILcdGXYEditorProvider
aObject
- the object to be edited.Object
.public void setPointFormat(Format aPointFormat)
Set the Format
used for formatting the coordinates of the center point as a
String
. An ILcdPoint
representing the center of the circle is given
to one of the format
methods of the java.text.Format
, which then
converts it to a String
that is displayed on the map during translate operations.
By default, a Format
that uses the toString
method is used.
aPointFormat
- the Format used for formatting the coordinates of the center point as a String.getPointFormat()
public Format getPointFormat()
setPointFormat(java.text.Format)
public void setDistanceFormat(Format aDistanceFormat)
Format
to use for formatting the circle radius in the editing
label. A Number
representing the length of the radius (same unit as
ILcdCircle.getRadius
) is given to one of the format
methods of the
java.text.Format
, which then converts it to a String
that is
displayed on the map during edit operations that change the radius.
By default, a distance format is used that assumes the radius is in meters.
aDistanceFormat
- the distance format to use for formatting the circle radius in the
editing label.getDistanceFormat()
,
TLcdDistanceFormat
public Format getDistanceFormat()
setDistanceFormat(java.text.Format)
public void setEditingLabelFont(Font aEditingLabelFont)
aEditingLabelFont
- the font used to display the editing labels.getEditingLabelFont()
public Font getEditingLabelFont()
setEditingLabelFont(java.awt.Font)
public void setEditingLabelForeground(Color aEditingLabelForeground)
Color.black
.aEditingLabelForeground
- the foreground color (text color) used to display the editing labels.getEditingLabelForeground()
public Color getEditingLabelForeground()
setEditingLabelForeground(java.awt.Color)
public void setEditingLabelBackground(Color aEditingLabelBackground)
Color.lightGray
.aEditingLabelBackground
- the background color used to display the editing labels.getEditingLabelBackground()
public Color getEditingLabelBackground()
setEditingLabelBackground(java.awt.Color)
public void setEditingLabelFilled(boolean aEditingLabelFilled)
false
.aEditingLabelFilled
- the flag indicating whether the frame around an editing label is filled.isEditingLabelFilled()
public boolean isEditingLabelFilled()
setEditingLabelFilled(boolean)
public void setEditingLabelFrame(boolean aEditingLabelFrame)
false
.aEditingLabelFrame
- the flag indicating whether the frame around an editing label is drawn.isEditingLabelFrame()
public boolean isEditingLabelFrame()
setEditingLabelFrame(boolean)
public void setEditingLabel(boolean aEditingLabel)
false
.aEditingLabel
- the flag indicating whether the frame around an editing label is drawn.isEditingLabel()
public boolean isEditingLabel()
setEditingLabel(boolean)
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in interface ILcdGXYEditorProvider
clone
in interface ILcdGXYPainterProvider
clone
in class ALcdGXYAreaPainter
Object.clone()