Class TLcdGXYEditableLabelPainter
- All Implemented Interfaces:
ILcdCloneable,ILcdPropertyChangeSource,ILcdGXYEditor,ILcdGXYEditorProvider,ILcdGXYLabelPainter,ILcdGXYLabelPainterProvider,ILcdGXYPainter,ILcdGXYPainterProvider,Serializable,Cloneable
ILcdGXYLabelPainter implementation that allows to edit the labels by
moving them around.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.view.gxy.painter.TLcdGXYIconPainter
TLcdGXYIconPainter.ScalingMode -
Field Summary
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.ILcdGXYLabelPainter
DEFAULT, SELECTEDFields inherited from interface com.luciad.view.gxy.ILcdGXYPainter
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.TLcdGXYEditableLabelPainter(TLcdGXYEditableLabelPainter aGXYEditableLabelPainter) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidanchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) Deprecated.ImplementsILcdGXYPainter.anchorPointSFCT.voidboundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) Deprecated.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()Deprecated.Creates and returns a copy of this object.booleanedit(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Deprecated.This implementation edits theILcdShapeobject set to the painter.protected booleaneditLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Deprecated.Deprecated.getDeltaLabelLocation(Object aObject) Deprecated.Returns the fixed distance in screen coordinates between the objects anchor point and the labels anchor point.final ILcdGXYEditorgetGXYEditor(Object aObject) Deprecated.Returns this instance as editor for editing the specifiedObject.final ILcdGXYLabelPaintergetGXYLabelPainter(Object aObject) Deprecated.Finds anILcdGXYLabelPainterthat can be used to label the object passed.final ILcdGXYPaintergetGXYPainter(Object aObject) Deprecated.Finds anILcdGXYPainterthat can be used to paint or locate the object passed.Deprecated.intDeprecated.Delegates to to the inner label painter.intgetPossibleLocationCount(Graphics aGraphics) Deprecated.Delegates to to the inner label painter.Deprecated.booleanisFrame()Deprecated.Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels.booleanDeprecated.protected booleanisLabelSensitive(int aMode) Deprecated.This method returns whether the label is taken into account as a mouse- sensitive part of the object when touching the object in mode aMode.booleanDeprecated.booleanisTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Deprecated.Returns whether the mouse position in the given context is touching the painted icon.doublelabelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Rectangle aRectangleSFCT) Deprecated.Delegates to to the inner label painter.voidpaint(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Deprecated.Displays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.voidpaintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Deprecated.Delegates to to the inner label painter.protected voidpaintPin(Graphics aGraphics, int aMode, int aStartPointX, int aStartPointY, int aEndPointX, int aEndPointY) Deprecated.Draws the pin on the given graphics between the given lines.voidputBoundsToFollow(Object aObject, Rectangle aBounds) Deprecated.voidputDeltaLabelLocation(Object aObject, Dimension aDimension) Deprecated.Sets the fixed distance in screen coordinates between the objects anchor point and the labels anchor point.voidDeprecated.Clears the table indicating which labels absolute position cannot be changed.voidDeprecated.Clears the location table.voidremoveBoundsToFollow(Object aObject) Deprecated.voidremoveDeltaLabelLocation(Object aObject) Deprecated.Clears the distance in screens coordinates between the objects anchor point and the labels anchor point.protected String[]retrieveLabels(int aMode, ILcdGXYContext aGXYContext) Deprecated.Retrieves the labels to be painted for aObject.protected String[]retrieveLabels(ILcdGXYContext aGXYContext) Deprecated.replaced byretrieveLabels(int, ILcdGXYContext)voidsetForcePinOnNonDefaultLocation(boolean aForcePinOnNonDefaultLocation) Deprecated.If set to true, this forces drawing of the pin when the label has been edited regardless of the value ofALcdGXYStampLabelPainter.isWithPin()of the inner label painter.voidsetFrame(boolean aFrame) Deprecated.Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels.voidsetIconSensitive(boolean aIconSensitive) Deprecated.voidsetLabelLocation(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Deprecated.voidsetLocationIndex(int aLocationIndex) Deprecated.Delegates to the inner label painter.voidDeprecated.Sets the object to paint and edit.voidsetSelectionBackground(Color aSelectionBackground) Deprecated.Sets the background color of the label if isSelectionFilled().voidsetSelectionFilled(boolean aSelectionFilled) Deprecated.Sets whether the selected label should be filled.Methods inherited from class com.luciad.view.gxy.painter.TLcdGXYIconPainter
acceptSnapTarget, clearImageCache, clearImageCache, firePropertyChangeEvent, getCreationClickCount, getCursor, getHaloAlgorithm, getHaloColor, getHaloThickness, getIcon, getIcon, getIconProvider, getObject, getPaintCache, getScale, getScalingMode, getSelectionIcon, getSelectionIconProvider, getSnapIcon, isHaloEnabled, isUseImageCache, isUseOrientation, paintSnap, setHaloAlgorithm, setHaloColor, setHaloEnabled, setHaloThickness, setIcon, setIconProvider, setModelModelTransformationClass, setPaintCache, setScale, setScalingMode, setSelectionIcon, setSelectionIconProvider, setSnapIcon, setUseImageCache, setUseOrientation, snapTarget, supportSnapMethods inherited from class com.luciad.view.gxy.ALcdGXYPainter
addPropertyChangeListener, firePropertyChangeEvent, getDisplayName, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOnMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.view.gxy.ILcdGXYEditor
acceptSnapTarget, getCreationClickCount, getDisplayName, getObjectMethods inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter
getObjectMethods inherited from interface com.luciad.view.gxy.ILcdGXYPainter
getCursor, getDisplayName, getObject, snapTarget, supportSnapMethods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
TLcdGXYEditableLabelPainter
public TLcdGXYEditableLabelPainter()Deprecated. -
TLcdGXYEditableLabelPainter
Deprecated.
-
-
Method Details
-
getInnerLabelPainter
Deprecated. -
setForcePinOnNonDefaultLocation
public void setForcePinOnNonDefaultLocation(boolean aForcePinOnNonDefaultLocation) Deprecated.If set to true, this forces drawing of the pin when the label has been edited regardless of the value ofALcdGXYStampLabelPainter.isWithPin()of the inner label painter. -
getBoundsToFollow
Deprecated. -
setObject
Deprecated.Description copied from class:TLcdGXYIconPainterSets the object to paint and edit. The object should be an instance of or
refer toan instance ofILcdShapefor painting andILcd2DEditableShapefor 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
ILcdShapeand shall throw aClassCastExceptionif it does not.When this painter is used as editor with an object that does not implement the interface
ILcd2DEditableShape, theeditmethod shall throw the necessary exception.- Specified by:
setObjectin interfaceILcdGXYEditor- Specified by:
setObjectin interfaceILcdGXYLabelPainter- Specified by:
setObjectin interfaceILcdGXYPainter- Overrides:
setObjectin classTLcdGXYIconPainter- Parameters:
aObject- The object to paint and edit.- See Also:
-
setIconSensitive
public void setIconSensitive(boolean aIconSensitive) Deprecated. -
isLabelSensitive
protected boolean isLabelSensitive(int aMode) Deprecated.This method returns whether the label is taken into account as a mouse- sensitive part of the object when touching the object in mode aMode. This default implementation always returns true. Overwrite this method if other behavior is desirable (e.g. only sensitive in selected mode).- Parameters:
aMode- The painter or editor mode during the touch- Returns:
- true.
-
isIconSensitive
public boolean isIconSensitive()Deprecated. -
setFrame
public void setFrame(boolean aFrame) Deprecated.Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels. Sets the property frame tonewFrame. -
isFrame
public boolean isFrame()Deprecated.Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels.- Returns:
trueif frame holdstrue, elsefalseis returned.
-
anchorPointSFCT
public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException Deprecated.Description copied from class:ALcdGXYPainterImplementsILcdGXYPainter.anchorPointSFCT.aPointSFCTwill be set to the center of the bounds calculated by boundsSFCT.- Specified by:
anchorPointSFCTin interfaceILcdGXYPainter- Overrides:
anchorPointSFCTin classTLcdGXYIconPainter- 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:
-
boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException Deprecated.Description copied from class:TLcdGXYIconPainterSets 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- Overrides:
boundsSFCTin classTLcdGXYIconPainter- Parameters:
aGraphics- The graphics to paint the object on.aMode- 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:
-
isTouched
Deprecated.Description copied from class:TLcdGXYIconPainterReturns whether the mouse position in the given context is touching the painted icon.
This implementation will use the method
TLcdGXYIconPainter.getIcon(int)with the specified render mode to determine which icon needs to be touched.- Specified by:
isTouchedin interfaceILcdGXYPainter- Overrides:
isTouchedin classTLcdGXYIconPainter- Parameters:
aGraphics- The graphics to paint the object on.aMode- The mode to render the object in.aGXYContext- The context in which the object is rendered.- Returns:
- whether the focus point of the
ILcdShapeobject is touched. - See Also:
-
setLocationIndex
public void setLocationIndex(int aLocationIndex) Deprecated.Delegates to the inner label painter.- Specified by:
setLocationIndexin interfaceILcdGXYLabelPainter- Parameters:
aLocationIndex- the index of the location. Must be between 0 and getPossibleLocationCount() - 1.- See Also:
-
getLocationIndex
public int getLocationIndex()Deprecated.Delegates to to the inner label painter.- Specified by:
getLocationIndexin interfaceILcdGXYLabelPainter- Returns:
- the index of the position. Must be between 0 and getPossibleLocationCount() - 1.
- See Also:
-
getPossibleLocationCount
Deprecated.Delegates to to the inner label painter.- Specified by:
getPossibleLocationCountin interfaceILcdGXYLabelPainter- Parameters:
aGraphics- the Graphics the label will be painted on.- Returns:
- the number of possible locations where this
ILcdGXYLabelPaintercan paint/draw the labels of the set Object. - See Also:
-
setSelectionFilled
public void setSelectionFilled(boolean aSelectionFilled) Deprecated.Sets whether the selected label should be filled. Takes only effect if the label is not filled by default. -
isSelectionFilled
public boolean isSelectionFilled()Deprecated.- See Also:
-
setSelectionBackground
Deprecated.Sets the background color of the label if isSelectionFilled(). Takes only effect if the label is not filled by default. -
getSelectionBackground
Deprecated.- See Also:
-
labelBoundsSFCT
public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Rectangle aRectangleSFCT) throws TLcdNoBoundsException Deprecated.Delegates to to the inner label painter.- Specified by:
labelBoundsSFCTin interfaceILcdGXYLabelPainter- Parameters:
aGraphics- theaGraphicsto consider.aMode- the representation mode of the label.aGXYContext- theILcdGXYContextthe drawing depends on.aRectangleSFCT- theRectanglecontaining the bounds of the label in view / graphics coordinates as side effect.- Returns:
- the angle orientation of the rectangle around the labels in RADIANs, clockwise, 0 at 3 o'clock.
- Throws:
TLcdNoBoundsException- if the Object doesn't have any valid bounds, e.g. if it is always invisible in the current projection.- See Also:
-
paint
Deprecated.Description copied from class:TLcdGXYIconPainterDisplays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.This implementation will use the method
TLcdGXYIconPainter.getIcon(int)with the specified render mode to determine how the object needs to be rendered. InILcdGXYPainter.RESHAPINGandILcdGXYPainter.TRANSLATINGmode, theILcdShapeobject is rendered as if the point was moved along the same distance in view coordinates as passed in the context.If the halo effect is enabled, a halo effect will be added around the icon. Note that the halo effect will only be added when the rendering mode does not contain the mode
SELECTED.- Specified by:
paintin interfaceILcdGXYPainter- Overrides:
paintin classTLcdGXYIconPainter- Parameters:
aGraphics- The graphics to paint the object on.aMode- The mode to render the object in.aGXYContext- The context to render the object in.
-
edit
Deprecated.Description copied from class:TLcdGXYIconPainterThis implementation edits the
ILcdShapeobject set to the painter. The object needs to implement the interfaceILcd2DEditableShapeotherwise aClassCastExceptionwill be thrown.In
ILcdGXYEditor.START_CREATION,ILcdGXYEditor.TRANSLATEDandILcdGXYEditor.RESHAPEDrender mode, the focus point of theILcdShapeobject is moved to the location beneath the mouse pointer.If, in all render modes, a snap target is found for the moved point, the snap target location is used for the moved point.
- Specified by:
editin interfaceILcdGXYEditor- Overrides:
editin classTLcdGXYIconPainter- Parameters:
aGraphics- The graphics to edit the object on.aMode- 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.
- See Also:
-
getGXYPainter
Deprecated.Description copied from interface:ILcdGXYPainterProviderFinds anILcdGXYPainterthat can be used to paint or locate the object passed.The painter provider is responsible for setting the object to the painter before returning the painter. An implementation should therefore have the following structure:
public ILcdGXYPainter getGXYPainter(Object aObject) { ILcdGXYPainter painter = ... // find the painter for the object if (painter != null) { painter.setObject(aObject); } return painter; }- Specified by:
getGXYPainterin interfaceILcdGXYPainterProvider- Overrides:
getGXYPainterin classALcdGXYPainter- Parameters:
aObject- the object to find a painter for- Returns:
- a painter that can be used to paint or locate the object; or null if no painter could be found for the given object, or the object could not be set on the retrieved painter.
-
getGXYEditor
Deprecated.Description copied from class:TLcdGXYIconPainterReturns this instance as editor for editing the specifiedObject. If thisObjectis not the same as theObjectset to this painter, theTLcdGXYIconPainter.setObject(Object)method is called to update the object set to the painter.- Specified by:
getGXYEditorin interfaceILcdGXYEditorProvider- Overrides:
getGXYEditorin classTLcdGXYIconPainter- Parameters:
aObject- the object to be edited.- Returns:
- this instance as editor for editing the specified
Object.
-
getGXYLabelPainter
Deprecated.Description copied from interface:ILcdGXYLabelPainterProviderFinds anILcdGXYLabelPainterthat can be used to label the object passed.The label painter provider is responsible for setting the object to the label painter before returning the label painter. An implementation should therefore have the following structure:
public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject) { ILcdGXYLabelPainter labelPainter = ... // find the label painter for the object if (labelPainter != null) { labelPainter.setObject(aObject); } return labelPainter; }- Specified by:
getGXYLabelPainterin interfaceILcdGXYLabelPainterProvider- Parameters:
aObject- the object to find a label painter for- Returns:
- a label painter that can be used to label the object; or null if no label painter could be found for the given object, or the object could not be set on the retrieved label painter.
-
putBoundsToFollow
Deprecated. -
removeBoundsToFollow
Deprecated. -
retrieveLabels
Deprecated.Retrieves the labels to be painted for aObject. This method is called within the paintLabel method. By default, it returns an array of oneStringcontainingaObject.toString(). Re-define this method in sub-classes for returning other labels. Never modify the content of the returned array. If it is not redefined it calls the methodretrieveLabels(ILcdGXYContext)- Parameters:
aMode- the label painting mode
-
retrieveLabels
Deprecated.replaced byretrieveLabels(int, ILcdGXYContext)- See Also:
-
paintLabel
Deprecated.Delegates to to the inner label painter.- Specified by:
paintLabelin interfaceILcdGXYLabelPainter- Parameters:
aGraphics- theGraphicsinstance on which to paint.aMode- a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.aGXYContext- theILcdGXYContextin which the label painting has to be performed.- See Also:
-
getDeltaLabelLocation
Deprecated.Returns the fixed distance in screen coordinates between the objects anchor point and the labels anchor point.- Parameters:
aObject- the object to return the delta for.- Returns:
- the fixed distance in screen coordinates between the objects anchor point and the labels anchor point.
- See Also:
-
putDeltaLabelLocation
Deprecated.Sets the fixed distance in screen coordinates between the objects anchor point and the labels anchor point.- Parameters:
aObject- the object to store the delta for.aDimension- the delta for the label in screen coordinates. This is the vector between the objects anchor point and the labels anchor point. Once this is set, the location index of the inner label painter is ignored.- See Also:
-
removeDeltaLabelLocation
Deprecated.Clears the distance in screens coordinates between the objects anchor point and the labels anchor point. This means the location index will be taken into account to determine the location of the label on the view.- Parameters:
aObject- the object to remove the delta for.- See Also:
-
paintPin
protected void paintPin(Graphics aGraphics, int aMode, int aStartPointX, int aStartPointY, int aEndPointX, int aEndPointY) Deprecated.Draws the pin on the given graphics between the given lines. Overwrite this method if you want to change the look of the pin, by manipulating the graphics passed.- Parameters:
aGraphics- the graphics to paint the pin on.aMode- the mode this objects label is painted in (e.g. ILcdGXYLabelPainter.SELECTED). This method is called by the inner label painter to paint a pin.aStartPointX- the x coordinate of the start point of the pin.aStartPointY- the y coordinate of the start point of the pin.aEndPointX- the x coordinate of the end point of the pin.aEndPointY- the y coordinate of the end point of the pin.
-
editLabel
Deprecated. -
setLabelLocation
Deprecated. -
removeAllDeltaLabelLocation
public void removeAllDeltaLabelLocation()Deprecated.Clears the location table. All labels will be painted at the location where they would have been painted before the label was dragged. -
removeAllBoundsToFollow
public void removeAllBoundsToFollow()Deprecated.Clears the table indicating which labels absolute position cannot be changed. -
clone
Deprecated.Description copied from class:TLcdGXYIconPainterCreates and returns a copy of this object. Deep copies are made of fallback icons (TLcdGXYIconPainter.getIcon()andTLcdGXYIconPainter.getSelectionIcon()) and the snap icon but shallow copies are made of the icon providers.- Specified by:
clonein interfaceILcdCloneable- Specified by:
clonein interfaceILcdGXYEditorProvider- Specified by:
clonein interfaceILcdGXYLabelPainter- Specified by:
clonein interfaceILcdGXYLabelPainterProvider- Specified by:
clonein interfaceILcdGXYPainterProvider- Overrides:
clonein classTLcdGXYIconPainter- Returns:
- a clone of this instance.
- See Also:
-
ILcdGXYLabelEditor. This interface has a much cleaner separation of concerns, and is independent of theILcdGXYPainterused for the domain object.