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.
Constructor and Description |
---|
TLcdSLDFeatureTypeStyleDecoder()
Creates a new
TLcdSLDFeatureTypeStyleDecoder with a default input stream factory. |
TLcdSLDFeatureTypeStyleDecoder(Collection<TLcdDataModel> aDataModels)
Creates a new
TLcdSLDFeatureTypeStyleDecoder which additionally uses the given data models to configure
this decoder. |
Modifier and Type | Method and Description |
---|---|
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.
|
TLcdSLDFeatureTypeStyle |
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 a
TLcdSLDFeatureTypeStyle instance. |
ILcdInputStreamFactory |
getInputStreamFactory()
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.
|
public TLcdSLDFeatureTypeStyleDecoder()
Creates a new TLcdSLDFeatureTypeStyleDecoder
with a default input stream factory.
public TLcdSLDFeatureTypeStyleDecoder(Collection<TLcdDataModel> aDataModels)
TLcdSLDFeatureTypeStyleDecoder
which additionally uses the given data models to configure
this decoder. This for example allows to decode custom SLD extensions.aDataModels
- a list of data models to decode SLD inline feature datapublic void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public TLcdSLDFeatureTypeStyle decodeFeatureTypeStyle(String aSourceName) throws IOException
aSourceName
- the full path to the file to be decoded, including the file name.IOException
- thrown if an error occurs during the read process.public final TLcdSLDFeatureTypeStyle decodeFeatureTypeStyle(InputStream aInputStream) throws IOException
aInputStream
- The input streamIOException
- thrown if an error occurs during the read process.public static TLcdSLDFeatureTypeStyle decodeFromString(String aFeatureTypeStyleXMLString) throws IOException
TLcdSLDFeatureTypeStyle
instance.aFeatureTypeStyleXMLString
- The SLD Feature Type Style as XML stringaFeatureTypeStyleXMLString
IOException
- When something goes wrong during the decoding