svn-gvsig-desktop / trunk / libraries / libGPE / src-test / org / gvsig / gpe / writer / GPELinearRingLayerTest.java @ 20219
History | View | Annotate | Download (4.68 KB)
1 | 19581 | jpiera | package org.gvsig.gpe.writer; |
---|---|---|---|
2 | 18288 | jpiera | |
3 | 20219 | jpiera | import org.gvsig.gpe.containers.CoordinatesIterator; |
4 | 18288 | jpiera | import org.gvsig.gpe.containers.Feature; |
5 | import org.gvsig.gpe.containers.GeometryAsserts; |
||
6 | import org.gvsig.gpe.containers.Layer; |
||
7 | import org.gvsig.gpe.containers.LinearRing; |
||
8 | |||
9 | |||
10 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
11 | *
|
||
12 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
13 | *
|
||
14 | * This program is free software; you can redistribute it and/or
|
||
15 | * modify it under the terms of the GNU General Public License
|
||
16 | * as published by the Free Software Foundation; either version 2
|
||
17 | * of the License, or (at your option) any later version.
|
||
18 | *
|
||
19 | * This program is distributed in the hope that it will be useful,
|
||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
22 | * GNU General Public License for more details.
|
||
23 | *
|
||
24 | * You should have received a copy of the GNU General Public License
|
||
25 | * along with this program; if not, write to the Free Software
|
||
26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
27 | *
|
||
28 | * For more information, contact:
|
||
29 | *
|
||
30 | * Generalitat Valenciana
|
||
31 | * Conselleria d'Infraestructures i Transport
|
||
32 | * Av. Blasco Ib??ez, 50
|
||
33 | * 46010 VALENCIA
|
||
34 | * SPAIN
|
||
35 | *
|
||
36 | * +34 963862235
|
||
37 | * gvsig@gva.es
|
||
38 | * www.gvsig.gva.es
|
||
39 | *
|
||
40 | * or
|
||
41 | *
|
||
42 | * IVER T.I. S.A
|
||
43 | * Salamanca 50
|
||
44 | * 46005 Valencia
|
||
45 | * Spain
|
||
46 | *
|
||
47 | * +34 963163400
|
||
48 | * dac@iver.es
|
||
49 | */
|
||
50 | /* CVS MESSAGES:
|
||
51 | *
|
||
52 | * $Id: GPELinearRingLayerTest.java 144 2007-06-07 14:53:59Z jorpiell $
|
||
53 | * $Log$
|
||
54 | * Revision 1.6 2007/06/07 14:52:28 jorpiell
|
||
55 | * Add the schema support
|
||
56 | *
|
||
57 | * Revision 1.5 2007/05/02 11:46:07 jorpiell
|
||
58 | * Writing tests updated
|
||
59 | *
|
||
60 | * Revision 1.4 2007/04/26 14:39:12 jorpiell
|
||
61 | * Add some tests
|
||
62 | *
|
||
63 | * Revision 1.3 2007/04/19 11:50:20 csanchez
|
||
64 | * Actualizacion protoripo libGPE
|
||
65 | *
|
||
66 | * Revision 1.2 2007/04/14 16:06:35 jorpiell
|
||
67 | * Add the container classes
|
||
68 | *
|
||
69 | * Revision 1.1 2007/04/13 07:17:54 jorpiell
|
||
70 | * Add the writting tests for the simple geometries
|
||
71 | *
|
||
72 | *
|
||
73 | */
|
||
74 | /**
|
||
75 | * @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
||
76 | */
|
||
77 | public abstract class GPELinearRingLayerTest extends GPEWriterBaseTest{ |
||
78 | private String layerId = "l1"; |
||
79 | private String layerName = "Line String Layer"; |
||
80 | private String layerDescription = "This is a linear ring test"; |
||
81 | private String srs = "EPSG:23030"; |
||
82 | private String bboxId = "bboxID"; |
||
83 | private double[] bboxX = generateRandomBBox(); |
||
84 | private double[] bboxY = generateRandomBBox(); |
||
85 | private double[] bboxZ = generateRandomBBox(); |
||
86 | private String feature1Name = "Turia"; |
||
87 | private String feature1Id = "f1"; |
||
88 | private String linearRing1Id = "p1"; |
||
89 | private double[] linearRing1X = generateRandomLinearRing(); |
||
90 | private double[] linearRing1Y = generateRandomLinearRing(); |
||
91 | private double[] linearRing1Z = generateRandomLinearRing(); |
||
92 | private String feature2Name = "Los Angeles"; |
||
93 | private String feature2Id = "f2"; |
||
94 | private String linearRing2Id = "p2"; |
||
95 | private double[] linearRing2X = generateRandomLinearRing(); |
||
96 | private double[] linearRing2Y = generateRandomLinearRing(); |
||
97 | private double[] linearRing2Z = generateRandomLinearRing(); |
||
98 | |||
99 | |||
100 | /*
|
||
101 | * (non-Javadoc)
|
||
102 | * @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects()
|
||
103 | */
|
||
104 | public void readObjects() { |
||
105 | Layer[] layers = getLayers();
|
||
106 | assertEquals(layers.length, 1);
|
||
107 | Layer layer = layers[0];
|
||
108 | |||
109 | assertEquals(layer.getFeatures().size(), 2);
|
||
110 | //FEATURE 1
|
||
111 | Feature feature1 = (Feature)layer.getFeatures().get(0);
|
||
112 | GeometryAsserts.linearRing((LinearRing)feature1.getGeometry(), linearRing1X, linearRing1Y, linearRing1Z); |
||
113 | |||
114 | //FEATURE 2
|
||
115 | Feature feature2 = (Feature)layer.getFeatures().get(1);
|
||
116 | GeometryAsserts.linearRing((LinearRing)feature2.getGeometry(), linearRing2X, linearRing2Y, linearRing2Z); |
||
117 | } |
||
118 | |||
119 | /*
|
||
120 | * (non-Javadoc)
|
||
121 | * @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects()
|
||
122 | */
|
||
123 | public void writeObjects() { |
||
124 | getWriterHandler().initialize(); |
||
125 | getWriterHandler().startLayer(layerId, layerName, layerDescription, srs, null);
|
||
126 | 20219 | jpiera | getWriterHandler().startBbox(bboxId, new CoordinatesIterator(bboxX, bboxY, bboxZ), srs);
|
127 | 18288 | jpiera | getWriterHandler().endBbox(); |
128 | getWriterHandler().startFeature(feature1Id,feature1Name, null);
|
||
129 | 20219 | jpiera | getWriterHandler().startLinearRing(linearRing1Id, new CoordinatesIterator(
|
130 | 18288 | jpiera | linearRing1X, |
131 | linearRing1Y, |
||
132 | 20219 | jpiera | linearRing1Z), |
133 | 18288 | jpiera | srs); |
134 | getWriterHandler().endLinearRing(); |
||
135 | getWriterHandler().endFeature(); |
||
136 | getWriterHandler().startFeature(feature2Id,feature2Name, null);
|
||
137 | 20219 | jpiera | getWriterHandler().startLinearRing(linearRing2Id, new CoordinatesIterator(
|
138 | 18288 | jpiera | linearRing2X, |
139 | linearRing2Y, |
||
140 | 20219 | jpiera | linearRing2Z), |
141 | 18288 | jpiera | srs); |
142 | getWriterHandler().endLinearRing(); |
||
143 | getWriterHandler().endFeature(); |
||
144 | getWriterHandler().endLayer(); |
||
145 | getWriterHandler().close(); |
||
146 | } |
||
147 | } |