public class TLcdGXYArcPainter extends ALcdGXYPainter implements ILcdGXYPainter, ILcdGXYPathPainter, ILcdGXYEditor, ILcdGXYEditorProvider
ILcdArc
objects and enables visual editing of
ILcd2DEditableArc
objects in an ILcdGXYView
.
The body of an ILcdArc
object is painted as:
This painter defines the two arc corner points of the ILcdArc
object and the four axis
corner points as a handle of the arc. The following image clarifies the handle location. The arc
corner points are represented by blue points, the axis corner points by red points.
BODY
mode depending on the drawCenter
property. When painted, it can be used as a handle to edit the object.
One of the arc corner points of the ILcdArc
object can be returned on the condition
that it is touched. 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 ILcdArc
object is governed by the line style set to this painter.
The location of the anchor point can be set using setAnchorPointLocation(int)
to the
middle of the arc bounds, the middle of the chord or the middle of the arc itself. By default,
the anchor point is located at the center point of the bounds, calculated by
boundsSFCT
. Note that the center point of the ILcdArc
object is not taken into account.
Depending on the paint mode, an arc is touched when either the arc, the arc handles, the axis handles or the center point of the arc is touched. Note that the center point can only be touched if it is painted.
The bounds of the ILcdArc
object contains the contour of the arc and the center point
if it is painted.
This editor provides the following edit functionality for the different render modes:
RESHAPED
: an axis handle is reshaped, depending on whether it is touched. The
image below illustrate the editing behavior. The small black arrow indicates the path of the mouse
cursor while reshaping the arc. The rotation angle and the length of the axis are updated. The gray
dotted lines indicate that the start angle and arc angle of the arc remain unchanged. ![]() |
Moving an axis point. |
TRANSLATED
: an arc handles or the whole arc is translated, depending on whether
an arc handle or the arc segment is touched. The images below illustrate the editing behavior. The small
black arrow indicates the path of the mouse cursor while translating the arc. ![]() |
|
![]() |
Moving an arc point. | |
Moving the arc segment. |
When initializing an arc via interaction through the view, a number of user interactions are required to
complete the initialization. This number depends on the creation mode
and
it is either 2, 3 or 5 for the modes TWO_CLICK
, THREE_CLICK
or FIVE_CLICK
.
The creationOrientation
property defines the orientation of the arc
during creation.
All points are accepted as snap target as long as:
ILcdArc
object with the model to model
transformation
,ILcdArc
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,...
Modifier and Type | Field and Description |
---|---|
static int |
ARC_END_CORNER
Constant value indicating that the end point of the arc segment of the arc is touched.
|
static int |
ARC_START_CORNER
Constant value indicating that the start point of the arc segment of the arc is touched.
|
static int |
BODY
Constant value indicating that the body of the arc is touched.
|
static int |
CENTER
Constant value indicating that the center point of the arc is touched.
|
static int |
CLOCKWISE
Constant for a clockwise orientation when creating an arc.
|
static int |
COUNTERCLOCKWISE
Constant for a counter clockwise orientation when creating an arc.
|
static int |
DEFAULT_ORIENTATION
Constant for the default orientation when creating an arc.
|
static int |
END_OF_CURVE
Constant value indicating that the anchor point should be chosen at the end of the curve
if ILcdCurve is implemented.
|
static int |
FIVE_CLICK
Constant for the five click creation mode.
|
static int |
FOCUS_POINT
Constant value indicating that the anchor point should be chosen as the arc's focus point.
|
static int |
MAJOR_RADIUS_CORNER
Constant value indicating that the end point of the major axis of the arc is touched.
|
static int |
MAJOR_RADIUS_OPPOSITE_CORNER
Constant value indicating that the opposite end point of the major axis of the arc
is touched.
|
static int |
MIDDLE_OF_ARC
Constant value indicating that the anchor point should be chosen on the arc, at half of its
length.
|
static int |
MIDDLE_OF_BOUNDS
Constant value indicating that the anchor point should be chosen in the middle of the arc's
bounds, calculated by
boundsSFCT . |
static int |
MIDDLE_OF_CHORD
Constant value indicating that the anchor point should be chosen in the middle of the chord
determined by the start and end points.
|
static int |
MIDDLE_OF_CURVE
Constant value indicating that the anchor point should be chosen at the middle of the curve
if ILcdCurve is implemented.
|
static int |
MINOR_RADIUS_CORNER
Constant value indicating that the end point of the minor axis of the arc is touched.
|
static int |
MINOR_RADIUS_OPPOSITE_CORNER
Constant value indicating that the opposite end point of the minor axis of the arc
is touched.
|
static int |
START_OF_CURVE
Constant value indicating that the anchor point should be chosen at the start of the curve
if ILcdCurve is implemented.
|
static int |
THREE_CLICK
Constant for the three click creation mode.
|
static int |
TWO_CLICK
Constant for the two click creation mode.
|
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATED
Constructor and Description |
---|
TLcdGXYArcPainter()
Constructs a default
TLcdGXYArcPainter and sets the display name
to "Arc". |
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 aRenderMode,
ILcdGXYContext aGXYContext,
Point aPointSFCT)
Moves the specified
aPointSFCT to the anchor point of the ILcdArc object. |
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.
|
protected void |
boundsOfEditingLabelsSFCT(Graphics aGraphics,
ILcdArc aArc,
int aTouchedLocation,
ILcdGXYContext aGXYContext,
ILcd2DEditableBounds aBoundsSFCT)
Called by the
boundsSFCT method when editing an ILcd2DEditableArc . |
void |
boundsSFCT(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext,
ILcd2DEditableBounds aBoundsSFCT)
Computes the bounds of the representation of an
ILcdArc in AWT coordinates. |
Object |
clone()
Makes
Object.clone() public. |
boolean |
edit(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
This implementation edits the
ILcdArc 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 either 2, 3 or 5 depending on the
creation mode
(TWO_CLICK , THREE_CLICK or FIVE_CLICK ) as the number of
required user interactions. |
int |
getCreationOrientation()
Returns the orientation used while creating
ILcdArc objects. |
Cursor |
getCursor(Graphics aGraphics,
int aRenderMode,
ILcdGXYContext aGXYContext)
Returns a
Cursor that clarifies the render mode and context this painter is operating
in. |
ILcdGXYEditor |
getGXYEditor(Object aObject)
Returns this instance as editor for editing the specified
Object . |
ILcdGXYPainterStyle |
getLineStyle()
Returns the line style used for painting the contour of the
ILcdArc 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.
|
ILcdIcon |
getSnapIcon()
Returns the icon that is used to paint snap target points of the object set to this painter.
|
boolean |
isDrawCenter()
Returns whether the center point of the arc should be displayed.
|
boolean |
isDrawCenterWhenSelected()
Returns whether the center point of the arc should be displayed when it is painted in selected mode.
|
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 arc, the arc handles, the axis handles or the
center point of the arc 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.
|
protected void |
paintEditingLabels(Graphics aGraphics,
ILcdArc aArc,
int aTouchedLocation,
ILcdGXYContext aGXYContext)
Called by the
paint method when editing an ILcd2DEditableArc . |
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 |
setCreationMode(int aCreationMode)
Sets the mode to decide how to create an
ILcdArc object. |
void |
setCreationOrientation(int aCreationOrientation)
Sets the orientation used while creating
ILcdArc objects. |
void |
setDrawCenter(boolean aDrawCenter)
Sets whether the center point of the arc should be displayed or not.
|
void |
setDrawCenterWhenSelected(boolean aDrawCenterWhenSelected)
Sets whether the center point of the arc should be displayed when it is painted in selected
mode or not.
|
void |
setLineStyle(ILcdGXYPainterStyle aLineStyle)
Sets the line style to use when painting the contour of the
ILcdArc object. |
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 |
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 |
setupGraphicsForLine(Graphics aGraphics,
Object aObject,
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 or one of the end points of the
ILcdArc if it is
touched. |
boolean |
supportSnap(Graphics aGraphics,
ILcdGXYContext aGXYContext)
This implementation supports snapping, always returns
true . |
addPropertyChangeListener, firePropertyChangeEvent, firePropertyChangeEvent, getDisplayName, getGXYPainter, removePropertyChangeListener, setClassTraceOn, setDisplayName
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayName
addPropertyChangeListener, removePropertyChangeListener
getDisplayName
public static final int CENTER
public static final int BODY
public static final int MAJOR_RADIUS_CORNER
ILcdArc.MAJOR_RADIUS_CORNER
,
Constant Field Valuespublic static final int MINOR_RADIUS_CORNER
ILcdArc.MINOR_RADIUS_CORNER
,
Constant Field Valuespublic static final int MAJOR_RADIUS_OPPOSITE_CORNER
public static final int MINOR_RADIUS_OPPOSITE_CORNER
public static final int ARC_START_CORNER
ILcdArc.ARC_START_CORNER
,
Constant Field Valuespublic static final int ARC_END_CORNER
ILcdArc.ARC_END_CORNER
,
Constant Field Valuespublic static final int MIDDLE_OF_BOUNDS
boundsSFCT
.
Note that the center point of the ILcdArc
object is not taken into account.public static final int FOCUS_POINT
MIDDLE_OF_BOUNDS
method is used to
calculate the anchor point.public static final int MIDDLE_OF_CHORD
public static final int MIDDLE_OF_ARC
public static final int MIDDLE_OF_CURVE
MIDDLE_OF_ARC
method. If ILcdCurve is not implemented,
or if no valid anchor point can be found, the MIDDLE_OF_BOUNDS
method is used.public static final int START_OF_CURVE
MIDDLE_OF_BOUNDS
method is used.public static final int END_OF_CURVE
MIDDLE_OF_BOUNDS
method is used.public static final int DEFAULT_ORIENTATION
public static final int CLOCKWISE
public static final int COUNTERCLOCKWISE
public static final int TWO_CLICK
0
, 45
and 0
after creation. The semi-major and semi-minor axes are equal.setCreationMode(int)
,
Constant Field Valuespublic static final int THREE_CLICK
0
and semi-major and semi-minor axes are equal. For
backwards compatibility reasons, this is the default creation mode.setCreationMode(int)
,
Constant Field Valuespublic static final int FIVE_CLICK
setCreationMode(int)
,
Constant Field Valuespublic TLcdGXYArcPainter()
TLcdGXYArcPainter
and sets the display name
to "Arc".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 ILcdArc
for painting and an instance of ILcd2DEditableArc
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 ILcdArc
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 ILcd2DEditableArc
, 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 ILcdArc
.getObject()
public Object getObject()
getObject
in interface ILcdGXYEditor
getObject
in interface ILcdGXYPainter
setObject(Object)
public void setCreationMode(int aCreationMode)
ILcdArc
object. An arc can be created
in the following modes. The default value is TWO_CLICK
.
TWO_CLICK
, which enables setting the center point and the radius,THREE_CLICK
, which enables setting the center point, the radius and the rotation
angle. and the arc angle, orFIVE_CLICK
, which enables setting the center point, the major axis extent and
the rotation angle, the minor axis extent, the start angle of the arc, and the arc angle
of the arc.aCreationMode
- The mode deciding how to create an ILcdArc
object.public void setCreationOrientation(int aCreationOrientation)
Sets the orientation used while creating ILcdArc
objects. The value passed should be
DEFAULT_ORIENTATION
, CLOCKWISE
or COUNTERCLOCKWISE
. The default value is
DEFAULT_ORIENTATION
for backward compatibility reasons.
This value will only be taken into account in creation modes where the choice of the start and arc angle are free (currently the three and five click creation modes).
aCreationOrientation
- A flag indicating the orientation of the arc during creation.getCreationOrientation()
public int getCreationOrientation()
ILcdArc
objects.ILcdArc
objects.setCreationOrientation(int)
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 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)
ILcdArc
object, there's only one invisible point, being the center point of the arc 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 setLineStyle(ILcdGXYPainterStyle aLineStyle)
ILcdArc
object.
Note that this property can be set to null
.aLineStyle
- the line style to use when painting the contour of the ILcdArc
object.getLineStyle()
public ILcdGXYPainterStyle getLineStyle()
ILcdArc
object.
Note that this method can return null
.ILcdArc
object.setLineStyle(ILcdGXYPainterStyle)
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
, MIDDLE_OF_CHORD
,
MIDDLE_OF_ARC
, MIDDLE_OF_CURVE
, START_OF_CURVE
,
END_OF_CURVE
.public void setAnchorPointLocation(int aAnchorPointLocation)
aAnchorPointLocation
- one of MIDDLE_OF_BOUNDS
, FOCUS_POINT
,
MIDDLE_OF_CHORD
, MIDDLE_OF_ARC
,
MIDDLE_OF_CURVE
, START_OF_CURVE
,
END_OF_CURVE
.protected void setupGraphicsForLine(Graphics aGraphics, Object aObject, 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.aObject
- The object to paint.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. The object is rendered as shown in the images of the class documentation.
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 toprotected void paintEditingLabels(Graphics aGraphics, ILcdArc aArc, int aTouchedLocation, ILcdGXYContext aGXYContext)
Called by the paint
method when editing an ILcd2DEditableArc
. It
draws labels indicating the values of properties being changed. For example, the coordinates of the
center point of the arc, the major or minor axis extent, the start angle, etc ... This method
is empty and therefore does not draw the labels but it can be redefined for specific needs.
The aTouchedLocation
argument indicates which part of the arc is being edited.
For example, MAJOR_RADIUS_CORNER
corresponds to the end point of the major axis of the arc.
It should be one of the following constants:
CENTER
, BODY
, MAJOR_RADIUS_CORNER
, MINOR_RADIUS_CORNER
,
MAJOR_RADIUS_OPPOSITE_CORNER
, MINOR_RADIUS_OPPOSITE_CORNER
,
ARC_START_CORNER
, ARC_END_CORNER
aGraphics
- The graphics to paint the object on.aArc
- The arc that is being edited.aTouchedLocation
- The part of the arc that is being edited.aGXYContext
- The context to render the object in.public void boundsSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException
ILcdArc
in AWT coordinates. The bounds will
include the center point of the arc depending on whether it is rendered or not. This in turn depends on
the painter mode passed and the values of the properties drawCenter
and drawCenterWhenSelected
.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
protected void boundsOfEditingLabelsSFCT(Graphics aGraphics, ILcdArc aArc, int aTouchedLocation, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT)
Called by the boundsSFCT
method when editing an ILcd2DEditableArc
.
It calculates the bounds of the labels indicating the values of properties being changed.
For example, the coordinates of the center point of the arc, the major or minor axis extent, the
start angle, etc ... Since by default, no labels are painted, this implementation is empty
and the aBoundsSFCT
argument remains unchanged.
Note that the ILcd2DEditableBounds
object already contains the bounds of the
edited object. Upon exit of this method, this object should be set to the union of the bounds
of the edited object and the labels painted while editing.
The aTouchedLocation
argument indicates which part of the arc is being edited.
For example, MAJOR_RADIUS_CORNER
corresponds to the end point of the major axis of the arc.
It should be one of the following constants:
CENTER
, MAJOR_RADIUS_CORNER
, MINOR_RADIUS_CORNER
,
MAJOR_RADIUS_OPPOSITE_CORNER
, MINOR_RADIUS_OPPOSITE_CORNER
,
ARC_START_CORNER
, ARC_END_CORNER
aGraphics
- The graphics to paint the object on.aArc
- The arc that is being edited.aTouchedLocation
- The part of the arc that is being edited.aGXYContext
- The context to render the object in.aBoundsSFCT
- The bounds in view coordinates to be updated.public boolean isTouched(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
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 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 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 boolean edit(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext)
This implementation edits the ILcdArc
object set to the painter. The object needs to
implement the interface ILcd2DEditableArc
otherwise a ClassCastException
will be thrown.
In ILcdGXYEditor.TRANSLATED
render mode, the ILcdArc
object is edited as follows:
In ILcdGXYEditor.RESHAPED
render mode, the ILcdArc
object is edited as follows:
The creation render mode behavior is defined by the creation mode
.
Further changes have to be done within edition mode.
TWO_CLICK
mode, the first point determines the center point of
the arc and the second the radius of the arc circle. The start angle of the arc
will be 0
degrees and the arc angle extent 45
degrees
counter-clockwise.THREE_CLICK
mode, the first point determines the center point of
the arc, the second the radius and the rotation angle of the arc circle, and the
third the end angle (and thus the arc angle) of the arc. The start angle of the arc
angle will be 0
degrees.FIVE_CLICK
mode, the first point determines the center point of
the arc, the second the length of the semi-major axis and the rotation angle of
the arc, the third the length of the semi-minor axis, the fourth the start angle
of the arc, and the fifth the end angle (and thus the arc angle) of the arc.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 ILcd2DEditableArc
.ILcdGXYContext
,
acceptSnapTarget
public int getCreationClickCount()
creation mode
(TWO_CLICK
, THREE_CLICK
or FIVE_CLICK
) as the number of
required user interactions.getCreationClickCount
in interface ILcdGXYEditor
creation mode
.setCreationMode(int)
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:
ILcd2DEditableArc
.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 an arc.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 Object snapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext)
Returns the center point or one of the end points of the ILcdArc
if it is
touched. If no point was 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.ILcdArc
if it is
touched, null
otherwise.supportSnap
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 void anchorPointSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException
Moves the specified aPointSFCT
to the anchor point of the ILcdArc
object.
anchorPointSFCT
in interface ILcdGXYPainter
anchorPointSFCT
in class ALcdGXYPainter
aGraphics
- The graphics to paint the object on.aRenderMode
- The mode to render the object in.aGXYContext
- The context to render the object in.aPointSFCT
- The point that needs to be updated.TLcdNoBoundsException
- if the ILcdArc
object doesn't have
a valid anchor point, e.g. if it is always invisible in the current projection.getAnchorPointLocation()
,
setAnchorPointLocation(int)
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 ALcdGXYPainter
Object.clone()