Class TLcdSLDSymbolizerPainterFactory

java.lang.Object
com.luciad.ogc.sld.view.gxy.TLcdSLDSymbolizerPainterFactory
All Implemented Interfaces:
ILcdSLDSymbolizerPainterFactory, ILcdCloneable, Cloneable

public class TLcdSLDSymbolizerPainterFactory extends Object implements ILcdSLDSymbolizerPainterFactory, ILcdCloneable
A ILcdSLDSymbolizerPainterFactory that provides support for creating symbolizer painters for point, line, polygon, raster and text symbolizers.

This class provides specific methods, depending on the type of symbolizer to create a symbolizer painter for: createPointSymbolizerPainter, createLineSymbolizerPainter, createPolygonSymbolizerPainter, createRasterSymbolizerPainter, createTextSymbolizerPainter. Each of these methods calls methods specific to the setup of the painter they will create, listed below.

The line symbolizer painter is set up to let the style be interpreted by a ILcdGraphicsProvider. The graphics provider is responsible to set up a Graphics so that the style defined in the symbolizer is applied when rendering on the Graphics. The actual rendering is done by ILcdGXYPainter implementations which are not allowed to alter the settings on the Graphics. These painters are provided by a ILcdGXYPainterProvider. The painter provider is required since the symbolizer does not impose any restrictions on the geometry that should be rendered. E.g., a line symbolizer can be applied to arcs, arcbands, circles, buffers, ... . The method to create a line symbolizer therefor calls

  1. createStrokeGraphicsProvider with the Stroke of the line symbolizer, which should return a ILcdGraphicsProvider that alters the Graphics so that any line rendering will have the style defined in the Stroke applied to it.
  2. createStrokePainterProvider which should return a ILcdGXYPainterProvider that returns ILcdGXYPainter instances which do not apply any style and are capable of rendering outlined vector geometries e.g., an outlined circle, an outlined bounds, an outlined buffer, ... .

The polygon symbolizer painter has a similar set up as the line symbolizer painter, but it requires two graphics providers and two painter providers: one for the stroke defined in the symbolizer and one for the fill defined in the symbolizer. To create a polygon symbolizer painter two methods are called on top of the methods called when creating a line symbolizer painter:
  1. createFillGraphicsProvider which should return a ILcdGraphicsProvider that alters the Graphics so that any area rendering will have the style defined in the Fill of the polygon symbolizer applied to it.
  2. createFillPainterProvider which should return a ILcdGXYPainterProvider that returns ILcdGXYPainter instances which do not apply any style and are capable of rendering filled vector geometries e.g., a filled circle, a filled bounds, a filled buffer, ... . Note that these painters should NOT render the outline of an area.

The point symbolizer painter has the style encapsulated in a ILcdObjectIconProvider. As the line and the polygon symbolizer it has ILcdGXYPainterProvider which returns ILcdGXYPainter instances for different geometries. However, the painter provider should return TLcdGXYIconPainter instances, as the ILcdIcon returned by the icon provider should be set to the painter returned by the painter provider. The method to create a point symbolizer painter calls

  1. createPointPainterProvider which should return an ILcdGXYPainterProvider that only returns TLcdGXYIconPainter instances.
  2. createIconProvider which should return an ILcdObjectIconProvider that returns for an object the ILcdIcon that represents the Graphic for the point symbolizer for that object.

The raster symbolizer painter has its style encapsulated in a ILcdGXYPainterProvider. The method to create a raster symbolizer painter calls:

  1. createRasterPainterProvider which should return a ILcdGXYPainterProvider capable of rendering raster data (ILcdRaster, ILcdMultilevelRaster, ILcdEarthTileSet and/or ALcdImage). If the painter provider returns a TLcdGXYImagePainter (default), it is automatically configured based on the supported raster symbolizer properties (opacity, gamma value, color map, channel selection).
  2. createSymbolizerPainter which should return a symbolizer painter for the outline.

The text symbolizer painter is implemented as a ILcdGXYLabelPainter. The text symbolizer style is split up in three parts: a ILcdGraphicsProvider for the halo of the text, a ILcdGraphicsProvider for the fill of the text and a TLcdSLDTextSymbolizerPropertiesProvider which encapsulates the rest of the styling information. This method calls

  1. createFillGraphicsProvider which should return a ILcdSLDGraphicsProvider which applies the style defined by the Graphic in the Fill when rendering the Halo of the text.
  2. createFontFillGraphicsProvider which should return a ILcdSLDGraphicsProvider which applies the style defined by the Font and the Fill when rendering the text. Note that this methods implementation uses the graphics provider created with createFillGraphicsProvider method in order to combine both into one graphics provider.

A symbolizer can optionally contain vendor options, which define additional behavior beyond the OGC Styled Layer Descriptor / Symbology Encoding standards. A vendor option is defined by a name and a value. The following vendor options are supported:

  • A vendor option followLine, which takes a boolean value and can be configured on a text symbolizer to render curved labels that follow a feature's geometry.
  • A vendor option conflictResolution, which takes a boolean value and can be configured on a text symbolizer to disable label placement conflict resolution (label decluttering).
  • A vendor option repeat, which takes an integer value and can be configured on a text symbolizer to repeat labels along a path, taking into account the specified integer in pixels as distance to be used between subsequent labels; this parameter is only supported for curved labels (= if the vendor option followLine is set to true). If repeating is enabled, the label gets repeated 10 times at the most.
  • A vendor option removeAlphaChannel, which takes a boolean value and can be configured on a raster symbolizer to remove the alpha channel from an image.
  • A vendor option allowEditing, which takes a boolean value and can be configured on a point symbolizer to disable editing for the symbolizer.
  • The vendor options colorReplace and colorReplaceTolerance, which can be configured on a raster symbolizer to replace colors in an image. The colorReplace option takes a string value consisting of a comma-separated list of values defined as hexSourceColor:hexDestinationColor. For example, #000000:#00000000 replaces a black color with a transparent color. Depending on the band semantics of the source image (grayscale, palette, RGB or RGBA) and the specified destination color(s) (RGB or RGBA), a color conversion operation is optionally performed first to make sure that the color replacement can be done. More specifically, the visualized image will have RGBA band semantics if the destination color(s) and/or the source image include an alpha component; in all other cases, the visualized image will have RGB semantics. The colorReplaceTolerance option takes an integer value that is used for matching the source color in the input image. The value is defined in the range (0 - 255) and defines the maximum distance between the red, green, blue and alpha components of the source color and the colors in the input image.
  • Constructor Details

    • TLcdSLDSymbolizerPainterFactory

      public TLcdSLDSymbolizerPainterFactory()
  • Method Details

    • setPaintCache

      public void setPaintCache(boolean aPaintCache)
      Turns caching of the representation of the object on or off. Caching greatly reduces the time to paint an object but requires more memory. The representation of an object can only be cached for objects which implement ILcdCache. By default, caching is turned on. This field only applies to the default implementations of the methods that create painter or editor providers. Please respect this field when overriding methods of this class.
      Parameters:
      aPaintCache - A flag indicating whether to use caching when painting an object.
      See Also:
    • getPaintCache

      public boolean getPaintCache()
      Returns whether caching is used by the painters created by the default implementation of this painter factory.
      Returns:
      true if caching is used to paint this painter's object, false otherwise.
      See Also:
    • createSymbolizerPainter

      public ALcdSLDSymbolizerPainter createSymbolizerPainter(ALcdSLDSymbolizer aSLDSymbolizer, TLcdSLDContext aSLDContext)
      Calls on a specific method depending on the symbolizer type. This implementation supports creating painters for TLcdSLDLineSymbolizer, TLcdSLDPolygonSymbolizer, TLcdSLDPointSymbolizer, TLcdSLDTextSymbolizer, and TLcdSLDRasterSymbolizer.
      Specified by:
      createSymbolizerPainter in interface ILcdSLDSymbolizerPainterFactory
      Parameters:
      aSLDSymbolizer - the model for the styling information to take into account.
      aSLDContext - the context for which the painter should be created.
      Returns:
      a ALcdSLDSymbolizerPainter which applies the styling instruction in aSLDSymbolizer in the given context.
      See Also:
    • createRasterSymbolizerPainter

      protected ALcdSLDSymbolizerPainter createRasterSymbolizerPainter(TLcdSLDRasterSymbolizer aSLDRasterSymbolizer, TLcdSLDContext aSLDContext)
      Creates a raster symbolizer painter that styles objects according to the supplied TLcdSLDRasterSymbolizer.

      The symbolizer painter for the outline is created with createSymbolizerPainter for either the line or polygon symbolizer contained in the outline.

      Note that overlap behaviour and contrast enhancement (apart from the gamma value) are not taken into account.

      Parameters:
      aSLDRasterSymbolizer - a raster symbolizer
      aSLDContext - the SLD context
      Returns:
      a ALcdSLDSymbolizerPainter instance
      See Also:
    • createTextSymbolizerPainter

      protected ALcdSLDSymbolizerPainter createTextSymbolizerPainter(TLcdSLDTextSymbolizer aSLDTextSymbolizer, TLcdSLDContext aSLDContext)
      Creates a text symbolizer label painter that styles objects according to the supplied TLcdSLDTextSymbolizer. A graphics provider is created for the text symbolizers Halo Fill using createFillGraphicsProvider, another graphics provider is created to interpret the Fill and the Font of the text symbolizer with createFontFillGraphicsProvider.
      Parameters:
      aSLDTextSymbolizer - a text symbolizer
      aSLDContext - the SLD context
    • createFontFillGraphicsProvider

      protected ILcdSLDGraphicsProvider createFontFillGraphicsProvider(TLcdSLDTextSymbolizer aSLDTextSymbolizer, TLcdSLDContext aSLDContext)
      Creates a graphics provider that takes into account the Font and the Fill style settings of a text symbolizer. This implementation calls createFillGraphicsProvider with the text symbolizers fill.
      Parameters:
      aSLDTextSymbolizer - the text symbolizer to interpret the style of.
      aSLDContext - the context in which the style should be interpreted.
      Returns:
      a graphics provider that takes into account the Font and the Fill style settings of a text symbolizer.
    • createPointSymbolizerPainter

      protected ALcdSLDSymbolizerPainter createPointSymbolizerPainter(TLcdSLDPointSymbolizer aSLDPointSymbolizer, TLcdSLDContext aSLDContext)
      Creates a point symbolizer painter based on the icon provider created with createIconProvider, the painter provider created with createPointPainterProvider and the context passed.
      Parameters:
      aSLDPointSymbolizer - the symbolizer model to create a painter for.
      aSLDContext - the context in which the painter should be applied.
      Returns:
      a TLcdSLDPointSymbolizerPainter
      See Also:
    • createIconProvider

      protected ILcdObjectIconProvider createIconProvider(TLcdSLDGraphic aGraphic, TLcdSLDContext aSLDContext)
      Creates an icon provider that supports marks and external graphics in formats supported by the JVM by default.
      Parameters:
      aGraphic - the Graphic model to create an icon for.
      aSLDContext - the context to create the icons in.
      Returns:
      an icon provider that supports marks and external graphics in formats supported by the JVM by default.
    • createSelectionIconProvider

      protected ILcdObjectIconProvider createSelectionIconProvider(TLcdSLDGraphic aGraphic, TLcdSLDContext aSLDContext)
      Creates an icon provider that supports marks and external graphics in formats supported by the JVM by default. This icon provider will be used if the object is being painted in selection mode.

      By default, this method returns null which ensures that the regular icon provider is always used.

      Parameters:
      aGraphic - the Graphic model to create an icon for.
      aSLDContext - the context to create the icons in.
      Returns:
      an icon provider that supports marks and external graphics in formats supported by the JVM by default.
      See Also:
    • createPolygonSymbolizerPainter

      protected ALcdSLDSymbolizerPainter createPolygonSymbolizerPainter(TLcdSLDPolygonSymbolizer aSLDPolygonSymbolizer, TLcdSLDContext aSLDContext)
      Creates a polygon symbolizer painter, based on
      • the graphics provider for strokes returned by createStrokeGraphicsProvider,
      • the painter provider for strokes returned by createStrokePainterProvider,
      • the graphics provider for fills returned by createFillGraphicsProvider,
      • the painter provider for fills returned by createStrokePainterProvider and
      • the SLD context passed.
      Parameters:
      aSLDPolygonSymbolizer - the model for the styling instructions to take into account.
      aSLDContext - the context for which the painter should be created.
      Returns:
      a polygon symbolizer painter taking into account the style defined in the polygon symbolizer passed.
    • createLineSymbolizerPainter

      protected ALcdSLDSymbolizerPainter createLineSymbolizerPainter(TLcdSLDLineSymbolizer aSLDLineSymbolizer, TLcdSLDContext aSLDContext)
      Creates a TLcdSLDLineSymbolizerPainter, based on
      • the graphics provider for strokes returned by createStrokeGraphicsProvider,
      • the painter provider for strokes returned by createStrokePainterProvider,
      • the SLD context passed.
      Parameters:
      aSLDLineSymbolizer - the model for the styling instructions to take into account.
      aSLDContext - the context for which the painter should be created.
      Returns:
      a TLcdSLDLineSymbolizerPainter
    • createFillGraphicsProvider

      protected ILcdSLDGraphicsProvider createFillGraphicsProvider(TLcdSLDFill aFill, TLcdSLDContext aSLDContext)
      Creates a ILcdSLDGraphicsProvider that sets up a Graphics object according to the styling information contained in the TLcdSLDFill passed. This implementation returns different implementations of ILcdSLDGraphicsProvider, depending on whether the TLcdSLDFill contains a graphic fill or not. CSS parameters are disregarded when the graphic fill is not null.
      Parameters:
      aFill - the styling information that should be taken into account.
      aSLDContext - the context for which the graphics provider should be created.
      Returns:
      a ILcdSLDGraphicsProvider that takes the graphic fill into account, when it is different from null, or that takes the CSS parameters into account otherwise.
    • createStrokeGraphicsProvider

      protected ILcdSLDGraphicsProvider createStrokeGraphicsProvider(TLcdSLDStroke aStroke, ALcdSLDSymbolizer aSymbolizer, TLcdSLDContext aSLDContext)
      Creates a ILcdSLDGraphicsProvider that sets up a Graphics object according to the styling information contained in the TLcdSLDStroke passed. CSS parameters are disregarded when the graphic fill or graphic stroke is not null.
      Parameters:
      aStroke - the styling information that should be taken into account.
      aSymbolizer - The symbolizer that contains the stroke, can be used to retrieve information about the uom.
      aSLDContext - the context for which the graphics provider should be created.
      Returns:
      a ILcdSLDGraphicsProvider that takes into account the first non null parameter that it encounters in the TLcdSLDStroke passed, in the following order: graphic stroke, graphic fill, CSS parameters.
      Since:
      2012.1
    • createStrokeGraphicsProvider

      protected ILcdSLDGraphicsProvider createStrokeGraphicsProvider(TLcdSLDStroke aStroke, TLcdSLDContext aSLDContext)
      Creates a ILcdSLDGraphicsProvider that sets up a Graphics object according to the styling information contained in the TLcdSLDStroke passed. CSS parameters are disregarded when the graphic fill or graphic stroke is not null.
      Parameters:
      aStroke - the styling information that should be taken into account.
      aSLDContext - the context for which the graphics provider should be created.
      Returns:
      a ILcdSLDGraphicsProvider that takes into account the first non null parameter that it encounters in the TLcdSLDStroke passed, in the following order: graphic stroke, graphic fill, CSS parameters.
    • createStrokePainterProvider

      protected ILcdGXYPainterProvider createStrokePainterProvider(ALcdSLDSymbolizer aSymbolizer)
      Deprecated.
      Returns a painter provider to paint lines.

      This implementation returns a provider supporting objects of the following classes: ILcdArcBand, ILcdArc, ILcdCircularArc, ILcdBounds, ILcdGeoBuffer, TLcdLonLatBuffer, TLcdLonLatHeightBuffer, ILcdVariableGeoBuffer, ILcdCircle, ILcdCircleBy3Points, ILcdEllipse, ILcdPolygon, ILcdComplexPolygon, ILcdPolyline, ILcdRaster, ILcdMultilevelRaster, ILcdPoint, ILcdCompositeCurve, TLcdLonLatCompositeRing, TLcdXYCompositeRing, ILcdSurface, ILcdShapeList, and ILcdBounded. The points and rasters are rendered as specified in the standard. If the symbolizer is a polygon symbolizer, point lists will be rendered as polygons, otherwise they will be rendered as polylines.

      Parameters:
      aSymbolizer - depending on the symbolizer the painters returned by the painter provider might be configured differently, e.g. the TLcdGXYPointListPainter mode should be set differently when the stroke painter provider should be created for a linesymbolizer or a polygonsymbolizer.
      Returns:
      a painter provider to paint lines.
    • createStrokePainterProvider

      protected ILcdGXYPainterProvider createStrokePainterProvider(ALcdSLDSymbolizer aSymbolizer, TLcdSLDContext aSLDContext)
      Returns a painter provider to paint lines.

      This implementation returns a provider supporting objects of the following classes: ILcdArcBand, ILcdArc, ILcdCircularArc, ILcdBounds, ILcdGeoBuffer, TLcdLonLatBuffer, TLcdLonLatHeightBuffer, ILcdVariableGeoBuffer, ILcdCircle, ILcdCircleBy3Points, ILcdEllipse, ILcdPolygon, ILcdComplexPolygon, ILcdPolyline, ILcdRaster, ILcdMultilevelRaster, ILcdPoint, ILcdCompositeCurve, TLcdLonLatCompositeRing, TLcdXYCompositeRing, ILcdSurface, ILcdShapeList, and ILcdBounded. The points and rasters are rendered as specified in the standard. If the symbolizer is a polygon symbolizer, point lists will be rendered as polygons, otherwise they will be rendered as polylines.

      Parameters:
      aSymbolizer - depending on the symbolizer the painters returned by the painter provider might be configured differently, e.g. the TLcdGXYPointListPainter mode should be set differently when the stroke painter provider should be created for a linesymbolizer or a polygonsymbolizer.
      aSLDContext - the context for which the painter provider should be created.
      Returns:
      a painter provider to paint lines.
      Since:
      2022.1
    • createFillPainterProvider

      protected ILcdGXYPainterProvider createFillPainterProvider()
      Create a painter provider that paints objects in filled mode. The painters returned by this provider must not set any style on the graphics.

      This painter provided will only be used by the polygon symbolizer. This implementation returns a provider supporting objects of the following classes: ILcdArcBand, ILcdArc, ILcdCircularArc, ILcdBounds, ILcdGeoBuffer, TLcdLonLatBuffer, TLcdLonLatHeightBuffer, ILcdVariableGeoBuffer, ILcdCircle, ILcdCircleBy3Points, ILcdEllipse, ILcdPolygon, ILcdComplexPolygon, ILcdPolyline, ILcdRaster, ILcdMultilevelRaster, ILcdPoint, ILcdCompositeCurve, TLcdLonLatCompositeRing, TLcdXYCompositeRing, ILcdSurface, ILcdShapeList, and ILcdBounded. The points and rasters are rendered as specified in the standard.

      Returns:
      a painter provider that paints objects in filled mode.
    • createPointPainterProvider

      protected ILcdGXYPainterProvider createPointPainterProvider()
      Creates the ILcdGXYPainterProvider the point symbolizer painter will delegate the actual painting to. Note that this ILcdGXYPainterProvider must always return a TLcdGXYIconPainter for every object. This implementation provides support for objects which implement ILcdBounded.
      Returns:
      an ILcdGXYPainterProvider returning a TLcdGXYIconPainter for every object.
    • createRasterPainterProvider

      protected ILcdGXYPainterProvider createRasterPainterProvider()
      Creates a painter provider for rasters. This implementation sets the start and stop resolution so that rasters will always be painted, regardless of the zoom level. This implementation returns a painter provider that has support for
      • ALcdImage objects,
      • ILcdMultilevelRaster objects,
      • ILcdRaster objects,
      • and ILcdBounded objects.
      • If the painter provider returns a TLcdGXYImagePainter (default), it is automatically configured based on the supported raster symbolizer properties (opacity, gamma value, color map, channel selection).

      Returns:
      an ILcdGXYPainterProvider.
    • createStrokeEditorProvider

      protected ILcdGXYEditorProvider createStrokeEditorProvider(ALcdSLDSymbolizer aSymbolizer)
      Returns an editor provider to edit lines.

      This implementation returns a provider supporting objects of the following classes: ILcdArcBand, ILcdArc, ILcdCircularArc, ILcdBounds, ILcdGeoBuffer, TLcdLonLatBuffer, TLcdLonLatHeightBuffer, ILcdVariableGeoBuffer, ILcdCircle, ILcdCircleBy3Points, ILcdEllipse, ILcdPolygon, ILcdComplexPolygon, ILcdPolyline, ILcdCompositeCurve, TLcdLonLatCompositeRing, TLcdXYCompositeRing, ILcdShapeList, and ILcdBounded.

      Parameters:
      aSymbolizer - depending on the symbolizer the editors returned by the editor provider might be configured differently, e.g. the TLcdGXYPointListPainter mode should be set differently when the stroke editor provider should be created for a linesymbolizer or a polygonsymbolizer.
      Returns:
      an editor provider to edit lines.
    • createFillEditorProvider

      protected ILcdGXYEditorProvider createFillEditorProvider()
      Create an editor provider that edits filled objects.

      This editor provided will only be used by the polygon symbolizer. This implementation returns a provider supporting objects of the following classes: ILcdArcBand, ILcdArc, ILcdCircularArc, ILcdBounds, ILcdGeoBuffer, TLcdLonLatBuffer, TLcdLonLatHeightBuffer, ILcdVariableGeoBuffer, ILcdCircle, ILcdCircleBy3Points, ILcdEllipse, ILcdPolygon, ILcdComplexPolygon, ILcdPolyline, TLcdLonLatCompositeRing, TLcdXYCompositeRing, ILcdSurface, ILcdShapeList, and ILcdBounded.

      Returns:
      an editor provider that edits filled objects.
    • createPointEditorProvider

      protected ILcdGXYEditorProvider createPointEditorProvider()
      Creates and ILcdGXYEditorProvider that will be used to edit objects that are rendered as points. Note that this ILcdGXYEditorProvider must always return a TLcdGXYIconPainter for every object. This implementation provides support for objects that implement ILcdBounded.
      Returns:
      an ILcdGXYEditorProvider returning a TLcdGXYIconPainter for every object.
    • createRasterEditorProvider

      protected ILcdGXYEditorProvider createRasterEditorProvider()
      Creates and ILcdGXYEditorProvider that can be used to edit rasters

      This method is currently not used and returns null by default. Editing rasters is not supported.

      Returns:
      returns null.
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
      
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
         }
       }
       
      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also: