svn-gvsig-desktop / trunk / libraries / libGPE / src-test / org / gvsig / gpe / writers / GPEFeatureWithIdTest.java @ 11435
History | View | Annotate | Download (3.43 KB)
1 |
package org.gvsig.gpe.writers; |
---|---|
2 |
|
3 |
import org.gvsig.gpe.containers.Feature; |
4 |
import org.gvsig.gpe.containers.Layer; |
5 |
|
6 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
7 |
*
|
8 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
9 |
*
|
10 |
* This program is free software; you can redistribute it and/or
|
11 |
* modify it under the terms of the GNU General Public License
|
12 |
* as published by the Free Software Foundation; either version 2
|
13 |
* of the License, or (at your option) any later version.
|
14 |
*
|
15 |
* This program is distributed in the hope that it will be useful,
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
* GNU General Public License for more details.
|
19 |
*
|
20 |
* You should have received a copy of the GNU General Public License
|
21 |
* along with this program; if not, write to the Free Software
|
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
23 |
*
|
24 |
* For more information, contact:
|
25 |
*
|
26 |
* Generalitat Valenciana
|
27 |
* Conselleria d'Infraestructures i Transport
|
28 |
* Av. Blasco Ib??ez, 50
|
29 |
* 46010 VALENCIA
|
30 |
* SPAIN
|
31 |
*
|
32 |
* +34 963862235
|
33 |
* gvsig@gva.es
|
34 |
* www.gvsig.gva.es
|
35 |
*
|
36 |
* or
|
37 |
*
|
38 |
* IVER T.I. S.A
|
39 |
* Salamanca 50
|
40 |
* 46005 Valencia
|
41 |
* Spain
|
42 |
*
|
43 |
* +34 963163400
|
44 |
* dac@iver.es
|
45 |
*/
|
46 |
/* CVS MESSAGES:
|
47 |
*
|
48 |
* $Id: GPEFeatureWithIdTest.java 11435 2007-05-02 11:46:50Z jorpiell $
|
49 |
* $Log$
|
50 |
* Revision 1.1 2007-05-02 11:46:07 jorpiell
|
51 |
* Writing tests updated
|
52 |
*
|
53 |
*
|
54 |
*/
|
55 |
/**
|
56 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
57 |
*/
|
58 |
public abstract class GPEFeatureWithIdTest extends GPEWriterBaseTest { |
59 |
private String layerId = "l1"; |
60 |
private String layerName = "Points Layer"; |
61 |
private String layerDescription = "This is a test of a points layer"; |
62 |
private String srs = "EPSG:23030"; |
63 |
private String feature1Name = "New York"; |
64 |
private String feature1Id = "f1"; |
65 |
private String point1Id = "p1"; |
66 |
private double point1X = generateRandomPoint(); |
67 |
private double point1Y = generateRandomPoint(); |
68 |
private double point1Z = generateRandomPoint(); |
69 |
private String feature2Name = "Los Angeles"; |
70 |
private String feature2Id = "f2"; |
71 |
private String point2Id = "p2"; |
72 |
private double point2X = generateRandomPoint(); |
73 |
private double point2Y = generateRandomPoint(); |
74 |
private double point2Z = generateRandomPoint(); |
75 |
|
76 |
|
77 |
/*
|
78 |
* (non-Javadoc)
|
79 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects()
|
80 |
*/
|
81 |
public void readObjects() { |
82 |
Layer[] layers = getLayers();
|
83 |
assertEquals(layers.length, 1);
|
84 |
Layer layer = layers[0];
|
85 |
|
86 |
assertEquals(layer.getFeatures().size(), 2);
|
87 |
//FEATURE 1
|
88 |
Feature feature1 = (Feature)layer.getFeatures().get(0);
|
89 |
assertEquals(feature1.getId(), feature1Id); |
90 |
|
91 |
//FEATURE 2
|
92 |
Feature feature2 = (Feature)layer.getFeatures().get(1);
|
93 |
assertEquals(feature2.getId(), feature2Id); |
94 |
} |
95 |
|
96 |
/*
|
97 |
* (non-Javadoc)
|
98 |
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects()
|
99 |
*/
|
100 |
public void writeObjects() { |
101 |
getWriterHandler().initialize(); |
102 |
getWriterHandler().startLayer(layerId, layerName, layerDescription, srs); |
103 |
getWriterHandler().startFeature(feature1Id,feature1Name); |
104 |
getWriterHandler().startPoint(point1Id, point1X, point1Y, point1Z, srs); |
105 |
getWriterHandler().endPoint(); |
106 |
getWriterHandler().endFeature(); |
107 |
getWriterHandler().startFeature(feature2Id,feature2Name); |
108 |
getWriterHandler().startPoint(point2Id, point2X, point2Y, point2Z, srs); |
109 |
getWriterHandler().endPoint(); |
110 |
getWriterHandler().endFeature(); |
111 |
getWriterHandler().endLayer(); |
112 |
getWriterHandler().close(); |
113 |
} |
114 |
} |