Revision 37363

View differences:

tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/config/text.properties
1
gpe_preferences_window=Gml Persistence Engine
2
gpe_preferences_window_other=Otros
3
gpe_preferences_window_xmlschema=XML Schema
4
gpe_preferences_window_xml=XML
5
gpe_preferences_window_coordinates=Coordenadas
6
gpe_xmlVersion=Versi?n de XML
7
gpe_xmlEncoding=Codificaci?n
8
gpe_defaultBlancSpace=Espacio en blanco para la etiquetas
9
gpe_namespacePrefix=Prefijo del Namespace
10
gpe_namespaceURI=Namespace
11
gpe_schemaName=Nombre del esquema por defecto
12
gpe_coordinates=S?mbolo decimal
13
gpe_coordinatesSeparator=Separador entre coordenadas
14
gpe_tuplesSeparator=Separador entre pares de coordenadas
15
gpe_decimalDigits=N?mero de decimales
16
gpe_exporting=Exportando capa
17
gpe_select_version=Selecciona la versi?n 
18
gpe_select_format=Selecciona el formato
19
gpe_select_writer=Selecciona el writer
20
gpe_select_schema=Selecciona el XML schema
21
gpe_create_default_schema=Crear un esquema por defecto
22
gpe_select_file=Seleciona el fichero
23
gpe_select_writer_window=Exportar a fichero
24
gpe_gvsig_dont_support_multilayer=La actual versi?n de gvSIG no soporta multicapa.\ Todas las geometr\u00edas se cargar\u00e1n en la misma capa. 
0 25

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/config/about.htm
1
<html>
2
  <head>
3
    <title>libGPE Extension.</title>
4
    <meta content="">
5
    <style></style>
6
  </head>
7
  <body>
8
<table width="60%" border="0">
9
  <tr>
10
     <td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td>
11
    <td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td>
12
  </tr>
13
  <tr>
14
    <td colspan="2"><font face="Arial, Helvetica, sans-serif">&copy; Copyright
15
      Generalitat Valenciana, IVER T.I. 2008.</font></td>
16
  </tr>
17
</table>
18
  <h3>libGPE Extension.</h3>
19
  <p><br><br><b> Build Number: #build.number#</b></p>
20
  </body>
21
</html>
0 22

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/config/text_en.properties
1
gpe_preferences_window=Gml Persistence Engine
2
gpe_preferences_window_other=Others
3
gpe_preferences_window_xmlschema=XML Schema
4
gpe_preferences_window_xml=XML
5
gpe_preferences_window_coordinates=Coordinates
6
gpe_xmlVersion=XML version
7
gpe_xmlEncoding=XML Encoding
8
gpe_defaultBlancSpace=Blank space for the label names
9
gpe_namespacePrefix=Namespace prefix
10
gpe_namespaceURI=Namespace
11
gpe_schemaName=Default namespace
12
gpe_coordinates=Decimal symbol
13
gpe_coordinatesSeparator=Separator between coordinates
14
gpe_tuplesSeparator=Separator between a pair of coordinates
15
gpe_decimalDigits=Decimal number
16
gpe_exporting=Exporting a layer
17
gpe_select_version=Select the version 
18
gpe_select_format=Select the format
19
gpe_select_writer=Select a writer
20
gpe_select_schema=Select a schema
21
gpe_create_default_schema=Create a default schema
22
gpe_select_file=Select the file
23
gpe_select_writer_window=Export to file
24
gpe_gvsig_dont_support_multilayer=Current gvSIG version doesnt support multilayer.\All the geometries have been loaded on the same layer.
0 25

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
	<libraries library-dir="lib"/>
5
	<resourceBundle name="text"/>
6
	<extensions>		
7
		<extension class-name="org.gvsig.gpe.GPELibraryExtension"
8
			description=""
9
			active="true"
10
			priority="1">			
11
		</extension>
12
		<!-- 	
13
		<extension class-name="org.gvsig.gpe.GPEWriterExtension"
14
			description="Support for writing"
15
			active="true">
16
			<menu text="Capa/export_to/GML" action-command="GML"/>
17
			<menu text="Capa/export_to/KML" action-command="KML"/>
18
		</extension>
19
		<extension class-name="org.gvsig.gpe.AboutGPEExtension"
20
                description="Extension to add about panel."
21
                active="true"
22
                priority="1">
23
		</extension>
24
		-->    			
25
	</extensions>
26
</plugin-config>
0 27

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPEStoreParameters.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program 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
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31

  
32
import org.cresques.cts.IProjection;
33

  
34
import org.gvsig.fmap.dal.DataStoreParameters;
35
import org.gvsig.fmap.dal.FileHelper;
36
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
37
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
38
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
39
import org.gvsig.fmap.geom.primitive.Envelope;
40
import org.gvsig.tools.dynobject.DelegatedDynObject;
41
import org.gvsig.tools.dynobject.DynStruct;
42

  
43
/**
44
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
45
 */
46
public class GPEStoreParameters extends AbstractDataParameters implements
47
DataStoreParameters, FilesystemStoreParameters {
48

  
49
    public static final String PARAMETERS_DEFINITION_NAME = "GPEStoreParameters";
50

  
51
    private static final String FILE_PARAMETER_NAME = "File";
52
    private static final String CRS_PARAMETER_NAME = "CRS";
53
    private static final String ENVELOPE_PARAMETER_NAME = "Envelope";
54

  
55
    private DelegatedDynObject parameters;
56

  
57
    public GPEStoreParameters() {
58
        this(PARAMETERS_DEFINITION_NAME);
59
    }
60

  
61
    protected GPEStoreParameters(String parametersDefinitionName) {
62
        this(parametersDefinitionName, GPEStoreProvider.NAME);
63
    }
64

  
65
    public GPEStoreParameters(String parametersDefinitionName, String name) {
66
        super();
67
        this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
68
        this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);       
69
    }
70

  
71
    protected static void registerParametersDefinition(){ 
72
        DynStruct dynStruct = FileHelper.registerParametersDefinition(
73
            GPEStoreParameters.PARAMETERS_DEFINITION_NAME,
74
            GPEStoreParameters.class, "GPEParameters.xml");
75
        dynStruct.addDynFieldObject("Envelope").setClassOfValue(Envelope.class).setMandatory(false);
76
    }
77

  
78
    protected DelegatedDynObject getDelegatedDynObject() {
79
        return parameters;
80
    }
81

  
82
    public String getDataStoreName() {
83
        return GPEStoreProvider.NAME;
84
    }
85

  
86
    public String getDescription() {
87
        return GPEStoreProvider.DESCRIPTION;
88
    }
89

  
90
    public boolean isValid() {
91
        return (this.getFile() != null);
92
    }
93

  
94
    public File getFile() {
95
        return (File) this.getDynValue(FILE_PARAMETER_NAME);
96
    }
97

  
98
    public void setFile(File file) {
99
        this.setDynValue(FILE_PARAMETER_NAME, file);
100
    }	
101

  
102
    public String getFileName() {
103
        return this.getFile().getAbsolutePath();
104
    }
105

  
106
    public void setFileName(String fileName) {
107
        this.setDynValue(FILE_PARAMETER_NAME, fileName);
108
    }
109

  
110
    public IProjection getCRS() {
111
        return (IProjection) this.getDynValue(CRS_PARAMETER_NAME);
112
    }
113

  
114
    public void setCRS(IProjection srs) {
115
        this.setDynValue(CRS_PARAMETER_NAME, srs);
116
    }
117

  
118
    public void setCRS(String srs) {
119
        this.setDynValue(CRS_PARAMETER_NAME, srs);
120
    }
121

  
122
    public Envelope getEnvelope() {
123
        return (Envelope) this.getDynValue(ENVELOPE_PARAMETER_NAME);
124
    }
125

  
126
    public void setEnvelope(Envelope envelope) {
127
        this.setDynValue(ENVELOPE_PARAMETER_NAME, envelope);
128
    }
129
}
0 130

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/handlers/FmapErrorHandler.java
1
package org.gvsig.fmap.dal.store.gpe.handlers;
2

  
3
import org.gvsig.gpe.lib.impl.parser.GPEErrorHandler;
4

  
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
/* CVS MESSAGES:
46
 *
47
 * $Id$
48
 * $Log$
49
 *
50
 */
51
/**
52
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
53
 */
54
public class FmapErrorHandler extends GPEErrorHandler{
55

  
56
}
0 57

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/handlers/FmapContentHandler.java
1
package org.gvsig.fmap.dal.store.gpe.handlers;
2

  
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.ArrayList;
6
import java.util.HashMap;
7
import java.util.Iterator;
8
import java.util.List;
9
import java.util.Map;
10

  
11
import org.cresques.cts.IProjection;
12
import org.jfree.util.Log;
13
import org.slf4j.Logger;
14
import org.slf4j.LoggerFactory;
15

  
16
import org.gvsig.fmap.dal.DataTypes;
17
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
18
import org.gvsig.fmap.dal.feature.EditableFeatureType;
19
import org.gvsig.fmap.dal.feature.Feature;
20
import org.gvsig.fmap.dal.feature.FeatureType;
21
import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
22
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
23
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
24
import org.gvsig.fmap.dal.store.gpe.GPEStoreProvider;
25
import org.gvsig.fmap.dal.store.gpe.model.GPEElement;
26
import org.gvsig.fmap.dal.store.gpe.model.GPEFeature;
27
import org.gvsig.fmap.geom.Geometry;
28
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
29
import org.gvsig.fmap.geom.Geometry.TYPES;
30
import org.gvsig.fmap.geom.GeometryLocator;
31
import org.gvsig.fmap.geom.GeometryManager;
32
import org.gvsig.fmap.geom.aggregate.MultiCurve;
33
import org.gvsig.fmap.geom.aggregate.MultiPoint;
34
import org.gvsig.fmap.geom.aggregate.MultiPrimitive;
35
import org.gvsig.fmap.geom.aggregate.MultiSurface;
36
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
37
import org.gvsig.fmap.geom.exception.CreateGeometryException;
38
import org.gvsig.fmap.geom.primitive.Curve;
39
import org.gvsig.fmap.geom.primitive.Envelope;
40
import org.gvsig.fmap.geom.primitive.GeneralPathX;
41
import org.gvsig.fmap.geom.primitive.Point;
42
import org.gvsig.fmap.geom.primitive.Primitive;
43
import org.gvsig.fmap.geom.primitive.Surface;
44
import org.gvsig.gpe.lib.api.parser.IAttributesIterator;
45
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator;
46
import org.gvsig.gpe.lib.api.parser.IGPEErrorHandler;
47
import org.gvsig.gpe.lib.impl.parser.GPEContentHandler;
48
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
49
 *
50
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
51
 *
52
 * This program is free software; you can redistribute it and/or
53
 * modify it under the terms of the GNU General Public License
54
 * as published by the Free Software Foundation; either version 2
55
 * of the License, or (at your option) any later version.
56
 *
57
 * This program is distributed in the hope that it will be useful,
58
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
59
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
60
 * GNU General Public License for more details.
61
 *
62
 * You should have received a copy of the GNU General Public License
63
 * along with this program; if not, write to the Free Software
64
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
65
 *
66
 * For more information, contact:
67
 *
68
 *  Generalitat Valenciana
69
 *   Conselleria d'Infraestructures i Transport
70
 *   Av. Blasco Ib??ez, 50
71
 *   46010 VALENCIA
72
 *   SPAIN
73
 *
74
 *      +34 963862235
75
 *   gvsig@gva.es
76
 *      www.gvsig.gva.es
77
 *
78
 *    or
79
 *
80
 *   IVER T.I. S.A
81
 *   Salamanca 50
82
 *   46005 Valencia
83
 *   Spain
84
 *
85
 *   +34 963163400
86
 *   dac@iver.es
87
 */
88
/* CVS MESSAGES:
89
 *
90
 * $Id$
91
 * $Log$
92
 *
93
 */
94
/**
95
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
96
 */
97
public class FmapContentHandler extends GPEContentHandler {
98
    private static final Logger LOG = LoggerFactory.getLogger(FmapContentHandler.class);
99

  
100
    private HashMap featureSet = null;
101
    private EditableFeatureType featureType = null;
102
    private FeatureStoreProviderServices store = null;
103
    private GPEStoreProvider storeProvider = null;
104
    private GeometryManager geomManager = GeometryLocator.getGeometryManager();
105
    private int featureId = 0;
106
    private Envelope envelope = null;
107
    private File file = null;
108
    private IProjection srs = null;
109
    private int geometryType = 0;
110

  
111
    public FmapContentHandler(IGPEErrorHandler errorHandler, FeatureStoreProviderServices store,
112
        GPEStoreProvider storeProvider, File file, IProjection srs, int geometryType) {
113
        super();
114
        setErrorHandler(errorHandler);
115
        this.store = store;
116
        this.storeProvider = storeProvider;
117
        this.file = file;
118
        this.srs = srs;
119
        this.geometryType = geometryType;
120
    }
121

  
122
    public int getFeaturesCount(){
123
        return featureSet.size();
124
    }
125

  
126
    public Feature getFeatureAt(int index){
127
        return (Feature)featureSet.get(new Integer(index));
128
    }
129

  
130
    public EditableFeatureType getFeatureType(){
131
        return featureType;
132
    }
133

  
134

  
135
    /**
136
     * @return the featureSet
137
     */
138
    public HashMap getFeatureSet() {
139
        return featureSet;
140
    }
141

  
142
    /*
143
     * (non-Javadoc)
144
     * @see org.gvsig.gpe.parser.GPEContentHandler#startLayer(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.gvsig.gpe.parser.IAttributesIterator, java.lang.Object, java.lang.Object)
145
     */
146
    public Object startLayer(String id, String namespace, String name,
147
        String description, String srs, IAttributesIterator iterator, Object parentLayer, Object box) {
148
        if (featureSet == null){
149
            featureSet = new HashMap();
150
        }
151
        if (envelope == null){
152
            try {
153
                envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D);
154
            } catch (CreateEnvelopeException e) {
155
                Log.error("Error creating the envelope", e);
156
            }
157
        }
158
        return featureSet;
159
    }
160

  
161
    /*
162
     * (non-Javadoc)
163
     * @see org.gvsig.gpe.IGPEContentHandler#endLayer(java.lang.Object)
164
     */
165
    public void endLayer(Object layer) {
166
        if (featureType == null){
167
            createFeatureType(null);
168
        }
169
        storeProvider.setEnvelope(envelope);
170
    }
171

  
172
    /*
173
     * (non-Javadoc)
174
     * @see org.gvsig.gpe.parser.GPEContentHandler#startPoint(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String)
175
     */
176
    public Object startPoint(String id, ICoordinateIterator coords, String srs) {
177
        return createPoint(coords);
178
    }
179

  
180
    private Point createPoint(ICoordinateIterator coords){
181
        double[] buffer = new double[coords.getDimension()];
182
        try {
183
            coords.hasNext();
184
            coords.next(buffer);
185
            Point point = null;
186
            if (coords.getDimension() == 2){
187
                point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
188
            }else if (coords.getDimension() == 3){
189
                point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
190
            }
191
            for (int i=0 ; i<buffer.length ; i++){
192
                point.setCoordinateAt(i, buffer[i]);
193
            }
194
            return point;
195
        } catch (IOException e) {
196
            getErrorHandler().addError(e);
197
        } catch (CreateGeometryException e) {
198
            getErrorHandler().addError(e);
199
        }
200
        return null;
201
    }
202

  
203
    private Point createPoint(double[] buffer){
204
        try {
205
            Point point = null;
206
            if (buffer.length == 2){
207
                point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
208
            }else if (buffer.length == 3){
209
                point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
210
            }
211
            for (int i=0 ; i<buffer.length ; i++){
212
                point.setCoordinateAt(i, buffer[i]);
213
            }
214
            return point;
215
        }catch (CreateGeometryException e) {
216
            getErrorHandler().addError(e);
217
        }
218
        return null;
219
    }
220

  
221

  
222
    /* (non-Javadoc)
223
     * @see org.gvsig.gpe.parser.GPEContentHandler#startLineString(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String)
224
     */
225
    public Object startLineString(String id, ICoordinateIterator coords,
226
        String srs) {
227
        return createCurve(coords);
228
    }
229

  
230
    private Curve createCurve(ICoordinateIterator coords){
231
        GeneralPathX gp = createGeneralPathX(coords);
232
        try {
233
            Curve curve = null;
234
            if (coords.getDimension() == 2){
235
                curve = (Curve) geomManager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
236
            }else if (coords.getDimension() == 3){
237
                curve = (Curve) geomManager.create(TYPES.CURVE, SUBTYPES.GEOM3D);
238
            }
239
            curve.setGeneralPath(gp);
240
            return curve;
241
        } catch (CreateGeometryException e) {
242
            getErrorHandler().addError(e);
243
        }
244
        return null;
245
    }
246

  
247
    private GeneralPathX createGeneralPathX(ICoordinateIterator coords){
248
        GeneralPathX gp = new GeneralPathX();
249
        if (coords == null){
250
            return gp;
251
        }
252
        double[] buffer = new double[coords.getDimension()];
253
        try {
254
            if (coords.hasNext()){
255
                coords.next(buffer);
256
                gp.moveTo(buffer[0], buffer[1]);
257
            }
258
            while(coords.hasNext()){
259
                coords.next(buffer);
260
                gp.lineTo(buffer[0], buffer[1]);
261
            }
262
        } catch (IOException e) {
263
            getErrorHandler().addError(e);
264
        }
265
        return gp;
266
    }
267

  
268
    /* (non-Javadoc)
269
     * @see org.gvsig.gpe.parser.GPEContentHandler#startPolygon(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String)
270
     */
271

  
272
    public Object startPolygon(String id, ICoordinateIterator coords, String srs) {
273
        return createSurface(coords);
274
    }
275

  
276
    private Surface createSurface(ICoordinateIterator coords){
277
        GeneralPathX gp = createGeneralPathX(coords);
278
        try {
279
            Surface surface = null;
280
            if (coords.getDimension() == 2){
281
                surface = (Surface) geomManager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);
282
            }else if (coords.getDimension() == 3){
283
                surface = (Surface) geomManager.create(TYPES.SURFACE, SUBTYPES.GEOM3D);
284
            }
285
            surface.setGeneralPath(gp);
286
            return surface;
287
        } catch (CreateGeometryException e) {
288
            getErrorHandler().addError(e);
289
        }
290
        return null;
291
    }
292

  
293

  
294
    /* (non-Javadoc)
295
     * @see org.gvsig.gpe.parser.GPEContentHandler#startInnerPolygon(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String)
296
     */
297
    public Object startInnerPolygon(String id, ICoordinateIterator coords,
298
        String srs) {
299
        return createSurface(coords);
300
    }
301

  
302
    /*
303
     * (non-Javadoc)
304
     * @see org.gvsig.gpe.IGPEContentHandler#addGeometryToFeature(java.lang.Object, java.lang.Object)
305
     */
306
    public void addGeometryToFeature(Object geometry, Object feature) {
307
        ((GPEFeature)feature).setGeometry((Geometry)geometry);
308
    }
309

  
310
    /*
311
     * (non-Javadoc)
312
     * @see org.gvsig.gpe.IGPEContentHandler#addBboxToLayer(java.lang.Object, java.lang.Object)
313
     */
314
    public void addBboxToLayer(Object bbox, Object layer) {
315
        //		if (layer != null){
316
        //		GPEBBox gpeBBox = (GPEBBox)bbox;
317
        //		if (gpeBBox.getSrs() != null){
318
        //		IProjection projection = null;
319
        //		try{
320
        //		CRSFactory.getCRS(gpeBBox.getSrs());
321
        //		}catch(Exception e){
322
        //		//If the CRS factory has an error.
323
        //		}
324
        //		if ((projection != null) && (!(projection.equals(((FLayer)layer).getProjection())))){
325
        //		//TODO reproyectar la bbox y asignarsela a la capa
326
        //		}
327
        //		}
328
        //		((IGPEDriver)layer).setExtent(gpeBBox.getBbox2D());
329
        //		}
330
    }
331

  
332
    /*
333
     * (non-Javadoc)
334
     * @see org.gvsig.gpe.IGPEContentHandler#addElementToFeature(java.lang.Object, java.lang.Object)
335
     */
336
    public void addElementToFeature(Object element, Object feature) {
337
        GPEElement gpeElement = (GPEElement)element;
338
        ((GPEFeature)feature).addElement(gpeElement);
339
    }
340

  
341
    /*
342
     * (non-Javadoc)
343
     * @see org.gvsig.gpe.IGPEContentHandler#addFeatureToLayer(java.lang.Object, java.lang.Object)
344
     */
345
    public void addFeatureToLayer(Object feature, Object layer) {
346
        GPEFeature gpefeature = (GPEFeature)feature;
347
        Envelope currentEnvelope = gpefeature.getEnvelope();
348
        if (featureType == null){
349
            createFeatureType(gpefeature);
350

  
351
            //Initialize the envelope
352
            try {
353
                envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D);
354
            } catch (CreateEnvelopeException e) {
355
                getErrorHandler().addError(e);
356
            }
357
            //Calculates the envelope
358
            envelope = currentEnvelope;
359
        }else{
360
            //Calculates the envelope
361
            if (currentEnvelope != null){
362
                envelope.add(currentEnvelope);
363
            }
364
        }
365
        //If it is null is a multilayer: not supported yet
366
        if (layer != null){
367
            FeatureProvider data = new DefaultFeatureProvider(featureType.getNotEditableCopy(), storeProvider.createNewOID());
368
            Map elements = gpefeature.getelements();
369
            Iterator keys = elements.keySet().iterator();
370
            String gid = gpefeature.getId();              
371
            data.setOID(gid);              
372
            while (keys.hasNext()){
373
                String elementName = (String)keys.next();
374
                data.set(elementName, ((GPEElement)elements.get(elementName)).getValue());
375
            }
376
            data.setDefaultGeometry(gpefeature.getGeometry());
377
            data.set(featureType.getDefaultGeometryAttributeIndex(), gpefeature.getGeometry());
378
            ((HashMap)layer).put(gid, data);
379
        }
380
    }
381

  
382
    private void createFeatureType(GPEFeature gpefeature){
383
        featureType = store.createFeatureType();
384
        
385
        //Adding the Geometry field
386
        EditableFeatureAttributeDescriptor attributeDescriptor = featureType.add("the_geom", DataTypes.GEOMETRY).setGeometryType(geometryType);
387
        attributeDescriptor.setGeometrySubType(SUBTYPES.GEOM2D);
388
        attributeDescriptor.setSRS(srs);
389
        featureType.setDefaultGeometryAttributeName("the_geom");
390
        
391
        //Adding the ID
392
        featureType.add("gid", DataTypes.LONG);
393
        featureType.setHasOID(true);
394

  
395
        if (gpefeature != null){
396
            Map elements = gpefeature.getelements();
397
            Iterator keys = elements.keySet().iterator();
398
            while (keys.hasNext()){
399
                String elementName = (String)keys.next();
400
                if (!elementName.equals("the_geom")){
401
                    featureType.add(elementName, DataTypes.STRING);
402
                }
403
            }
404
        }
405

  
406
        FeatureType defaultType = featureType.getNotEditableCopy();
407
        List types = new ArrayList(1);
408
        types.add(defaultType);
409
        this.store.setFeatureTypes(types, defaultType);
410
    }
411

  
412
    /*
413
     * (non-Javadoc)
414
     * @see org.gvsig.gpe.IGPEContentHandler#addInnerPolygonToPolygon(java.lang.Object, java.lang.Object)
415
     */
416
    public void addInnerPolygonToPolygon(Object innerPolygon, Object Polygon) {
417
        //((Geometry)Polygon).addGeometry((GPEGeometry)innerPolygon);
418
    }
419

  
420
    /*
421
     * (non-Javadoc)
422
     * @see org.gvsig.gpe.IGPEContentHandler#addNameToFeature(java.lang.String, java.lang.Object)
423
     */
424
    public void addNameToFeature(String name, Object feature) {
425

  
426
    }
427

  
428
    /*
429
     * (non-Javadoc)
430
     * @see org.gvsig.gpe.IGPEContentHandler#addParentElementToElement(java.lang.Object, java.lang.Object)
431
     */
432
    public void addParentElementToElement(Object parent, Object element) {
433

  
434
    }
435

  
436
    /*
437
     * (non-Javadoc)
438
     * @see org.gvsig.gpe.IGPEContentHandler#addSrsToLayer(java.lang.String, java.lang.Object)
439
     */
440
    public void addSrsToLayer(String srs, Object Layer) {
441
        //		this.srs = srs;
442
    }
443

  
444

  
445
    /* (non-Javadoc)
446
     * @see org.gvsig.gpe.parser.GPEContentHandler#startBbox(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String)
447
     */
448
    public Object startBbox(String id, ICoordinateIterator coords, String srs) {
449
        Envelope envelope = null;
450
        try {
451
            if (coords.getDimension() == 2){
452
                envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D);
453
            }else if (coords.getDimension() == 3){
454
                envelope = geomManager.createEnvelope(SUBTYPES.GEOM3D);
455
            }
456
            double[] buffer = new double[coords.getDimension()];
457

  
458
            if (coords.hasNext()){
459
                coords.next(buffer);
460
                envelope.setLowerCorner(createPoint(buffer));
461
            }
462
            if (coords.hasNext()){
463
                coords.next(buffer);
464
                envelope.setUpperCorner(createPoint(buffer));
465
            }
466
        } catch (IOException e) {
467
            getErrorHandler().addError(e);
468
        } catch (CreateEnvelopeException e) {
469
            getErrorHandler().addError(e);
470
        }
471
        return envelope;
472
    }
473

  
474
    /*
475
     * (non-Javadoc)
476
     * @see org.gvsig.gpe.parser.GPEContentHandler#startElement(java.lang.String, java.lang.String, java.lang.Object, org.gvsig.gpe.parser.IAttributesIterator, java.lang.Object)
477
     */
478
    public Object startElement(String namespace, String name, Object value,
479
        IAttributesIterator attributesIterator,	Object parentElement) {
480
        return new GPEElement(name, value, (GPEElement)parentElement);
481
    }
482

  
483
    /*
484
     * (non-Javadoc)
485
     * @see org.gvsig.gpe.parser.GPEContentHandler#startFeature(java.lang.String, java.lang.String, java.lang.String, org.gvsig.gpe.parser.IAttributesIterator, java.lang.Object)
486
     */
487
    public Object startFeature(String id, String namespace, String name,
488
        IAttributesIterator attributes, Object layer){
489
        String sId;
490
        if (id == null){
491
            sId = new String(new Long(featureId).toString());			
492
        }else{
493
            sId = id;
494
        }
495
        featureId++;
496
        //Check the xml schema...
497
        //		for (int i=0 ; i<schemas.size() ; i++){
498
        //			IXSSchema schema = schemas.get(i);
499
        //			IXSElementDeclaration element = schema.getElementDeclarationByName(namespace, name);
500
        //			if (element != null){
501
        //				featureType = store.createFeatureType();
502
        //				IXSTypeDefinition type = element.getTypeDefinition();
503
        //				if (type instanceof IXSComplexTypeDefinition){
504
        //					IXSComplexTypeDefinition complexType = (IXSComplexTypeDefinition)type;
505
        //					complexType.getContentType().
506
        //				}
507
        //
508
        //				featureType.add("the_geom", DataTypes.GEOMETRY).setGeometryType(TYPES.GEOMETRY);
509
        //				featureType.setDefaultGeometryAttributeName("the_geom");
510
        //				featureType.setHasOID(true);
511
        //				while (keys.hasNext()){
512
        //					String elementName = (String)keys.next();
513
        //					featureType.add(elementName, DataTypes.STRING);
514
        //				}
515
        //				FeatureType defaultType = featureType.getNotEditableCopy();
516
        //				List types = new ArrayList(1);
517
        //				types.add(defaultType);
518
        //				this.store.setFeatureTypes(types, defaultType);
519
        //
520
        //				//Initialize the envelope
521
        //				try {
522
        //					envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D);
523
        //				} catch (CreateEnvelopeException e) {
524
        //					getErrorHandler().addError(e);
525
        //				}
526
        //			}
527
        //		}
528
        return new GPEFeature(sId,
529
            name, name);
530
    }
531

  
532
    /* (non-Javadoc)
533
     * @see org.gvsig.gpe.parser.GPEContentHandler#startLinearRing(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String)
534
     */
535
    public Object startLinearRing(String id, ICoordinateIterator coords,
536
        String srs) {
537
        return createSurface(coords);
538
    }
539

  
540
    /*
541
     * (non-Javadoc)
542
     * @see org.gvsig.gpe.IGPEContentHandler#startMultiPoint(java.lang.String, java.lang.String)
543
     */
544
    public Object startMultiPoint(String id, String srs) {
545
        try {
546
            return geomManager.create(TYPES.MULTIPOINT, SUBTYPES.GEOM2D);
547
        } catch (CreateGeometryException e) {
548
            getErrorHandler().addError(e);
549
        }
550
        return null;
551
    }
552

  
553
    /*
554
     * (non-Javadoc)
555
     * @see org.gvsig.gpe.IGPEContentHandler#addPointToMultiPoint(java.lang.Object, java.lang.Object)
556
     */
557
    public void addPointToMultiPoint(Object point, Object multiPoint) {
558
        ((MultiPoint)multiPoint).addPoint((Point)point);
559
    }
560

  
561
    /*
562
     * (non-Javadoc)
563
     * @see org.gvsig.gpe.IGPEContentHandler#startMultiLineString(java.lang.String, java.lang.String)
564
     */
565
    public Object startMultiLineString(String id, String srs) {
566
        super.startMultiLineString(id, srs);
567
        try {
568
            return geomManager.create(TYPES.MULTICURVE, SUBTYPES.GEOM2D);
569
        } catch (CreateGeometryException e) {
570
            getErrorHandler().addError(e);
571
        }
572
        return null;
573
    }
574

  
575
    /*
576
     * (non-Javadoc)
577
     * @see org.gvsig.gpe.IGPEContentHandler#addLineStringToMultiLineString(java.lang.Object, java.lang.Object)
578
     */
579
    public void addLineStringToMultiLineString(Object lineString, Object multiLineString) {
580
        ((MultiCurve)multiLineString).addCurve((Curve)lineString);
581
    }
582

  
583
    /*
584
     * (non-Javadoc)
585
     * @see org.gvsig.gpe.IGPEContentHandler#startMultiPolygon(java.lang.String, java.lang.String)
586
     */
587
    public Object startMultiPolygon(String id, String srs) {
588
        super.startMultiPolygon(id, srs);
589
        try {
590
            return geomManager.create(TYPES.MULTISURFACE, SUBTYPES.GEOM2D);
591
        } catch (CreateGeometryException e) {
592
            getErrorHandler().addError(e);
593
        }
594
        return null;
595
    }
596

  
597
    /*
598
     * (non-Javadoc)
599
     * @see org.gvsig.gpe.IGPEContentHandler#addPolygonToMultiPolygon(java.lang.Object, java.lang.Object)
600
     */
601
    public void addPolygonToMultiPolygon(Object polygon, Object multiPolygon) {
602
        ((MultiSurface)multiPolygon).addSurface((Surface)polygon);
603
    }
604

  
605
    /* (non-Javadoc)
606
     * @see org.gvsig.gpe.GPEContentHandler#addCurveToMultiCurve(java.lang.Object, java.lang.Object)
607
     */
608
    public void addCurveToMultiCurve(Object curve, Object multiCurve) {
609
        ((MultiCurve)multiCurve).addCurve((Curve)curve);
610
    }
611

  
612
    /* (non-Javadoc)
613
     * @see org.gvsig.gpe.GPEContentHandler#addSegmentToCurve(java.lang.Object, java.lang.Object)
614
     */
615
    public void addSegmentToCurve(Object segment, Object curve) {
616
        ((Curve)curve).addVertex((Point)segment);
617
    }
618

  
619
    /* (non-Javadoc)
620
     * @see org.gvsig.gpe.parser.GPEContentHandler#startCurve(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String)
621
     */
622
    public Object startCurve(String id, ICoordinateIterator coords, String srs) {
623
        return createCurve(coords);
624
    }
625

  
626
    /* (non-Javadoc)
627
     * @see org.gvsig.gpe.GPEContentHandler#startCurve(java.lang.String, java.lang.String)
628
     */
629
    public Object startCurve(String id, String srs) {
630
        return createCurve(null);
631
    }
632

  
633
    /* (non-Javadoc)
634
     * @see org.gvsig.gpe.GPEContentHandler#startMultiCurve(java.lang.String, java.lang.String)
635
     */
636
    public Object startMultiCurve(String id, String srs) {
637
        try {
638
            return geomManager.create(TYPES.MULTICURVE, SUBTYPES.GEOM2D);
639
        } catch (CreateGeometryException e) {
640
            getErrorHandler().addError(e);
641
        }
642
        return null;
643
    }
644

  
645
    /* (non-Javadoc)
646
     * @see org.gvsig.gpe.GPEContentHandler#addGeometryToMultiGeometry(java.lang.Object, java.lang.Object)
647
     */
648
    public void addGeometryToMultiGeometry(Object geometry, Object multiGeometry) {
649
        ((MultiPrimitive)multiGeometry).addPrimitive((Primitive)geometry);
650
    }
651

  
652
    /* (non-Javadoc)
653
     * @see org.gvsig.gpe.GPEContentHandler#startMultiGeometry(java.lang.String, java.lang.String)
654
     */
655
    public Object startMultiGeometry(String id, String srs) {
656
        try {
657
            return geomManager.create(TYPES.AGGREGATE, SUBTYPES.GEOM2D);
658
        } catch (CreateGeometryException e) {
659
            getErrorHandler().addError(e);
660
        }
661
        return null;
662
    }
663

  
664
    /**
665
     * @return a new OID
666
     */
667
    public Object createNewOID() {
668
        featureId++;
669
        return String.valueOf(featureId);
670
    }	
671

  
672
    /**
673
     * @param envelope the envelope to set
674
     */
675
    public void setEnvelope(Envelope envelope) {
676
        this.envelope = envelope;
677
    }
678

  
679
    /**
680
     * @param featureType the featureType to set
681
     */
682
    public void setFeatureType(EditableFeatureType featureType) {
683
        this.featureType = featureType;
684
    }
685
}
0 686

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/handlers/FmapContentHandlerCreationException.java
1
package org.gvsig.fmap.dal.store.gpe.handlers;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.tools.exception.BaseException;
7

  
8
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
9
 *
10
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
11
 *
12
 * This program is free software; you can redistribute it and/or
13
 * modify it under the terms of the GNU General Public License
14
 * as published by the Free Software Foundation; either version 2
15
 * of the License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
25
 *
26
 * For more information, contact:
27
 *
28
 *  Generalitat Valenciana
29
 *   Conselleria d'Infraestructures i Transport
30
 *   Av. Blasco Ib??ez, 50
31
 *   46010 VALENCIA
32
 *   SPAIN
33
 *
34
 *      +34 963862235
35
 *   gvsig@gva.es
36
 *      www.gvsig.gva.es
37
 *
38
 *    or
39
 *
40
 *   IVER T.I. S.A
41
 *   Salamanca 50
42
 *   46005 Valencia
43
 *   Spain
44
 *
45
 *   +34 963163400
46
 *   dac@iver.es
47
 */
48
/* CVS MESSAGES:
49
 *
50
 * $Id$
51
 * $Log$
52
 *
53
 */
54
/**
55
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
56
 */
57
public class FmapContentHandlerCreationException extends BaseException{
58
	private static final long serialVersionUID = -6021604626521668293L;
59
	
60
	public FmapContentHandlerCreationException(){
61
		initialize();
62
	}
63
	
64
	public FmapContentHandlerCreationException(Throwable e){
65
		initialize();
66
		initCause(e);
67
	}
68
	
69
	protected Map values() {
70
		return new HashMap();
71
	}
72
	
73
	/**
74
	 * Initialize the properties
75
	 */
76
	private void initialize() {
77
		messageKey = "gpe_lgvsig_contentHandler_error";
78
		formatString = "Error creating the contentHandler for" +
79
				"Fmap";
80
		code = serialVersionUID;
81
	}
82

  
83
}
0 84

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/model/GPEFeature.java
1
package org.gvsig.fmap.dal.store.gpe.model;
2

  
3
import java.util.LinkedHashMap;
4

  
5
import org.slf4j.Logger;
6
import org.slf4j.LoggerFactory;
7

  
8
import org.gvsig.fmap.geom.Geometry;
9
import org.gvsig.fmap.geom.GeometryLocator;
10
import org.gvsig.fmap.geom.GeometryManager;
11
import org.gvsig.fmap.geom.exception.CreateGeometryException;
12
import org.gvsig.fmap.geom.primitive.Envelope;
13

  
14
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
15
 *
16
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
17
 *
18
 * This program is free software; you can redistribute it and/or
19
 * modify it under the terms of the GNU General Public License
20
 * as published by the Free Software Foundation; either version 2
21
 * of the License, or (at your option) any later version.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 * GNU General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU General Public License
29
 * along with this program; if not, write to the Free Software
30
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
31
 *
32
 * For more information, contact:
33
 *
34
 *  Generalitat Valenciana
35
 *   Conselleria d'Infraestructures i Transport
36
 *   Av. Blasco Ib??ez, 50
37
 *   46010 VALENCIA
38
 *   SPAIN
39
 *
40
 *      +34 963862235
41
 *   gvsig@gva.es
42
 *      www.gvsig.gva.es
43
 *
44
 *    or
45
 *
46
 *   IVER T.I. S.A
47
 *   Salamanca 50
48
 *   46005 Valencia
49
 *   Spain
50
 *
51
 *   +34 963163400
52
 *   dac@iver.es
53
 */
54
/* CVS MESSAGES:
55
 *
56
 * $Id$
57
 * $Log$
58
 *
59
 */
60
/**
61
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
62
 */
63
public class GPEFeature {
64
	private static final GeometryManager GEOMETRY_MANAGER = GeometryLocator.getGeometryManager();
65
	private static final Logger LOG = LoggerFactory.getLogger(GPEFeature.class);
66
	
67
    private static int idFeature = 0;
68
	private Geometry geometry = null;
69
	private LinkedHashMap elements = null;
70
	private String id = null;
71
	private String name = null;
72
	private String typeName = null;
73
	
74
	public GPEFeature(String id, String name, String typeName) {
75
		this();
76
		this.id = id;		
77
		this.name = name;
78
		this.typeName = typeName;		
79
	}	
80

  
81
	public GPEFeature(){
82
		elements = new LinkedHashMap();		
83
	}
84

  
85
	/**
86
	 * @return the id
87
	 */
88
	public String getId() {
89
		return id;
90
	}
91

  
92
	/**
93
	 * @param id the id to set
94
	 */
95
	public void setId(String id) {
96
		this.id = id;
97
	}
98

  
99
	/**
100
	 * @return the geometry
101
	 */
102
	public Geometry getGeometry() {
103
		if (geometry == null){
104
		    try {
105
	            this.geometry = GEOMETRY_MANAGER.create(Geometry.TYPES.NULL, Geometry.SUBTYPES.GEOM3D);
106
	        } catch (CreateGeometryException e) {
107
	            LOG.error("Not possible to create a geometry", e);
108
	        }
109
		}
110
	    return geometry;
111
	}
112

  
113
	/**
114
	 * @param geometry the geometry to set
115
	 */
116
	public void setGeometry(Geometry geometry) {
117
		this.geometry = geometry;
118
	}
119

  
120
	/**
121
	 * @return the elements
122
	 */
123
	public LinkedHashMap getelements() {
124
		return elements;
125
	}
126

  
127
	/**
128
	 * @param elements the elements to set
129
	 */
130
	public void setElements(LinkedHashMap elements) {
131
		this.elements = elements;
132
	}
133
	
134
	/**
135
	 * It adds a new element
136
	 * @param element
137
	 * The element to add
138
	 */
139
	public void addElement(GPEElement element){
140
		elements.put(element.getName(), element);
141
	}
142

  
143
	/**
144
	 * @return the name
145
	 */
146
	public String getName() {
147
		return name;
148
	}
149

  
150
	/**
151
	 * @return the typeName
152
	 */
153
	public String getTypeName() {
154
		return typeName;
155
	}
156
	
157
	/**
158
	 * Initialize the feature id
159
	 */
160
	public static void initIdFeature(){
161
		idFeature = 0;
162
	}
163

  
164
	public Envelope getEnvelope() {
165
		if (geometry == null){
166
			return null;
167
		}
168
		return geometry.getEnvelope();
169
	}
170
}
0 171

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/model/GPEElement.java
1
package org.gvsig.fmap.dal.store.gpe.model;
2

  
3
import java.util.HashMap;
4

  
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
/* CVS MESSAGES:
46
 *
47
 * $Id$
48
 * $Log$
49
 *
50
 */
51
/**
52
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
53
 */
54
public class GPEElement {
55
	private String name = null;
56
	private Object value = null;
57
	private HashMap subElements = null;
58
	
59
	public GPEElement(String name, Object value) {
60
		super();
61
		this.name = name;
62
		this.value = value;
63
		subElements = new HashMap();
64
	}
65
	
66
	public GPEElement(String name, Object value, GPEElement parentElement) {
67
		this(name,value);
68
		//If it is a complex value
69
		if (parentElement != null){
70
			parentElement.addChildElement(this);			
71
		}
72
	}	
73
	
74
	/**
75
	 * It adds a new child element
76
	 * @param children
77
	 * The element to add
78
	 */
79
	public void addChildElement(GPEElement children){
80
		subElements.put(children.getName(), children);
81
	}
82
	
83
	/**
84
	 * @return the name
85
	 */
86
	public String getName() {
87
		return name;
88
	}
89
	
90
	/**
91
	 * @return the value
92
	 */
93
	public Object getValue() {
94
		if (subElements.size() > 0){
95
//			ComplexValue cValue = ValueFactory.createComplexValue(name);
96
//			Iterator it = subElements.keySet().iterator();
97
//			while(it.hasNext()){
98
//				GPEElement element = (GPEElement)subElements.get(it.next());
99
//				cValue.put(element.getName(), element.getValue());
100
//			}
101
//			return cValue;
102
		}
103
		return value;		
104
	}
105
}
0 106

  
tags/v2_0_0_Build_2041/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/DALGPELibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff