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.Geometry;
20: import org.geotools.xml.AbstractComplexBinding;
21: import org.geotools.xml.ElementInstance;
22: import org.geotools.xml.Node;
23:
24: /**
25: * Binding object for the type http://www.opengis.net/gml:GeometryAssociationType.
26: *
27: * <p>
28: * <pre>
29: * <code>
30: * <complexType name="GeometryAssociationType">
31: * <annotation>
32: * <documentation> An instance of this type (e.g. a
33: * geometryMember) can either enclose or point to a
34: * primitive geometry element. When serving as a
35: * simple link that references a remote geometry instance,
36: * the value of the gml:remoteSchema attribute can be used to
37: * locate a schema fragment that constrains the target
38: * instance. </documentation>
39: * </annotation>
40: * <sequence minOccurs="0">
41: * <element ref="gml:_Geometry"/>
42: * </sequence>optional
43: * <!-- <attributeGroup ref="gml:AssociationAttributeGroup"/> -->
44: * <attributeGroup ref="xlink:simpleLink"/>
45: * <attribute ref="gml:remoteSchema" use="optional"/>
46: * </complexType>
47: *
48: * </code>
49: * </pre>
50: * </p>
51: *
52: * @generated
53: */
54: public class GMLGeometryAssociationTypeBinding extends
55: AbstractComplexBinding {
56: /**
57: * @generated
58: */
59: public QName getTarget() {
60: return GML.GeometryAssociationType;
61: }
62:
63: /**
64: * <!-- begin-user-doc -->
65: * <!-- end-user-doc -->
66: *
67: * @generated modifiable
68: */
69: public Class getType() {
70: return Geometry.class;
71: }
72:
73: /**
74: * <!-- begin-user-doc -->
75: * Returns an object of type @link Geometry.
76: * <!-- end-user-doc -->
77: *
78: * @generated modifiable
79: */
80: public Object parse(ElementInstance instance, Node node,
81: Object value) throws Exception {
82: //TODO: xlink and remoteSchema attributes, hard to do because of streaming
83: return node.getChildValue(Geometry.class);
84: }
85:
86: public Object getProperty(Object object, QName name)
87: throws Exception {
88: if (GML._Geometry.equals(name)) {
89: return object;
90: }
91:
92: return null;
93: }
94: }
|