01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.gml2.bindings;
17:
18: import javax.xml.namespace.QName;
19: import com.vividsolutions.jts.geom.GeometryCollection;
20: import org.opengis.referencing.crs.CoordinateReferenceSystem;
21: import org.geotools.xml.AbstractComplexBinding;
22: import org.geotools.xml.ElementInstance;
23: import org.geotools.xml.Node;
24:
25: /**
26: * Binding object for the type http://www.opengis.net/gml:AbstractGeometryCollectionBaseType.
27: *
28: * <p>
29: * <pre>
30: * <code>
31: * <complexType name="AbstractGeometryCollectionBaseType" abstract="true">
32: * <annotation>
33: * <documentation> This abstract base type for geometry
34: * collections just makes the srsName attribute
35: * mandatory. </documentation>
36: * </annotation>
37: * <complexContent>
38: * <restriction base="gml:AbstractGeometryType">
39: * <attribute name="gid" type="ID" use="optional"/>
40: * <attribute name="srsName" type="anyURI" use="required"/>
41: * </restriction>
42: * </complexContent>
43: * </complexType>
44: *
45: * </code>
46: * </pre>
47: * </p>
48: *
49: * @generated
50: */
51: public class GMLAbstractGeometryCollectionBaseTypeBinding extends
52: AbstractComplexBinding {
53: /**
54: * @generated
55: */
56: public QName getTarget() {
57: return GML.AbstractGeometryCollectionBaseType;
58: }
59:
60: /**
61: * <!-- begin-user-doc -->
62: * <!-- end-user-doc -->
63: *
64: * @generated modifiable
65: */
66: public Class getType() {
67: return GeometryCollection.class;
68: }
69:
70: /**
71: * <!-- begin-user-doc -->
72: * <!-- end-user-doc -->
73: *
74: * @generated modifiable
75: */
76: public Object parse(ElementInstance instance, Node node,
77: Object value) throws Exception {
78: if (value instanceof GeometryCollection) {
79: //set an srs if there is one
80: CoordinateReferenceSystem crs = GML2ParsingUtils.crs(node);
81:
82: if (crs != null) {
83: ((GeometryCollection) value).setUserData(crs);
84: }
85: }
86:
87: return value;
88: }
89: }
|