public class TLcdSLDRulePainter extends ALcdSLDRulePainter implements ILcdGXYLabelPainter2
ILcdGXYPainter
for all painter methods (paint, boundsSFCT, ...),
ILcdGXYLabelPainter
for all label painter methods (paintLabel, labelBoundsSFCT, ...),
BODY, CREATING, HANDLES, RESHAPING, SNAPS, TRANSLATING
DEFAULT, SELECTED
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
Constructor and Description |
---|
TLcdSLDRulePainter(boolean aHasElseFilter,
ALcdSLDSymbolizerPainter[] aSymbolizerPainters) |
TLcdSLDRulePainter(ILcdFilter aFilterEvaluator,
ALcdSLDSymbolizerPainter[] aSymbolizerPainters) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Rule painters do not support property change events.
|
void |
anchorPointSFCT(Graphics aGraphics,
int aPainterMode,
ILcdGXYContext aGXYContext,
Point aPoint)
Delegates computation of the anchor point to the symbolizer painters if the object was accepted.
|
void |
boundsSFCT(Graphics aGraphics,
int aPainterMode,
ILcdGXYContext aGXYContext,
ILcd2DEditableBounds a2DEditableBounds)
Delegates computation of the bounds to the symbolizer painters if the object was accepted.
|
Cursor |
getCursor(Graphics aGraphics,
int aPainterMode,
ILcdGXYContext aGXYContext)
Rule painters do not provide cursors.
|
String |
getDisplayName()
Returns "Rule painter".
|
int |
getLabelCount(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns the number of labels for the object set to this label painter.
|
Cursor |
getLabelCursor(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Returns a
Cursor to indicate the type of editing aMode and
aGXYContext . |
int |
getLabelIndex()
Returns the index of the label that is currently painted or scheduled to paint.
|
TLcdLabelLocation |
getLabelLocation()
Returns the
TLcdLabelLocation that was previously set that contains the
information on the whereabouts of the label. |
int |
getLocationIndex()
Gets the index of location where to paint the label(s) of the set Object.
|
Object |
getObject()
Gets the Object this ILcdGXYLabelPainter can label.
|
int |
getPossibleLocationCount(Graphics aGraphics)
Retrieves the highest possible location count from the symbolizer painters that implement
ILcdGXYLabelPainter . |
int |
getSubLabelCount(int aLabelIndex)
Return the number of sublabels in a label.
|
int |
getSubLabelIndex()
Returns the index of the sublabel to paint.
|
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 |
isScaleValid(ILcdGXYView aView)
Converts the views scale (pixels/meter) to a map scale (meter/meter)
and compares it with the min and max scale denominators set.
|
boolean |
isTouched(Graphics aGraphics,
int aPainterMode,
ILcdGXYContext aGXYContext)
Delegates checking whether the object is touched to the symbolizer painters if the object was accepted.
|
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 aMode,
ILcdGXYContext aGXYContext,
Rectangle aRectangle)
Calculates the bounds of the label that can be painted.
|
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 |
paint(Graphics aGraphics,
int aPainterMode,
ILcdGXYContext aGXYContext)
Delegates the painting to the symbolizer painters if the object was accepted, does nothing otherwise.
|
void |
paintLabel(Graphics aGraphics,
int aLabelPainterMode,
ILcdGXYContext aGXYContext)
Delegates paint to the symbolizer painters that implement
ILcdGXYLabelPainter if
the object was accepted. |
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Rule painters do not support property change events.
|
void |
setLabelIndex(int aLabelIndex)
Sets the label.
|
void |
setLabelLocation(TLcdLabelLocation aLabelLocation)
Sets the label location of the label.
|
void |
setLocationIndex(int aLocationIndex)
Sets the index of location where to paint the label(s) of the set Object.
|
void |
setObject(Object aObject)
The object set to this painter is delegated to the symbolizer painters only if it is accepted.
|
void |
setSubLabelIndex(int aSubLabelIndex)
Sets the sublabel index.
|
Object |
snapTarget(Graphics aGraphics,
ILcdGXYContext aGXYContext)
First snap target found in one of the symbolizer painters if the object was accepted.
|
boolean |
supportLabelSnap(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns whether this label painter supports snapping for the label specified by
setObject , setLabelIndex and setSubLabelIndex ,
considering the given ILcdGXYContext instance. |
boolean |
supportSnap(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Do any of the symbolizer painters support snapping?
|
String |
toString()
Returns the display name.
|
accept, clone, getMaxScaleDenominator, getMinScaleDenominator, getSymbolizerPainter, getSymbolizerPainterCount, hasElseFilter, setMaxScaleDenominator, setMinScaleDenominator
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clone
public TLcdSLDRulePainter(ILcdFilter aFilterEvaluator, ALcdSLDSymbolizerPainter[] aSymbolizerPainters)
public TLcdSLDRulePainter(boolean aHasElseFilter, ALcdSLDSymbolizerPainter[] aSymbolizerPainters)
public void setObject(Object aObject)
setObject
in interface ILcdGXYLabelPainter
setObject
in interface ILcdGXYLabelPainter2
setObject
in interface ILcdGXYPainter
aObject
- the object to set to this painter.ALcdSLDRulePainter.accept(Object)
public Object getObject()
ILcdGXYLabelPainter
getObject
in interface ILcdGXYLabelPainter
getObject
in interface ILcdGXYPainter
ILcdGXYLabelPainter.setObject(java.lang.Object)
public void paint(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext)
paint
in interface ILcdGXYPainter
paint
in class ALcdSLDRulePainter
aGraphics
- the Graphics on which the representation of the object is paintedaPainterMode
- the mode the object is represented in (see class documentation).aGXYContext
- the ILcdGXYContext
the drawing depends on.setObject(Object)
public void boundsSFCT(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds a2DEditableBounds) throws TLcdNoBoundsException
boundsSFCT
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaPainterMode
- the mode the object is represented in (see class documentation). For example, an object may be
represented differently in SELECTED mode compared to DEFAULT mode. The returned bounds of the representation
must take this different representation into account.aGXYContext
- the context for which the representation of the object is painted. It contains amongst others
the transformations from model to world and world to view.a2DEditableBounds
- the bounds that must be adapted to encompass the representation of the object in the given
mode and context. These bounds must not be taken into account when the method has thrown an exception.TLcdNoBoundsException
- when the object was not accepted or when all of the symbolizer painters
threw a TLcdNoBoundsException.setObject(Object)
public boolean isTouched(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext)
isTouched
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaPainterMode
- the mode the object is represented inaGXYContext
- contains the location of the interaction and the transformations to convert this location into
model coordinatessetObject(Object)
public void anchorPointSFCT(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext, Point aPoint) throws TLcdNoBoundsException
TLcdNoBoundsException
anchorPointSFCT
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaPainterMode
- the mode the object is painted in (see class documentation)aGXYContext
- the context for which the representation of the object is painted. It contains amongst others
the transformations from model to world and world to view.aPoint
- the point that has to be moved to the location of the anchor point of the representation of
the object. This point must not be taken into account when the method has thrown a TLcdNoBoundsException.TLcdNoBoundsException
- when all symbolizer painters threw a TLcdNoBoundsException
or when
the object was not accepted.setObject(Object)
public boolean supportSnap(Graphics aGraphics, ILcdGXYContext aGXYContext)
supportSnap
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaGXYContext
- the context in which this object is represented and in which the editing of an object occurs.setObject(Object)
public Object snapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext)
snapTarget
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaGXYContext
- the context in which this object is represented and in which the editing of an object occurs.supportSnap(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
,
setObject(Object)
public Cursor getCursor(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext)
getCursor
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaPainterMode
- the rendering mode to return the cursor for.aGXYContext
- the context in which the rendering occurs.public String getDisplayName()
getDisplayName
in interface ILcdGXYLabelPainter2
getDisplayName
in interface ILcdGXYPainter
public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- is ignored.ALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- is ignored.ILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void setLocationIndex(int aLocationIndex)
ILcdGXYLabelPainter
setLocationIndex
in interface ILcdGXYLabelPainter
aLocationIndex
- the index of the location. Must be between 0 and getPossibleLocationCount()
- 1.ILcdGXYLabelPainter.getLocationIndex()
public int getLocationIndex()
ILcdGXYLabelPainter
getLocationIndex
in interface ILcdGXYLabelPainter
ILcdGXYLabelPainter.setLocationIndex(int)
public void paintLabel(Graphics aGraphics, int aLabelPainterMode, ILcdGXYContext aGXYContext)
ILcdGXYLabelPainter
if
the object was accepted. Does nothing otherwise.paintLabel
in interface ILcdGXYLabelPainter
paintLabel
in interface ILcdGXYLabelPainter2
paintLabel
in class ALcdSLDRulePainter
aGraphics
- the Graphics
instance on which to paint.aLabelPainterMode
- a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.aGXYContext
- the ILcdGXYContext
in which the label painting has to be
performed.setObject(java.lang.Object)
public int getPossibleLocationCount(Graphics aGraphics)
ILcdGXYLabelPainter
. This allows to use all positions of the most sophisticated
label painter.getPossibleLocationCount
in interface ILcdGXYLabelPainter
aGraphics
- the Graphics the label will be painted on.ILcdGXYLabelPainter
.ILcdGXYLabelPainter.setLocationIndex(int)
public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, 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.aMode
- the representation mode of the label.aGXYContext
- 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 isScaleValid(ILcdGXYView aView)
isScaleValid
in class ALcdSLDRulePainter
aView
- public String toString()
toString
in class Object
getDisplayName()
public void setLabelIndex(int aLabelIndex)
ILcdGXYMultiLabelPainter
Sets the label. The results of any subsequent method calls to ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
and ILcdGXYLabelPainter.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.
setLabelIndex
in interface ILcdGXYMultiLabelPainter
aLabelIndex
- The label index. This should be larger than or equal to 0
and
less than the result ILcdGXYMultiLabelPainter.getLabelCount(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
.ILcdGXYMultiLabelPainter.setSubLabelIndex(int)
public int getLabelIndex()
ILcdGXYMultiLabelPainter
getLabelIndex
in interface ILcdGXYMultiLabelPainter
ILcdGXYMultiLabelPainter.setLabelIndex(int)
public int getLabelCount(Graphics aGraphics, ILcdGXYContext aGXYContext)
ILcdGXYMultiLabelPainter
Returns the number of labels for the object set to this label painter.
Note: when returning multiple (moveable) labels for the same object, it might be useful to useTLcdGXYEditControllerModel2.EDIT_WHAT_FIRST_TOUCHED_LABEL
to avoid that a mouse drag moves them all together.getLabelCount
in interface ILcdGXYMultiLabelPainter
aGraphics
- The Graphics currently painting onaGXYContext
- The ILcdGXYContext currently validpublic int getSubLabelIndex()
ILcdGXYMultiLabelPainter
getSubLabelIndex
in interface ILcdGXYMultiLabelPainter
ILcdGXYMultiLabelPainter.setSubLabelIndex(int)
public void setSubLabelIndex(int aSubLabelIndex)
ILcdGXYMultiLabelPainter
ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
and
ILcdGXYLabelPainter.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.setSubLabelIndex
in interface ILcdGXYMultiLabelPainter
aSubLabelIndex
- The sub label index. This should be larger than or equal to
0
and less than the result ILcdGXYMultiLabelPainter.getSubLabelCount(int)
.ILcdGXYMultiLabelPainter.setLabelIndex(int)
public int getSubLabelCount(int aLabelIndex)
ILcdGXYMultiLabelPainter
getSubLabelCount
in interface ILcdGXYMultiLabelPainter
aLabelIndex
- the index of the label.public void setLabelLocation(TLcdLabelLocation aLabelLocation)
ILcdGXYLabelPainter2
Sets the label location of the label. This label location will be used to determine what the bounds of the label are, where it must be painted, etc.
Note that aLabelLocation
also contains a label location index. This is
independent of the ILcdGXYLabelPainter.getLocationIndex()
of the super interface. Contrary to the location
index returned by getLocationIndex
, the location index in
aLabelLocation
can be less than 0
, in which case the labels are
freely placed.
This method has to be called after ILcdGXYLabelPainter2.setObject(java.lang.Object)
has been called, as calling
setObject
clears this label location.
setLabelLocation
in interface ILcdGXYLabelPainter2
aLabelLocation
- The TLcdLabelLocation
instance containing all the
information about the location of the label.ILcdGXYLabelPainter2.setObject(java.lang.Object)
public TLcdLabelLocation getLabelLocation()
ILcdGXYLabelPainter2
TLcdLabelLocation
that was previously set that contains the
information on the whereabouts of the label.getLabelLocation
in interface ILcdGXYLabelPainter2
ILcdGXYLabelPainter2.setLabelLocation(com.luciad.view.TLcdLabelLocation)
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 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 supportLabelSnap(Graphics aGraphics, ILcdGXYContext aGXYContext)
ILcdGXYLabelPainter2
Returns whether this label painter supports snapping for the label specified by
setObject
, setLabelIndex
and setSubLabelIndex
,
considering the given ILcdGXYContext
instance. When the label painter
supports snap for the specified label and context, it can return a snap target for
this label and context.
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.
supportLabelSnap
in interface ILcdGXYLabelPainter2
aGraphics
- the Graphics on which is worked.aGXYContext
- the ILcdGXYContext of the snapping.true
if this label painter supports snapping for the specified label.labelSnapTarget
public Object labelSnapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext)
ILcdGXYLabelPainter2
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
).labelSnapTarget
in interface ILcdGXYLabelPainter2
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 Cursor getLabelCursor(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
ILcdGXYLabelPainter2
Cursor
to indicate the type of editing aMode
and
aGXYContext
.getLabelCursor
in interface ILcdGXYLabelPainter2
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.