package org.geotools.gml4wcs.bindings; import javax.xml.namespace.QName; import org.geotools.gml4wcs.GML; import org.geotools.xml.AbstractComplexBinding; import org.geotools.xml.ElementInstance; import org.geotools.xml.Node; import org.opengis.referencing.crs.CoordinateReferenceSystem; import com.vividsolutions.jts.geom.Geometry; /** * Binding object for the type http://www.opengis.net/gml:AbstractGeometryType. * * <p> * * <pre> * <code> * <complexType abstract="true" name="AbstractGeometryType"> * <annotation> * <documentation>All geometry elements are derived directly or indirectly from this abstract supertype. A geometry element may have an identifying attribute ("id"), a name (attribute "name") and a description (attribute "description"). It may be associated with a spatial reference system (attribute "srsName"). The following rules shall be adhered: - Every geometry type shall derive from this abstract type. - Every geometry element (i.e. an element of a geometry type) shall be directly or indirectly in the substitution group of _Geometry.</documentation> * </annotation> * <complexContent> * <extension base="gml:AbstractGeometryBaseType"> * <attribute name="srsName" type="anyURI" use="optional"> * <annotation> * <documentation>No gid attribute added.</documentation> * <documentation>In general srsName points to a CRS instance of CoordinateReferenceSystemType (see coordinateReferenceSystems.xsd). For well known references it is not required that the CRS description exists at the location the URI points to (Note: These "WKCRS"-ids still have to be specified). If no srsName attribute is given, the CRS must be specified as part of the larger context this geometry element is part of, e.g. a geometric aggregate.</documentation> * </annotation> * </attribute> * </extension> * </complexContent> * </complexType> * * </code> * </pre> * * </p> * * @generated * * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/extension/xsd/xsd-wcs/src/main/java/org/geotools/gml4wcs/bindings/AbstractGeometryTypeBinding.java $ */ public class AbstractGeometryTypeBinding extends AbstractComplexBinding { /** * @generated */ public QName getTarget() { return GML.AbstractGeometryType; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated modifiable */ public Class getType() { return Geometry.class; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { // set the crs if (value instanceof Geometry) { CoordinateReferenceSystem crs = GML3ParsingUtils.crs(node); if (crs != null) { Geometry geometry = (Geometry) value; geometry.setUserData(crs); } } return value; } public Object getProperty(Object object, QName name) throws Exception { Geometry geometry = (Geometry) object; if ("srsName".equals(name.getLocalPart())) { CoordinateReferenceSystem crs = GML3EncodingUtils.getCRS(geometry); if (crs != null) { return GML3EncodingUtils.crs(crs); } } if (GML.id.equals(name)) { return GML3EncodingUtils.getID(geometry); } if (GML.name.equals(name)) { return GML3EncodingUtils.getName(geometry); } if (GML.description.equals(name)) { return GML3EncodingUtils.getDescription(geometry); } return null; } }