Package com.luciad.format.gml31.xml
Class TLcdGML31ModelEncoder
java.lang.Object
com.luciad.format.xml.bind.schema.ALcdXMLModelEncoder
com.luciad.format.gml31.xml.TLcdGML31ModelEncoder
- All Implemented Interfaces:
ILcdOutputStreamFactoryCapable,ILcdModelEncoder,Serializable
@LcdService(service=ILcdModelEncoder.class,
priority=20000)
public class TLcdGML31ModelEncoder
extends ALcdXMLModelEncoder
This model encoder encodes Geography Markup Language (GML) version 3.1.
Output files
| File | Description |
|---|---|
| *.gml, *.gml31, *.xml | GML 3.1 data file |
| *.xsd | Application schema (XML Schema) |
Supported file transfer protocols
- This model encoder supports all transfer protocols that are supported by
the
outputStreamFactoryof this encoder.
Supported models for saving
- This model encoder can save all models decoded by the
TLcdGML31ModelDecoderand models having aTLcdGML31ModelDescriptor. These models are instances ofTLcdGML31ModelorTLcdGML31AbstractFeatureCollection. Model elements are instances ofTLcdGML31AbstractFeature.
Supported models for exporting
- This model encoder can save all models having
ILcdShape/ILcdDataObjectelements. Nested features are also supported. - The following shapes are supported:
Java class GML geometry type ILcdPoint gml:PointType ILcdPolyline gml:LineStringType or gml:CurveType with gml:GeodesicString ILcdCircle gml:CurveType ILcdCircleBy3Points gml:CurveType ILcdCircularArcBy3Points gml:CurveType ILcdCircularArcByBulge gml:CurveType ILcdCircularArcByCenterPoint gml:CurveType ILcdCircularArc gml:CurveType ILcdCompositeCurve gml:CompositeCurveType ILcdPolygon gml:PolygonType ILcdComplexPolygon gml:MultiSurfaceType ILcdSurface gml:PolygonType ILcdShapeList gml:MultiGeometryType - The following feature classes are supported:
Java class XSD type Boolean xsd:boolean Byte xsd:byte Short xsd:short Integer xsd:int Long xsd:long Float xsd:float Double xsd:double
Supported model references
- This model encoder supports all model references which can be formatted by the
TLcdOGCModelReferenceFormatter.
Useful settings
- A default target namespace can be configured on this model encoder. This namespace will be the namespace of all the application schemas that are generated during export of non-GML31 models.
Sample code
ILcdModelEncoder encoder = new TLcdGML31ModelEncoder();
encoder.export(model, "world.gml31");
Thread safety
- The encoding of models is thread-safe, as long as no properties are changed during the encoding.
Supported versions and specifications
- GML 3.1.1
Known limitations
- Since:
- 9.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this encoder can export the specified model to the specified destination.booleanReturns whether this model encoder can save the specified model to the location it originally came from.protected StringcreateSchemaLocation(String aNamespaceURI, String aDefaultSchemaLocation, String aDestinationName) Returns a schema location for the specified namespace URI to be encoded in the "xsi:schemaLocations" attribute in the generated XML documents.voidExports the specified model to the specified destination.voidExports the given model to a destination result.voidexportSchema(ILcdModel aModel, String aDestinationName) Exports the XML schema for the specified model to the specified destination.Returns the default target application schema namespace.Returns a short, displayable name for the format thisILcdModelEncoderencodes to.Returns theorg.xml.sax.ext.EntityResolver2that is used for creating input sources for XSD schemas.Returns the model reference formatter that is used to formatILcdModelReferenceinstances when encoding an srsName.Returns theILcdOutputStreamFactorythat is used for creating output streams.Returns thejavax.xml.stream.XMLOutputFactorythat is used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.booleanReturnstrueif the schema is automatically encoded when a model is encoded,falseotherwise.voidSaves the model to the location where it originally came from.voidsetAutoEncodeSchema(boolean aAutoEncodeSchema) Sets whether a schema is to be encoded automatically when a model is encoded.voidsetDefaultTargetNamespace(String aTargetNamespace) Sets the default target application schema namespace.voidsetEntityResolver(EntityResolver2 aEntityResolver) Sets theorg.xml.sax.ext.EntityResolver2to be used for creating input sources for XSD schemas.voidsetModelReferenceFormatter(ILcdModelReferenceFormatter aModelReferenceFormatter) Sets the formatter that is used to formatILcdModelReferenceinstances when encoding an srsName.voidsetOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory) Sets theILcdOutputStreamFactoryto be used for creating output streams.voidsetXMLOutputFactory(XMLOutputFactory aXMLOutputFactory) Sets thejavax.xml.stream.XMLOutputFactoryto be used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.toString()
-
Constructor Details
-
TLcdGML31ModelEncoder
public TLcdGML31ModelEncoder()Creates a newTLcdGML31ModelEncoder, ready to use.
-
-
Method Details
-
canSave
Description copied from interface:ILcdModelEncoderReturns whether this model encoder can save the specified model to the location it originally came from. Often this will only be a simple test, for example checking the type of the model's model descriptor.- Parameters:
aModel- the model to be verified.- Returns:
trueif this encoder can save the model in the location where it originally came from,falseotherwise.- See Also:
-
getDisplayName
Description copied from interface:ILcdModelEncoderReturns a short, displayable name for the format thisILcdModelEncoderencodes to.- Returns:
- the displayable name of this
ILcdModelEncoder.
-
getEntityResolver
Description copied from class:ALcdXMLModelEncoderReturns theorg.xml.sax.ext.EntityResolver2that is used for creating input sources for XSD schemas.- Specified by:
getEntityResolverin classALcdXMLModelEncoder- Returns:
- the entity resolver to be used for creating input sources for XSD schemas.
-
getOutputStreamFactory
Description copied from class:ALcdXMLModelEncoderReturns theILcdOutputStreamFactorythat is used for creating output streams.- Specified by:
getOutputStreamFactoryin interfaceILcdOutputStreamFactoryCapable- Specified by:
getOutputStreamFactoryin classALcdXMLModelEncoder- Returns:
- the
ILcdOutputStreamFactorythat is used for creating output streams. - See Also:
-
getXMLOutputFactory
Description copied from class:ALcdXMLModelEncoderReturns thejavax.xml.stream.XMLOutputFactorythat is used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.- Specified by:
getXMLOutputFactoryin classALcdXMLModelEncoder- Returns:
- the
javax.xml.stream.XMLOutputFactorythat is used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.
-
save
Description copied from interface:ILcdModelEncoderSaves the model to the location where it originally came from.- Parameters:
aModel- the model to be saved.- Throws:
IllegalArgumentException- if the model cannot be saved by this encoder (!canSave(aModel)).IOException- if an I/O error occurs during encoding.
-
setEntityResolver
Description copied from class:ALcdXMLModelEncoderSets theorg.xml.sax.ext.EntityResolver2to be used for creating input sources for XSD schemas. This entity resolver is only used for retrieving runtime extension schemas.- Specified by:
setEntityResolverin classALcdXMLModelEncoder- Parameters:
aEntityResolver- the entity resolver to be used for creating input sources for XSD schemas.
-
setOutputStreamFactory
Description copied from class:ALcdXMLModelEncoderSets theILcdOutputStreamFactoryto be used for creating output streams. This output stream factory is used for output streams for both the data files and the XSD schemas.- Specified by:
setOutputStreamFactoryin interfaceILcdOutputStreamFactoryCapable- Specified by:
setOutputStreamFactoryin classALcdXMLModelEncoder- Parameters:
aOutputStreamFactory- the output stream factory to be used by this model encoder.- See Also:
-
setXMLOutputFactory
Description copied from class:ALcdXMLModelEncoderSets thejavax.xml.stream.XMLOutputFactoryto be used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.- Specified by:
setXMLOutputFactoryin classALcdXMLModelEncoder- Parameters:
aXMLOutputFactory- thejavax.xml.stream.XMLOutputFactoryto be used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.
-
toString
-
getDefaultTargetNamespace
Returns the default target application schema namespace. This is the namespace in which all generated elements and types generated specifically for the exported document will be declared. If null (the default), a namespace will be generated.- Returns:
- the default namespace for generated application schemas, or null if a namespace is generated.
-
setDefaultTargetNamespace
Sets the default target application schema namespace. This is the namespace in which all generated elements and types generated specifically for the exported document will be declared. If null (the default), a namespace will be generated.- Parameters:
aTargetNamespace- the default namespace for generated application schemas.
-
isAutoEncodeSchema
public boolean isAutoEncodeSchema()Returnstrueif the schema is automatically encoded when a model is encoded,falseotherwise.- Returns:
trueif the schema is automatically encoded when a model is encoded,falseotherwise.
-
setAutoEncodeSchema
public void setAutoEncodeSchema(boolean aAutoEncodeSchema) Sets whether a schema is to be encoded automatically when a model is encoded. When set totrue, this means that two output streams will be created when thesaveorexportmethod is called, one for the destination file and one for the schema.- Parameters:
aAutoEncodeSchema- whether a schema is to be encoded automatically when a model is encoded.
-
createSchemaLocation
protected String createSchemaLocation(String aNamespaceURI, String aDefaultSchemaLocation, String aDestinationName) Returns a schema location for the specified namespace URI to be encoded in the "xsi:schemaLocations" attribute in the generated XML documents. The default implementation just returns the default location which is passed. This might be a local source however, which can be unwanted in some cases (e.g. a WFS server).- Parameters:
aNamespaceURI- the namespace URI for which to create a schema location.aDefaultSchemaLocation- the default schema location, if known by the encoder.aDestinationName- the name of the document being saved or exported, which will refer in its "xsi:schemaLocations" attribute to this schema location.- Returns:
- a schema location for the specified namespace URI, which has a useful meaning in the encoded document.
-
canExport
Description copied from interface:ILcdModelEncoderReturns whether this encoder can export the specified model to the specified destination. This method will typically check whether the contents of the specified model are compatible with the format this encoder is written for.- Parameters:
aModel- the model to be verified.aDestinationName- the location where the model should be exported to.- Returns:
trueif this encoder can export the specified model to the specified location,falseotherwise.- See Also:
-
export
Description copied from interface:ILcdModelEncoderExports the specified model to the specified destination.- Parameters:
aModel- the model to be exported.aDestinationName- the location where the model should be saved. Typically, this is a name for the output file, but it can also point to a file containing the required properties to create a set of data files.- Throws:
IOException- if an I/O error occurs during encoding.
-
export
Exports the given model to a destination result.
- Overrides:
exportin classALcdXMLModelEncoder- Parameters:
aModel- the model to exportaDestination- the destination- Throws:
IOException- if an I/O error occurs during encoding.UnsupportedOperationException- in case the encoder is not able to write to the given result- See Also:
-
exportSchema
Exports the XML schema for the specified model to the specified destination.- Parameters:
aModel- the model for which to generate and export an XML Schema.aDestinationName- the destination to which the XML schema should be saved.- Throws:
IOException- if an exception occurs during exporting.
-
getModelReferenceFormatter
Returns the model reference formatter that is used to formatILcdModelReferenceinstances when encoding an srsName.- Returns:
- the model reference formatter of this encoder
-
setModelReferenceFormatter
Sets the formatter that is used to formatILcdModelReferenceinstances when encoding an srsName.- Parameters:
aModelReferenceFormatter- the model reference formatter for this encoder
-