Statistics
| Revision:

root / trunk / libraries / libGPE / src-test / org / gvsig / gpe / writers / GPEPointsLayerTest.java @ 11265

History | View | Annotate | Download (4.06 KB)

1
package org.gvsig.gpe.writers;
2

    
3
import org.gvsig.gpe.containers.Element;
4
import org.gvsig.gpe.containers.Feature;
5
import org.gvsig.gpe.containers.Layer;
6

    
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
/* CVS MESSAGES:
48
 *
49
 * $Id: GPEPointsLayerTest.java 11265 2007-04-19 11:56:03Z csanchez $
50
 * $Log$
51
 * Revision 1.4  2007-04-19 11:50:20  csanchez
52
 * Actualizacion protoripo libGPE
53
 *
54
 * Revision 1.3  2007/04/19 07:23:20  jorpiell
55
 * Add the add methods to teh contenhandler and change the register mode
56
 *
57
 * Revision 1.2  2007/04/14 16:06:35  jorpiell
58
 * Add the container classes
59
 *
60
 * Revision 1.1  2007/04/13 07:17:54  jorpiell
61
 * Add the writting tests for the simple geometries
62
 *
63
 *
64
 */
65
/**
66
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
67
 */
68
public abstract class GPEPointsLayerTest extends GPEWriterBaseTest {
69
        private String layerId = "l1";
70
        private String layerName = "Points Layer";
71
        private String layerDescription = "This is a test of a points layer";
72
        private double[] bboxX = generateRandomBBox();
73
        private double[] bboxY = generateRandomBBox();
74
        private double[] bboxZ = generateRandomBBox();
75
        private String feature1Name = "New York";
76
        private String feature1Id = "f1";
77
        private String element1 = "POPULATION";
78
        
79
        /*
80
         * (non-Javadoc)
81
         * @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects()
82
         */
83
        public void readObjects() {
84
                Layer[] layers = getLayers();
85
                assertEquals(layers.length, 1);
86
                
87
                Layer layer = layers[0];
88
                assertEquals(layer.getName(),layerName);
89
                assertEquals(layer.getDescription(),layerDescription);
90
//                assertEquals(layer.getId(),layerId);
91
//                assertEquals(layer.getBbox().getX(),bboxX);
92
//                assertEquals(layer.getBbox().getY(),bboxY);
93
//                assertEquals(layer.getBbox().getZ(),bboxZ);
94
                assertEquals(layer.getFeatures().size(), 2);
95
                Feature feature1 = (Feature)layer.getFeatures().get(0);
96
//                assertEquals(feature1.getId(), feature1Id);
97
                assertEquals(feature1.getName(), feature1Name);
98
                Element element11 = (Element)feature1.getElements().get(0);
99
        }
100

    
101
        /*
102
         * (non-Javadoc)
103
         * @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects()
104
         */
105
        public void writeObjects() {
106
                getWriterHandler().initialize();
107
                getWriterHandler().startLayer(layerId, layerName, layerDescription, "23030");
108
                getWriterHandler().startBbox("bbox", bboxX,
109
                                bboxY,
110
                                bboxZ,
111
                                "23030");
112
                getWriterHandler().endBbox();
113
                getWriterHandler().startFeature(feature1Name,feature1Id);
114
                getWriterHandler().startElement("POPULATION", new Integer("300000"), Integer.class);
115
                getWriterHandler().endElement();
116
                getWriterHandler().startPoint("p1", 2, 2, 2, "EPSG:23030");
117
                getWriterHandler().endPoint();                
118
                getWriterHandler().endFeature();
119
                getWriterHandler().startFeature("Los Angeles","2");
120
                getWriterHandler().startElement("POPULATION", new Integer("400000"), Integer.class);
121
                getWriterHandler().endElement();
122
                getWriterHandler().startPoint("p1", 1, 1, 1, "EPSG:23030");
123
                getWriterHandler().endPoint();                
124
                getWriterHandler().endFeature();
125
                getWriterHandler().endLayer();
126
                getWriterHandler().close();                
127
        }
128

    
129
}