Class TLcdGXYPointListPainter
- All Implemented Interfaces:
ILcdCloneable,ILcdPropertyChangeSource,ILcdGXYEditor,ILcdGXYEditorProvider,ILcdGXYPainter,ILcdGXYPainterProvider,ILcdGXYPathPainter,Serializable,Cloneable
- Direct Known Subclasses:
TLcdGXYAISPointListPainter,TLcdGXYRoundedPointListPainter,TLcdMagneticNorthGXYPainter,TLcdPOLPainter,TLcdVPFPointListPainter
ILcdPointList objects (including ILcdComplexPolygon) and enables
visual editing of ILcd2DEditablePointList objects in an ILcdGXYView.
Painting an ILcdPointList
Body
This painter provides five paint modes to paint the body of an ILcdPointList. The mode
property can be set using the method setMode and allows the point list to be painted
as:
|
|
|
||
A set of points (POINT) |
|
A polyline (POLYLINE) |
||
| |
||||
|
|
|
|
|
An outlined polygon (POLYGON) |
|
A filled polygon (FILLED) |
|
A filled and outlined polygon (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. These properties are not taken into account when an object needs to
be painted in the paint mode POINT or POLYLINE.
Handles
Every point of the point list is regarded as a handle of the point list. The following image clarifies the handle location, the points are represented by red points.
Note that, when the paint mode is set to
POINT, the points are more than only a
handle. They are also the only visible part of the shape and should therefore always be painted
independent of the rendering mode.
Snap targets
Every point of the point list can be returned on the condition that it is touched, see
getTouchedPoint. The point returned as
a snap target is highlighted with the snapIcon.
Styling options
The visualization of the ILcdPointList 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 ILcdPointList in a view
Anchor point of an ILcdPointList
When the ILcdPointList is also an ILcdShape, the anchor point is located at
the focus point of the shape. Otherwise the anchor point is located at the center point of the point list.
When is an ILcdPointList touched
Depending on the paint mode, a point list is touched when either
a point of the point list, a segment of the point list, or the internal area of the point list is touched.
The methods
getTouchedPoint,
getTouchedSegment
and
insidePolygon
provide information
on which part of the point list is being touched.
Visually editing and creating an ILcd2DEditablePointList
Modifying an ILcd2DEditablePointList
This editor provides the following edit functionality for the different render modes:
RESHAPED: a point is added to the point list or removed from the point list, depending on whether a point or a segment of the point list is touched.TRANSLATED: a single point or the whole point list is translated, depending on whether a point or a segment is touched. The images below illustrate the editing behavior. The small black arrow indicates the path of the mouse cursor while translating the point list.
Moving a point.
Moving a segment.
Moving the interior.
Creating an ILcd2DEditablePointList
The number of points in a point list is not limited. When initializing a point list via interaction
through the view, a new point will be appended to the point list when calling
edit with
either START_CREATION, CREATING or END_CREATION mode.
Accepted snap targets
All points are accepted as snap target as long as:
- the point can be transformed to the reference of the
ILcdPointListobject with themodel to model transformation, - the point is not the last point of the
ILcdPointListobject 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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDeprecated.static final intConstant value indicating that the anchor point should be chosen as the location determined by the average values of the x and y coordinates.static final intConstant value indicating that the anchor point should be chosen at the end of the curve if ILcdCurve is implemented.static final intDraw theILcdPointListobject as a filled polygon, only the area of the polygon defined by theILcdPointListis painted.static final intConstant value indicating that the anchor point should be chosen at the location of the first possible point.static final intConstant value indicating that the anchor point should be chosen as the focus point of the point list if it implements ILcdShape.static final intConstant value indicating that the anchor point should be chosen inside the polygon.static final intConstant value indicating that the anchor point should be chosen at the location of the point with index ( ( getPointCount() - 1 ) / 2 ).static final intConstant value indicating that the anchor point should be chosen in the middle of the bounds, calculated byboundsSFCT.static final intConstant value indicating that the anchor point should be chosen at the middle of the curve if ILcdCurve is implemented.static final intDeprecated.useOUTLINED_FILLEDinsteadstatic final intDraw theILcdPointListobject as an outlined and filled polygon, both the area and the contour of the polygon defined by theILcdPointListare painted.static final intDraw theILcdPointListas a list of points.static final intDraw theILcdPointListobject as an outlined polygon, only the contour of the polygon defined by theILcdPointListis painted.static final intDraw theILcdPointListas a polyline.static final intConstant value indicating that the anchor point should be chosen at the start of the curve if ILcdCurve is implemented.Fields inherited from class com.luciad.view.gxy.painter.ALcdGXYAreaPainter
OUTLINEDFields 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
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a defaultTLcdGXYPointListPainterin the default modePOLYLINEand, as display name, the result of the methodgetModeName()is used.TLcdGXYPointListPainter(int aDefaultMode) Constructs aTLcdGXYPointListPainterin the specified default mode and, as display name, the result of the methodgetModeName()is used.TLcdGXYPointListPainter(String aDisplayName) Constructs a defaultTLcdGXYPointListPainterin the default modePOLYLINEand with the given display name.TLcdGXYPointListPainter(String aDisplayName, int aDefaultMode) Constructs aTLcdGXYPointListPainterin the specified default mode and with the given display name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptSnapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns whether the object set to the editor can be edited so that (part of) the object snaps to the object passed as snap target in the context.voidanchorPointSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, Point aPointSFCT) Moves the specifiedaPointSFCTto the anchor point of theILcdPointList.voidappend2DPoint(ILcd2DEditablePointList a2DEditablePointList, double aX, double aY, int aRenderMode, ILcdGXYContext aGXYContext) Appends a point to the end of the specifiedILcd2DEditablePointList.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) Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object in the given mode taking into account the given context.clone()MakesObject.clone()public.booleanedit(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) This implementation edits the retrieved ILcdPointList.intReturns the location of the anchor point (by default: FOCUS_POINT).intReturns the number of user interactions required to complete the initialization of anILcdPointListobject set to this editor.getCursor(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Returns aCursorthat clarifies the render mode and context this painter is operating in.booleanDeprecated.useALcdGXYAreaPainter.getSelectionMode()instead.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.intgetMode()Returns the default mode to decide how to paint anILcdPointList.protected StringReturns the current default paint mode as aString.Returns 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 icon that is used to paint snap target points of the object set to this painter.intgetTouchedPoint(ILcdGXYContext aGXYContext) Returns the index of the point in theILcdPointListobject that has been touched according to the screen (x,y) coordinates passed in theILcdGXYContext, or-1if none of the points were touched.final intgetTouchedSegment(ILcdGXYPen aPen, int aX, int aY, boolean includesHotPoints, ILcdModelXYWorldTransformation aMWT, ILcdGXYViewXYWorldTransformation aVWT) Deprecated.usegetTouchedSegment(Graphics, int, ILcdGXYContext)insteadintgetTouchedSegment(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Returns the index of the segment in theILcdPointListobject that has been touched according to the coordinates in the context, or-1if none of the segments were touched.Returns how the interior of self-intersecting polygons is determined.voidinsert2DPoint(ILcd2DEditablePointList a2DEditablePointList, int aIndex, double aX, double aY, int aRenderMode, ILcdGXYContext aGXYContext) Inserts a point at the given index into the specifiedILcd2DEditablePointList.booleaninsidePolygon(ILcdGXYContext aGXYContext) Checks whether the current position of the mouse is on the inside of the point list set to this painter as if it was rendered as in polygon mode.booleanReturns whether this painter only allows moving the shape as a whole.booleanisTouched(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Depending on the render mode and paint mode, returns whether one of the handles (the source point list), the painted point list or the interior of the point list is touched.booleanDeprecated.This method has been deprecated.protected booleanlinkToSnapTarget(Graphics aGraphics, ILcd2DEditablePointList aPointList, int aPointIndex, int aRenderMode, ILcdGXYContext aGXYContext) Edits the specifiedILcdPointListso that, if the snap target is accepted, the point (specified by its index) snaps to this snap target.voidmove2DPoint(ILcd2DEditablePointList a2DEditablePointList, int aIndex, double aX, double aY, int aRenderMode, ILcdGXYContext aGXYContext) Moves the point at the given index in the specifiedILcd2DEditablePointListto the given point in the 2D space.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.voidremovePointAt(ILcd2DEditablePointList a2DEditablePointList, int aIndex, int aRenderMode, ILcdGXYContext aGXYContext) Removes the point at the given index from the specifiedILcd2DEditablePointList.protected intretrieveMinimalPointcount(int aPainterMode) Returns the number of points theILcdPointListshould retain when removing points.protected ILcdPointListretrievePointList(Object aObject) Extracts anILcdPointListfrom the given object.voidsetAnchorPointLocation(int aAnchorPointLocation) Sets the preferred anchor point location.voidsetFillSelection(boolean aFillSelection) Deprecated.useALcdGXYAreaPainter.setSelectionMode(int)instead.voidsetMinimumEditDelta(int aDelta) Sets the minimum pixel distance the input device (a mouse, for example) must move before editing the shape.voidsetMode(int aDefaultMode) Sets the default mode to decide how to paint anILcdPointList.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.voidsetMoveOnlyOnEdit(boolean aMoveOnlyOnEdit) Sets whether this painter only allows moving the shape as a whole.voidSets the object to paint or edit.voidsetPaintCache(boolean aPaintCache) Turns caching of the representation of the object on or off.voidsetSnapIcon(ILcdIcon aSnapIcon) Sets the icon that marks snap targets of the object currently set to this painter.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.protected voidsetupGraphicsForFill(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called just before filling polygons on the specifiedGraphicsobject.protected voidsetupGraphicsForLine(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called just before painting a line on the specifiedGraphicsobject.protected voidsetupGraphicsForPoint(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called just before painting points on the specifiedGraphicsobject.voidsetWindingRule(TLcdAWTPath.WindingRule aWindingRule) Specifies how the interior of self-intersecting polygons is determined.snapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns a point of theILcdPointListobject if the point is touched.booleansupportSnap(Graphics aGraphics, ILcdGXYContext aGXYContext) Supports snapping when theILcdPointListobject set to this painter contains at least one point.voidtranslate2D(ILcd2DEditablePointList a2DEditablePointList, double aDeltaX, double aDeltaY, int aRenderMode, ILcdGXYContext aGXYContext) Translates all the points of the specifiedILcd2DEditablePointListfrom their current positions over the given translation vector in the 2D space.voidtranslate2DPoint(ILcd2DEditablePointList a2DEditablePointList, int aIndex, double aDeltaX, double aDeltaY, int aRenderMode, ILcdGXYContext aGXYContext) Translates the point at the given index in the specifiedILcd2DEditablePointListfrom its current position over the given translation vector in the 2D space.Methods inherited from class com.luciad.view.gxy.painter.ALcdGXYAreaPainter
getEditMode, getFillStyle, getLineStyle, getSelectionMode, setEditMode, setFillStyle, setLineStyle, 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
-
POLYGON
public static final int POLYGONDraw theILcdPointListobject as an outlined polygon, only the contour of the polygon defined by theILcdPointListis painted. This constant has the same value as the constantALcdGXYAreaPainter.OUTLINED.- See Also:
-
FILLED
public static final int FILLEDDraw theILcdPointListobject as a filled polygon, only the area of the polygon defined by theILcdPointListis painted.- Since:
- 1.4
- See Also:
-
OUTLINED_FILLED
public static final int OUTLINED_FILLEDDraw theILcdPointListobject as an outlined and filled polygon, both the area and the contour of the polygon defined by theILcdPointListare painted.- Since:
- 1.4
- See Also:
-
POINT
public static final int POINTDraw theILcdPointListas a list of points.- See Also:
-
POLYLINE
public static final int POLYLINEDraw theILcdPointListas a polyline.- See Also:
-
AREA
public static final int AREADeprecated.useFILLEDinsteadDraw theILcdPointListobject as a filled polygon, only the area of the polygon defined by theILcdPointListis painted.- See Also:
-
OUTLINE_AREA
public static final int OUTLINE_AREADeprecated.useOUTLINED_FILLEDinsteadDraw theILcdPointListobject as an outlined and filled polygon, both the area and the contour of the polygon defined by theILcdPointListare painted.- See Also:
-
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 point list if it implements ILcdShape. If it does not implement ILcdShape, theCOORDINATES_AVERAGEmethod is used.- See Also:
-
COORDINATES_AVERAGE
public static final int COORDINATES_AVERAGEConstant value indicating that the anchor point should be chosen as the location determined by the average values of the x and y coordinates. If this method cannot return an anchor point, theMIDDLE_OF_BOUNDSmethod is used.- See Also:
-
FIRST_POSSIBLE_POINT
public static final int FIRST_POSSIBLE_POINTConstant value indicating that the anchor point should be chosen at the location of the first possible point. If the first point is invalid, then the second one is used, and so on... If no valid anchor point can be found, theMIDDLE_OF_BOUNDSmethod is used.- See Also:
-
MEDIAN_POINT
public static final int MEDIAN_POINTConstant value indicating that the anchor point should be chosen at the location of the point with index ( ( getPointCount() - 1 ) / 2 ). If no valid anchor point can be found, theMIDDLE_OF_BOUNDSmethod is used.- See Also:
-
MIDDLE_OF_CURVE
public static final int MIDDLE_OF_CURVEConstant value indicating that the anchor point should be chosen at the middle of the curve if ILcdCurve is implemented. If ILcdCurve is not implemented, or if no valid anchor point can be found, theMIDDLE_OF_BOUNDSmethod is used.- See Also:
-
START_OF_CURVE
public static final int START_OF_CURVEConstant value indicating that the anchor point should be chosen at the start of the curve if ILcdCurve is implemented. If ILcdCurve is not implemented, or if no valid anchor point can be found, theMIDDLE_OF_BOUNDSmethod is used.- See Also:
-
END_OF_CURVE
public static final int END_OF_CURVEConstant value indicating that the anchor point should be chosen at the end of the curve if ILcdCurve is implemented. If ILcdCurve is not implemented, or if no valid anchor point can be found, theMIDDLE_OF_BOUNDSmethod is used.- See Also:
-
INSIDE_POLYGON
public static final int INSIDE_POLYGONConstant value indicating that the anchor point should be chosen inside the polygon. This method works when this painter uses the POLYGON painting mode. If no anchor point could be calculated, theMIDDLE_OF_BOUNDSmethod is used instead.- See Also:
-
-
Constructor Details
-
TLcdGXYPointListPainter
public TLcdGXYPointListPainter()Constructs a defaultTLcdGXYPointListPainterin the default modePOLYLINEand, as display name, the result of the methodgetModeName()is used. -
TLcdGXYPointListPainter
Constructs a defaultTLcdGXYPointListPainterin the default modePOLYLINEand with the given display name.- Parameters:
aDisplayName- The display name for this painter, used for textual representation of this painter.
-
TLcdGXYPointListPainter
public TLcdGXYPointListPainter(int aDefaultMode) Constructs a
TLcdGXYPointListPainterin the specified default mode and, as display name, the result of the methodgetModeName()is used.The default paint mode should be one of the following values:
POINT,POLYLINE,POLYGON,FILLED,OUTLINED_FILLED.- Parameters:
aDefaultMode- The default paint mode to paintILcdPointListobjects.- See Also:
-
TLcdGXYPointListPainter
Constructs a
TLcdGXYPointListPainterin the specified default mode and with the given display name.The default paint mode should be one of the following values:
POINT,POLYLINE,POLYGON,FILLED,OUTLINED_FILLED.- Parameters:
aDisplayName- The display name for this painter, used for textual representation of this painter.aDefaultMode- The default paint mode to paintILcdPointListobjects.- See Also:
-
-
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 or edit. This painter needs anILcdPointListfor painting and (optionally) anILcd2DEditablePointListfor editing. You can change how theILcdPointListis derived from the object by overridingretrievePointList(java.lang.Object).- Specified by:
setObjectin interfaceILcdGXYEditor- Specified by:
setObjectin interfaceILcdGXYPainter- Parameters:
aObject- The object to paint and edit.- Throws:
ClassCastException- when the object does not implementILcdPointList.- See Also:
-
retrievePointList
Extracts anILcdPointListfrom the given object. The default implementation simply casts the object to anILcdPointList. Re-define this method to obtain theILcdPointListby other means.- Returns:
- the point list associated with the given object
- Throws:
ClassCastException- when the point list cannot be derived- Since:
- 2022.0
- 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:
-
setMode
public void setMode(int aDefaultMode) Sets the default mode to decide how to paint anILcdPointList. The point list can be painted as a set of individual points (POINT), as a polyline (POLYLINE), as an outlined polygon (POLYGON), as a filled polygon (FILLED), or as a filled and outlined polygon (OUTLINED_FILLED). As a side effect, this method will set the display name and initialize the line style if no line style was defined. The display name is retrieved using the methodgetModeName(). This will also have an effect on the behavior ofgetCreationClickCount(),isTouched(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext), andedit(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext).- Overrides:
setModein classALcdGXYAreaPainter- Parameters:
aDefaultMode- The default paint mode to paintILcdPointListobjects.- See Also:
-
getMode
public int getMode()Returns the default mode to decide how to paint anILcdPointList. The object can be painted as a set of individual points (POINT), as a polyline (POLYLINE), as an outlined polygon (POLYGON), as a filled polygon (FILLED), or as a filled and outlined polygon (OUTLINED_FILLED).- Overrides:
getModein classALcdGXYAreaPainter- Returns:
- The default paint mode to paint
ILcdPointListobjects. - 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.
-
isMoveOnlyOnEdit
public boolean isMoveOnlyOnEdit()Returns whether this painter only allows moving the shape as a whole. If false, other editing operations will be available as well.- Returns:
- whether this painter allows only moving the shape while editing.
- See Also:
-
setMoveOnlyOnEdit
public void setMoveOnlyOnEdit(boolean aMoveOnlyOnEdit) Sets whether this painter only allows moving the shape as a whole. If false, other editing operations will be available as well. By default, this value is set tofalse.- Parameters:
aMoveOnlyOnEdit- when set totruethis painter can only move aILcdPointListwhen editing and not change its shape.- See Also:
-
setFillSelection
public void setFillSelection(boolean aFillSelection) Deprecated.useALcdGXYAreaPainter.setSelectionMode(int)instead.Determines whether the painter will fill the polygon when it is selected. This property is only valid when the default paint mode property is eitherPOLYGON,FILLEDorOUTLINED_FILLED. The default isfalse.- Parameters:
aFillSelection- A flag indicating whether to paint the object filled when selected.- See Also:
-
getFillSelection
public boolean getFillSelection()Deprecated.useALcdGXYAreaPainter.getSelectionMode()instead.Returns whether the object is painted filled in the render modeILcdGXYPainter.SELECTED.- Returns:
- whether the object is painted filled in the render mode
ILcdGXYPainter.SELECTED. - 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: FOCUS_POINT). -
setAnchorPointLocation
public void setAnchorPointLocation(int aAnchorPointLocation) Sets the preferred anchor point location.- Parameters:
aAnchorPointLocation- one ofMIDDLE_OF_BOUNDS,COORDINATES_AVERAGE,FOCUS_POINT,FIRST_POSSIBLE_POINT,MEDIAN_POINT,MIDDLE_OF_CURVE,START_OF_CURVE,END_OF_CURVE,INSIDE_POLYGON.
-
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.
-
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:
-
getWindingRule
Returns how the interior of self-intersecting polygons is determined. This affects isTouched behavior and the fills.- Returns:
- the winding rule to use
-
setWindingRule
Specifies how the interior of self-intersecting polygons is determined. This affects isTouched behavior and the fills.- Parameters:
aWindingRule- the winding rule to use
-
getModeName
Returns the current default paint mode as aString. The methodsetMode(int)calls this method to adjust the display name of this instance depending on new mode property.- Returns:
- the current default paint mode as a
String.
-
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 polygons 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.
-
setupGraphicsForPoint
protected void setupGraphicsForPoint(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext) Called just before painting points on the specified
Graphicsobject. It can be redefined in order to set specificGraphicsproperties likeColor, etc...This implementation calls
ILcdGXYPainterStyle.setupGraphics(Graphics, Object, int, ILcdGXYContext)on the lineStyle property if a line style has been set to this instance.Note that points are painted using the method
ILcdGXYPen.drawHotPoint(com.luciad.shape.ILcdPoint, com.luciad.transformation.ILcdModelXYWorldTransformation, com.luciad.view.gxy.ILcdGXYViewXYWorldTransformation, java.awt.Graphics). Therefore changes should be applied to the pen, not the graphics, since those are usually disregarded by the pen.- 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.
-
anchorPointSFCT
public void anchorPointSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException Moves the specified
aPointSFCTto the anchor point of theILcdPointList. This implementation first finds an anchor point in model coordinates and then transforms it into a view point.See
getAnchorPointLocation()on how the anchor point is calculated.- Specified by:
anchorPointSFCTin interfaceILcdGXYPainter- Overrides:
anchorPointSFCTin classALcdGXYPainter- 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.aPointSFCT- The point that needs to be updated.- Throws:
TLcdNoBoundsException- if theILcdPointListobject doesn't have a valid anchor point, e.g. if it is always invisible in the current projection.- See Also:
-
paint
Displays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.This implementation will use the specified render mode to determine how the object needs to be rendered. In
ILcdGXYPainter.TRANSLATINGmode, theILcdPointListobject is rendered as if all points were moved along the same distance in view coordinates as passed in the context. InILcdGXYPainter.RESHAPINGmode, the object is painted with one point moved as defined in the context. InILcdGXYPainter.CREATINGmode, the object is painted as if the current mouse position is the last point of theILcdPointList. In the above render modes, the object is painted using the edit paint mode (ALcdGXYAreaPainter.getEditMode()).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 (getMode()) is used.Note: when the paint mode is set to
POINTorPOLYLINE, the objects will be painted as, respectively points and polylines. The selectionMode and editMode property are not taken into account when finding the mode in which the object should be painted.- 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
-
isTouched
Depending on the render mode and paint mode, returns whether one of the handles (the source point list), the painted point list or the interior of the point list is touched.This implementation will use the specified
paint modeto determine how the object is represented. Depending on the representation of theILcdPointListobject, the object is touched when- the painted point list is touched,
- its interior space is touched when the paint mode is
FILLED, - the source point list is touched when the render mode is
ILcdGXYPainter.SELECTED.
The method
insidePolygondetermines whether the current mouse position is located inside theILcdPointListobject or not.It is not possible to derive from this method which part of the point list has been touched. To determine which part of the
ILcdPointListobject is touched, the methodsgetTouchedPointandgetTouchedSegmentwill return the required information.- 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:
- whether one of the points, segments or the interior of the point list is touched.
- See Also:
-
insidePolygon
Checks whether the current position of the mouse is on the inside of the point list set to this painter as if it was rendered as in polygon mode. This method is called byisTouchedwhen the painter is configured to render the point list in FILLED or OUTLINED_FILLED mode.- Parameters:
aGXYContext- the context that contains a.o. the mouse position and the transformations.- Returns:
- true if the mouse is positioned on the inside of the point list as if it is rendered as in polygon mode. False otherwise.
-
getTouchedPoint
Returns the index of the point in the
ILcdPointListobject that has been touched according to the screen (x,y) coordinates passed in theILcdGXYContext, or-1if none of the points were touched.If more than one point of the
ILcdPointListobject is touched, the index of the one with the smaller index is returned.- Parameters:
aGXYContext- The context in which the object is rendered.- Returns:
- the index of the point in the
ILcdPointListobject that was touched,-1if none of the points were touched.
-
getTouchedSegment
Returns the index of the segment in the
ILcdPointListobject that has been touched according to the coordinates in the context, or-1if none of the segments were touched.If more than one segment of the
ILcdPointListobject is touched, the index of the one with the smaller index is returned.- 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 index of the segment of the point list painted that was touched, -1 if none was touched.
-
getTouchedSegment
public final int getTouchedSegment(ILcdGXYPen aPen, int aX, int aY, boolean includesHotPoints, ILcdModelXYWorldTransformation aMWT, ILcdGXYViewXYWorldTransformation aVWT) Deprecated.usegetTouchedSegment(Graphics, int, ILcdGXYContext)insteadReturns the index of the segment in the
ILcdPointListobject that has been touched according to the specified screen (aX,aY) coordinates, or-1if none of the segments were touched.If more than one segment of the
ILcdPointListobject is touched, the index of the one with the smaller index is returned.- Parameters:
aPen- the pen used to paint the segments on the screen.aX- the x screen coordinateaY- the y screen coordinateincludesHotPoints- whether or not to include hot points.aMWT- the model to world transformation to use to transform the world coordinate to a model coordinate.aVWT- the view to world transformation to use to transform a view (screen) coordinate to a world coordinate.- Returns:
- the index of the segment of the point list painted that was touched, -1 if none was touched.
-
boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aRenderMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object in the given mode taking into account the given context.If this method returns without exception the bounds argument must encompass the representation of the object. A point outside the bounds will not be contained within the painted object.
The bounds returned in this method can be seen as the equivalent in the view space of the bounds in the model space for
ILcdBoundedobjects.- 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 happen when the object does not have a representation in the given context, for example when it is located in a part of the world which is not visible in the current view.- See Also:
-
supportSnap
Supports snapping when the
ILcdPointListobject set to this painter contains at least one point.- Specified by:
supportSnapin interfaceILcdGXYPainter- Overrides:
supportSnapin classALcdGXYPainter- Parameters:
aGraphics- the graphics on which is worked.aGXYContext- the context of the snapping.- Returns:
trueif theILcdPointListobject contains at least one point,falseotherwise.
-
snapTarget
Returns a point of the
ILcdPointListobject if the point is touched. If no point was touched,nullwill be returned.- Specified by:
snapTargetin interfaceILcdGXYPainter- Overrides:
snapTargetin classALcdGXYPainter- Parameters:
aGraphics- the graphics on which is worked.aGXYContext- the context of the snapping.- Returns:
- a point of the
ILcdPointListobject if the point 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.
-
removePointAt
public void removePointAt(ILcd2DEditablePointList a2DEditablePointList, int aIndex, int aRenderMode, ILcdGXYContext aGXYContext) Removes the point at the given index from the specifiedILcd2DEditablePointList.- Parameters:
a2DEditablePointList- the point list to remove a point from.aIndex- a valid index in the list ofILcdPointobjects.aRenderMode- a mode which in this implementation isn't taken into account.aGXYContext- a context which in this implementation isn't taken into account.
-
retrieveMinimalPointcount
protected int retrieveMinimalPointcount(int aPainterMode) Returns the number of points the
ILcdPointListshould retain when removing points. In thePOINTpaint mode, this is1, in thePOLYLINEpaint mode, it is2and in the different polygon paint modes, the minimal point count is3.The method is used in the
editmethod to prevent the user from removing too many points from theILcdPointList.- Parameters:
aPainterMode- the painter mode for which the point count is wanted.- Returns:
- the number of points the
ILcdPointListshould retain when removing points.
-
insert2DPoint
public void insert2DPoint(ILcd2DEditablePointList a2DEditablePointList, int aIndex, double aX, double aY, int aRenderMode, ILcdGXYContext aGXYContext) Inserts a point at the given index into the specified
ILcd2DEditablePointList.The specified coordinates are defined in the model reference.
- Parameters:
a2DEditablePointList- the point list to insert a point into.aIndex- a valid index in the list ofILcdPointobjects.aX- the X-coordinate of the new point.aY- the Y-coordinate of the new point.aRenderMode- a mode which in this implementation isn't taken into account.aGXYContext- a context which in this implementation isn't taken into account.
-
append2DPoint
public void append2DPoint(ILcd2DEditablePointList a2DEditablePointList, double aX, double aY, int aRenderMode, ILcdGXYContext aGXYContext) Appends a point to the end of the specified
ILcd2DEditablePointList.The specified coordinates are defined in the model reference.
- Parameters:
a2DEditablePointList- the point list to append a point to.aX- the X-coordinate of the new point.aY- the Y-coordinate of the new point.aRenderMode- a mode which in this implementation isn't taken into account.aGXYContext- a context which in this implementation isn't taken into account.
-
translate2D
public void translate2D(ILcd2DEditablePointList a2DEditablePointList, double aDeltaX, double aDeltaY, int aRenderMode, ILcdGXYContext aGXYContext) Translates all the points of the specified
ILcd2DEditablePointListfrom their current positions over the given translation vector in the 2D space. Only the first two dimensions of the points are considered. The third dimension is left unchanged.The specified translation coordinates are defined in the model reference.
- Parameters:
a2DEditablePointList- the point list to translate.aDeltaX- the X-coordinate of the translation vector.aDeltaY- the Y-coordinate of the translation vector.aRenderMode- a mode which in this implementation isn't taken into account.aGXYContext- a context which in this implementation isn't taken into account.
-
move2DPoint
public void move2DPoint(ILcd2DEditablePointList a2DEditablePointList, int aIndex, double aX, double aY, int aRenderMode, ILcdGXYContext aGXYContext) Moves the point at the given index in the specified
ILcd2DEditablePointListto the given point in the 2D space. Only the first two dimensions of the points are considered. The third dimension is left unchanged.The specified coordinates are defined in the model reference.
- Parameters:
a2DEditablePointList- the point list to move a point of.aIndex- a valid index in the list ofILcdPointobjects.aX- the X-coordinate of the new point.aY- the Y-coordinate of the new point.aRenderMode- a mode which in this implementation isn't taken into account.aGXYContext- a context which in this implementation isn't taken into account.
-
translate2DPoint
public void translate2DPoint(ILcd2DEditablePointList a2DEditablePointList, int aIndex, double aDeltaX, double aDeltaY, int aRenderMode, ILcdGXYContext aGXYContext) Translates the point at the given index in the specified
ILcd2DEditablePointListfrom its current position over the given translation vector in the 2D space. Only the first two dimensions of the points are considered. The third dimension is left unchanged.The specified translation coordinates are defined in the model reference.
- Parameters:
a2DEditablePointList- the point list to translate a point of.aIndex- a valid index in the list ofILcdPointobjects.aDeltaX- the X-coordinate of the translation vector.aDeltaY- the Y-coordinate of the translation vector.aRenderMode- which in this implementation isn't taken into account.aGXYContext- a context which in this implementation isn't taken into account.
-
edit
This implementation edits the retrieved ILcdPointList. The point list needs to implement the interface
ILcd2DEditablePointList.In
ILcdGXYEditor.TRANSLATEDrender mode, theILcdPointListis edited as follows:- While touching a point, the point gets translated.
- While touching a segment, 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, theILcdPointListis edited as follows:- While touching a point and moving the mouse pointer, the point gets translated.
- While touching a point and not moving the mouse pointer, the point gets removed.
- While touching a segment, a new point is added beneath the mouse pointer.
- While touching the interior, the object remains unchanged.
In the creation render modes, new points are created beneath the mouse pointer and added to the
ILcdPointList.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 point list does not implementILcd2DEditablePointList.- See Also:
-
acceptSnapTarget
Returns whether the object set to the editor can be edited so that (part of) the object snaps to the object passed as snap target in the context. If the snap target is accepted, a call to theeditmethod with this context passed should edit the object so that (part of) the object snaps to the object passed as snap target in the context.The context contains information on the user interaction at hand: the current location of the user interaction, given by its
This editor can snap the current object to the given target if the following conditions are met:XandYcoordinates, and thedistance in X directionanddistance in Y directionover which the user interaction is taking place. For example,getXandgetYmay contain the current mouse location whilegetDeltaXandgetDeltaYcontain the distance over which the mouse has been dragged. The context also contains the candidatesnap targetand thelayer the snap target is contained in.- The current object is an
ILcd2DEditablePointListor anILcdEditableComplexPolygonwithILcd2DEditablePointListinstances - the target to snap to is an
ILcdPointwhose coordinates are expressed in the same coordinate system as the current object or the model to model transformation can transform the point to a point in the objects coordinate system. - One of the current point list's points is touched (in other words: you are translating a specific point of the pointlist) or the pointlist is empty.
- The touched point is not the last point of the current point list. If this is wanted, override this function and return true if the touched point is the last point.
- 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
-
linkToSnapTarget
protected boolean linkToSnapTarget(Graphics aGraphics, ILcd2DEditablePointList aPointList, int aPointIndex, int aRenderMode, ILcdGXYContext aGXYContext) Edits the specifiedILcdPointListso that, if the snap target is accepted, the point (specified by its index) snaps to this snap target. The method does nothing otherwise.- Parameters:
aGraphics- the Graphics on which to snap to the target.aPointList- the point list to edit.aPointIndex- the index of the point in the point list that should snap to the target.aRenderMode- the mode in which the snapping occurs. The mode is not taken into account in this implementation.aGXYContext- the context in which to snap to the target.- Returns:
trueif the specified point is snapped to the snap target,falseotherwise.
-
getCreationClickCount
public int getCreationClickCount()Returns the number of user interactions required to complete the initialization of anILcdPointListobject set to this editor. In the paint modePOINT, only one click is required. For the other modes, a negative number is returned, meaning that an unlimited number of points can be used. The polyline mode returns-2, whereas the polygon modes return-3, indicating a minimum click count of 2 and 3, respectively.- Specified by:
getCreationClickCountin interfaceILcdGXYEditor- Returns:
1if the paint mode equalsPOINT,-2if the mode equalsPOLYLINE,-3otherwise.
-
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:
-
FILLEDinstead