Class TLcdSLDRulePainter
- All Implemented Interfaces:
ILcdCloneable,ILcdPropertyChangeSource,ILcdGXYLabelPainter,ILcdGXYLabelPainter2,ILcdGXYMultiLabelPainter,ILcdGXYPainter,Serializable,Cloneable
-
to its symbolizer painters who implement
ILcdGXYPainterfor all painter methods (paint, boundsSFCT, ...), -
to its symbolizer painters who implement
ILcdGXYLabelPainterfor all label painter methods (paintLabel, labelBoundsSFCT, ...),
- See Also:
-
Field Summary
Fields inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter
DEFAULT, SELECTEDFields inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter2
BODY, CREATING, HANDLES, RESHAPING, SNAPS, TRANSLATINGFields inherited from interface com.luciad.view.gxy.ILcdGXYPainter
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING -
Constructor Summary
ConstructorsConstructorDescriptionTLcdSLDRulePainter(boolean aHasElseFilter, ALcdSLDSymbolizerPainter[] aSymbolizerPainters) TLcdSLDRulePainter(ILcdFilter aFilterEvaluator, ALcdSLDSymbolizerPainter[] aSymbolizerPainters) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Rule painters do not support property change events.voidanchorPointSFCT(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext, Point aPoint) Delegates computation of the anchor point to the symbolizer painters if the object was accepted.voidboundsSFCT(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".intgetLabelCount(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 aCursorto indicate the type of editingaModeandaGXYContext.intReturns the index of the label that is currently painted or scheduled to paint.Returns theTLcdLabelLocationthat was previously set that contains the information on the whereabouts of the label.intGets the index of location where to paint the label(s) of the set Object.Gets the Object this ILcdGXYLabelPainter can label.intgetPossibleLocationCount(Graphics aGraphics) Retrieves the highest possible location count from the symbolizer painters that implementILcdGXYLabelPainter.intgetSubLabelCount(int aLabelIndex) Return the number of sublabels in a label.intReturns the index of the sublabel to paint.booleanisLabelTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Tests if the label specified bysetObject,setLabelIndexandsetSubLabelIndexis touched at view location(specified by aGXYContext.getX()andaGXYContext.getY()), considering the mode and theILcdGXYContextinstance.booleanisScaleValid(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.booleanisTouched(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext) Delegates checking whether the object is touched to the symbolizer painters if the object was accepted.voidlabelAnchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) SetsaPointSFCTto the anchor point of the label specified bysetObject,setLabelIndexandsetSubLabelIndex.doublelabelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Rectangle aRectangle) Calculates the bounds of the label that can be painted.labelSnapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns anObjectthat can be used as snapping target when graphically editing anotherObjector label than the one this ILcdGXYLabelPainter2 represents.voidpaint(Graphics aGraphics, int aPainterMode, ILcdGXYContext aGXYContext) Delegates the painting to the symbolizer painters if the object was accepted, does nothing otherwise.voidpaintLabel(Graphics aGraphics, int aLabelPainterMode, ILcdGXYContext aGXYContext) Delegates paint to the symbolizer painters that implementILcdGXYLabelPainterif the object was accepted.voidremovePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Rule painters do not support property change events.voidsetLabelIndex(int aLabelIndex) Sets the label.voidsetLabelLocation(TLcdLabelLocation aLabelLocation) Sets the label location of the label.voidsetLocationIndex(int aLocationIndex) Sets the index of location where to paint the label(s) of the set Object.voidThe object set to this painter is delegated to the symbolizer painters only if it is accepted.voidsetSubLabelIndex(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.booleansupportLabelSnap(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns whether this label painter supports snapping for the label specified bysetObject,setLabelIndexandsetSubLabelIndex, considering the givenILcdGXYContextinstance.booleansupportSnap(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, setMinScaleDenominatorMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
setObjectin interfaceILcdGXYLabelPainter- Specified by:
setObjectin interfaceILcdGXYLabelPainter2- Specified by:
setObjectin interfaceILcdGXYPainter- Parameters:
aObject- the object to set to this painter.- See Also:
-
getObject
Description copied from interface:ILcdGXYLabelPainterGets the Object this ILcdGXYLabelPainter can label.- Specified by:
getObjectin interfaceILcdGXYLabelPainter- Specified by:
getObjectin 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:
paintin interfaceILcdGXYPainter- Specified by:
paintin 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- theILcdGXYContextthe 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:
boundsSFCTin 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:
isTouchedin 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:
anchorPointSFCTin 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 aTLcdNoBoundsExceptionor when the object was not accepted.- See Also:
-
supportSnap
Do any of the symbolizer painters support snapping?- Specified by:
supportSnapin 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:
snapTargetin 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:
getCursorin 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:
getDisplayNamein interfaceILcdGXYLabelPainter2- Specified by:
getDisplayNamein interfaceILcdGXYPainter- Returns:
- "Rule painter".
-
addPropertyChangeListener
Rule painters do not support property change events.- Specified by:
addPropertyChangeListenerin interfaceILcdPropertyChangeSource- Parameters:
aPropertyChangeListener- is ignored.- See Also:
-
removePropertyChangeListener
Rule painters do not support property change events.- Specified by:
removePropertyChangeListenerin interfaceILcdPropertyChangeSource- Parameters:
aPropertyChangeListener- is ignored.- See Also:
-
setLocationIndex
public void setLocationIndex(int aLocationIndex) Description copied from interface:ILcdGXYLabelPainterSets the index of location where to paint the label(s) of the set Object.- Specified by:
setLocationIndexin 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:ILcdGXYLabelPainterGets the index of location where to paint the label(s) of the set Object.- Specified by:
getLocationIndexin interfaceILcdGXYLabelPainter- Returns:
- the index of the position. Must be between 0 and getPossibleLocationCount() - 1.
- See Also:
-
paintLabel
Delegates paint to the symbolizer painters that implementILcdGXYLabelPainterif the object was accepted. Does nothing otherwise.- Specified by:
paintLabelin interfaceILcdGXYLabelPainter- Specified by:
paintLabelin interfaceILcdGXYLabelPainter2- Specified by:
paintLabelin classALcdSLDRulePainter- Parameters:
aGraphics- theGraphicsinstance on which to paint.aLabelPainterMode- a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.aGXYContext- theILcdGXYContextin 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:
getPossibleLocationCountin 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:ILcdGXYLabelPainter2Calculates the bounds of the label that can be painted. The bounds are set as a side effect in
aRectangleSFCT, the orientation ofaRectangleSFCTis returned as an angle.The bounds represent the upper left point of the label, and a width and a height. The rotation value represents the rotation of the label bounds around the upper left point.
The domain object, the label index, the sublabel index and the location of the label for which the bounds are retrieved should be set before calling this method using the respective methods.
Note that if this label painter is used in conjunction with a labeling algorithm, the bounds should preferably be independent of the location, as this will yield the best results.
- Specified by:
labelBoundsSFCTin interfaceILcdGXYLabelPainter- Specified by:
labelBoundsSFCTin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- theaGraphicsto consider.aMode- the representation mode of the label.aGXYContext- theILcdGXYContextthe drawing depends on.aRectangle- theRectanglecontaining the bounds of the label in view / graphics coordinates as side effect.- Returns:
- the angle orientation of the rectangle around the labels in RADIANs, clockwise, 0 at 3 o'clock.
- Throws:
TLcdNoBoundsException- if the Object doesn't have any valid bounds, e.g. if it is always invisible in the current projection.- See Also:
-
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:
isScaleValidin 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:ILcdGXYMultiLabelPainterSets the label. The results of any subsequent method calls to
ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)andILcdGXYLabelPainter.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)etc. will apply to the label and sublabel indicated by this label index.- Specified by:
setLabelIndexin interfaceILcdGXYMultiLabelPainter- Parameters:
aLabelIndex- The label index. This should be larger than or equal to0and less than the resultILcdGXYMultiLabelPainter.getLabelCount(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext).- See Also:
-
getLabelIndex
public int getLabelIndex()Description copied from interface:ILcdGXYMultiLabelPainterReturns the index of the label that is currently painted or scheduled to paint.- Specified by:
getLabelIndexin interfaceILcdGXYMultiLabelPainter- Returns:
- the index of the label that is currently painted or scheduled to paint.
- See Also:
-
getLabelCount
Description copied from interface:ILcdGXYMultiLabelPainterReturns 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_LABELto avoid that a mouse drag moves them all together.- Specified by:
getLabelCountin 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:ILcdGXYMultiLabelPainterReturns the index of the sublabel to paint.- Specified by:
getSubLabelIndexin interfaceILcdGXYMultiLabelPainter- Returns:
- the index of the sublabel to paint.
- See Also:
-
setSubLabelIndex
public void setSubLabelIndex(int aSubLabelIndex) Description copied from interface:ILcdGXYMultiLabelPainterSets the sublabel index. The results of any subsequent method calls toILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)andILcdGXYLabelPainter.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)etc. will apply to the label and sublabel indicated by this sublabel index.- Specified by:
setSubLabelIndexin interfaceILcdGXYMultiLabelPainter- Parameters:
aSubLabelIndex- The sub label index. This should be larger than or equal to0and less than the resultILcdGXYMultiLabelPainter.getSubLabelCount(int).- See Also:
-
getSubLabelCount
public int getSubLabelCount(int aLabelIndex) Description copied from interface:ILcdGXYMultiLabelPainterReturn the number of sublabels in a label. The value should be 1 or higher.- Specified by:
getSubLabelCountin 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:ILcdGXYLabelPainter2Sets 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
aLabelLocationalso 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 inaLabelLocationcan 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 callingsetObjectclears this label location.- Specified by:
setLabelLocationin interfaceILcdGXYLabelPainter2- Parameters:
aLabelLocation- TheTLcdLabelLocationinstance containing all the information about the location of the label.- See Also:
-
getLabelLocation
Description copied from interface:ILcdGXYLabelPainter2Returns theTLcdLabelLocationthat was previously set that contains the information on the whereabouts of the label.- Specified by:
getLabelLocationin interfaceILcdGXYLabelPainter2- Returns:
- The label location that was previously set.
- See Also:
-
isLabelTouched
Description copied from interface:ILcdGXYLabelPainter2Tests if the label specified bysetObject,setLabelIndexandsetSubLabelIndexis touched at view location(specified by aGXYContext.getX()andaGXYContext.getY()), considering the mode and theILcdGXYContextinstance.Before calling this method, the domain object, the label index, the sublabel index and the location of the label should be set using the respective methods.
- Specified by:
isLabelTouchedin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- TheGraphicsinstance on which the label is painted.aMode- the mode to consider. This is a bitwise combinations of several constants. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)for more information.aGXYContext- theILcdGXYContextto consider.- Returns:
- true if the representation of the Object returned by getObject() is touched, false otherwise
- See Also:
-
labelAnchorPointSFCT
public void labelAnchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException Description copied from interface:ILcdGXYLabelPainter2Sets
aPointSFCTto the anchor point of the label specified bysetObject,setLabelIndexandsetSubLabelIndex.If the location index is less than 0, the label anchor point is unambiguously determined by the
label location. The actual label is to be painted somewhere around this anchor point. This method is typically called to compare the result with the label bounds, thus determining the exact relation between thelabeland itslocation.Before calling this method, the domain object, the label index, the sublabel index and the location of the label should be set using the respective methods.
- Specified by:
labelAnchorPointSFCTin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- TheGraphicsinstance on which the label is painted.aMode- The mode to consider. This can be a bitwise combination of several constants. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)for more information.aGXYContext- TheILcdGXYContextthat can be used to retrieve extra information.aPointSFCT- The point which will be updated to reflect the location of the anchor point.- Throws:
TLcdNoBoundsException- if the Object doesn't have any valid anchor point, e.g. if it is always invisible in the current projection.- See Also:
-
supportLabelSnap
Description copied from interface:ILcdGXYLabelPainter2Returns whether this label painter supports snapping for the label specified by
setObject,setLabelIndexandsetSubLabelIndex, considering the givenILcdGXYContextinstance. 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:
supportLabelSnapin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- the Graphics on which is worked.aGXYContext- the ILcdGXYContext of the snapping.- Returns:
trueif this label painter supports snapping for the specified label.- See Also:
-
labelSnapTarget
Description copied from interface:ILcdGXYLabelPainter2Returns anObjectthat can be used as snapping target when graphically editing anotherObjector label than the one this ILcdGXYLabelPainter2 represents. The returnedObjectcan be theObjectthis ILcdGXYLabelPainter2 represents or any other (e.g. anILcdPointif getObject() is anILcdPointList).- Specified by:
labelSnapTargetin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- the Graphics on which is worked.aGXYContext- the ILcdGXYContext of the snapping.- Returns:
- an
Objectthat can be used as snapping target when graphically editing anotherObjector label than the one this ILcdGXYLabelPainter2 represents (returned by getObject()). This object can benull.
-
getLabelCursor
Description copied from interface:ILcdGXYLabelPainter2Returns aCursorto indicate the type of editingaModeandaGXYContext.- Specified by:
getLabelCursorin interfaceILcdGXYLabelPainter2- Parameters:
aGraphics- TheGraphicsinstance on which the label is painted.aMode- The mode to consider. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, ILcdGXYContext)for more information.aGXYContext- TheILcdGXYContextcontaining extra information, such as the layer, the view and the mouse position.- Returns:
- a
Cursorto indicate the type of editingaModeandaGXYContext. Returnsnullif no particularCursoris required.
-