Class TLcdGXYCirclePainter
- All Implemented Interfaces:
ILcdCloneable,ILcdPropertyChangeSource,ILcdGXYEditor,ILcdGXYEditorProvider,ILcdGXYPainter,ILcdGXYPainterProvider,ILcdGXYPathPainter,Serializable,Cloneable
ILcdCircle objects and enables visual editing of
ILcd2DEditableCircle objects in an ILcdGXYView.
Painting an ILcdCircle
Body
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.
Handles
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.
Snap targets
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.
Styling options
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.
Locating an ILcdCircle in a view
Anchor point of an ILcdCircle
The anchor point of the ILcdCircle object is located at the center point of the bounds,
calculated by boundsSFCT.
When is an ILcdCircle touched
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.
Visually editing and creating an ILcd2DEditableCircle
Modifying an ILcd2DEditableCircle
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.
Note that, if the center point of the circle is touched (and painted), the whole circle can be translated as if the contour was touched.
Creating an ILcd2DEditableCircle
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.
Accepted snap targets
All points are accepted as snap target as long as:
- the point can be transformed to the reference of the
ILcdCircleobject with themodel to model transformation, - the point is not the center point of the
ILcdCircleobject set to this painter.
Additional properties
Caching
This painter implementation supports caching for objects implementing ILcdCache.
Caching can be turned on/off with the setPaintCache method.
Drawing the center point
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,...
Drawing the editing labels
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant value indicating that the anchor point should be chosen as the center point of the circle.static final intDraw theILcdCircleobject as a filled circle, only the area of the circle defined by theILcdCircleis painted.static final intConstant value indicating that the anchor point should be chosen as the focus point of the circle.static final intConstant value indicating that the anchor point should be chosen in the middle of the bounds, calculated byboundsSFCT.static final intDraw theILcdCircleobject as an outlined circle, only the contour of the circle defined by theILcdCircleis painted.static final intDraw theILcdCircleobject as an outlined and filled circle, both the area and the contour of the circle defined by theILcdCircleare painted.static Cursor[]Cursor to return to indicate the object will be reshaped.static CursorCursor to return to indicate the object will be translated.Fields inherited from class com.luciad.view.gxy.ALcdGXYPainter
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBoundsFields inherited from interface com.luciad.view.gxy.ILcdGXYEditor
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATEDFields inherited from interface com.luciad.view.gxy.ILcdGXYPainter
CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a defaultTLcdGXYCirclePainterin the default modeOUTLINEDand sets the display name to "Circle". -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptSnapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext) Determines whether a snap target should be accepted or not.voidanchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) ImplementsILcdGXYPainter.anchorPointSFCT.booleanappendAWTPath(ILcdGXYContext aGXYContext, int aRenderMode, ILcdAWTPath aAWTPathSFCT) Appends a discretized representation in view coordinates to the given path.booleanappendGeneralPath(ILcdGXYContext aGXYContext, int aRenderMode, ILcdGeneralPath aGeneralPathSFCT) Appends a discretized representation in world coordinates to the given path.voidboundsSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) Computes the bounds of the representation of anILcdCirclein AWT coordinates.clone()MakesObject.clone()public.booleanedit(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) This implementation edits theILcdCircleobject set to the painter.intReturns the location of the anchor point (by default: MIDDLE_OF_BOUNDS).Returns the icon for the center point's default representation, used ifisDrawCenter()returns true.Returns the icon for the center point's selected representation, used ifisDrawCenterWhenSelected()returns true.intReturns2as the number of required user interactions.getCursor(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Returns aCursorthat clarifies the render mode and context this painter is operating in.Returns the format used when displaying the circle radius while it is being reshaped.Returns the background color used when displaying the editing labels.Returns the font used when displaying the editing labels.Returns the foreground color (text color) used when displaying the editing labels.getGXYEditor(Object aObject) Returns this instance as editor for editing the specifiedObject.intReturns the minimum pixel distance the input device (a mouse, for example) must move before editing the shape.final ObjectReturns the object that can currently be painted or edited by this painter/editor.booleanReturns whether caching is used when painting this painter's object.Returns the format used when displaying the center point while it is being moved.Returns the icon that is used to paint snap target points of the object set to this painter.booleanDeprecated.booleanDeprecated.UseisDrawCenterWhenSelected()instead.booleanReturns whether the center point of the circle should be displayed.booleanReturns whether the center point of the circle should be displayed when it is painted in selected mode.booleanReturns whether the editing labels are drawn or not.booleanReturns whether the frame around an editing label is filled or not.booleanReturns whether the frame around an editing label is drawn or not.booleanReturns whether the painter allows snapping to the invisible points of the shape.booleanisTouched(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.booleanDeprecated.This method has been deprecated.voidpaint(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.voidpaintEditingLabels(Graphics aGraphics, ILcdCircle aCircle, int aRenderMode, ILcdGXYContext aGXYContext) Called by thepaintmethod when editing anILcd2DEditableCircle.voidsetAnchorPointLocation(int aAnchorPointLocation) Sets the preferred anchor point location.voidsetCenterIcon(ILcdIcon aIcon) Sets the icon for the center point's default representation, ifisDrawCenter()returns true.voidSets the icon for the center point's selected representation, ifisDrawCenterWhenSelected()returns true.voidsetDisplayCenter(boolean aDrawCenter) Deprecated.UsesetDrawCenter(boolean)instead.voidsetDisplayCenterOnSelection(boolean aDrawCenterWhenSelected) Deprecated.UsesetDrawCenterWhenSelected(boolean)instead.voidsetDistanceFormat(Format aDistanceFormat) Set the distanceFormatto use for formatting the circle radius in the editing label.voidsetDrawCenter(boolean aDrawCenter) Sets whether the center point of the circle should be displayed or not.voidsetDrawCenterWhenSelected(boolean aDrawCenterWhenSelected) Sets whether the center point of the circle should be displayed when it is painted in selected mode or not.voidsetEditingLabel(boolean aEditingLabel) Sets whether the editing labels should be drawn or not.voidsetEditingLabelBackground(Color aEditingLabelBackground) Sets the background color that will be used to display the editing labels.voidsetEditingLabelFilled(boolean aEditingLabelFilled) Sets whether the frame around an editing labels needs to be filled or not.voidsetEditingLabelFont(Font aEditingLabelFont) Sets the font that will be used to display the editing labels.voidsetEditingLabelForeground(Color aEditingLabelForeground) Sets the foreground color (text color) that will be used to display the editing labels.voidsetEditingLabelFrame(boolean aEditingLabelFrame) Sets whether the frame around an editing labels needs to be drawn or not.voidsetMinimumEditDelta(int aDelta) Sets the minimum pixel distance the input device (a mouse, for example) must move before editing the shape.voidsetModelModelTransformationClass(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.voidSets the object to paint and edit.voidsetPaintCache(boolean aPaintCache) Turns caching of the representation of the object on or off.voidsetPointFormat(Format aPointFormat) Set theFormatused for formatting the coordinates of the center point as aString.voidsetSnapIcon(ILcdIcon aSnapIcon) Sets the icon that marks snap targets of the object currently set to this painter.voidsetSnapToInvisiblePoints(boolean aSnapToInvisiblePoints) Sets whether the other shapes can snap to invisible points of this shape.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.protected voidsetupGraphicsForFill(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called just before filling circles on the specifiedGraphicsobject.protected voidsetupGraphicsForLine(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called just before painting a line on the specifiedGraphicsobject.snapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns the center point of theILcdCircleif it is touched.booleansupportSnap(Graphics aGraphics, ILcdGXYContext aGXYContext) This implementation supports snapping, always returnstrue.Methods inherited from class com.luciad.view.gxy.painter.ALcdGXYAreaPainter
getEditMode, getFillStyle, getLineStyle, getMode, getSelectionMode, setEditMode, setFillStyle, setLineStyle, setMode, setSelectionModeMethods inherited from class com.luciad.view.gxy.ALcdGXYPainter
addPropertyChangeListener, firePropertyChangeEvent, firePropertyChangeEvent, getDisplayName, getGXYPainter, removePropertyChangeListener, setClassTraceOn, setDisplayNameMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.view.gxy.ILcdGXYEditor
getDisplayNameMethods inherited from interface com.luciad.view.gxy.ILcdGXYPainter
getDisplayNameMethods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
-
Field Details
-
OUTLINED
public static final int OUTLINEDDraw theILcdCircleobject as an outlined circle, only the contour of the circle defined by theILcdCircleis painted.- See Also:
-
FILLED
public static final int FILLEDDraw theILcdCircleobject as a filled circle, only the area of the circle defined by theILcdCircleis painted.- See Also:
-
OUTLINED_FILLED
public static final int OUTLINED_FILLEDDraw theILcdCircleobject as an outlined and filled circle, both the area and the contour of the circle defined by theILcdCircleare painted.- See Also:
-
sCursorTranslating
Cursor to return to indicate the object will be translated. -
sCursorResizing
Cursor to return to indicate the object will be reshaped. Direction depends on the shape of the object. -
MIDDLE_OF_BOUNDS
public static final int MIDDLE_OF_BOUNDSConstant value indicating that the anchor point should be chosen in the middle of the bounds, calculated byboundsSFCT.- See Also:
-
FOCUS_POINT
public static final int FOCUS_POINTConstant value indicating that the anchor point should be chosen as the focus point of the circle. If this point cannot be calculated, theMIDDLE_OF_BOUNDSmethod is used to calculate the anchor point.- See Also:
-
CENTER_POINT
public static final int CENTER_POINTConstant value indicating that the anchor point should be chosen as the center point of the circle. If this point cannot be calculated, theMIDDLE_OF_BOUNDSmethod is used to calculate the anchor point.- See Also:
-
-
Constructor Details
-
TLcdGXYCirclePainter
public TLcdGXYCirclePainter()Constructs a defaultTLcdGXYCirclePainterin the default modeOUTLINEDand sets the display name to "Circle".
-
-
Method Details
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen only the informative, warning and error log messages are recorded.- Overrides:
setTraceOnin classALcdGXYPainter- Parameters:
aTraceOn- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrueif tracing is enabled for this class.- Overrides:
isTraceOnin classALcdGXYPainter- Returns:
- true if tracing is enabled for this class, false otherwise.
-
setObject
Sets the object to paint and edit. The object should be an instance of
ILcdCirclefor painting and an instance ofILcd2DEditableCirclefor 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
ILcdCircleand shall throw aClassCastExceptionif it does not.When this painter is used as editor with an object that does not implement the interface
ILcd2DEditableCircle, theeditmethod shall throw the necessary exception.- Specified by:
setObjectin interfaceILcdGXYEditor- Specified by:
setObjectin interfaceILcdGXYPainter- Parameters:
aObject- The object to paint and edit.- Throws:
ClassCastException- when the object does not implementILcdCircle.- See Also:
-
getObject
Returns the object that can currently be painted or edited by this painter/editor.- Specified by:
getObjectin interfaceILcdGXYEditor- Specified by:
getObjectin interfaceILcdGXYPainter- Returns:
- the object that can currently be painted or edited by this painter/editor.
- See Also:
-
setPaintCache
public void setPaintCache(boolean aPaintCache) Turns caching of the representation of the object on or off. Caching greatly reduces the time to paint an object but requires more memory. The representation of an object can only be cached for objects which implementILcdCache. By default, caching is turned on.- Parameters:
aPaintCache- A flag indicating whether to use caching when painting an object.- See Also:
-
getPaintCache
public boolean getPaintCache()Returns whether caching is used when painting this painter's object.- Returns:
trueif caching is used to paint this painter's object,falseotherwise.- See Also:
-
setDisplayCenter
public void setDisplayCenter(boolean aDrawCenter) Deprecated.UsesetDrawCenter(boolean)instead. -
isDisplayCenter
public boolean isDisplayCenter()Deprecated.UseisDrawCenter()instead. -
setDisplayCenterOnSelection
public void setDisplayCenterOnSelection(boolean aDrawCenterWhenSelected) Deprecated.UsesetDrawCenterWhenSelected(boolean)instead. -
isDisplayCenterOnSelection
public boolean isDisplayCenterOnSelection()Deprecated.UseisDrawCenterWhenSelected()instead. -
setDrawCenter
public void setDrawCenter(boolean aDrawCenter) Sets whether the center point of the circle should be displayed or not. The default value of this property isfalse. This setting has an influence on the methodsboundsSFCT,isTouchedand snapping. Regardless of this setting, the center point is always displayed as a handle in HANDLES mode to allow editing.- Parameters:
aDrawCenter- A flag indicating whether the center point should be displayed or not.- See Also:
-
isDrawCenter
public boolean isDrawCenter()Returns whether the center point of the circle should be displayed.- Returns:
- whether the center point of the circle should be displayed.
- See Also:
-
setDrawCenterWhenSelected
public void setDrawCenterWhenSelected(boolean aDrawCenterWhenSelected) Sets whether the center point of the circle should be displayed when it is painted in selected mode or not. The default value of this property istrue. This setting has an influence on the methodsboundsSFCT,isTouchedand snapping. Regardless of this setting, the center point is always displayed as a handle in HANDLES mode to allow editing.- Parameters:
aDrawCenterWhenSelected- A flag indicating whether the center point should be displayed when it is painted in selected mode or not.- See Also:
-
isDrawCenterWhenSelected
public boolean isDrawCenterWhenSelected()Returns whether the center point of the circle should be displayed when it is painted in selected mode.- Returns:
- whether the center point of the circle should be displayed when it is painted in selected mode.
- See Also:
-
setCenterIcon
Sets the icon for the center point's default representation, ifisDrawCenter()returns true.- Parameters:
aIcon- the icon for the center point's default representation- See Also:
-
getCenterIcon
Returns the icon for the center point's default representation, used ifisDrawCenter()returns true.- Returns:
- the icon for the center point's default representation
-
setCenterIconWhenSelected
Sets the icon for the center point's selected representation, ifisDrawCenterWhenSelected()returns true.- Parameters:
aIcon- the icon for the center point's selected representation- See Also:
-
getCenterIconWhenSelected
Returns the icon for the center point's selected representation, used ifisDrawCenterWhenSelected()returns true.- Returns:
- the icon for the center point's selected representation
-
setSnapToInvisiblePoints
public void setSnapToInvisiblePoints(boolean aSnapToInvisiblePoints) Sets whether the other shapes can snap to invisible points of this shape. For anILcdCircleobject, there's only one invisible point, being the center point of the circle when it is not drawn. The default value isfalse.- Parameters:
aSnapToInvisiblePoints- A flag indicating whether snapping to the invisible points is allowed.- See Also:
-
isSnapToInvisiblePoints
public boolean isSnapToInvisiblePoints()Returns whether the painter allows snapping to the invisible points of the shape.- Returns:
- whether the painter allows snapping to the invisible points of the shape.
- See Also:
-
setSnapIcon
Sets the icon that marks snap targets of the object currently set to this painter. This icon is painted when thepaintmethod is called with the render modeILcdGXYPainter.SNAPS.- Parameters:
aSnapIcon- The icon that should be used to paint snap target points.- See Also:
-
getSnapIcon
Returns the icon that is used to paint snap target points of the object set to this painter.- Returns:
- the icon that is used to paint snap target points of the object set to this painter.
- See Also:
-
setMinimumEditDelta
public void setMinimumEditDelta(int aDelta) Sets the minimum pixel distance the input device (a mouse, for example) must move before editing the shape. A larger value ensures that the object easily "snaps" back in place, a small value allows fine editing.- Parameters:
aDelta- the minimum pixel distance the input device should move in either the X or Y direction
-
getMinimumEditDelta
public int getMinimumEditDelta()Returns the minimum pixel distance the input device (a mouse, for example) must move before editing the shape. A larger value ensures that the object easily "snaps" back in place, a small value allows fine editing. The default value is 3 pixels.- Returns:
- the minimum pixel distance the input device should move in either the X or Y direction
-
getAnchorPointLocation
public int getAnchorPointLocation()Returns the location of the anchor point (by default: MIDDLE_OF_BOUNDS).- Returns:
- one of
MIDDLE_OF_BOUNDS,FOCUS_POINT,CENTER_POINT.
-
setAnchorPointLocation
public void setAnchorPointLocation(int aAnchorPointLocation) Sets the preferred anchor point location.- Parameters:
aAnchorPointLocation- one ofMIDDLE_OF_BOUNDS,FOCUS_POINT,CENTER_POINT.
-
setupGraphicsForLine
protected void setupGraphicsForLine(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called just before painting a line on the specified
Graphicsobject. It can be redefined in order to set specificGraphicsproperties likeColor, 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.- Parameters:
aGraphics- The graphics to paint the object on.aRenderMode- The mode to render the object in.aGXYContext- The context to render the object in.
-
setupGraphicsForFill
protected void setupGraphicsForFill(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called just before filling circles on the specified
Graphicsobject. It can be redefined in order to set specificGraphicsproperties likeColor, 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.- Parameters:
aGraphics- The graphics to paint the object on.aRenderMode- The mode to render the object in.aGXYContext- The context to render the object in.
-
paint
Displays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.This implementation will use the specified render mode to determine how the object needs to be rendered. In
ILcdGXYPainter.CREATING,ILcdGXYPainter.RESHAPINGandILcdGXYPainter.TRANSLATINGmode, 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.- Specified by:
paintin interfaceILcdGXYPainter- Parameters:
aGraphics- The graphics to paint the object on.aRenderMode- The mode to render the object in.aGXYContext- The context to render the object in.
-
appendAWTPath
Description copied from interface:ILcdGXYPathPainterAppends a discretized representation in view coordinates to the given path.- Specified by:
appendAWTPathin 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:ILcdGXYPathPainterAppends a discretized representation in world coordinates to the given path.- Specified by:
appendGeneralPathin 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
-
edit
This implementation edits the
ILcdCircleobject set to the painter. The object needs to implement the interfaceILcd2DEditableCircleotherwise aClassCastExceptionwill be thrown.In
ILcdGXYEditor.TRANSLATEDrender mode, theILcdCircleobject is edited as follows:- While touching the center point, the object gets translated as a whole.
- While touching the contour, the object gets translated as a whole.
- While touching the interior and the selected object is painted as filled, the object gets translated as a whole.
In
ILcdGXYEditor.RESHAPEDrender mode, theILcdCircleobject is edited as follows:- While touching the contour, the contour will move while enlarging or reducing the radius of the circle.
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.
- Specified by:
editin interfaceILcdGXYEditor- Parameters:
aGraphics- The graphics to edit the object on.aRenderMode- The mode to render the object in.aGXYContext- The context to render the object in.- Returns:
- true if the object has changed when this method returns, false otherwise.
- Throws:
ClassCastException- if the painter's object does not implementILcd2DEditableCircle.- See Also:
-
paintEditingLabels
public void paintEditingLabels(Graphics aGraphics, ILcdCircle aCircle, int aRenderMode, ILcdGXYContext aGXYContext) Called by the
paintmethod when editing anILcd2DEditableCircle. 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.- Parameters:
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.
-
getCreationClickCount
public int getCreationClickCount()Returns2as the number of required user interactions.- Specified by:
getCreationClickCountin interfaceILcdGXYEditor- Returns:
2.
-
isTouched
Depending on the rendering mode, returns whether the contour, the center point, or the interior of the circle is touched. Note that the center point can only be touched if it is painted.This implementation will use the specified
paint modeto determine how the object is represented. Depending on the representation of theILcdCircleobject, 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.- Specified by:
isTouchedin interfaceILcdGXYPainter- Parameters:
aGraphics- The graphics to paint the object on.aRenderMode- The mode to render the object in.aGXYContext- The context in which the object is rendered.- Returns:
- the contour, the center point, or the interior of the circle is touched.
- See Also:
-
boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException Computes the bounds of the representation of anILcdCirclein AWT coordinates.- Specified by:
boundsSFCTin interfaceILcdGXYPainter- Parameters:
aGraphics- The graphics to paint the object on.aRenderMode- The mode to render the object in.aGXYContext- The context to render the object in.aBoundsSFCT- The bounds to update.- Throws:
TLcdNoBoundsException- if no bounds can be determined for the representation of the object. This can 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:
-
setModelModelTransformationClass
Sets the transformation class that should be used when snapping to points that are defined in a different reference than the reference of this painter's object. The transformation will be instantiated and setup to transform points from the model of the snap layer to points in the model which contains the current object of this painter. The default value is the
TLcdGeoReference2GeoReferenceclass.This property allows the painter to snap to points defined in a different model reference.
Instances of this specified class should implement
ILcdModelModelTransformation, otherwise the snapping functionality to different model references will not work.- Parameters:
aModel2ModelTransformationClass- the transformation used as described above.
-
acceptSnapTarget
Determines whether a snap target should be accepted or not. A snap target is accepted if the following conditions are met:
- The current object is an
ILcd2DEditableCircle. - The snap target is an
ILcdPointwhose coordinates are expressed in the same coordinate system as the current objects coordinate system or the model to model transformation can transform the point to a point in the objects coordinate system. - The snap object is not the center point of the current object. If this is wanted, override the function and return true if the snap object is the center point.
- The center point is touched or the radius is
0. This enables snapping when creating a circle.
- Specified by:
acceptSnapTargetin interfaceILcdGXYEditor- Parameters:
aGraphics- the graphics on which the snap target should be checked.aGXYContext- the context in which the snap target should be checked.- Returns:
trueif the above conditions are met,falseotherwise.- See Also:
- The current object is an
-
supportSnap
This implementation supports snapping, always returnstrue.- Specified by:
supportSnapin interfaceILcdGXYPainter- Overrides:
supportSnapin classALcdGXYPainter- Parameters:
aGraphics- the graphics on which is worked.aGXYContext- the context of the snapping.- Returns:
true.
-
snapTarget
Returns the center point of the
ILcdCircleif it is touched. If it was not touched,nullwill be returned. Note that the center point is only returned if the center point is drawn (seeisDrawCenter()) or when snapping to invisible points is enabled (seeisSnapToInvisiblePoints()).- Specified by:
snapTargetin interfaceILcdGXYPainter- Overrides:
snapTargetin classALcdGXYPainter- Parameters:
aGraphics- the graphics on which is worked.aGXYContext- the context of the snapping.- Returns:
- the center point of the
ILcdCircleif it is touched,nullotherwise. - See Also:
-
getCursor
Returns aCursorthat clarifies the render mode and context this painter is operating in. When no specificCursoris required,nullis returned.- Specified by:
getCursorin interfaceILcdGXYPainter- Overrides:
getCursorin classALcdGXYPainter- Parameters:
aGraphics- The graphics on which the object is painted.aRenderMode- The mode to render the object in.aGXYContext- The context in which the object is rendered.- Returns:
- a cursor to indicate the type of operating mode and context. Returns
nullif no particular cursor is required.
-
anchorPointSFCT
public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException Description copied from class:ALcdGXYPainterImplementsILcdGXYPainter.anchorPointSFCT.aPointSFCTwill be set to the center of the bounds calculated by boundsSFCT.- Specified by:
anchorPointSFCTin interfaceILcdGXYPainter- Overrides:
anchorPointSFCTin classALcdGXYPainter- Parameters:
aGraphics- the Graphics on which the representation of the object is paintedaMode- the mode the object is painted in (see class documentation)aGXYContext- the context for which the representation of the object is painted. It contains amongst others the transformations from model to world and world to view.aPointSFCT- the point that has to be moved to the location of the anchor point of the representation of the object. This point must not be taken into account when the method has thrown a TLcdNoBoundsException.- Throws:
TLcdNoBoundsException- if no anchor point can be determined for the representation of the object. This can be when the object does not have a representation in the given context, for example when it is located in a part of the world which is not visible in the projection as set in the views world reference.- See Also:
-
getGXYEditor
Returns this instance as editor for editing the specifiedObject. If thisObjectis not the same as theObjectset to this painter, thesetObject(Object)method is called to update the object set to the painter.- Specified by:
getGXYEditorin interfaceILcdGXYEditorProvider- Parameters:
aObject- the object to be edited.- Returns:
- this instance as editor for editing the specified
Object.
-
setPointFormat
Set the
Formatused for formatting the coordinates of the center point as aString. AnILcdPointrepresenting the center of the circle is given to one of theformatmethods of thejava.text.Format, which then converts it to aStringthat is displayed on the map during translate operations.By default, a
Formatthat uses thetoStringmethod is used.- Parameters:
aPointFormat- the Format used for formatting the coordinates of the center point as a String.- See Also:
-
getPointFormat
Returns the format used when displaying the center point while it is being moved.- Returns:
- the format used when displaying the center point while it is being moved.
- See Also:
-
setDistanceFormat
Set the distanceFormatto use for formatting the circle radius in the editing label. ANumberrepresenting the length of the radius (same unit asILcdCircle.getRadius) is given to one of theformatmethods of thejava.text.Format, which then converts it to aStringthat 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.
- Parameters:
aDistanceFormat- the distance format to use for formatting the circle radius in the editing label.- See Also:
-
getDistanceFormat
Returns the format used when displaying the circle radius while it is being reshaped.- Returns:
- the format used when displaying the circle radius while it is being reshaped.
- See Also:
-
setEditingLabelFont
Sets the font that will be used to display the editing labels. By default, the font family is "Dialog" with a size of 10 pixels.- Parameters:
aEditingLabelFont- the font used to display the editing labels.- See Also:
-
getEditingLabelFont
Returns the font used when displaying the editing labels.- Returns:
- the font used when displaying the editing labels.
- See Also:
-
setEditingLabelForeground
Sets the foreground color (text color) that will be used to display the editing labels. The default value of this property isColor.black.- Parameters:
aEditingLabelForeground- the foreground color (text color) used to display the editing labels.- See Also:
-
getEditingLabelForeground
Returns the foreground color (text color) used when displaying the editing labels.- Returns:
- the foreground color (text color) used when displaying the editing labels.
- See Also:
-
setEditingLabelBackground
Sets the background color that will be used to display the editing labels. The default value of this property isColor.lightGray.- Parameters:
aEditingLabelBackground- the background color used to display the editing labels.- See Also:
-
getEditingLabelBackground
Returns the background color used when displaying the editing labels.- Returns:
- the background color used when displaying the editing labels.
- See Also:
-
setEditingLabelFilled
public void setEditingLabelFilled(boolean aEditingLabelFilled) Sets whether the frame around an editing labels needs to be filled or not. The default value of this property isfalse.- Parameters:
aEditingLabelFilled- the flag indicating whether the frame around an editing label is filled.- See Also:
-
isEditingLabelFilled
public boolean isEditingLabelFilled()Returns whether the frame around an editing label is filled or not.- Returns:
- whether the frame around an editing label is filled or not.
- See Also:
-
setEditingLabelFrame
public void setEditingLabelFrame(boolean aEditingLabelFrame) Sets whether the frame around an editing labels needs to be drawn or not. The default value of this property isfalse.- Parameters:
aEditingLabelFrame- the flag indicating whether the frame around an editing label is drawn.- See Also:
-
isEditingLabelFrame
public boolean isEditingLabelFrame()Returns whether the frame around an editing label is drawn or not.- Returns:
- whether the frame around an editing label is drawn or not.
- See Also:
-
setEditingLabel
public void setEditingLabel(boolean aEditingLabel) Sets whether the editing labels should be drawn or not. The labels display the location of the center point of the circle when dragging it, or the radius of circle when changing its size. The default value of this property isfalse.- Parameters:
aEditingLabel- the flag indicating whether the frame around an editing label is drawn.- See Also:
-
isEditingLabel
public boolean isEditingLabel()Returns whether the editing labels are drawn or not.- Returns:
- whether the editing labels are drawn or not.
- See Also:
-
clone
Description copied from interface:ILcdCloneableMakes
When for example extending fromObject.clone()public.java.lang.Object, it can be implemented like this:public Object clone() { try { return super.clone(); } catch ( CloneNotSupportedException e ) { // Cannot happen: extends from Object and implements Cloneable (see also Object.clone) throw new RuntimeException( e ); } }- Specified by:
clonein interfaceILcdCloneable- Specified by:
clonein interfaceILcdGXYEditorProvider- Specified by:
clonein interfaceILcdGXYPainterProvider- Overrides:
clonein classALcdGXYAreaPainter- Returns:
- a clone of this painter provider.
- See Also:
-
isDrawCenter()instead.