Class TLcdSLDFeatureTypeStyleDecoder
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionCreates a newTLcdSLDFeatureTypeStyleDecoder
with a default input stream factory.TLcdSLDFeatureTypeStyleDecoder
(Collection<TLcdDataModel> aDataModels) Creates a newTLcdSLDFeatureTypeStyleDecoder
which additionally uses the given data models to configure this decoder. -
Method Summary
Modifier and TypeMethodDescriptionfinal TLcdSLDFeatureTypeStyle
decodeFeatureTypeStyle
(InputStream aInputStream) Processes the given input stream, representing an XML source document, and returns the feature type style that corresponds to the root element.decodeFeatureTypeStyle
(String aSourceName) Processes the given XML source document, and returns the feature type style that corresponds to the root element.static TLcdSLDFeatureTypeStyle
decodeFromString
(String aFeatureTypeStyleXMLString) Utility method which parses a string representing an SLD Feature Type Style in XML to aTLcdSLDFeatureTypeStyle
instance.Returns the input stream factory that is currently used for creating input streams given source names.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory that will be used for creating input streams given source names.
-
Constructor Details
-
TLcdSLDFeatureTypeStyleDecoder
public TLcdSLDFeatureTypeStyleDecoder()Creates a new
TLcdSLDFeatureTypeStyleDecoder
with a default input stream factory. -
TLcdSLDFeatureTypeStyleDecoder
Creates a newTLcdSLDFeatureTypeStyleDecoder
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
Sets the input stream factory that will be used for creating input streams given source names.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used.
-
getInputStreamFactory
Returns the input stream factory that is currently used for creating input streams given source names.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is currently used.
-
decodeFeatureTypeStyle
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 aTLcdSLDFeatureTypeStyle
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
-