Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.io.gml.writer.internal.geometry.writers
Class AbstractGeometryWriter<T extends com.vividsolutions.jts.geom.Geometry>

java.lang.Object
  extended by eu.esdihumboldt.hale.io.gml.writer.internal.geometry.writers.AbstractPathMatcher
      extended by eu.esdihumboldt.hale.io.gml.writer.internal.geometry.writers.AbstractGeometryWriter<T>
Type Parameters:
T - the geometry type
All Implemented Interfaces:
GeometryWriter<T>
Direct Known Subclasses:
CurveWriter, LegacyMultiPolygonWriter, LegacyPolygonWriter, LineStringWriter, MultiLineStringWriter, MultiPointWriter, MultiPolygonWriter, PointWriter, PolygonWriter

public abstract class AbstractGeometryWriter<T extends com.vividsolutions.jts.geom.Geometry>
extends AbstractPathMatcher
implements GeometryWriter<T>

Abstract geometry writer implementation

Author:
Simon Templer
Partner:
01 / Fraunhofer Institute for Computer Graphics Research

Constructor Summary
AbstractGeometryWriter(Class<T> geometryType)
          Constructor
 
Method Summary
 void addCompatibleType(QName typeName)
          Add a compatible type.
protected static void descendAndWriteCoordinates(XMLStreamWriter writer, Pattern descendPattern, com.vividsolutions.jts.geom.Coordinate[] coordinates, TypeDefinition elementType, QName elementName, String gmlNs, boolean unique)
          Write coordinates into a posList or coordinates property
 Set<QName> getCompatibleTypes()
          Get the compatible types' names for the geometry type that can be handled by this writer.
 Class<T> getGeometryType()
          Get the geometry type represented by the writer
protected  boolean verifyEndPoint(TypeDefinition endPoint)
          Verify the verification end point.
protected static void writeCoordinates(XMLStreamWriter writer, com.vividsolutions.jts.geom.Coordinate[] coordinates, TypeDefinition elementType, String gmlNs)
          Write coordinates into a pos, posList or coordinates property
 
Methods inherited from class eu.esdihumboldt.hale.io.gml.writer.internal.geometry.writers.AbstractPathMatcher
addBasePattern, addVerificationPattern, addVerificationPattern, descend, match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.esdihumboldt.hale.io.gml.writer.internal.geometry.GeometryWriter
match, write
 

Constructor Detail

AbstractGeometryWriter

public AbstractGeometryWriter(Class<T> geometryType)
Constructor

Parameters:
geometryType - the geometry type
Method Detail

getCompatibleTypes

public Set<QName> getCompatibleTypes()
Description copied from interface: GeometryWriter
Get the compatible types' names for the geometry type that can be handled by this writer. The compatible types serve as entry points for the matching.

Specified by:
getCompatibleTypes in interface GeometryWriter<T extends com.vividsolutions.jts.geom.Geometry>
Returns:
the type names, a null namespace in a name references the GML namespace
See Also:
GeometryWriter.getCompatibleTypes()

addCompatibleType

public void addCompatibleType(QName typeName)
Add a compatible type. A Pattern.GML_NAMESPACE_PLACEHOLDER namespace references the GML namespace.

Parameters:
typeName - the type name

getGeometryType

public Class<T> getGeometryType()
Description copied from interface: GeometryWriter
Get the geometry type represented by the writer

Specified by:
getGeometryType in interface GeometryWriter<T extends com.vividsolutions.jts.geom.Geometry>
Returns:
the geometry type
See Also:
GeometryWriter.getGeometryType()

verifyEndPoint

protected boolean verifyEndPoint(TypeDefinition endPoint)
Verify the verification end point. After reaching the end-point of a verification pattern this method is called with the TypeDefinition of the end-point to assure the needed structure is present (e.g. a DirectPositionListType element). If no verification pattern is present the end-point of the matched base pattern will be verified. The default implementation checks for properties with any of the types supported for writing coordinates.

Specified by:
verifyEndPoint in class AbstractPathMatcher
Parameters:
endPoint - the end-point type definition
Returns:
if the end-point is valid for writing the geometry
See Also:
SUPPORTED_COORDINATES_TYPES

descendAndWriteCoordinates

protected static void descendAndWriteCoordinates(XMLStreamWriter writer,
                                                 Pattern descendPattern,
                                                 com.vividsolutions.jts.geom.Coordinate[] coordinates,
                                                 TypeDefinition elementType,
                                                 QName elementName,
                                                 String gmlNs,
                                                 boolean unique)
                                          throws XMLStreamException
Write coordinates into a posList or coordinates property

Parameters:
writer - the XML stream writer
descendPattern - the pattern to descend
coordinates - the coordinates to write
elementType - the type of the encompassing element
elementName - the encompassing element name
gmlNs - the GML namespace
unique - if the path's start element cannot be repeated
Throws:
XMLStreamException - if an error occurs writing the coordinates

writeCoordinates

protected static void writeCoordinates(XMLStreamWriter writer,
                                       com.vividsolutions.jts.geom.Coordinate[] coordinates,
                                       TypeDefinition elementType,
                                       String gmlNs)
                                throws XMLStreamException
Write coordinates into a pos, posList or coordinates property

Parameters:
writer - the XML stream writer
coordinates - the coordinates to write
elementType - the type of the encompassing element
gmlNs - the GML namespace
Throws:
XMLStreamException - if an error occurs writing the coordinates

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d