Class TLcdSLDRulePainter
- All Implemented Interfaces:
ILcdCloneable
,ILcdPropertyChangeSource
,ILcdGXYLabelPainter
,ILcdGXYLabelPainter2
,ILcdGXYMultiLabelPainter
,ILcdGXYPainter
,Serializable
,Cloneable
-
to its symbolizer painters who implement
ILcdGXYPainter
for all painter methods (paint, boundsSFCT, ...), -
to its symbolizer painters who implement
ILcdGXYLabelPainter
for all label painter methods (paintLabel, labelBoundsSFCT, ...),
- See Also:
-
Field Summary
Fields inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter
DEFAULT, SELECTED
Fields inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter2
BODY, CREATING, HANDLES, RESHAPING, SNAPS, TRANSLATING
Fields inherited from interface com.luciad.view.gxy.ILcdGXYPainter
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
-
Constructor Summary
ConstructorDescriptionTLcdSLDRulePainter
(boolean aHasElseFilter, ALcdSLDSymbolizerPainter[] aSymbolizerPainters) TLcdSLDRulePainter
(ILcdFilter aFilterEvaluator, ALcdSLDSymbolizerPainter[] aSymbolizerPainters) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.getCursor
(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext) Rule painters do not provide cursors.Returns "Rule painter".int
getLabelCount
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns the number of labels for the object set to this label painter.getLabelCursor
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Returns aCursor
to indicate the type of editingaMode
andaGXYContext
.int
Returns the index of the label that is currently painted or scheduled to paint.Returns theTLcdLabelLocation
that was previously set that contains the information on the whereabouts of the label.int
Gets the index of location where to paint the label(s) of the set Object.Gets the Object this ILcdGXYLabelPainter can label.int
getPossibleLocationCount
(Graphics aGraphics) Retrieves the highest possible location count from the symbolizer painters that implementILcdGXYLabelPainter
.int
getSubLabelCount
(int aLabelIndex) Return the number of sublabels in a label.int
Returns the index of the sublabel to paint.boolean
isLabelTouched
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Tests if the label specified bysetObject
,setLabelIndex
andsetSubLabelIndex
is touched at view location(specified by aGXYContext.getX()
andaGXYContext.getY()
), considering the mode and theILcdGXYContext
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) SetsaPointSFCT
to the anchor point of the label specified bysetObject
,setLabelIndex
andsetSubLabelIndex
.double
labelBoundsSFCT
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Rectangle aRectangle) Calculates the bounds of the label that can be painted.labelSnapTarget
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns anObject
that can be used as snapping target when graphically editing anotherObject
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 implementILcdGXYLabelPainter
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
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.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 bysetObject
,setLabelIndex
andsetSubLabelIndex
, considering the givenILcdGXYContext
instance.boolean
supportSnap
(Graphics aGraphics, ILcdGXYContext aGXYContext) Do any of the symbolizer painters support snapping?toString()
Returns the display name.Methods inherited from class com.luciad.ogc.sld.view.gxy.ALcdSLDRulePainter
accept, clone, getMaxScaleDenominator, getMinScaleDenominator, getSymbolizerPainter, getSymbolizerPainterCount, hasElseFilter, setMaxScaleDenominator, setMinScaleDenominator
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter2
clone
-
Constructor Details
-
TLcdSLDRulePainter
public TLcdSLDRulePainter(ILcdFilter aFilterEvaluator, ALcdSLDSymbolizerPainter[] aSymbolizerPainters) -
TLcdSLDRulePainter
-
-
Method Details
-
setObject
The object set to this painter is delegated to the symbolizer painters only if it is accepted.- Specified by:
setObject
in interfaceILcdGXYLabelPainter
- Specified by:
setObject
in interfaceILcdGXYLabelPainter2
- Specified by:
setObject
in interfaceILcdGXYPainter
- Parameters:
aObject
- the object to set to this painter.- See Also:
-
getObject
Description copied from interface:ILcdGXYLabelPainter
Gets the Object this ILcdGXYLabelPainter can label.- Specified by:
getObject
in interfaceILcdGXYLabelPainter
- Specified by:
getObject
in interfaceILcdGXYPainter
- Returns:
- the Object this ILcdGXYLabelPainter can label.
- See Also:
-
paint
Delegates the painting to the symbolizer painters if the object was accepted, does nothing otherwise.- Specified by:
paint
in interfaceILcdGXYPainter
- Specified by:
paint
in classALcdSLDRulePainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaPainterMode
- the mode the object is represented in (see class documentation).aGXYContext
- theILcdGXYContext
the drawing depends on.- See Also:
-
boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds a2DEditableBounds) throws TLcdNoBoundsException Delegates computation of the bounds to the symbolizer painters if the object was accepted. The result is the union of the bounds computed by the individual painters.- Specified by:
boundsSFCT
in interfaceILcdGXYPainter
- Parameters:
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.- Throws:
TLcdNoBoundsException
- when the object was not accepted or when all of the symbolizer painters threw a TLcdNoBoundsException.- See Also:
-
isTouched
Delegates checking whether the object is touched to the symbolizer painters if the object was accepted.- Specified by:
isTouched
in interfaceILcdGXYPainter
- Parameters:
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 coordinates- Returns:
- true if the object was accepted and is touched according to (at least) one of the symbolizer painters in the given context. False otherwise.
- See Also:
-
anchorPointSFCT
public void anchorPointSFCT(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext, Point aPoint) throws TLcdNoBoundsException Delegates computation of the anchor point to the symbolizer painters if the object was accepted. This implementation will set the point passed at the anchor point computed by the first symbolizer painter which does not throw aTLcdNoBoundsException
- Specified by:
anchorPointSFCT
in interfaceILcdGXYPainter
- Parameters:
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.- Throws:
TLcdNoBoundsException
- when all symbolizer painters threw aTLcdNoBoundsException
or when the object was not accepted.- See Also:
-
supportSnap
Do any of the symbolizer painters support snapping?- Specified by:
supportSnap
in interfaceILcdGXYPainter
- Parameters:
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.- Returns:
- true if one of the symbolizer painters supports snapping and the object was accepted. False otherwise.
- See Also:
-
snapTarget
First snap target found in one of the symbolizer painters if the object was accepted.- Specified by:
snapTarget
in interfaceILcdGXYPainter
- Parameters:
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.- Returns:
- first snap target found in one of the symbolizer painters if the object was accepted. Null otherwise.
- See Also:
-
getCursor
Rule painters do not provide cursors.- Specified by:
getCursor
in interfaceILcdGXYPainter
- Parameters:
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.- Returns:
- always null.
-
getDisplayName
Returns "Rule painter".- Specified by:
getDisplayName
in interfaceILcdGXYLabelPainter2
- Specified by:
getDisplayName
in interfaceILcdGXYPainter
- Returns:
- "Rule painter".
-
addPropertyChangeListener
Rule painters do not support property change events.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- is ignored.- See Also:
-
removePropertyChangeListener
Rule painters do not support property change events.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- is ignored.- See Also:
-
setLocationIndex
public void setLocationIndex(int aLocationIndex) Description copied from interface:ILcdGXYLabelPainter
Sets the index of location where to paint the label(s) of the set Object.- Specified by:
setLocationIndex
in interfaceILcdGXYLabelPainter
- Parameters:
aLocationIndex
- the index of the location. Must be between 0 and getPossibleLocationCount() - 1.- See Also:
-
getLocationIndex
public int getLocationIndex()Description copied from interface:ILcdGXYLabelPainter
Gets the index of location where to paint the label(s) of the set Object.- Specified by:
getLocationIndex
in interfaceILcdGXYLabelPainter
- Returns:
- the index of the position. Must be between 0 and getPossibleLocationCount() - 1.
- See Also:
-
paintLabel
Delegates paint to the symbolizer painters that implementILcdGXYLabelPainter
if the object was accepted. Does nothing otherwise.- Specified by:
paintLabel
in interfaceILcdGXYLabelPainter
- Specified by:
paintLabel
in interfaceILcdGXYLabelPainter2
- Specified by:
paintLabel
in classALcdSLDRulePainter
- Parameters:
aGraphics
- theGraphics
instance on which to paint.aLabelPainterMode
- a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.aGXYContext
- theILcdGXYContext
in which the label painting has to be performed.- See Also:
-
getPossibleLocationCount
Retrieves the highest possible location count from the symbolizer painters that implementILcdGXYLabelPainter
. This allows to use all positions of the most sophisticated label painter.- Specified by:
getPossibleLocationCount
in interfaceILcdGXYLabelPainter
- Parameters:
aGraphics
- the Graphics the label will be painted on.- Returns:
- the highest possible location count from the symbolizer painters that implement
ILcdGXYLabelPainter
. - See Also:
-
labelBoundsSFCT
public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Rectangle aRectangle) throws TLcdNoBoundsException Description copied from interface:ILcdGXYLabelPainter2
Calculates the bounds of the label that can be painted. The bounds are set as a side effect in
aRectangleSFCT
, the orientation ofaRectangleSFCT
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.
- Specified by:
labelBoundsSFCT
in interfaceILcdGXYLabelPainter
- Specified by:
labelBoundsSFCT
in interfaceILcdGXYLabelPainter2
- Parameters:
aGraphics
- theaGraphics
to consider.aMode
- the representation mode of the label.aGXYContext
- theILcdGXYContext
the drawing depends on.aRectangle
- theRectangle
containing 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:
-
isScaleValid
Converts the views scale (pixels/meter) to a map scale (meter/meter) and compares it with the min and max scale denominators set.- Specified by:
isScaleValid
in classALcdSLDRulePainter
- Parameters:
aView
-- Returns:
- true if the converted scale is inside min scale/max scale interval.
-
toString
Returns the display name. -
setLabelIndex
public void setLabelIndex(int aLabelIndex) Description copied from interface:ILcdGXYMultiLabelPainter
Sets 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:
setLabelIndex
in interfaceILcdGXYMultiLabelPainter
- Parameters:
aLabelIndex
- The label index. This should be larger than or equal to0
and less than the resultILcdGXYMultiLabelPainter.getLabelCount(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
.- See Also:
-
getLabelIndex
public int getLabelIndex()Description copied from interface:ILcdGXYMultiLabelPainter
Returns the index of the label that is currently painted or scheduled to paint.- Specified by:
getLabelIndex
in interfaceILcdGXYMultiLabelPainter
- Returns:
- the index of the label that is currently painted or scheduled to paint.
- See Also:
-
getLabelCount
Description copied from interface: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.- Specified by:
getLabelCount
in interfaceILcdGXYMultiLabelPainter
- Parameters:
aGraphics
- The Graphics currently painting onaGXYContext
- The ILcdGXYContext currently valid- Returns:
- The number of label for the given object.
-
getSubLabelIndex
public int getSubLabelIndex()Description copied from interface:ILcdGXYMultiLabelPainter
Returns the index of the sublabel to paint.- Specified by:
getSubLabelIndex
in interfaceILcdGXYMultiLabelPainter
- Returns:
- the index of the sublabel to paint.
- See Also:
-
setSubLabelIndex
public void setSubLabelIndex(int aSubLabelIndex) Description copied from interface:ILcdGXYMultiLabelPainter
Sets 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:
setSubLabelIndex
in interfaceILcdGXYMultiLabelPainter
- Parameters:
aSubLabelIndex
- The sub label index. This should be larger than or equal to0
and less than the resultILcdGXYMultiLabelPainter.getSubLabelCount(int)
.- See Also:
-
getSubLabelCount
public int getSubLabelCount(int aLabelIndex) Description copied from interface:ILcdGXYMultiLabelPainter
Return the number of sublabels in a label. The value should be 1 or higher.- Specified by:
getSubLabelCount
in interfaceILcdGXYMultiLabelPainter
- Parameters:
aLabelIndex
- the index of the label.- Returns:
- The number of sublabels of the label with the given index.
-
setLabelLocation
Description copied from interface: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 theILcdGXYLabelPainter.getLocationIndex()
of the super interface. Contrary to the location index returned bygetLocationIndex
, the location index inaLabelLocation
can be less than0
, in which case the labels are freely placed.This method has to be called after
ILcdGXYLabelPainter2.setObject(java.lang.Object)
has been called, as callingsetObject
clears this label location.- Specified by:
setLabelLocation
in interfaceILcdGXYLabelPainter2
- Parameters:
aLabelLocation
- TheTLcdLabelLocation
instance containing all the information about the location of the label.- See Also:
-
getLabelLocation
Description copied from interface:ILcdGXYLabelPainter2
Returns theTLcdLabelLocation
that was previously set that contains the information on the whereabouts of the label.- Specified by:
getLabelLocation
in interfaceILcdGXYLabelPainter2
- Returns:
- The label location that was previously set.
- See Also:
-
isLabelTouched
Description copied from interface:ILcdGXYLabelPainter2
Tests if the label specified bysetObject
,setLabelIndex
andsetSubLabelIndex
is touched at view location(specified by aGXYContext.getX()
andaGXYContext.getY()
), considering the mode and theILcdGXYContext
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.
- Specified by:
isLabelTouched
in interfaceILcdGXYLabelPainter2
- Parameters:
aGraphics
- TheGraphics
instance 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
- theILcdGXYContext
to 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:ILcdGXYLabelPainter2
Sets
aPointSFCT
to the anchor point of the label specified bysetObject
,setLabelIndex
andsetSubLabelIndex
.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 thelabel
and 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:
labelAnchorPointSFCT
in interfaceILcdGXYLabelPainter2
- Parameters:
aGraphics
- TheGraphics
instance 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
- TheILcdGXYContext
that 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:
-
supportLabelSnap
Description copied from interface:ILcdGXYLabelPainter2
Returns whether this label painter supports snapping for the label specified by
setObject
,setLabelIndex
andsetSubLabelIndex
, considering the givenILcdGXYContext
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.
- Specified by:
supportLabelSnap
in interfaceILcdGXYLabelPainter2
- Parameters:
aGraphics
- the Graphics on which is worked.aGXYContext
- the ILcdGXYContext of the snapping.- Returns:
true
if this label painter supports snapping for the specified label.- See Also:
-
labelSnapTarget
Description copied from interface:ILcdGXYLabelPainter2
Returns anObject
that can be used as snapping target when graphically editing anotherObject
or label than the one this ILcdGXYLabelPainter2 represents. The returnedObject
can be theObject
this ILcdGXYLabelPainter2 represents or any other (e.g. anILcdPoint
if getObject() is anILcdPointList
).- Specified by:
labelSnapTarget
in interfaceILcdGXYLabelPainter2
- Parameters:
aGraphics
- the Graphics on which is worked.aGXYContext
- the ILcdGXYContext of the snapping.- Returns:
- an
Object
that can be used as snapping target when graphically editing anotherObject
or label than the one this ILcdGXYLabelPainter2 represents (returned by getObject()). This object can benull
.
-
getLabelCursor
Description copied from interface:ILcdGXYLabelPainter2
Returns aCursor
to indicate the type of editingaMode
andaGXYContext
.- Specified by:
getLabelCursor
in interfaceILcdGXYLabelPainter2
- Parameters:
aGraphics
- TheGraphics
instance on which the label is painted.aMode
- The mode to consider. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, ILcdGXYContext)
for more information.aGXYContext
- TheILcdGXYContext
containing extra information, such as the layer, the view and the mouse position.- Returns:
- a
Cursor
to indicate the type of editingaMode
andaGXYContext
. Returnsnull
if no particularCursor
is required.
-