public class TLcdICAOAirspaceDetailedLabelPainter extends TLcdGXYStampLabelPainter
The label will contain the following items
If the airspace type is 'class', the actual value of the class will be used in the label instead of the type.
The setTypeExpression
method,
setClassExpression
method, the
setNameExpression
method, the
setLowerLimitValueExpression
method, the setLowerLimitUnitExpression
method, the
setLowerLimitReferenceExpression
method, the
setUpperLimitValueExpression
method, the setUpperLimitUnitExpression
method and the
setUpperLimitReferenceExpression
method allow the user to specify the
properties that are used to retrieve the values that will be shown in the
label item. The default value of each property is null
, which
means that the corresponding value will not be used in the label.
This label painter evaluates its expressions using an instance of
TLcdDataObjectExpressionLanguage
.
CENTER, EAST, MAXIMUM_AVAILABLE_LOCATIONS, NORTH, NORTH_EAST, NORTH_WEST, SOUTH, SOUTH_EAST, SOUTH_WEST, WEST
BODY, CREATING, HANDLES, RESHAPING, SNAPS, TRANSLATING
DEFAULT, SELECTED
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATED
Constructor and Description |
---|
TLcdICAOAirspaceDetailedLabelPainter()
Default constructor.
|
TLcdICAOAirspaceDetailedLabelPainter(TLcdICAOAirspaceDetailedLabelPainter aDetailedLabelPainter)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptSnapTargetForLabel(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns whether the label specified by
setObject , setLabelIndex and
setSubLabelIndex accepts the snap target in the given
ILcdGXYContext . |
protected void |
addComponentToGXYView(ILcdGXYView aGXYView,
Component aComponent)
Adds the specified interactive label to the user interface.
|
protected void |
anchorPointSFCT(Graphics aGraphics,
int aMode,
ILcdGXYContext aContext,
Point aPointSFCT)
Retrieves an anchor point that is used to determine where the pin
of the label (specified by
setObject , setLabelIndex and
setSubLabelIndex ) attaches to the object representation. |
int |
calculateMaxLabelWidth(String[] aLabels,
Graphics aGraphics)
Calculates the maximum label width, given the specified labels.
|
protected boolean |
canAddComponentToGXYView(ILcdGXYView aGXYView)
Returns whether or not an interactive label can be added to the given view.
|
void |
cancelLabelInteraction()
Cancels the interactive label, if there is one.
|
boolean |
canStopLabelInteraction()
Returns whether or not the label interaction can be stopped.
|
void |
clearImageCache()
Clears the entire label image cache.
|
void |
clearImageCache(Object aObject)
Clears the label image cache for the given object.
|
Object |
clone()
Returns a new instance of this
ALcdGXYLabelPainter . |
boolean |
editLabel(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Adapts the set
TLcdLabelLocation according to the information present in
aGXYContext. |
protected void |
firePropertyChangeEvent(PropertyChangeEvent aPropertyChangeEvent)
Notifies the registered
PropertyChangeListener s of the specified event. |
ILcdGenericAirspace |
getAirspace()
Returns the featured airspace to be labeled.
|
Color |
getBackground()
Returns the color of the label frames filling.
|
protected Component |
getComponentForGXYView(ILcdGXYView aGXYView)
Gets the component that represents the given
ILcdGXYView . |
String |
getDisplayName()
This default implementation returns the display name set with
setDisplayName , or toString() if this was set to null . |
int |
getDistanceToAltitudeLine()
Returns the vertical spacing between the upper altitude and the separation line between
upper and lower altitude, expressed in pixels.
|
Object |
getDomainObjectForInteractiveLabel()
Returns the domain object for the interactive label, or
null if there is no
interactive label. |
Font |
getFont()
Returns the font for drawing the labels.
|
Color |
getForeground()
Returns the color of the labels.
|
ALcdGXYInteractiveLabelProvider |
getGXYInteractiveLabelProvider()
Returns the interactive label provider.
|
ILcdGXYLabelEditor |
getGXYLabelEditor(Object aObject)
Returns a valid
ILcdGXYLabelEditor for editing the labels of aObject. |
ILcdGXYLabelPainter |
getGXYLabelPainter(Object aObject)
Finds an
ILcdGXYLabelPainter that can be used to label the object passed. |
ALcdGXYLabelStamp |
getGXYLabelStamp()
Returns the
ALcdGXYLabelStamp that is used by this painter to paint the labels. |
TLcdHaloAlgorithm |
getHaloAlgorithm()
Returns the algorithm that is used for rendering halo's.
|
Color |
getHaloColor()
Returns the current halo color.
|
Color |
getHaloPinColor()
Returns the current halo pin color.
|
int |
getHaloThickness()
Returns the current halo thickness.
|
int |
getHorizontalSpacing()
Returns the horizontal spacing between two strings in
the label, expressed in pixels.
|
int |
getLabelCreationClickCount()
Returns the number of points required to initialize the label of the set
Object . |
Cursor |
getLabelCursor(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Returns a
Cursor to indicate the type of editing aMode and
aGXYContext . |
Color |
getPinColor()
Returns the color in which the pin is drawn.
|
String |
getPositionAsString(int aPosition)
Returns the string representation of the given position of the labels relative to the anchor point.
|
int[] |
getPositionList()
Returns the list of possible positions to place the labels.
|
String[] |
getPositionListAsString()
Gets the
String representations of the current position list. |
int |
getPossibleLocationCount(Graphics aGraphics)
Returns the number of possible locations to use (starting from the default position).
|
Color |
getSelectedPinColor()
Returns the color in which the pin should be drawn of the label of a selected object.
|
Color |
getSelectionColor()
Returns the color of the label of a selected object.
|
int |
getShiftLabelPosition()
Returns how many pixels the label must be removed from the anchor point of the domain object.
|
int |
getVerticalSpacing()
Returns the vertical distance in pixels between successive features.
|
boolean |
isFilled()
Returns whether the label's rectangle is painted filled.
|
boolean |
isHaloEnabled()
Returns true if the halo effect is on for the labels, false otherwise.
|
boolean |
isHaloPinEnabled()
Returns true if the halo effect also includes the pin.
|
boolean |
isLabelTouched(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Tests if the label specified by
setObject , setLabelIndex and
setSubLabelIndex is touched at view location (specified by
aGXYContext.getX() and aGXYContext.getY() ), considering the mode and the
ILcdGXYContext instance. |
boolean |
isMakeLabelsStickyOnEdit()
Returns whether the labels this editor edits are made sticky.
|
boolean |
isPaintCache()
Returns whether intermediate results should be cached.
|
boolean |
isUseImageCache()
Returns
true when image caching for labels with a halo is enabled,
false otherwise. |
boolean |
isWithAnchorPoint()
Returns whether to draw an anchor point at
anchorPointSFCT . |
boolean |
isWithPin()
Returns whether a pin is drawn from the object to the label.
|
void |
labelAnchorPointSFCT(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext,
Point aPointSFCT)
Sets
aPointSFCT to the anchor point of the label specified by
setObject , setLabelIndex and setSubLabelIndex . |
double |
labelBoundsSFCT(Graphics aGraphics,
int i,
ILcdGXYContext aILcdGXYContext,
Rectangle aRectangle)
Calculates the bounds of the label that can be painted.
|
protected double |
labelPositionForLocationIndexSFCT(int aLocationIndex,
int aWidth,
int aHeight,
Point aAnchorPoint,
int aMode,
ILcdGXYContext aGXYContext,
Graphics aGraphics,
Point aPointSFCT)
For discrete placement, the upper left corner is chosen as follows:
- east-oriented positions: left label side touches aPointSFCT + shift
- west-oriented positions: right label side touches aPointSFCT + shift
- middle-oriented positions: vertical center axis of label touches aPointSFCT
- north-oriented positions: lower side touches aPointSFCT + shift
- south-oriented positions: upper side touches aPointSFCT + shift
- center-oriented positions: horizontal center axis touches aPointSFCT
The labels are unrotated.
|
Object |
labelSnapTarget(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns an
Object that can be used as snapping target when graphically editing
another Object or label than the one this ILcdGXYLabelPainter2 represents. |
void |
paintLabel(Graphics aGraphics,
int aMode,
ILcdGXYContext aILcdGXYContext)
Paints the label specified by
setObject , setLabelIndex and
setSubLabelIndex on aGraphics . |
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.
|
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.
|
protected void |
removeComponentFromGXYView(ILcdGXYView aGXYView,
Component aComponent)
Removes the specified
java.awt.Component from the user interface. |
protected String[] |
retrieveLabels(int aMode,
ILcdGXYContext aContext) |
void |
setBackground(Color aBackground)
Sets the color of the label frames filling.
|
void |
setClassExpression(String aExpression)
Specifies the expression that evaluates to the airspace class.
|
void |
setClassIndex(int aIndex)
Deprecated.
|
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setDistanceToAltitudeLine(int aDistanceToAltitudeLine)
Specifies the vertical spacing between the upper altitude and the horizontal separation
line between upper and lower altitude, expressed in pixels.
|
void |
setFilled(boolean aFilled)
Sets whether the label's rectangle must be painted filled.
|
void |
setFont(Font aFont)
Sets the font for drawing the labels.
|
void |
setForeground(Color aForeground)
Sets the color of the labels.
|
void |
setGXYInteractiveLabelProvider(ALcdGXYInteractiveLabelProvider aGXYInteractiveLabelProvider)
Deprecated.
this is controller logic. Use
TLcdGXYInteractiveLabelsController instead. |
void |
setGXYLabelStamp(ALcdGXYLabelStamp aGXYLabelStamp)
Sets the
ALcdGXYLabelStamp that this painter should use to paint the labels. |
void |
setHaloAlgorithm(TLcdHaloAlgorithm aHaloAlgorithm)
Sets the algorithm to be used for rendering halo's.
|
void |
setHaloColor(Color aColor)
Sets the color of the halo to be added around labels.
|
void |
setHaloEnabled(boolean aHaloEnabled)
Switches the halo effect for the labels on or off.
|
void |
setHaloPinColor(Color aColor)
Sets the color of the halo to be added around pins.
|
void |
setHaloPinEnabled(boolean aHaloPinEnabled)
Sets if the halo effect should be applied to the pin.
|
void |
setHaloThickness(int aThickness)
Sets the thickness (in pixels) of the halo to be added around labels.
|
void |
setHorizontalSpacing(int aHorizontalSpacing)
Specifies the horizontal spacing between two strings
in the label, expressed in pixels.
|
void |
setLowerLimitReferenceExpression(String aExpression)
Specifies the expression that evaluates to the lower limit reference.
|
void |
setLowerLimitReferenceIndex(int aIndex)
Deprecated.
|
void |
setLowerLimitUnitExpression(String aExpression)
Specifies the expression that evaluates to the lower limit unit.
|
void |
setLowerLimitUnitIndex(int aIndex)
Deprecated.
|
void |
setLowerLimitValueExpression(String aExpression)
Specifies the expression that evaluates to the lower limit value.
|
void |
setLowerLimitValueIndex(int aIndex)
Deprecated.
|
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.
|
void |
setNameExpression(String aExpression)
Specifies the expression that evaluates to the name.
|
void |
setNameIndex(int aIndex)
Deprecated.
|
void |
setObject(Object aObject)
Sets the Object to be labeled by this ILcdGXYLabelPainter.
|
void |
setPaintCache(boolean aPaintCache)
The paintCache property determines whether the painter will cache
(intermediate) calculated points.
|
void |
setPinColor(Color aPinColor)
Sets the color in which the pin should be drawn.
|
void |
setPositionList(int[] aPositionList)
Sets a new position list.
|
void |
setPositionListAsString(String[] aPositionList)
The labels can occupy various positions relative to the anchor point
(see description above).
|
void |
setProvideInteractiveLabelOnMouseOver(boolean aProvideInteractiveLabelOnMouseOver)
Deprecated.
this is controller logic. Use
TLcdGXYInteractiveLabelsController instead. |
void |
setSelectedPinColor(Color aSelectedPinColor)
Sets the color in which the pin of the label of a selected label should be drawn.
|
void |
setSelectionColor(Color aSelectionColor)
Sets the color of the label of a selected object
|
void |
setShiftLabelPosition(int aShift)
Sets how many pixels the label must be removed from the anchor point of the domain object.
|
void |
setTypeExpression(String aExpression)
Specifies the expression that evaluates to the airspace type feature.
|
void |
setTypeIndex(int aIndex)
Deprecated.
|
void |
setUnitProvidingServiceExpression(String aExpression)
Specifies the expression that evaluates to the unit providing service.
|
void |
setUnitProvidingServiceIndex(int aIndex)
Deprecated.
|
void |
setUpperLimitReferenceExpression(String aExpression)
Specifies the expression that evaluates to the upper limit reference.
|
void |
setUpperLimitReferenceIndex(int aIndex)
Deprecated.
|
void |
setUpperLimitUnitExpression(String aExpression)
Specifies the expression that evaluates to the upper limit unit.
|
void |
setUpperLimitUnitIndex(int aIndex)
Deprecated.
|
void |
setUpperLimitValueExpression(String aExpression)
Specifies the expression that evaluates to the upper limit value.
|
void |
setUpperLimitValueIndex(int aIndex)
Deprecated.
|
void |
setUseImageCache(boolean aUseCache)
Sets whether or not labels with halos should be cached as images.
|
void |
setVerticalSpacing(int aVerticalSpacing)
Sets the vertical distance in pixels between successive features.
|
void |
setWithAnchorPoint(boolean aWithAnchorPoint)
Determines whether to draw an anchor point at
anchorPointSFCT . |
void |
setWithPin(boolean aWithPin)
The property
withPin determines whether a pin should be drawn from the object to
the label. |
void |
startLabelInteraction(Object aDomainObject,
int aLabelIndex,
int aSubLabelIndex,
ILcdGXYContext aGXYContext)
Configure an interactive label for the specified label and show it in the GUI.
|
boolean |
stopLabelInteraction()
Stops the interactive label, if there is one.
|
addPropertyChangeListener, getLabelCount, getLabelIndex, getLabelLocation, getLocationIndex, getObject, getSubLabelCount, getSubLabelIndex, removePropertyChangeListener, setDisplayName, setLabelIndex, setLabelLocation, setLocationIndex, setSubLabelIndex, supportLabelSnap
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLabelLocation, setLabelLocation, supportLabelSnap
getLabelCount, getLabelIndex, getSubLabelCount, getSubLabelIndex, setLabelIndex, setSubLabelIndex
getLocationIndex, getObject, setLocationIndex
getLabelCount, getLabelIndex, getLabelLocation, getObject, getSubLabelCount, getSubLabelIndex, setLabelIndex, setLabelLocation, setSubLabelIndex
addPropertyChangeListener, removePropertyChangeListener
public TLcdICAOAirspaceDetailedLabelPainter()
public TLcdICAOAirspaceDetailedLabelPainter(TLcdICAOAirspaceDetailedLabelPainter aDetailedLabelPainter)
aDetailedLabelPainter
- the object to be copied.public void setObject(Object aObject)
ILcdGXYLabelPainter2
Setting the object should set the TLcdLabelLocation
to null
, to
ensure that older code which has not been adapted to this new interface keeps working.
setObject
in interface ILcdGXYLabelEditor
setObject
in interface ILcdGXYLabelPainter
setObject
in interface ILcdGXYLabelPainter2
setObject
in class ALcdGXYLabelPainter
aObject
- The object to be labeled.ILcdGXYLabelPainter.getObject()
public Object clone()
ALcdGXYLabelPainter
ALcdGXYLabelPainter
. The label location
of the clone is a clone of the label location of the original. No other objects
are cloned.clone
in interface ILcdGXYLabelEditor
clone
in interface ILcdGXYLabelEditorProvider
clone
in interface ILcdGXYLabelPainter
clone
in interface ILcdGXYLabelPainter2
clone
in interface ILcdGXYLabelPainterProvider
ALcdGXYLabelPainter
of which the label location
is a deep clone.public void paintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aILcdGXYContext)
ILcdGXYLabelPainter2
Paints the label specified by setObject
, setLabelIndex
and
setSubLabelIndex
on aGraphics
. aGXYContext
should
contain the ILcdGXYView
for which the label is painted and
ILcdGXYLayer
to which the object belongs
The implementation of this method shall define how to paint the specified label in the given
mode, considering aGXYContext
and the set TLcdLabelLocation
.
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.DEFAULT
or ILcdGXYLabelPainter.SELECTED
, the mode now can be a
bitwise combination of several constants
paintLabel
in interface ILcdGXYLabelPainter
paintLabel
in interface ILcdGXYLabelPainter2
aGraphics
- The graphics object to paint the label onaMode
- A bitwise combination of aILcdGXYContext
- the drawing context for the labelILcdGXYLabelPainter.DEFAULT
,
ILcdGXYLabelPainter.SELECTED
public double labelBoundsSFCT(Graphics aGraphics, int i, ILcdGXYContext aILcdGXYContext, Rectangle aRectangle) throws TLcdNoBoundsException
ILcdGXYLabelPainter2
Calculates the bounds of the label that can be painted. The bounds are set as a side effect
in aRectangleSFCT
, the orientation of aRectangleSFCT
is 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.
labelBoundsSFCT
in interface ILcdGXYLabelPainter
labelBoundsSFCT
in interface ILcdGXYLabelPainter2
aGraphics
- the aGraphics
to consider.i
- the representation mode of the label.aILcdGXYContext
- the ILcdGXYContext
the drawing depends on.aRectangle
- the Rectangle
containing the bounds of the label in view /
graphics coordinates as side effect.TLcdNoBoundsException
- if the Object doesn't have any valid bounds, e.g. if it is always
invisible in the current projection.ILcdGXYViewLabelPainter
,
ILcdGXYLayerLabelPainter
,
ILcdGXYLabelPainter2.labelAnchorPointSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Point)
public boolean isLabelTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
ILcdGXYLabelPainter2
setObject
, setLabelIndex
and
setSubLabelIndex
is touched at view location (specified by
aGXYContext.getX()
and aGXYContext.getY()
), considering the mode and the
ILcdGXYContext
instance.
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.
isLabelTouched
in interface ILcdGXYLabelPainter2
aGraphics
- The Graphics
instance on which the label is painted.aMode
- the mode to consider. This is a bitwise combinations of several constants.
See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
for more information.aGXYContext
- the ILcdGXYContext
to consider.ILcdGXYContext
public int calculateMaxLabelWidth(String[] aLabels, Graphics aGraphics)
aLabels
- The labels of the airspace, determined through retrieveLabels(int,com.luciad.view.gxy.ILcdGXYContext)
.aGraphics
- A Graphics instance, which is used to retrieve the font properties.public ILcdGenericAirspace getAirspace()
@Deprecated public void setTypeIndex(int aIndex)
setTypeExpression(String)
aIndex
- the index of the airspace type feature.public void setTypeExpression(String aExpression)
aExpression
- the airspace type property name.TLcdDataObjectExpressionLanguage
@Deprecated public void setClassIndex(int aIndex)
setClassExpression(String)
aIndex
- the index of the airspace class feature.public void setClassExpression(String aExpression)
aExpression
- the airspace class expression.TLcdDataObjectExpressionLanguage
@Deprecated public void setNameIndex(int aIndex)
setNameExpression(String)
aIndex
- the index of the name feature.public void setNameExpression(String aExpression)
aExpression
- the name expressionTLcdDataObjectExpressionLanguage
@Deprecated public void setUnitProvidingServiceIndex(int aIndex)
setUnitProvidingServiceExpression(String)
aIndex
- the index of the unit providing service.public void setUnitProvidingServiceExpression(String aExpression)
aExpression
- the unit providing service expressionTLcdDataObjectExpressionLanguage
@Deprecated public void setLowerLimitValueIndex(int aIndex)
setLowerLimitValueExpression(String)
aIndex
- the index of the lower limit value feature.public void setLowerLimitValueExpression(String aExpression)
aExpression
- the lower limit value expression.TLcdDataObjectExpressionLanguage
@Deprecated public void setLowerLimitUnitIndex(int aIndex)
setLowerLimitUnitExpression(String)
aIndex
- the index of the lower limit unit feature.public void setLowerLimitUnitExpression(String aExpression)
aExpression
- the lower limit unit expression.TLcdDataObjectExpressionLanguage
@Deprecated public void setLowerLimitReferenceIndex(int aIndex)
setLowerLimitReferenceExpression(String)
aIndex
- the index of the lower limit reference feature.public void setLowerLimitReferenceExpression(String aExpression)
aExpression
- the lower limit reference expressionTLcdDataObjectExpressionLanguage
@Deprecated public void setUpperLimitValueIndex(int aIndex)
setUpperLimitValueExpression(String)
aIndex
- the index of the upper limit value feature.public void setUpperLimitValueExpression(String aExpression)
aExpression
- the upper limit value expression.TLcdDataObjectExpressionLanguage
@Deprecated public void setUpperLimitUnitIndex(int aIndex)
setUpperLimitUnitExpression(String)
aIndex
- the index of the upper limit unit feature.public void setUpperLimitUnitExpression(String aExpression)
aExpression
- the upper limit unit expression.TLcdDataObjectExpressionLanguage
@Deprecated public void setUpperLimitReferenceIndex(int aIndex)
setUpperLimitReferenceExpression(String)
aIndex
- the index of the upper limit reference feature.public void setUpperLimitReferenceExpression(String aExpression)
aExpression
- the upper limit reference expression.TLcdDataObjectExpressionLanguage
public int getHorizontalSpacing()
setHorizontalSpacing(int)
public void setHorizontalSpacing(int aHorizontalSpacing)
aHorizontalSpacing
- the horizontal spacing between two strings in the label, expressed in pixels.getHorizontalSpacing()
public int getDistanceToAltitudeLine()
setDistanceToAltitudeLine(int)
public void setDistanceToAltitudeLine(int aDistanceToAltitudeLine)
aDistanceToAltitudeLine
- the vertical spacing between the upper altitude and the horizontal separation
line between upper and lower altitude, expressed in pixels.getDistanceToAltitudeLine()
public boolean isPaintCache()
setPaintCache(boolean)
public void setPaintCache(boolean aPaintCache)
aPaintCache
- true to cache intermediate results.isPaintCache()
public void setFont(Font aFont)
aFont
- the font for drawing the labels.public Font getFont()
public void setForeground(Color aForeground)
aForeground
- the color of the labels.public Color getForeground()
public void setBackground(Color aBackground)
aBackground
- the color of the label frames filling.public Color getBackground()
public void setSelectionColor(Color aSelectionColor)
aSelectionColor
- the color of the label of a selected object.public Color getSelectionColor()
public void setFilled(boolean aFilled)
aFilled
- whether the label's rectangle must be painted filled.public boolean isFilled()
public void setVerticalSpacing(int aVerticalSpacing)
aVerticalSpacing
- the vertical distance in pixels between successive features.public int getVerticalSpacing()
protected String[] retrieveLabels(int aMode, ILcdGXYContext aContext)
public int getPossibleLocationCount(Graphics aGraphics)
aGraphics
- the Graphics the label will be painted on. Not used in this implementation.ILcdGXYLabelPainter.setLocationIndex(int)
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.
aPositionList
- the list of possible positions to place the labels.getPositionList()
,
ALcdGXYLabelPainter.setLabelLocation(TLcdLabelLocation)
,
setShiftLabelPosition(int)
public int[] getPositionList()
setPositionList(int[])
public void setPositionListAsString(String[] aPositionList)
String
objects are valid
(independent of the font case):
aPositionList
- the list of possible positions to place labels givens as Strings objects.getPositionListAsString()
public String[] getPositionListAsString()
String
representations of the current position list.String
representations of the current position list.setPositionListAsString(java.lang.String[])
public String getPositionAsString(int aPosition)
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.getPositionConstantFromString(java.lang.String)
protected double labelPositionForLocationIndexSFCT(int aLocationIndex, int aWidth, int aHeight, Point aAnchorPoint, int aMode, ILcdGXYContext aGXYContext, Graphics aGraphics, Point aPointSFCT)
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.aPointSFCT
parameter as a side
effect.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 east
or west
, this shift is applied in
horizontal direction; if the position is north
or south
, this
shift is applied in vertical direction. In case of north east
, south east
, south west
or north west
, this
shift is applied in both directions. If the location of the label is center
,
the shift is ignored.
The default for this value is 8
pixels.
aShift
- the distance, expressed in pixels, that the label must be removed from the domain
object.getShiftLabelPosition()
public int getShiftLabelPosition()
setShiftLabelPosition(int)
@Deprecated public void setGXYInteractiveLabelProvider(ALcdGXYInteractiveLabelProvider aGXYInteractiveLabelProvider)
TLcdGXYInteractiveLabelsController
instead.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 IllegalStateException
.
setProvideInteractiveLabelOnMouseOver
must be set to true
.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 be null
.IllegalStateException
- When the interactive label provider was already set.IllegalArgumentException
- When the interactive label provider was null
.setProvideInteractiveLabelOnMouseOver(boolean)
public ALcdGXYInteractiveLabelProvider getGXYInteractiveLabelProvider()
setGXYInteractiveLabelProvider(ALcdGXYInteractiveLabelProvider)
protected Component getComponentForGXYView(ILcdGXYView aGXYView)
Gets the component that represents the given ILcdGXYView
. By default this is
the view itself casted to java.awt.Component
. This information is used for
handling mouse events.
Override this method if your ILcdGXYView
implementation does not extend from
java.awt.Component
.
aGXYView
- The view for which a Component
must be retrieved.java.awt.Component
which corresponds to the given
ILcdGXYView
IllegalArgumentException
- By default when aGXYView
is not a
java.awt.Component
ALcdGXYInteractiveLabelProvider.dispatchMouseEvent(java.awt.event.MouseEvent,
java.awt.Component, java.awt.Component)
protected boolean canAddComponentToGXYView(ILcdGXYView aGXYView)
Returns whether or not an interactive label can be added to the given view. If this method
returns false
, addComponentToGXYView
must not be called. By default this method checks if the given
ILcdGXYView
is an instance of java.awt.Container
without a layout
set on it.
Override this method if your ILcdGXYView
implementation is not a
java.awt.Container
or if you add components to another container than the
specified ILcdGXYView
.
aGXYView
- The ILcdGXYView
for which to check if a component can be added.true
if a component can be added, false
otherwise.addComponentToGXYView(ILcdGXYView, java.awt.Component)
protected void addComponentToGXYView(ILcdGXYView aGXYView, Component aComponent)
Adds the specified interactive label to the user interface. By default this method casts the
given ILcdGXYView
to java.awt.Container
and adds the component to the
view.
Override this method if your implementation of ILcdGXYView
does not extend from
java.awt.Container
or if you want to add the interactive label to another
java.awt.Container
because, for instance, you already need to add other components
to the specified ILcdGXYView
.
If you override this method, you also need to override canAddComponentToGXYView
and removeComponentFromGXYView
as these methods are closely related to each other.
This method will not be called if canAddComponentToGXYView
returns false
.
aGXYView
- The view to which the interactive label should be added.aComponent
- The interactive label that should be added to the user interface.IllegalArgumentException
- By default if aGXYView
is not an instance of
java.awt.Container
or if the layout of
aGXYView
is not null.canAddComponentToGXYView(ILcdGXYView)
,
removeComponentFromGXYView(ILcdGXYView, java.awt.Component)
protected void removeComponentFromGXYView(ILcdGXYView aGXYView, Component aComponent)
Removes the specified java.awt.Component
from the user interface. By default
this method casts the specified ILcdGXYView
to java.awt.Container
and
removes the component from that container.
Override this method if you have overridden
addComponentToGXYView
.
aGXYView
- The view from which the interactive label should be removed.aComponent
- The interactive label that should be removed from the user interfaceIllegalArgumentException
- By default if the view does not extend from
java.awt.Container
public void startLabelInteraction(Object aDomainObject, int aLabelIndex, int aSubLabelIndex, ILcdGXYContext aGXYContext)
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 of ILcdGXYContext
containing the layer and the
view for which the label should be made interactivepublic 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
.
true
if the label interaction can be stopped, false
otherwise.public boolean stopLabelInteraction()
Stops the interactive label, if there is one. The interactive label will commit any outstanding changes.
true
if the interactive label could be stopped or if there was no
interactive label, false
otherwise.canStopLabelInteraction()
,
ALcdGXYInteractiveLabelProvider.stopInteraction()
public void cancelLabelInteraction()
public Object getDomainObjectForInteractiveLabel()
null
if there is no
interactive label.null
if there is no
interactive label.@Deprecated public void setProvideInteractiveLabelOnMouseOver(boolean aProvideInteractiveLabelOnMouseOver)
TLcdGXYInteractiveLabelsController
instead.Enables the ALcdGXYInteractiveLabelProvider
functionality, 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 certain ILcdGXYController
is active.
aProvideInteractiveLabelOnMouseOver
- true
to activate the
ALcdGXYInteractiveLabelProvider
, false
otherwise.setGXYInteractiveLabelProvider
public void labelAnchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException
ILcdGXYLabelPainter2
Sets aPointSFCT
to the anchor point of the label specified by
setObject
, setLabelIndex
and setSubLabelIndex
.
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 the label
and its location
.
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.
labelAnchorPointSFCT
in interface ILcdGXYLabelPainter2
aGraphics
- The Graphics
instance on which the label is painted.aMode
- The mode to consider. This can be a bitwise combination of several
constants. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
for more information.aGXYContext
- The ILcdGXYContext
that can be used to retrieve extra
information.aPointSFCT
- The point which will be updated to reflect the location of the anchor
point.TLcdNoBoundsException
- if the Object doesn't have any valid anchor point, e.g. if it is
always invisible in the current projection.ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
,
ILcdGXYLabelPainter2.getLabelLocation()
,
ILcdGXYLabelPainter2.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)
public boolean editLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
ILcdGXYLabelEditor
Adapts the set TLcdLabelLocation
according to the information present in
aGXYContext. If the method returns true
, the TLcdLabelLocation
was
modified, if false
is 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 and
aGXYContext
. These should all be set before calling this method. Note that
if aMode
is one of the creating modes, the (sub) label indices are irrelevant.
editLabel
in interface ILcdGXYLabelEditor
aGraphics
- The Graphics
on which the label is painted.aMode
- the mode to consider when editing aObject: aMode shall be a combination of
ILcdGXYLabelEditor.TRANSLATED
,ILcdGXYLabelEditor.RESHAPED
, ILcdGXYLabelEditor.START_CREATION
,ILcdGXYLabelEditor.CREATING
, ILcdGXYLabelEditor.END_CREATION
.aGXYContext
- contains the information to consider when editing the set Object.ILcdGXYContext
public Object labelSnapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext)
ALcdGXYLabelPainter
Object
that can be used as snapping target when graphically editing
another Object
or label than the one this ILcdGXYLabelPainter2 represents. The
returned Object
can be the Object
this ILcdGXYLabelPainter2
represents or any other (e.g. an ILcdPoint
if getObject() is an
ILcdPointList
).
This default implementation always returns null
. Override this method if you want
to support snapping.
labelSnapTarget
in interface ILcdGXYLabelPainter2
labelSnapTarget
in class ALcdGXYLabelPainter
aGraphics
- the Graphics on which is worked.aGXYContext
- the ILcdGXYContext of the snapping.Object
that can be used as snapping target when graphically editing
another Object
or label than the one this ILcdGXYLabelPainter2 represents
(returned by getObject()). This object can be null
.public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject)
ILcdGXYLabelPainterProvider
ILcdGXYLabelPainter
that 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;
}
getGXYLabelPainter
in interface ILcdGXYLabelPainterProvider
aObject
- the object to find a label painter forpublic ILcdGXYLabelEditor getGXYLabelEditor(Object aObject)
ILcdGXYLabelEditorProvider
Returns a valid ILcdGXYLabelEditor
for editing the labels of aObject. The
returned ILcdGXYLabelEditor
must have aObject
set on it. The
TLcdLabelLocation must not yet be set on it.
getGXYLabelEditor
in interface ILcdGXYLabelEditorProvider
aObject
- the Object for which to obtain a ILcdGXYLabelEditor
.ILcdGXYLabelEditor
for editing the labels of aObject
with aObject
set on it.ILcdGXYLabelEditor.setObject(java.lang.Object)
public void setGXYLabelStamp(ALcdGXYLabelStamp aGXYLabelStamp)
Sets the ALcdGXYLabelStamp
that this painter should use to paint the labels. This stamp must be set to
a non-null
value before this label painter can be used on a layer.
aGXYLabelStamp
- The ALcdGXYLabelStamp
that this painter should use to paint the labels.public ALcdGXYLabelStamp getGXYLabelStamp()
ALcdGXYLabelStamp
that is used by this painter to paint the labels.ALcdGXYLabelStamp
that is used by this painter to paint the labels.setGXYLabelStamp(ALcdGXYLabelStamp)
protected void firePropertyChangeEvent(PropertyChangeEvent aPropertyChangeEvent)
ALcdGXYLabelPainter
PropertyChangeListener
s of the specified event.firePropertyChangeEvent
in class ALcdGXYLabelPainter
aPropertyChangeEvent
- The event describing the property change of which the registered
listeners should be notified.ALcdGXYLabelPainter.addPropertyChangeListener(java.beans.PropertyChangeListener)
public String getDisplayName()
ALcdGXYLabelPainter
setDisplayName
, or toString()
if this was set to null
.getDisplayName
in interface ILcdGXYLabelEditor
getDisplayName
in interface ILcdGXYLabelPainter2
getDisplayName
in class ALcdGXYLabelPainter
ILcdGXYLabelPainter2
public Cursor getLabelCursor(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
ALcdGXYLabelPainter
Cursor
to indicate the type of editing aMode
and
aGXYContext
.
This default implementation always returns null
. Override this method if you want
to display custom cursors.
getLabelCursor
in interface ILcdGXYLabelPainter2
getLabelCursor
in class ALcdGXYLabelPainter
aGraphics
- The Graphics
instance on which the label is painted.aMode
- The mode to consider. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int,
ILcdGXYContext)
for more information.aGXYContext
- The ILcdGXYContext
containing extra information, such as the
layer, the view and the mouse position.Cursor
to indicate the type of editing aMode
and
aGXYContext
. Returns null
if no particular
Cursor
is required.public boolean acceptSnapTargetForLabel(Graphics aGraphics, ILcdGXYContext aGXYContext)
ILcdGXYLabelEditor
Returns whether the label specified by setObject
, setLabelIndex
and
setSubLabelIndex
accepts the snap target in the given
ILcdGXYContext
.
The snap target is the Object
returned by aGXYContext.getSnapTarget()
,
and is on the ILcdGXYLayer
returned by aGXYContext.getSnapTargetLayer()
.
acceptSnapTargetForLabel
in interface ILcdGXYLabelEditor
aGraphics
- The Graphics
on which the label is painted.aGXYContext
- The ILcdGXYContext
containing the snapping information.true
if the label accepts the snap target, false
otherwise.ILcdGXYContext.getSnapTarget()
,
ILcdGXYContext.getSnapTargetLayer()
protected void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Point aPointSFCT) throws TLcdNoBoundsException
setObject
, setLabelIndex
and
setSubLabelIndex
) 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 anchorPointSFCT
method of
the corresponding ILcdGXYPainter
for the Object to be painted
(see aGXYContext.getGXYLayer().getGXYPainter( aObject )
).
When the set TLcdLabelLocation
can 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.
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.TLcdNoBoundsException
- if the Object doesn't have any valid anchor point, e.g. if it is always invisible in
the current projection.public void setMakeLabelsStickyOnEdit(boolean aMakeLabelsStickyOnEdit)
aMakeLabelsStickyOnEdit
- true
if you want the labels to be sticky after they are edited,
false
otherwise.TLcdLabelLocation.getLabelEditMode()
,
ILcdGXYViewLabelPainter
,
ILcdGXYLayerLabelPainter
public boolean isMakeLabelsStickyOnEdit()
true
if this editor sets the labels it edits to be sticky, false
otherwise. The
default value is false
.setMakeLabelsStickyOnEdit(boolean)
public int getLabelCreationClickCount()
ILcdGXYLabelEditor
Object
.getLabelCreationClickCount
in interface ILcdGXYLabelEditor
Object
or
-1 if this is undefined like for a polyline or a polygon. 0 means graphical creation
of labels is not supported.public Color getPinColor()
setPinColor(java.awt.Color)
public void setPinColor(Color aPinColor)
aPinColor
- The color in which the pin should be drawn.getPinColor()
,
setWithPin(boolean)
public Color getSelectedPinColor()
public void setSelectedPinColor(Color aSelectedPinColor)
aSelectedPinColor
- The color in which the pin of the label of a selected label should be drawn.setWithPin(boolean)
public boolean isHaloEnabled()
setHaloEnabled(boolean)
public void setHaloEnabled(boolean aHaloEnabled)
aHaloEnabled
- true if halos should be added, false otherwiseisHaloEnabled()
,
setHaloPinEnabled(boolean)
public boolean isHaloPinEnabled()
setHaloPinEnabled(boolean)
,
setHaloEnabled(boolean)
public void setHaloPinEnabled(boolean aHaloPinEnabled)
aHaloPinEnabled
- true if the halo effect includes the pin, false otherwiseisHaloPinEnabled()
,
setHaloEnabled(boolean)
,
setWithPin(boolean)
public int getHaloThickness()
setHaloThickness(int)
public void setHaloThickness(int aThickness)
aThickness
- the new halo thicknessTLcdGXYHaloLabelPainter.setHaloThickness(int)
,
setHaloEnabled(boolean)
public Color getHaloColor()
setHaloColor(java.awt.Color)
public void setHaloColor(Color aColor)
aColor
- the new halo colorTLcdGXYHaloLabelPainter.setHaloColor(java.awt.Color)
,
setHaloEnabled(boolean)
public void setHaloAlgorithm(TLcdHaloAlgorithm aHaloAlgorithm)
TLcdHaloAlgorithm
for more information on the available algorithms.aHaloAlgorithm
- the algorithm to be used for rendering halo's.TLcdHaloAlgorithm
,
getHaloAlgorithm()
,
setHaloEnabled(boolean)
public TLcdHaloAlgorithm getHaloAlgorithm()
TLcdHaloAlgorithm
,
setHaloAlgorithm(com.luciad.util.TLcdHaloAlgorithm)
public Color getHaloPinColor()
setHaloColor(java.awt.Color)
public void setHaloPinColor(Color aColor)
aColor
- the new halo colorgetHaloPinColor()
,
setHaloPinEnabled(boolean)
public boolean isUseImageCache()
true
when image caching for labels with a halo is enabled,
false
otherwise.true
when label image caching is enabled, false
otherwisesetUseImageCache(boolean)
public void setUseImageCache(boolean aUseCache)
aUseCache
- specifies whether image caching should be enabledTLcdGXYHaloLabelPainter.setUseImageCache(boolean)
,
setHaloEnabled(boolean)
,
setHaloPinEnabled(boolean)
,
isUseImageCache()
public void clearImageCache()
clearImageCache(Object)
.setUseImageCache(boolean)
public void clearImageCache(Object aObject)
clearImageCache()
.aObject
- the object for which the cache to be cleared.setUseImageCache(boolean)
protected boolean pinPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aAnchorPoint, Rectangle aLabelBounds, double aRotation, Point aPinPointSFCT)
aGraphics
- The Graphics
instance on which the pin will be painted.aMode
- The mode in which the pin will be painted. See paintLabel(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 labelanchorPointSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Point)
,
setWithPin(boolean)
protected void paintPin(Graphics aGraphics, int aMode, int aStartPointX, int aStartPointY, int aEndPointX, int aEndPointY)
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.setWithPin(boolean)
public void setWithPin(boolean aWithPin)
withPin
determines whether a pin should be drawn from the object to
the label. The pin is attached to the object at the anchor point
and to the label stamp at the pin point
.aWithPin
- true to paint a pin connecting the label and the object.isWithPin()
,
anchorPointSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Point)
,
pinPointSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Point, java.awt.Rectangle, double, java.awt.Point)
,
paintPin(java.awt.Graphics, int, int, int, int, int)
public boolean isWithPin()
true
if a pin is drawn from the object to the labelsetWithPin(boolean)
public void setWithAnchorPoint(boolean aWithAnchorPoint)
anchorPointSFCT
.aWithAnchorPoint
- true to paint an anchor pointisWithAnchorPoint()
,
anchorPointSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Point)
,
paintAnchorPoint(java.awt.Graphics, int, int, int)
public boolean isWithAnchorPoint()
anchorPointSFCT
.true
if an anchor point is painted, false
otherwisesetWithAnchorPoint(boolean)
public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.