Class TLcdGXYLabelPainter
- All Implemented Interfaces:
ILcdPropertyChangeSource,ILcdGXYLabelEditor,ILcdGXYLabelEditorProvider,ILcdGXYLabelPainter,ILcdGXYLabelPainter2,ILcdGXYLabelPainterProvider,ILcdGXYMultiLabelPainter,Serializable,Cloneable
- Direct Known Subclasses:
TLcdAIXM51XPathLabelPainter,TLcdGXYDataObjectLabelPainter,TLcdGXYFeaturedLabelPainter
TLcdGXYLabelPainter is an implementation of ILcdGXYLabelPainter2
that paints textual labels. The appearance of this text, such as the font, the color, framing
etc., can be configured with the appropriate methods.
Like its parent class, TLcdGXYStampLabelPainter, this label painter supports
discrete placement of the labels as well as free placement. See TLcdGXYStampLabelPainter for more information on how to configure these
placements.
The text of the labels to be drawn are given by the method retrieveLabels(int, com.luciad.view.gxy.ILcdGXYContext). This
method can be redefined for specific needs (it returns by default an array of 1
String containing Object.toString().
The label editing facilities provided by this class are the same as its parent class. Please refer to the documentation of the parent class for more information.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intInteger code to indicate label text alignment behavior.static final intInteger code to indicate label text alignment behavior.static final intInteger code to indicate label text alignment behavior.static final intInteger code to indicate label text alignment behavior.Fields inherited from class com.luciad.view.gxy.TLcdGXYStampLabelPainter
CENTER, EAST, MAXIMUM_AVAILABLE_LOCATIONS, NORTH, NORTH_EAST, NORTH_WEST, SOUTH, SOUTH_EAST, SOUTH_WEST, WESTFields inherited from interface com.luciad.view.gxy.ILcdGXYLabelEditor
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATEDFields inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter
DEFAULT, SELECTEDFields inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter2
BODY, CREATING, HANDLES, RESHAPING, SNAPS, TRANSLATING -
Constructor Summary
ConstructorsConstructorDescriptionCreates a label painter with the default settings, without an interactive label provider.TLcdGXYLabelPainter(ALcdGXYInteractiveLabelProvider aGXYInteractiveLabelProvider) Creates a label painter with the default settings, and the specified interactive label provider.TLcdGXYLabelPainter(TLcdGXYLabelPainter aGXYLabelPainter) Clone constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptSnapTargetForLabel(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns whether the label specified bysetObject,setLabelIndexandsetSubLabelIndexaccepts the snap target in the givenILcdGXYContext.protected voidaddComponentToGXYView(ILcdGXYView aGXYView, Component aComponent) Adds the specified interactive label to the user interface.protected voidanchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Point aPointSFCT) Retrieves an anchor point that is used to determine where the pin of the label (specified bysetObject,setLabelIndexandsetSubLabelIndex) attaches to the object representation.protected intcalculateMaxLabelWidth(String[] aLabelArray, Graphics aGraphics) Calculates the maximum width for a label when painting the given String objects in the given array on the given Graphics object.protected booleancanAddComponentToGXYView(ILcdGXYView aGXYView) Returns whether or not an interactive label can be added to the given view.voidCancels the interactive label, if there is one.booleanReturns whether or not the label interaction can be stopped.voidClears the entire label image cache.voidclearImageCache(Object aObject) Clears the label image cache for the given object.clone()Returns a new instance of thisALcdGXYLabelPainter.booleaneditLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Adapts the setTLcdLabelLocationaccording to the information present in aGXYContext.protected voidfirePropertyChangeEvent(PropertyChangeEvent aPropertyChangeEvent) Notifies the registeredPropertyChangeListeners of the specified event.Gets the color of the label frames filling.protected ComponentgetComponentForGXYView(ILcdGXYView aGXYView) Gets the component that represents the givenILcdGXYView.This default implementation returns the display name set withsetDisplayName, ortoString()if this was set tonull.Returns the domain object for the interactive label, ornullif there is no interactive label.getFont()Gets theFontfor drawing the labels.Gets the foreground color of the labels (text).Returns the color to use for the label frame.Returns the interactive label provider.getGXYLabelEditor(Object aObject) Returns a validILcdGXYLabelEditorfor editing the labels of aObject.getGXYLabelPainter(Object aObject) Returns thisILcdGXYLabelPainterfor painting the labels of aObject.Returns theALcdGXYLabelStampthat is used by this painter to paint the labels.Returns the algorithm that is used for rendering halo's.Returns the current halo color.Returns the current halo pin color.intReturns the current halo thickness.intReturns the number of points required to initialize the label of the setObject.getLabelCursor(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Returns aCursorto indicate the type of editingaModeandaGXYContext.intReturns the label text alignment mode.intReturns the amount of padding used around the text.Returns the color in which the pin is drawn.protected voidgetPinPointSFCT(Point aAnchorPoint, String[] aLabelArray, int aMaxLabelWidth, int aSingleLabelHeight, Point aPinLocationSFCT) Calculates the position where the pin attaches to the label specified bysetObject,setLabelIndexandsetSubLabelIndex.getPositionAsString(int aPosition) Returns the string representation of the given position of the labels relative to the anchor point.int[]Returns the list of possible positions to place the labels.String[]Gets theStringrepresentations of the current position list.intgetPossibleLocationCount(Graphics aGraphics) Returns the number of possible locations to use (starting from the default position).Returns the color in which the pin should be drawn of the label of a selected object.Gets the color of the label of a selected object that thisTLcdGXYLabelPainter.ABOVEdraws labels for.intReturns how many pixels the label must be removed from the anchor point of the domain object.protected voidgetUpperLeftPointSFCT(Point aAnchorPoint, String[] aLabelArray, int aMaxLabelWidth, int aSingleLabelHeight, Point aLocationPointSFCT) Calculates the upper left corner of the label specified bysetObject,setLabelIndexandsetSubLabelIndex.intThe value of the property VerticalSpacing represents the vertical distance in pixels between successive features.final booleanReturns if anti-aliasing is enabled.booleanThe propertyconsiderPindetermines whether the pin should be taken into account for the bounds.booleanisFilled()Labels can be drawn surrounded by a filled background, the filled property determines whether to draw a filled rectangle behind the labels.booleanisFrame()Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels.booleanReturns true if the halo effect is on for the labels, false otherwise.booleanReturns true if the halo effect also includes the pin.booleanisLabelTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Tests if the label specified bysetObject,setLabelIndexandsetSubLabelIndexis touched at view location(specified by aGXYContext.getX()andaGXYContext.getY()), considering the mode and theILcdGXYContextinstance.booleanReturns whether the labels this editor edits are made sticky.booleanReturnstruewhen image caching for labels with a halo is enabled,falseotherwise.booleanReturns whether to draw an anchor point atanchorPointSFCT.booleanReturns whether a pin is drawn from the object to the label.voidlabelAnchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) SetsaPointSFCTto the anchor point of the label specified bysetObject,setLabelIndexandsetSubLabelIndex.doublelabelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Rectangle aRectangle) Calculates the bounds of the label that can be painted.protected doublelabelPositionForLocationIndexSFCT(int aLocationIndex, int aWidth, int aHeight, Point aAnchorPoint, int aMode, ILcdGXYContext aGXYContext, Graphics aGraphics, Point aPointSFCT) Calculates the upper left corner of the label, usinggetUpperLeftPointSFCT(java.awt.Point, java.lang.String[], int, int, java.awt.Point).labelSnapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns anObjectthat can be used as snapping target when graphically editing anotherObjector label than the one this ILcdGXYLabelPainter2 represents.voidpaintLabel(int aLocationIndex, Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Convenience method that sets the location index to aLocationIndex and callspaintLabel(aGraphics, aMode,aGXYContext).voidpaintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aContext) Paints the label specified bysetObject,setLabelIndexandsetSubLabelIndexonaGraphics.protected voidpaintPin(Graphics aGraphics, int aMode, int aStartPointX, int aStartPointY, int aEndPointX, int aEndPointY) Draws a label pin on the given graphics between the given lines.protected booleanpinPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aAnchorPoint, Rectangle aLabelBounds, double aRotation, Point aPinPointSFCT) Determines where the pin attaches to the label.protected voidremoveComponentFromGXYView(ILcdGXYView aGXYView, Component aComponent) Removes the specifiedjava.awt.Componentfrom the user interface.protected String[]retrieveLabels(int aMode, ILcdGXYContext aGXYContext) Returns an array containing the lines of text for a single label.protected String[]retrieveLabels(ILcdGXYContext aGXYContext) Deprecated.final voidsetAntiAliased(boolean aAntiAliased) Enable or disable anti-aliasing.voidsetBackground(Color aBackgroundColor) Sets the color of the label frames filling toaBackgroundColor.static voidsetClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated.voidsetConsiderPinForBounds(boolean aConsiderPinForBounds) The propertyconsiderPindetermines whether the pin should be taken into account for the bounds.voidsetFilled(boolean aFilled) Labels can be drawn surrounded by a filled background, the filled property determines whether to draw a filled rectangle behind the labels.voidSets theFontfor drawing the labels toaFont.voidsetForeground(Color aForegroundColor) Sets the color of the labels toaForegroundColor.voidsetFrame(boolean aFramed) Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels.voidsetFrameColor(Color aColor) Sets the color to use for the label frame.voidsetGXYInteractiveLabelProvider(ALcdGXYInteractiveLabelProvider aGXYInteractiveLabelProvider) Deprecated.this is controller logic.voidsetGXYLabelStamp(ALcdGXYLabelStamp aGXYLabelStamp) Overridden to throw anUnsupportedOperationException.voidsetHaloAlgorithm(TLcdHaloAlgorithm aHaloAlgorithm) Sets the algorithm to be used for rendering halo's.voidsetHaloColor(Color aColor) Sets the color of the halo to be added around labels.voidsetHaloEnabled(boolean aHaloEnabled) Switches the halo effect for the labels on or off.voidsetHaloPinColor(Color aColor) Sets the color of the halo to be added around pins.voidsetHaloPinEnabled(boolean aHaloPinEnabled) Sets if the halo effect should be applied to the pin.voidsetHaloThickness(int aThickness) Sets the thickness (in pixels) of the halo to be added around labels.voidsetLabelIndex(int aLabelIndex) Sets the label.voidsetLabelTextAlignmentMode(int aLabelTextAlignmentMode) Sets the label text alignment mode to use.voidsetMakeLabelsStickyOnEdit(boolean aMakeLabelsStickyOnEdit) Sets whether or not this editor should set the label edit mode of the edited labels to include the sticky flag.voidSets the Object to be labeled by this ILcdGXYLabelPainter.voidsetPadding(int aPadding) Sets the amount of padding around the label text, in pixels.voidsetPinColor(Color aPinColor) Sets the color in which the pin should be drawn.voidsetPositionList(int[] aPositionList) Sets a new position list.voidsetPositionListAsString(String[] aPositionList) The labels can occupy various positions relative to the anchor point (see description above).voidsetProvideInteractiveLabelOnMouseOver(boolean aProvideInteractiveLabelOnMouseOver) Deprecated.this is controller logic.voidsetSelectedPinColor(Color aSelectedPinColor) Sets the color in which the pin of the label of a selected label should be drawn.voidsetSelectionColor(Color aSelectionColor) Sets the color of the label of a selected object that thisTLcdGXYLabelPainter.ABOVEdraws labels for, to aSelectionColor.voidsetShiftLabelPosition(int aShift) Sets how many pixels the label must be removed from the anchor point of the domain object.voidsetSubLabelIndex(int aSubLabelIndex) Sets the sublabel index.voidsetUseImageCache(boolean aUseCache) Sets whether or not labels with halos should be cached as images.voidsetVerticalSpacing(int aVerticalSpacing) The value of the property VerticalSpacing represents the vertical distance between successive features.voidsetWithAnchorPoint(boolean aWithAnchorPoint) Determines whether to draw an anchor point atanchorPointSFCT.voidsetWithPin(boolean aWithPin) The propertywithPindetermines whether a pin should be drawn from the object to the label.voidstartLabelInteraction(Object aDomainObject, int aLabelIndex, int aSubLabelIndex, ILcdGXYContext aGXYContext) Configure an interactive label for the specified label and show it in the GUI.booleanStops the interactive label, if there is one.Methods inherited from class com.luciad.view.gxy.ALcdGXYLabelPainter
addPropertyChangeListener, getLabelCount, getLabelIndex, getLabelLocation, getLocationIndex, getObject, getSubLabelCount, getSubLabelIndex, removePropertyChangeListener, setDisplayName, setLabelLocation, setLocationIndex, supportLabelSnapMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.view.gxy.ILcdGXYLabelEditor
getLabelCount, getLabelIndex, getLabelLocation, getObject, getSubLabelCount, getSubLabelIndex, setLabelLocationMethods inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter
getLocationIndex, getObject, setLocationIndexMethods inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter2
getLabelLocation, setLabelLocation, supportLabelSnapMethods inherited from interface com.luciad.view.gxy.ILcdGXYMultiLabelPainter
getLabelCount, getLabelIndex, getSubLabelCount, getSubLabelIndexMethods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
-
Field Details
-
LABEL_TEXT_ALIGNMENT_DEFAULT
public static final int LABEL_TEXT_ALIGNMENT_DEFAULTInteger code to indicate label text alignment behavior.- See Also:
-
LABEL_TEXT_ALIGNMENT_LEFT
public static final int LABEL_TEXT_ALIGNMENT_LEFTInteger code to indicate label text alignment behavior.- See Also:
-
LABEL_TEXT_ALIGNMENT_CENTER
public static final int LABEL_TEXT_ALIGNMENT_CENTERInteger code to indicate label text alignment behavior.- See Also:
-
LABEL_TEXT_ALIGNMENT_RIGHT
public static final int LABEL_TEXT_ALIGNMENT_RIGHTInteger code to indicate label text alignment behavior.- See Also:
-
-
Constructor Details
-
TLcdGXYLabelPainter
public TLcdGXYLabelPainter()Creates a label painter with the default settings, without an interactive label provider. -
TLcdGXYLabelPainter
Creates a label painter with the default settings, and the specified interactive label provider.- Parameters:
aGXYInteractiveLabelProvider- The interactive label provider that should be used. SeesetGXYInteractiveLabelProviderfor more details.
-
TLcdGXYLabelPainter
Clone constructor. All property values of the given label painter are copied. (shallow copy of possible locations list)- Parameters:
aGXYLabelPainter- the label painter to copy all properties from.
-
-
Method Details
-
setAntiAliased
public final void setAntiAliased(boolean aAntiAliased) Enable or disable anti-aliasing. By default, anti-aliasing is enabled.
When activated, anti-aliasing will be applied on both the labels and the pins.
See also
ILcdGXYView.isAntiAliased().- Parameters:
aAntiAliased- true to enable anti-aliasing.- Since:
- 2016.1
- See Also:
-
isAntiAliased
public final boolean isAntiAliased()Returns if anti-aliasing is enabled.- Returns:
- if anti-aliasing is enabled.
- Since:
- 2016.1
- See Also:
-
setGXYLabelStamp
Overridden to throw anUnsupportedOperationException. This label painter installs its own label stamp and relies on its presence for proper operation.- Parameters:
aGXYLabelStamp- Any label stamp.
-
clone
Description copied from class:ALcdGXYLabelPainterReturns a new instance of thisALcdGXYLabelPainter. The label location of the clone is a clone of the label location of the original. No other objects are cloned.- Specified by:
clonein interfaceILcdGXYLabelEditor- Specified by:
clonein interfaceILcdGXYLabelEditorProvider- Specified by:
clonein interfaceILcdGXYLabelPainter- Specified by:
clonein interfaceILcdGXYLabelPainter2- Specified by:
clonein interfaceILcdGXYLabelPainterProvider- Returns:
- A new instance of this
ALcdGXYLabelPainterof which the label location is a deep clone.
-
setObject
Description copied from interface:ILcdGXYLabelPainter2Sets the Object to be labeled by this ILcdGXYLabelPainter.Setting the object should set the
TLcdLabelLocationtonull, to ensure that older code which has not been adapted to this new interface keeps working.- Specified by:
setObjectin interfaceILcdGXYLabelEditor- Specified by:
setObjectin interfaceILcdGXYLabelPainter- Specified by:
setObjectin interfaceILcdGXYLabelPainter2- Overrides:
setObjectin classALcdGXYLabelPainter- Parameters:
aObject- The object to be labeled.- See Also:
-
setLabelIndex
public void setLabelIndex(int aLabelIndex) Description copied from interface:ILcdGXYMultiLabelPainterSets the label. The results of any subsequent method calls to
ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)andILcdGXYLabelPainter.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)etc. will apply to the label and sublabel indicated by this label index.- Specified by:
setLabelIndexin interfaceILcdGXYLabelEditor- Specified by:
setLabelIndexin interfaceILcdGXYMultiLabelPainter- Overrides:
setLabelIndexin classALcdGXYLabelPainter- Parameters:
aLabelIndex- The label index. This should be larger than or equal to0and less than the resultILcdGXYMultiLabelPainter.getLabelCount(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext).- See Also:
-
setSubLabelIndex
public void setSubLabelIndex(int aSubLabelIndex) Description copied from interface:ILcdGXYMultiLabelPainterSets the sublabel index. The results of any subsequent method calls toILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)andILcdGXYLabelPainter.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)etc. will apply to the label and sublabel indicated by this sublabel index.- Specified by:
setSubLabelIndexin interfaceILcdGXYLabelEditor- Specified by:
setSubLabelIndexin interfaceILcdGXYMultiLabelPainter- Overrides:
setSubLabelIndexin classALcdGXYLabelPainter- Parameters:
aSubLabelIndex- The sub label index. This should be larger than or equal to0and less than the resultILcdGXYMultiLabelPainter.getSubLabelCount(int).- See Also:
-
retrieveLabels
Returns an array containing the lines of text for a single label.
This method is called to retrieve the actual label text. Each array element is treated as a line of the label defined by
setObject,setLabelIndexandsetSubLabelIndex. If this method returns null or a zero-length array, no label will be painted. If this method returns an array containing an empty String, a label is painted without text (decorations like pin and frame are painted).A text line can contain HTML commands if its content is surrounded by an
<html>tag. The HTML support is limited to what is supported by Swing.By default, this method calls
retrieveLabels(com.luciad.view.gxy.ILcdGXYContext), which returns a single line of text (i.e. an array of oneString) containinggetObject().toString(), or null if the object has an empty toString() result. Override this method to return other text. Never modify the content of the returned array.This method may only be called for the label painter's supported label and sublabel indices. Override the
getLabelCountand/orgetSubLabelCountmethods if you want to define multiple labels per domain object.- Parameters:
aMode- the label painting mode. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, ILcdGXYContext)for more information about the mode.aGXYContext- the context in which the label is painted.- Returns:
- the return value of the method
retrieveLabels(ILcdGXYContext).
-
retrieveLabels
Deprecated.replaced byretrieveLabels(int, ILcdGXYContext)Returns the text of the specified label.- Parameters:
aGXYContext- the context in which the label is painted.- Returns:
- the label text for the set object
- See Also:
-
getGXYLabelPainter
Returns thisILcdGXYLabelPainterfor painting the labels of aObject.- Specified by:
getGXYLabelPainterin interfaceILcdGXYLabelPainterProvider- Parameters:
aObject- the object to find a label painter for.- Returns:
- always returns this
ILcdGXYLabelPainter.
-
paintPin
protected void paintPin(Graphics aGraphics, int aMode, int aStartPointX, int aStartPointY, int aEndPointX, int aEndPointY) Draws a label pin on the given graphics between the given lines. Overwrite this method if you want to change the look of the pin, for example 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).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.- See Also:
-
paintLabel
public void paintLabel(int aLocationIndex, Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Convenience method that sets the location index to aLocationIndex and callspaintLabel(aGraphics, aMode,aGXYContext).- Parameters:
aLocationIndex- the relative location at which the label should be painted.aGraphics- the Graphics on which the label will be painted.aMode- the mode for which the label should be painted. This can be either ILcdGXYLabelPainter.DEFAULT or ILcdGXYLabelPainter.SELECTED.aGXYContext- the context in which the label will be painted.- See Also:
-
calculateMaxLabelWidth
Calculates the maximum width for a label when painting the given String objects in the given array on the given Graphics object.- Parameters:
aLabelArray- the String objects to be painted for this label.aGraphics- the Graphics the label is painted on.- Returns:
- the labels width when painting the String objects in the given array on the given Graphics object.
-
labelPositionForLocationIndexSFCT
protected double labelPositionForLocationIndexSFCT(int aLocationIndex, int aWidth, int aHeight, Point aAnchorPoint, int aMode, ILcdGXYContext aGXYContext, Graphics aGraphics, Point aPointSFCT) Calculates the upper left corner of the label, using
getUpperLeftPointSFCT(java.awt.Point, java.lang.String[], int, int, java.awt.Point). The label is not rotated.This method is only called when the labels are placed discretely, that is, the location index is not -1.
- Parameters:
aLocationIndex- the location index. This index is non-negative, thus representing a fixed label location.aWidth- the width of the label.aHeight- the height of the label.aAnchorPoint- The anchor point, retrieved using #anchorPointSFCT.aMode- the mode to consider.aGXYContext- the context.aGraphics- the Graphics.aPointSFCT- This point should be moved to the upper left label corner.- Returns:
- the rotation of the label in radians. This rotation is applied in counter-clockwise direction and a
rotation of 0 indicates regular horizontally painted text. The origin of the rotation is the upper left
corner of the label, which is returned by this method through the
aPointSFCTparameter as a side effect.
-
getUpperLeftPointSFCT
protected void getUpperLeftPointSFCT(Point aAnchorPoint, String[] aLabelArray, int aMaxLabelWidth, int aSingleLabelHeight, Point aLocationPointSFCT) Calculates the upper left corner of the label specified by
setObject,setLabelIndexandsetSubLabelIndex.This method is only called when the labels are placed discretely, that is, the location index is not -1.
When this method is overridden, make sure to override the
getPinPointSFCTmethod as well to make sure the pin is attached to the label.- Parameters:
aAnchorPoint- the anchor point of the object, determined byanchorPointSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Point)aLabelArray- the String objects to be used as labelaMaxLabelWidth- the maximum label text widthaSingleLabelHeight- the height of one line of the labelaLocationPointSFCT- the upper left corner of the label's text. The padding and halo width should not be taken into account.
-
pinPointSFCT
protected boolean pinPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aAnchorPoint, Rectangle aLabelBounds, double aRotation, Point aPinPointSFCT) Determines where the pin attaches to the label. This implementation delegates togetPinPointSFCT(java.awt.Point, java.lang.String[], int, int, java.awt.Point)when the location index is larger than 0. If not, it attaches the pin to the middle of one of label bounds' edges.- Parameters:
aGraphics- TheGraphicsinstance on which the pin will be painted.aMode- The mode in which the pin will be painted. SeepaintLabel(java.awt.Graphics, int, ILcdGXYContext)for more information.aGXYContext- The instance containing the context in which the pin will be painted.aAnchorPoint- The point in AWT coordinates where the pin attaches to the object representation (see #anchorPointSFCT)aLabelBounds- The bounds of the label in AWT coordinates.aRotation- The rotation of the label in radians, positive going from the x to the y axisaPinPointSFCT- The point in AWT coordinates where the pin attaches to the label- Returns:
- Whether or not the pin needs to be drawn.
- See Also:
-
getPinPointSFCT
protected void getPinPointSFCT(Point aAnchorPoint, String[] aLabelArray, int aMaxLabelWidth, int aSingleLabelHeight, Point aPinLocationSFCT) Calculates the position where the pin attaches to the label specified by
setObject,setLabelIndexandsetSubLabelIndex. This implementation attaches the pin to the middle of one of the edges of the label bounds.This method is only called when the label is painted for a certain location index, that is, the location index is not -1.
- Parameters:
aAnchorPoint- the anchor point for the object (where the pin attaches to the object), determined byanchorPointSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Point)aLabelArray- the String objects to be used as labelaMaxLabelWidth- the maximum text widthaSingleLabelHeight- the height of one line of textaPinLocationSFCT- the point where the pin attaches to the label- See Also:
-
getLabelTextAlignmentMode
public int getLabelTextAlignmentMode()Returns the label text alignment mode. The default mode will align the label text left or right depending on the label position. The other modes will align all label text in the same way (left, center, or right).- Returns:
- the label text alignment mode.
- See Also:
-
setLabelTextAlignmentMode
public void setLabelTextAlignmentMode(int aLabelTextAlignmentMode) Sets the label text alignment mode to use.- Parameters:
aLabelTextAlignmentMode- the new label text alignment property value.- See Also:
-
setFont
Sets theFontfor drawing the labels toaFont.- Parameters:
aFont- the font to use to paint labels.- See Also:
-
getFont
Gets theFontfor drawing the labels. The default value is plain Dialog of size 10.- Returns:
- the font used to paint labels.
- See Also:
-
setForeground
Sets the color of the labels toaForegroundColor.- Parameters:
aForegroundColor- the color to be used to paint the labels foreground (text).- See Also:
-
getForeground
Gets the foreground color of the labels (text).- Returns:
- the foreground color of the labels (text).
- See Also:
-
setBackground
Sets the color of the label frames filling toaBackgroundColor.- Parameters:
aBackgroundColor- the color to be used for the label frames filling.- See Also:
-
getBackground
Gets the color of the label frames filling.- Returns:
- the color of the label frames filling.
- See Also:
-
setSelectionColor
Sets the color of the label of a selected object that thisTLcdGXYLabelPainter.ABOVEdraws labels for, to aSelectionColor.- Parameters:
aSelectionColor- the color to use to paint labels for selected objects.- See Also:
-
getSelectionColor
Gets the color of the label of a selected object that thisTLcdGXYLabelPainter.ABOVEdraws labels for.- Returns:
- the color labels for selected objects are painted in.
- See Also:
-
setFrame
public void setFrame(boolean aFramed) Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels. Sets the property frame toaFramed.- Parameters:
aFramed- true to paint the labels in a frame.- See Also:
-
isFrame
public boolean isFrame()Labels can be drawn surrounded by a frame, the frame property determines whether to frame the labels.- Returns:
- whether labels will be painted in frames.
- See Also:
-
getFrameColor
Returns the color to use for the label frame. If the frame is painted, then it will be painted with this color. Anullvalue indicates thatgetForeground()should be used instead. This is also the default.- Returns:
- the color to use for the label frame or
null
-
setFrameColor
Sets the color to use for the label frame.- Parameters:
aColor- the color to use for the label frame ornull- See Also:
-
setPadding
public void setPadding(int aPadding) Sets the amount of padding around the label text, in pixels. If the frame is painted, it will be painted around this margin.- Parameters:
aPadding- the new padding size, in pixels- See Also:
-
getPadding
public int getPadding()Returns the amount of padding used around the text.- Returns:
- the padding around the text, in pixels
- See Also:
-
setFilled
public void setFilled(boolean aFilled) Labels can be drawn surrounded by a filled background, the filled property determines whether to draw a filled rectangle behind the labels. Sets the property filled toaFilled.- Parameters:
aFilled- true to paint labels with a filled background.- See Also:
-
isFilled
public boolean isFilled()Labels can be drawn surrounded by a filled background, the filled property determines whether to draw a filled rectangle behind the labels.- Returns:
trueif filled holdstrue, elsefalseis returned.- See Also:
-
setVerticalSpacing
public void setVerticalSpacing(int aVerticalSpacing) The value of the property VerticalSpacing represents the vertical distance between successive features. More specifically, the distance between the tops of two successive label lines is this value + the standard height of a line of text in the set font. Negative values are allowed.- Parameters:
aVerticalSpacing- the vertical distance to be used between lines of a label, in pixels.- See Also:
-
getVerticalSpacing
public int getVerticalSpacing()The value of the property VerticalSpacing represents the vertical distance in pixels between successive features.- Returns:
- the vertical spacing used between lines in a label.
- See Also:
-
setConsiderPinForBounds
public void setConsiderPinForBounds(boolean aConsiderPinForBounds) The propertyconsiderPindetermines whether the pin should be taken into account for the bounds. This property is only useful in combination withisWithPinreturning true.- Parameters:
aConsiderPinForBounds- true to incorporate the pin in the bounds calculations.- See Also:
-
isConsiderPinForBounds
public boolean isConsiderPinForBounds()The propertyconsiderPindetermines whether the pin should be taken into account for the bounds. This property is only useful in combination withisWithPinreturning true.
The default value false, i.e., not to include the pin within the label bounds.- Returns:
trueif the pin should be considered for the bounds,falseotherwise.- See Also:
-
paintLabel
Description copied from interface:ILcdGXYLabelPainter2Paints the label specified by
setObject,setLabelIndexandsetSubLabelIndexonaGraphics.aGXYContextshould contain theILcdGXYViewfor which the label is painted andILcdGXYLayerto which the object belongsThe implementation of this method shall define how to paint the specified label in the given mode, considering
aGXYContextand the setTLcdLabelLocation.The domain object, label index, sublabel index and the label location should be set before calling this method using the respective methods.
This interface extends the original contract of the paintLabel method to allow for more modes. Where in the super interface the mode could only be one of
ILcdGXYLabelPainter.DEFAULTorILcdGXYLabelPainter.SELECTED, the mode now can be a bitwise combination of several constants- Specified by:
paintLabelin interfaceILcdGXYLabelPainter- Specified by:
paintLabelin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- The graphics object to paint the label onaMode- A bitwise combination ofaContext- the drawing context for the label- See Also:
-
getPossibleLocationCount
Returns the number of possible locations to use (starting from the default position).- Parameters:
aGraphics- the Graphics the label will be painted on. Not used in this implementation.- Returns:
- the number of possible locations to use (starting from the default position).
- See Also:
-
setPositionList
public void setPositionList(int[] aPositionList) Sets a new position list. This list is only used when the labels are not placed freely. By default, all supported positions are offered: SOUTH_EAST, NORTH_WEST, NORTH_EAST, SOUTH_WEST, EAST, WEST, NORTH, SOUTH, and CENTER. See
setShiftLabelPosition(int)for how these positions affect the label.- Parameters:
aPositionList- the list of possible positions to place the labels.- See Also:
-
getPositionList
public int[] getPositionList()Returns the list of possible positions to place the labels.- Returns:
- the list of possible positions to place the labels.
- See Also:
-
setPositionListAsString
The labels can occupy various positions relative to the anchor point (see description above). The following entries for theStringobjects are valid (independent of the font case):- "C" or "center".
- "N" or "north".
- "S" or "south".
- "E" or "east".
- "W" or "west".
- "SE" or "southeast"
- "NE" or "northeast"
- "SW" or "southwest"
- "NW" or "northwest"
- Parameters:
aPositionList- the list of possible positions to place labels givens as Strings objects.- See Also:
-
getPositionListAsString
Gets theStringrepresentations of the current position list.- Returns:
- the
Stringrepresentations of the current position list. - See Also:
-
getPositionAsString
Returns the string representation of the given position of the labels relative to the anchor point.- Parameters:
aPosition- the integer code for a position. Can be any of SOUTH_EAST, SOUTH, SOUTH_WEST, WEST, NORTH_WEST, NORTH, NORTH_EAST, EAST or CENTER.- Returns:
- the string representation of the given position of the labels relative to the anchor point.
- See Also:
-
setShiftLabelPosition
public void setShiftLabelPosition(int aShift) Sets how many pixels the label must be removed from the anchor point of the domain object. If the position of the label is
eastorwest, this shift is applied in horizontal direction; if the position isnorthorsouth, this shift is applied in vertical direction. In case ofnorth east,south east,south westornorth west, this shift is applied in both directions. If the location of the label iscenter, the shift is ignored.The default for this value is
8pixels.- Parameters:
aShift- the distance, expressed in pixels, that the label must be removed from the domain object.- See Also:
-
getShiftLabelPosition
public int getShiftLabelPosition()Returns how many pixels the label must be removed from the anchor point of the domain object.- Returns:
- the distance, expressed in pixels, that the label must be removed from the domain object.
- See Also:
-
setGXYInteractiveLabelProvider
@Deprecated public void setGXYInteractiveLabelProvider(ALcdGXYInteractiveLabelProvider aGXYInteractiveLabelProvider) Deprecated.this is controller logic. UseTLcdGXYInteractiveLabelsControllerinstead.Sets the interactive label provider. This method can be called at most once. If the interactive label provider was previously set (with this method or in the constructor), calling this method will throw and
Note that to fully enable the functionality,IllegalStateException.setProvideInteractiveLabelOnMouseOvermust be set totrue.- Parameters:
aGXYInteractiveLabelProvider- The interactive label provider that will be used to configure and show a component that can, for instance, be used to edit the properties of the labeled domain object. This cannot benull.- Throws:
IllegalStateException- When the interactive label provider was already set.IllegalArgumentException- When the interactive label provider wasnull.- See Also:
-
getGXYInteractiveLabelProvider
Returns the interactive label provider.- Returns:
- The interactive label provider.
- See Also:
-
getComponentForGXYView
Gets the component that represents the given
ILcdGXYView. By default this is the view itself casted tojava.awt.Component. This information is used for handling mouse events.Override this method if your
ILcdGXYViewimplementation does not extend fromjava.awt.Component.- Parameters:
aGXYView- The view for which aComponentmust be retrieved.- Returns:
- The
java.awt.Componentwhich corresponds to the givenILcdGXYView - Throws:
IllegalArgumentException- By default whenaGXYViewis not ajava.awt.Component- See Also:
-
canAddComponentToGXYView
Returns whether or not an interactive label can be added to the given view. If this method returns
false,addComponentToGXYViewmust not be called. By default this method checks if the givenILcdGXYViewis an instance ofjava.awt.Containerwithout a layout set on it.Override this method if your
ILcdGXYViewimplementation is not ajava.awt.Containeror if you add components to another container than the specifiedILcdGXYView.- Parameters:
aGXYView- TheILcdGXYViewfor which to check if a component can be added.- Returns:
trueif a component can be added,falseotherwise.- See Also:
-
addComponentToGXYView
Adds the specified interactive label to the user interface. By default this method casts the given
ILcdGXYViewtojava.awt.Containerand adds the component to the view.Override this method if your implementation of
ILcdGXYViewdoes not extend fromjava.awt.Containeror if you want to add the interactive label to anotherjava.awt.Containerbecause, for instance, you already need to add other components to the specifiedILcdGXYView.If you override this method, you also need to override
canAddComponentToGXYViewandremoveComponentFromGXYViewas these methods are closely related to each other.This method will not be called if
canAddComponentToGXYViewreturnsfalse.- Parameters:
aGXYView- The view to which the interactive label should be added.aComponent- The interactive label that should be added to the user interface.- Throws:
IllegalArgumentException- By default ifaGXYViewis not an instance ofjava.awt.Containeror if the layout ofaGXYViewis not null.- See Also:
-
removeComponentFromGXYView
Removes the specified
java.awt.Componentfrom the user interface. By default this method casts the specifiedILcdGXYViewtojava.awt.Containerand removes the component from that container.Override this method if you have overridden
addComponentToGXYView.- Parameters:
aGXYView- The view from which the interactive label should be removed.aComponent- The interactive label that should be removed from the user interface- Throws:
IllegalArgumentException- By default if the view does not extend fromjava.awt.Container
-
startLabelInteraction
public void startLabelInteraction(Object aDomainObject, int aLabelIndex, int aSubLabelIndex, ILcdGXYContext aGXYContext) Configure an interactive label for the specified label and show it in the GUI.- Parameters:
aDomainObject- The domain object for which to display an interactive label.aLabelIndex- The index of the label for which an interactive label should be displayed.aSubLabelIndex- The index of the sublabel for which an interactive label should be displayed.aGXYContext- An instance ofILcdGXYContextcontaining the layer and the view for which the label should be made interactive
-
canStopLabelInteraction
public boolean canStopLabelInteraction()Returns whether or not the label interaction can be stopped. For instance, when the interactive label contains invalid text, this method should return
false.- Returns:
trueif the label interaction can be stopped,falseotherwise.
-
stopLabelInteraction
public boolean stopLabelInteraction()Stops the interactive label, if there is one. The interactive label will commit any outstanding changes.
- Returns:
trueif the interactive label could be stopped or if there was no interactive label,falseotherwise.- See Also:
-
cancelLabelInteraction
public void cancelLabelInteraction()Cancels the interactive label, if there is one. This prevents the interactive label from committing any changes. -
getDomainObjectForInteractiveLabel
Returns the domain object for the interactive label, ornullif there is no interactive label.- Returns:
- The domain object for the interactive label, or
nullif there is no interactive label.
-
setProvideInteractiveLabelOnMouseOver
@Deprecated public void setProvideInteractiveLabelOnMouseOver(boolean aProvideInteractiveLabelOnMouseOver) Deprecated.this is controller logic. UseTLcdGXYInteractiveLabelsControllerinstead.Enables the
ALcdGXYInteractiveLabelProviderfunctionality, so that the interactive label is present when the mouse hoovers over a label. This flag is typically enabled/disabled whenever the interactive label functionality is desired/not wanted. For example, the interactive labels could only be desired when a certainILcdGXYControlleris active.- Parameters:
aProvideInteractiveLabelOnMouseOver-trueto activate theALcdGXYInteractiveLabelProvider,falseotherwise.- See Also:
-
isLabelTouched
Description copied from interface:ILcdGXYLabelPainter2Tests if the label specified bysetObject,setLabelIndexandsetSubLabelIndexis touched at view location(specified by aGXYContext.getX()andaGXYContext.getY()), considering the mode and theILcdGXYContextinstance.Before calling this method, the domain object, the label index, the sublabel index and the location of the label should be set using the respective methods.
- Specified by:
isLabelTouchedin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- TheGraphicsinstance on which the label is painted.aMode- the mode to consider. This is a bitwise combinations of several constants. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)for more information.aGXYContext- theILcdGXYContextto consider.- Returns:
- true if the representation of the Object returned by getObject() is touched, false otherwise
- See Also:
-
labelAnchorPointSFCT
public void labelAnchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException Description copied from interface:ILcdGXYLabelPainter2Sets
aPointSFCTto the anchor point of the label specified bysetObject,setLabelIndexandsetSubLabelIndex.If the location index is less than 0, the label anchor point is unambiguously determined by the
label location. The actual label is to be painted somewhere around this anchor point. This method is typically called to compare the result with the label bounds, thus determining the exact relation between thelabeland itslocation.Before calling this method, the domain object, the label index, the sublabel index and the location of the label should be set using the respective methods.
- Specified by:
labelAnchorPointSFCTin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- TheGraphicsinstance on which the label is painted.aMode- The mode to consider. This can be a bitwise combination of several constants. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)for more information.aGXYContext- TheILcdGXYContextthat can be used to retrieve extra information.aPointSFCT- The point which will be updated to reflect the location of the anchor point.- Throws:
TLcdNoBoundsException- if the Object doesn't have any valid anchor point, e.g. if it is always invisible in the current projection.- See Also:
-
editLabel
Description copied from interface:ILcdGXYLabelEditorAdapts the set
TLcdLabelLocationaccording to the information present in aGXYContext. If the method returnstrue, theTLcdLabelLocationwas modified, iffalseis returned, it wasn't changed.The implementation of this method shall define how to edit the label specified by the set domain
Object, label index and sublabel index, considering the given mode andaGXYContext. These should all be set before calling this method. Note that ifaModeis one of the creating modes, the (sub) label indices are irrelevant.- Specified by:
editLabelin interfaceILcdGXYLabelEditor- Parameters:
aGraphics- TheGraphicson which the label is painted.aMode- the mode to consider when editing aObject: aMode shall be a combination ofILcdGXYLabelEditor.TRANSLATED,ILcdGXYLabelEditor.RESHAPED,ILcdGXYLabelEditor.START_CREATION,ILcdGXYLabelEditor.CREATING,ILcdGXYLabelEditor.END_CREATION.
aGXYContext- contains the information to consider when editing the set Object.- Returns:
- true if the label of the set Object has changed, false otherwise.
- See Also:
-
labelSnapTarget
Description copied from class:ALcdGXYLabelPainterReturns anObjectthat can be used as snapping target when graphically editing anotherObjector label than the one this ILcdGXYLabelPainter2 represents. The returnedObjectcan be theObjectthis ILcdGXYLabelPainter2 represents or any other (e.g. anILcdPointif getObject() is anILcdPointList).This default implementation always returns
null. Override this method if you want to support snapping.- Specified by:
labelSnapTargetin interfaceILcdGXYLabelPainter2- Overrides:
labelSnapTargetin classALcdGXYLabelPainter- Parameters:
aGraphics- the Graphics on which is worked.aGXYContext- the ILcdGXYContext of the snapping.- Returns:
- an
Objectthat can be used as snapping target when graphically editing anotherObjector label than the one this ILcdGXYLabelPainter2 represents (returned by getObject()). This object can benull.
-
getGXYLabelEditor
Description copied from interface:ILcdGXYLabelEditorProviderReturns a valid
ILcdGXYLabelEditorfor editing the labels of aObject. The returnedILcdGXYLabelEditormust haveaObjectset on it. The TLcdLabelLocation must not yet be set on it.- Specified by:
getGXYLabelEditorin interfaceILcdGXYLabelEditorProvider- Parameters:
aObject- the Object for which to obtain aILcdGXYLabelEditor.- Returns:
- a valid
ILcdGXYLabelEditorfor editing the labels ofaObjectwithaObjectset on it. - See Also:
-
getGXYLabelStamp
Returns theALcdGXYLabelStampthat is used by this painter to paint the labels.- Returns:
- The
ALcdGXYLabelStampthat is used by this painter to paint the labels. - See Also:
-
firePropertyChangeEvent
Description copied from class:ALcdGXYLabelPainterNotifies the registeredPropertyChangeListeners of the specified event.- Overrides:
firePropertyChangeEventin classALcdGXYLabelPainter- Parameters:
aPropertyChangeEvent- The event describing the property change of which the registered listeners should be notified.- See Also:
-
getDisplayName
Description copied from class:ALcdGXYLabelPainterThis default implementation returns the display name set withsetDisplayName, ortoString()if this was set tonull.- Specified by:
getDisplayNamein interfaceILcdGXYLabelEditor- Specified by:
getDisplayNamein interfaceILcdGXYLabelPainter2- Overrides:
getDisplayNamein classALcdGXYLabelPainter- Returns:
- the display name of this
ILcdGXYLabelPainter2
-
getLabelCursor
Description copied from class:ALcdGXYLabelPainterReturns aCursorto indicate the type of editingaModeandaGXYContext.This default implementation always returns
null. Override this method if you want to display custom cursors.- Specified by:
getLabelCursorin interfaceILcdGXYLabelPainter2- Overrides:
getLabelCursorin classALcdGXYLabelPainter- Parameters:
aGraphics- TheGraphicsinstance on which the label is painted.aMode- The mode to consider. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, ILcdGXYContext)for more information.aGXYContext- TheILcdGXYContextcontaining extra information, such as the layer, the view and the mouse position.- Returns:
- a
Cursorto indicate the type of editingaModeandaGXYContext. Returnsnullif no particularCursoris required.
-
acceptSnapTargetForLabel
Description copied from interface:ILcdGXYLabelEditorReturns whether the label specified by
setObject,setLabelIndexandsetSubLabelIndexaccepts the snap target in the givenILcdGXYContext.The snap target is the
Objectreturned byaGXYContext.getSnapTarget(), and is on theILcdGXYLayerreturned byaGXYContext.getSnapTargetLayer().- Specified by:
acceptSnapTargetForLabelin interfaceILcdGXYLabelEditor- Parameters:
aGraphics- TheGraphicson which the label is painted.aGXYContext- TheILcdGXYContextcontaining the snapping information.- Returns:
trueif the label accepts the snap target,falseotherwise.- See Also:
-
labelBoundsSFCT
public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Rectangle aRectangle) throws TLcdNoBoundsException Description copied from interface:ILcdGXYLabelPainter2Calculates the bounds of the label that can be painted. The bounds are set as a side effect in
aRectangleSFCT, the orientation ofaRectangleSFCTis returned as an angle.The bounds represent the upper left point of the label, and a width and a height. The rotation value represents the rotation of the label bounds around the upper left point.
The domain object, the label index, the sublabel index and the location of the label for which the bounds are retrieved should be set before calling this method using the respective methods.
Note that if this label painter is used in conjunction with a labeling algorithm, the bounds should preferably be independent of the location, as this will yield the best results.
- Specified by:
labelBoundsSFCTin interfaceILcdGXYLabelPainter- Specified by:
labelBoundsSFCTin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- theaGraphicsto consider.aMode- the representation mode of the label.aContext- theILcdGXYContextthe drawing depends on.aRectangle- 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:
-
anchorPointSFCT
protected void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Point aPointSFCT) throws TLcdNoBoundsException Retrieves an anchor point that is used to determine where the pin of the label (specified bysetObject,setLabelIndexandsetSubLabelIndex) attaches to the object representation. Implementations of this class can also use it to determine, for example, discrete positions for a label.By default, this anchor point is the result of the
anchorPointSFCTmethod of the correspondingILcdGXYPainterfor the Object to be painted (seeaGXYContext.getGXYLayer().getGXYPainter( aObject )). When the setTLcdLabelLocationcan retrieve an anchor point, this anchor point should be returned.Before calling this method, the domain object, the label index, the sublabel index and the location of the label should be set using the respective methods.
- Parameters:
aGraphics- the Graphics for which the labels anchor point should be calculated.aMode- the mode for the which the label anchor point should be calculated. Can be ILcdGXYLabelPainter.SELECTED or ILcdGXYLabelPainter.DEFAULT.aContext- the context in which this label will be painted.aPointSFCT- the point that will be moved to the computed anchor point.- Throws:
TLcdNoBoundsException- if the Object doesn't have any valid anchor point, e.g. if it is always invisible in the current projection.
-
setMakeLabelsStickyOnEdit
public void setMakeLabelsStickyOnEdit(boolean aMakeLabelsStickyOnEdit) Sets whether or not this editor should set the label edit mode of the edited labels to include the sticky flag. This means the labels will no longer be automatically moved by the decluttering algorithm.- Parameters:
aMakeLabelsStickyOnEdit-trueif you want the labels to be sticky after they are edited,falseotherwise.- See Also:
-
isMakeLabelsStickyOnEdit
public boolean isMakeLabelsStickyOnEdit()Returns whether the labels this editor edits are made sticky.- Returns:
trueif this editor sets the labels it edits to be sticky,falseotherwise. The default value isfalse.- See Also:
-
getLabelCreationClickCount
public int getLabelCreationClickCount()Description copied from interface:ILcdGXYLabelEditorReturns the number of points required to initialize the label of the setObject.- Specified by:
getLabelCreationClickCountin interfaceILcdGXYLabelEditor- Returns:
- the number of points required to initialize the label of the set
Objector -1 if this is undefined like for a polyline or a polygon. 0 means graphical creation of labels is not supported.
-
getPinColor
Returns the color in which the pin is drawn.- Returns:
- The color in which the pin is drawn.
- See Also:
-
setPinColor
Sets the color in which the pin should be drawn.- Parameters:
aPinColor- The color in which the pin should be drawn.- See Also:
-
getSelectedPinColor
Returns the color in which the pin should be drawn of the label of a selected object.- Returns:
- The color in which the pin should be drawn of the label of a selected object.
-
setSelectedPinColor
Sets the color in which the pin of the label of a selected label should be drawn.- Parameters:
aSelectedPinColor- The color in which the pin of the label of a selected label should be drawn.- See Also:
-
isHaloEnabled
public boolean isHaloEnabled()Returns true if the halo effect is on for the labels, false otherwise.- Returns:
- true if the halo effect is on, false otherwise
- See Also:
-
setHaloEnabled
public void setHaloEnabled(boolean aHaloEnabled) Switches the halo effect for the labels on or off.- Parameters:
aHaloEnabled- true if halos should be added, false otherwise- See Also:
-
isHaloPinEnabled
public boolean isHaloPinEnabled()Returns true if the halo effect also includes the pin.- Returns:
- true if the halo effect includes the pin, false otherwise
- See Also:
-
setHaloPinEnabled
public void setHaloPinEnabled(boolean aHaloPinEnabled) Sets if the halo effect should be applied to the pin. This only has effect when the pin is enabled.- Parameters:
aHaloPinEnabled- true if the halo effect includes the pin, false otherwise- See Also:
-
getHaloThickness
public int getHaloThickness()Returns the current halo thickness.- Returns:
- the current halo thickness
- See Also:
-
setHaloThickness
public void setHaloThickness(int aThickness) Sets the thickness (in pixels) of the halo to be added around labels.- Parameters:
aThickness- the new halo thickness- See Also:
-
getHaloColor
Returns the current halo color.- Returns:
- the current halo color
- See Also:
-
setHaloColor
Sets the color of the halo to be added around labels.- Parameters:
aColor- the new halo color- See Also:
-
setHaloAlgorithm
Sets the algorithm to be used for rendering halo's. The choice of the halo algorithm may have a major impact on the overall performance of this painter. SeeTLcdHaloAlgorithmfor more information on the available algorithms.- Parameters:
aHaloAlgorithm- the algorithm to be used for rendering halo's.- See Also:
-
getHaloAlgorithm
Returns the algorithm that is used for rendering halo's.- Returns:
- the algorithm that is used for rendering halo's.
- See Also:
-
getHaloPinColor
Returns the current halo pin color.- Returns:
- the current halo pin color
- See Also:
-
setHaloPinColor
Sets the color of the halo to be added around pins.- Parameters:
aColor- the new halo color- See Also:
-
isUseImageCache
public boolean isUseImageCache()Returnstruewhen image caching for labels with a halo is enabled,falseotherwise.- Returns:
truewhen label image caching is enabled,falseotherwise- See Also:
-
setUseImageCache
public void setUseImageCache(boolean aUseCache) Sets whether or not labels with halos should be cached as images. Creating a halo for a label is an expensive operation, so enabling image caching can considerably improve performance.- Parameters:
aUseCache- specifies whether image caching should be enabled- See Also:
-
clearImageCache
public void clearImageCache()Clears the entire label image cache. To remove a single label from the cache, useclearImageCache(Object).- See Also:
-
clearImageCache
Clears the label image cache for the given object. The next time this object is painted, a new image will be created and cached for it. To remove all cached images in one go, useclearImageCache().- Parameters:
aObject- the object for which the cache to be cleared.- See Also:
-
setWithPin
public void setWithPin(boolean aWithPin) The propertywithPindetermines whether a pin should be drawn from the object to the label. The pin is attached to the object at theanchor pointand to the label stamp at thepin point.- Parameters:
aWithPin- true to paint a pin connecting the label and the object.- See Also:
-
isWithPin
public boolean isWithPin()Returns whether a pin is drawn from the object to the label.- Returns:
trueif a pin is drawn from the object to the label- See Also:
-
setWithAnchorPoint
public void setWithAnchorPoint(boolean aWithAnchorPoint) Determines whether to draw an anchor point atanchorPointSFCT.- Parameters:
aWithAnchorPoint- true to paint an anchor point- See Also:
-
isWithAnchorPoint
public boolean isWithAnchorPoint()Returns whether to draw an anchor point atanchorPointSFCT.- Returns:
trueif an anchor point is painted,falseotherwise- See Also:
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istruethen all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
retrieveLabels(int, ILcdGXYContext)