svn-gvsig-desktop / trunk / libraries / libGPE / src-test / org / gvsig / gpe / writer / GPEMultiPointLayerTest.java @ 20219
History | View | Annotate | Download (4.47 KB)
1 |
package org.gvsig.gpe.writer; |
---|---|
2 |
|
3 |
import org.gvsig.gpe.containers.CoordinatesIterator; |
4 |
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.MultiPoint; |
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: GPEMultiPointLayerTest.java 144 2007-06-07 14:53:59Z jorpiell $
|
53 |
* $Log$
|
54 |
* Revision 1.7 2007/06/07 14:52:28 jorpiell
|
55 |
* Add the schema support
|
56 |
*
|
57 |
* Revision 1.6 2007/05/16 12:07:25 jorpiell
|
58 |
* A method name changed
|
59 |
*
|
60 |
* Revision 1.5 2007/05/09 10:03:19 jorpiell
|
61 |
* Add the multigeometry tests
|
62 |
*
|
63 |
* Revision 1.4 2007/04/26 14:39:12 jorpiell
|
64 |
* Add some tests
|
65 |
*
|
66 |
* Revision 1.3 2007/04/19 11:50:20 csanchez
|
67 |
* Actualizacion protoripo libGPE
|
68 |
*
|
69 |
* Revision 1.2 2007/04/14 16:06:35 jorpiell
|
70 |
* Add the container classes
|
71 |
*
|
72 |
* Revision 1.1 2007/04/13 13:14:55 jorpiell
|
73 |
* Created the base tests and add some methods to the content handler
|
74 |
*
|
75 |
*
|
76 |
*/
|
77 |
/**
|
78 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
79 |
*/
|
80 |
public abstract class GPEMultiPointLayerTest extends GPEWriterBaseTest{ |
81 |
private String layerId = "l1"; |
82 |
private String srs = "EPSG:23030"; |
83 |
private String feature1Id = "f1"; |
84 |
private String multiPoint1Id = "mp1"; |
85 |
private String point1Id = "p1"; |
86 |
private double point1X = generateRandomPoint(); |
87 |
private double point1Y = generateRandomPoint(); |
88 |
private double point1Z = generateRandomPoint(); |
89 |
private String point2Id = "p2"; |
90 |
private double point2X = generateRandomPoint(); |
91 |
private double point2Y = generateRandomPoint(); |
92 |
private double point2Z = generateRandomPoint(); |
93 |
private String point3Id = "p3"; |
94 |
private double point3X = generateRandomPoint(); |
95 |
private double point3Y = generateRandomPoint(); |
96 |
private double point3Z = generateRandomPoint(); |
97 |
|
98 |
/*
|
99 |
* (non-Javadoc)
|
100 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects()
|
101 |
*/
|
102 |
public void readObjects() { |
103 |
Layer[] layers = getLayers();
|
104 |
assertEquals(layers.length, 1);
|
105 |
Layer layer = layers[0];
|
106 |
|
107 |
assertEquals(layer.getFeatures().size(), 1);
|
108 |
//FEATURE 1
|
109 |
Feature feature1 = (Feature)layer.getFeatures().get(0);
|
110 |
MultiPoint multiPoint = (MultiPoint)feature1.getGeometry(); |
111 |
assertEquals(multiPoint.getGeometries().size(), 3);
|
112 |
GeometryAsserts.point(multiPoint.getMultiPointAt(0), point1X, point1Y, point1Z);
|
113 |
GeometryAsserts.point(multiPoint.getMultiPointAt(1), point2X, point2Y, point2Z);
|
114 |
GeometryAsserts.point(multiPoint.getMultiPointAt(2), point3X, point3Y, point3Z);
|
115 |
} |
116 |
|
117 |
/*
|
118 |
* (non-Javadoc)
|
119 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects()
|
120 |
*/
|
121 |
public void writeObjects() { |
122 |
getWriterHandler().initialize(); |
123 |
getWriterHandler().startLayer(layerId, null , null , srs, null); |
124 |
getWriterHandler().startFeature(feature1Id,null, null); |
125 |
getWriterHandler().startMultiPoint(multiPoint1Id, srs); |
126 |
getWriterHandler().startPoint(point1Id, new CoordinatesIterator(point1X, point1Y, point1Z), srs);
|
127 |
getWriterHandler().endPoint(); |
128 |
getWriterHandler().startPoint(point2Id, new CoordinatesIterator(point2X, point2Y, point2Z), srs);
|
129 |
getWriterHandler().endPoint(); |
130 |
getWriterHandler().startPoint(point3Id, new CoordinatesIterator(point3X, point3Y, point3Z), srs);
|
131 |
getWriterHandler().endPoint(); |
132 |
getWriterHandler().endMultiPoint(); |
133 |
getWriterHandler().endFeature(); |
134 |
getWriterHandler().endLayer(); |
135 |
getWriterHandler().close(); |
136 |
} |
137 |
|
138 |
} |