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 com.vividsolutions.jts.geom.Coordinate;
19: import com.vividsolutions.jts.geom.Geometry;
20: import com.vividsolutions.jts.geom.GeometryFactory;
21: import org.geotools.xml.ElementInstance;
22: import org.geotools.xml.Node;
23:
24: public class GMLGeometryPropertyTypeBindingTest extends
25: AbstractGMLBindingTest {
26: ElementInstance association;
27: ElementInstance geometry;
28:
29: protected void setUp() throws Exception {
30: super .setUp();
31:
32: association = createElement(GML.NAMESPACE,
33: "myGeometryProperty", GML.GEOMETRYPROPERTYTYPE, null);
34: geometry = createElement(GML.NAMESPACE, "myPoint",
35: GML.POINTTYPE, null);
36: }
37:
38: public void testWithGeometry() throws Exception {
39: Node node = createNode(association,
40: new ElementInstance[] { geometry },
41: new Object[] { new GeometryFactory()
42: .createPoint(new Coordinate(0, 0)) }, null,
43: null);
44: GMLGeometryAssociationTypeBinding s = (GMLGeometryAssociationTypeBinding) getBinding(GML.GEOMETRYASSOCIATIONTYPE);
45: GMLGeometryPropertyTypeBinding s1 = (GMLGeometryPropertyTypeBinding) getBinding(GML.GEOMETRYPROPERTYTYPE);
46: Geometry p = (Geometry) s1.parse(association, node, s.parse(
47: association, node, null));
48: assertNotNull(p);
49: }
50: }
|