Class TLcdSLDFeatureTypeStyleDecoder

java.lang.Object
com.luciad.ogc.sld.xml.TLcdSLDFeatureTypeStyleDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable

public class TLcdSLDFeatureTypeStyleDecoder extends Object implements ILcdInputStreamFactoryCapable

This class supports the decoding of XML documents containing feature type styles structured according to version 1.1 of the OGC Symbology Encoding Implementation Specification and the deprecated version 1.0 of the OGC Styled Layer Descriptor Implementation Specification.

Next to decoding a feature type style from an XML document with a <FeatureTypeStyle> top element, support is also provided for decoding a feature type style from an XML document with a <StyledLayerDescriptor>, <NamedLayer>, <UserLayer>, or <UserStyle> top element. For those use cases, it is required that there is only a single feature type style defined in the document; if multiple feature type styles are found, an exception is thrown.

Since:
6.1
  • Constructor Details

    • TLcdSLDFeatureTypeStyleDecoder

      public TLcdSLDFeatureTypeStyleDecoder()

      Creates a new TLcdSLDFeatureTypeStyleDecoder with a default input stream factory.

    • TLcdSLDFeatureTypeStyleDecoder

      public TLcdSLDFeatureTypeStyleDecoder(Collection<TLcdDataModel> aDataModels)
      Creates a new TLcdSLDFeatureTypeStyleDecoder which additionally uses the given data models to configure this decoder. This for example allows to decode custom SLD extensions.
      Parameters:
      aDataModels - a list of data models to decode SLD inline feature data
      Since:
      2017.0
  • Method Details

    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Sets the input stream factory that will be used for creating input streams given source names.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the input stream factory to be used.
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Returns the input stream factory that is currently used for creating input streams given source names.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      the input stream factory that is currently used.
    • decodeFeatureTypeStyle

      public TLcdSLDFeatureTypeStyle decodeFeatureTypeStyle(String aSourceName) throws IOException
      Processes the given XML source document, and returns the feature type style that corresponds to the root element.
      Parameters:
      aSourceName - the full path to the file to be decoded, including the file name.
      Returns:
      the feature type style that corresponds to the root element.
      Throws:
      IOException - thrown if an error occurs during the read process.
    • decodeFeatureTypeStyle

      public final TLcdSLDFeatureTypeStyle decodeFeatureTypeStyle(InputStream aInputStream) throws IOException
      Processes the given input stream, representing an XML source document, and returns the feature type style that corresponds to the root element.
      Parameters:
      aInputStream - The input stream
      Returns:
      the feature type style that corresponds to the root element.
      Throws:
      IOException - thrown if an error occurs during the read process.
    • decodeFromString

      public static TLcdSLDFeatureTypeStyle decodeFromString(String aFeatureTypeStyleXMLString) throws IOException
      Utility method which parses a string representing an SLD Feature Type Style in XML to a TLcdSLDFeatureTypeStyle instance.
      Parameters:
      aFeatureTypeStyleXMLString - The SLD Feature Type Style as XML string
      Returns:
      the parsed version of aFeatureTypeStyleXMLString
      Throws:
      IOException - When something goes wrong during the decoding
      Since:
      2017.0