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.gml3.bindings;
17:
18: import org.w3c.dom.Document;
19: import org.w3c.dom.Element;
20: import com.vividsolutions.jts.geom.Coordinate;
21: import com.vividsolutions.jts.geom.LineString;
22: import com.vividsolutions.jts.geom.LinearRing;
23: import org.geotools.gml3.GML3TestSupport;
24:
25: public class LinearRingTypeBindingTest extends GML3TestSupport {
26: public void testPos() throws Exception {
27: document.appendChild(GML3MockData.linearRingWithPos(document,
28: null));
29:
30: LinearRing line = (LinearRing) parse();
31: assertNotNull(line);
32:
33: assertEquals(new Coordinate(1d, 2d), line.getPointN(0)
34: .getCoordinate());
35: assertEquals(new Coordinate(3d, 4d), line.getPointN(1)
36: .getCoordinate());
37: assertEquals(new Coordinate(5d, 6d), line.getPointN(2)
38: .getCoordinate());
39: assertEquals(new Coordinate(1d, 2d), line.getPointN(3)
40: .getCoordinate());
41: }
42:
43: public void testPosList() throws Exception {
44: document.appendChild(GML3MockData.linearRingWithPosList(
45: document, null));
46:
47: LinearRing line = (LinearRing) parse();
48: assertNotNull(line);
49:
50: assertEquals(new Coordinate(1d, 2d), line.getPointN(0)
51: .getCoordinate());
52: assertEquals(new Coordinate(3d, 4d), line.getPointN(1)
53: .getCoordinate());
54: assertEquals(new Coordinate(1d, 2d), line.getPointN(0)
55: .getCoordinate());
56: assertEquals(new Coordinate(3d, 4d), line.getPointN(1)
57: .getCoordinate());
58: assertEquals(new Coordinate(5d, 6d), line.getPointN(2)
59: .getCoordinate());
60: assertEquals(new Coordinate(1d, 2d), line.getPointN(3)
61: .getCoordinate());
62: }
63: }
|