Revision 38724
tags/v2_0_0_Build_2051/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_2051/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_2051/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_2051/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 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
34 |
import org.gvsig.fmap.dal.FileHelper; |
|
35 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
|
36 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
|
37 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
38 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
39 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
40 |
import org.gvsig.tools.dynobject.DynStruct; |
|
41 |
|
|
42 |
/** |
|
43 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
44 |
*/ |
|
45 |
public class GPEStoreParameters extends AbstractDataParameters implements |
|
46 |
DataStoreParameters, FilesystemStoreParameters { |
|
47 |
|
|
48 |
public static final String PARAMETERS_DEFINITION_NAME = "GPEStoreParameters"; |
|
49 |
|
|
50 |
private static final String FILE_PARAMETER_NAME = "File"; |
|
51 |
private static final String CRS_PARAMETER_NAME = "CRS"; |
|
52 |
private static final String ENVELOPE_PARAMETER_NAME = "Envelope"; |
|
53 |
|
|
54 |
private DelegatedDynObject parameters; |
|
55 |
|
|
56 |
public GPEStoreParameters() { |
|
57 |
this(PARAMETERS_DEFINITION_NAME); |
|
58 |
} |
|
59 |
|
|
60 |
protected GPEStoreParameters(String parametersDefinitionName) { |
|
61 |
this(parametersDefinitionName, GPEStoreProvider.NAME); |
|
62 |
} |
|
63 |
|
|
64 |
public GPEStoreParameters(String parametersDefinitionName, String name) { |
|
65 |
super(); |
|
66 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName); |
|
67 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name); |
|
68 |
} |
|
69 |
|
|
70 |
protected static void registerParametersDefinition(){ |
|
71 |
DynStruct dynStruct = FileHelper.registerParametersDefinition( |
|
72 |
GPEStoreParameters.PARAMETERS_DEFINITION_NAME, |
|
73 |
GPEStoreParameters.class, "GPEParameters.xml"); |
|
74 |
dynStruct.addDynFieldObject("Envelope").setClassOfValue(Envelope.class).setMandatory(false); |
|
75 |
} |
|
76 |
|
|
77 |
protected DelegatedDynObject getDelegatedDynObject() { |
|
78 |
return parameters; |
|
79 |
} |
|
80 |
|
|
81 |
public String getDataStoreName() { |
|
82 |
return GPEStoreProvider.NAME; |
|
83 |
} |
|
84 |
|
|
85 |
public String getDescription() { |
|
86 |
return GPEStoreProvider.DESCRIPTION; |
|
87 |
} |
|
88 |
|
|
89 |
public boolean isValid() { |
|
90 |
return (this.getFile() != null); |
|
91 |
} |
|
92 |
|
|
93 |
public File getFile() { |
|
94 |
return (File) this.getDynValue(FILE_PARAMETER_NAME); |
|
95 |
} |
|
96 |
|
|
97 |
public void setFile(File file) { |
|
98 |
this.setDynValue(FILE_PARAMETER_NAME, file); |
|
99 |
} |
|
100 |
|
|
101 |
public String getFileName() { |
|
102 |
return this.getFile().getAbsolutePath(); |
|
103 |
} |
|
104 |
|
|
105 |
public void setFileName(String fileName) { |
|
106 |
this.setDynValue(FILE_PARAMETER_NAME, fileName); |
|
107 |
} |
|
108 |
|
|
109 |
public IProjection getCRS() { |
|
110 |
return (IProjection) this.getDynValue(CRS_PARAMETER_NAME); |
|
111 |
} |
|
112 |
|
|
113 |
public void setCRS(IProjection srs) { |
|
114 |
this.setDynValue(CRS_PARAMETER_NAME, srs); |
|
115 |
} |
|
116 |
|
|
117 |
public void setCRS(String srs) { |
|
118 |
this.setDynValue(CRS_PARAMETER_NAME, srs); |
|
119 |
} |
|
120 |
|
|
121 |
public Envelope getEnvelope() { |
|
122 |
return (Envelope) this.getDynValue(ENVELOPE_PARAMETER_NAME); |
|
123 |
} |
|
124 |
|
|
125 |
public void setEnvelope(Envelope envelope) { |
|
126 |
this.setDynValue(ENVELOPE_PARAMETER_NAME, envelope); |
|
127 |
} |
|
128 |
} |
|
0 | 129 |
tags/v2_0_0_Build_2051/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_2051/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.gvsig.fmap.dal.DataTypes; |
|
13 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
14 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
15 |
import org.gvsig.fmap.dal.feature.Feature; |
|
16 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
17 |
import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider; |
|
18 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
|
19 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
|
20 |
import org.gvsig.fmap.dal.store.gpe.GPEStoreProvider; |
|
21 |
import org.gvsig.fmap.dal.store.gpe.model.GPEElement; |
|
22 |
import org.gvsig.fmap.dal.store.gpe.model.GPEFeature; |
|
23 |
import org.gvsig.fmap.geom.Geometry; |
|
24 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
25 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
26 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
27 |
import org.gvsig.fmap.geom.GeometryManager; |
|
28 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
|
29 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
30 |
import org.gvsig.fmap.geom.aggregate.MultiPrimitive; |
|
31 |
import org.gvsig.fmap.geom.aggregate.MultiSurface; |
|
32 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
33 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
34 |
import org.gvsig.fmap.geom.primitive.Curve; |
|
35 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
36 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
37 |
import org.gvsig.fmap.geom.primitive.Point; |
|
38 |
import org.gvsig.fmap.geom.primitive.Primitive; |
|
39 |
import org.gvsig.fmap.geom.primitive.Surface; |
|
40 |
import org.gvsig.gpe.lib.api.parser.IAttributesIterator; |
|
41 |
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator; |
|
42 |
import org.gvsig.gpe.lib.api.parser.IGPEErrorHandler; |
|
43 |
import org.gvsig.gpe.lib.impl.parser.GPEContentHandler; |
|
44 |
import org.jfree.util.Log; |
|
45 |
import org.slf4j.Logger; |
|
46 |
import org.slf4j.LoggerFactory; |
|
47 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
48 |
* |
|
49 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
50 |
* |
|
51 |
* This program is free software; you can redistribute it and/or |
|
52 |
* modify it under the terms of the GNU General Public License |
|
53 |
* as published by the Free Software Foundation; either version 2 |
|
54 |
* of the License, or (at your option) any later version. |
|
55 |
* |
|
56 |
* This program is distributed in the hope that it will be useful, |
|
57 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
58 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
59 |
* GNU General Public License for more details. |
|
60 |
* |
|
61 |
* You should have received a copy of the GNU General Public License |
|
62 |
* along with this program; if not, write to the Free Software |
|
63 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
64 |
* |
|
65 |
* For more information, contact: |
|
66 |
* |
|
67 |
* Generalitat Valenciana |
|
68 |
* Conselleria d'Infraestructures i Transport |
|
69 |
* Av. Blasco Ib??ez, 50 |
|
70 |
* 46010 VALENCIA |
|
71 |
* SPAIN |
|
72 |
* |
|
73 |
* +34 963862235 |
|
74 |
* gvsig@gva.es |
|
75 |
* www.gvsig.gva.es |
|
76 |
* |
|
77 |
* or |
|
78 |
* |
|
79 |
* IVER T.I. S.A |
|
80 |
* Salamanca 50 |
|
81 |
* 46005 Valencia |
|
82 |
* Spain |
|
83 |
* |
|
84 |
* +34 963163400 |
|
85 |
* dac@iver.es |
|
86 |
*/ |
|
87 |
/* CVS MESSAGES: |
|
88 |
* |
|
89 |
* $Id$ |
|
90 |
* $Log$ |
|
91 |
* |
|
92 |
*/ |
|
93 |
/** |
|
94 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
95 |
*/ |
|
96 |
public class FmapContentHandler extends GPEContentHandler { |
|
97 |
private static final Logger LOG = LoggerFactory.getLogger(FmapContentHandler.class); |
|
98 |
|
|
99 |
private HashMap featureSet = null; |
|
100 |
private EditableFeatureType featureType = null; |
|
101 |
private FeatureStoreProviderServices store = null; |
|
102 |
private GPEStoreProvider storeProvider = null; |
|
103 |
private GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
104 |
private int featureId = 0; |
|
105 |
private Envelope envelope = null; |
|
106 |
private File file = null; |
|
107 |
private IProjection srs = null; |
|
108 |
private int geometryType = 0; |
|
109 |
|
|
110 |
public FmapContentHandler(IGPEErrorHandler errorHandler, FeatureStoreProviderServices store, |
|
111 |
GPEStoreProvider storeProvider, File file, IProjection srs, int geometryType) { |
|
112 |
super(); |
|
113 |
setErrorHandler(errorHandler); |
|
114 |
this.store = store; |
|
115 |
this.storeProvider = storeProvider; |
|
116 |
this.file = file; |
|
117 |
this.srs = srs; |
|
118 |
this.geometryType = geometryType; |
|
119 |
} |
|
120 |
|
|
121 |
public int getFeaturesCount(){ |
|
122 |
return featureSet.size(); |
|
123 |
} |
|
124 |
|
|
125 |
public Feature getFeatureAt(int index){ |
|
126 |
return (Feature)featureSet.get(new Integer(index)); |
|
127 |
} |
|
128 |
|
|
129 |
public EditableFeatureType getFeatureType(){ |
|
130 |
return featureType; |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
/** |
|
135 |
* @return the featureSet |
|
136 |
*/ |
|
137 |
public HashMap getFeatureSet() { |
|
138 |
return featureSet; |
|
139 |
} |
|
140 |
|
|
141 |
/* |
|
142 |
* (non-Javadoc) |
|
143 |
* @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) |
|
144 |
*/ |
|
145 |
public Object startLayer(String id, String namespace, String name, |
|
146 |
String description, String srs, IAttributesIterator iterator, Object parentLayer, Object box) { |
|
147 |
if (featureSet == null){ |
|
148 |
featureSet = new HashMap(); |
|
149 |
} |
|
150 |
if (envelope == null){ |
|
151 |
try { |
|
152 |
envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D); |
|
153 |
} catch (CreateEnvelopeException e) { |
|
154 |
Log.error("Error creating the envelope", e); |
|
155 |
} |
|
156 |
} |
|
157 |
return featureSet; |
|
158 |
} |
|
159 |
|
|
160 |
/* |
|
161 |
* (non-Javadoc) |
|
162 |
* @see org.gvsig.gpe.IGPEContentHandler#endLayer(java.lang.Object) |
|
163 |
*/ |
|
164 |
public void endLayer(Object layer) { |
|
165 |
if (featureType == null){ |
|
166 |
createFeatureType(null); |
|
167 |
} |
|
168 |
storeProvider.setEnvelope(envelope); |
|
169 |
} |
|
170 |
|
|
171 |
/* |
|
172 |
* (non-Javadoc) |
|
173 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startPoint(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
174 |
*/ |
|
175 |
public Object startPoint(String id, ICoordinateIterator coords, String srs) { |
|
176 |
return createPoint(coords); |
|
177 |
} |
|
178 |
|
|
179 |
private Point createPoint(ICoordinateIterator coords){ |
|
180 |
double[] buffer = new double[coords.getDimension()]; |
|
181 |
try { |
|
182 |
coords.hasNext(); |
|
183 |
coords.next(buffer); |
|
184 |
Point point = null; |
|
185 |
if (coords.getDimension() == 2){ |
|
186 |
point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D); |
|
187 |
}else if (coords.getDimension() == 3){ |
|
188 |
point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM3D); |
|
189 |
} |
|
190 |
for (int i=0 ; i<buffer.length ; i++){ |
|
191 |
point.setCoordinateAt(i, buffer[i]); |
|
192 |
} |
|
193 |
return point; |
|
194 |
} catch (IOException e) { |
|
195 |
getErrorHandler().addError(e); |
|
196 |
} catch (CreateGeometryException e) { |
|
197 |
getErrorHandler().addError(e); |
|
198 |
} |
|
199 |
return null; |
|
200 |
} |
|
201 |
|
|
202 |
private Point createPoint(double[] buffer){ |
|
203 |
try { |
|
204 |
Point point = null; |
|
205 |
if (buffer.length == 2){ |
|
206 |
point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D); |
|
207 |
}else if (buffer.length == 3){ |
|
208 |
point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM3D); |
|
209 |
} |
|
210 |
for (int i=0 ; i<buffer.length ; i++){ |
|
211 |
point.setCoordinateAt(i, buffer[i]); |
|
212 |
} |
|
213 |
return point; |
|
214 |
}catch (CreateGeometryException e) { |
|
215 |
getErrorHandler().addError(e); |
|
216 |
} |
|
217 |
return null; |
|
218 |
} |
|
219 |
|
|
220 |
|
|
221 |
/* (non-Javadoc) |
|
222 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startLineString(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
223 |
*/ |
|
224 |
public Object startLineString(String id, ICoordinateIterator coords, |
|
225 |
String srs) { |
|
226 |
return createCurve(coords); |
|
227 |
} |
|
228 |
|
|
229 |
private Curve createCurve(ICoordinateIterator coords){ |
|
230 |
GeneralPathX gp = createGeneralPathX(coords); |
|
231 |
try { |
|
232 |
Curve curve = null; |
|
233 |
if (coords.getDimension() == 2){ |
|
234 |
curve = (Curve) geomManager.create(TYPES.CURVE, SUBTYPES.GEOM2D); |
|
235 |
}else if (coords.getDimension() == 3){ |
|
236 |
curve = (Curve) geomManager.create(TYPES.CURVE, SUBTYPES.GEOM3D); |
|
237 |
} |
|
238 |
curve.setGeneralPath(gp); |
|
239 |
return curve; |
|
240 |
} catch (CreateGeometryException e) { |
|
241 |
getErrorHandler().addError(e); |
|
242 |
} |
|
243 |
return null; |
|
244 |
} |
|
245 |
|
|
246 |
private GeneralPathX createGeneralPathX(ICoordinateIterator coords){ |
|
247 |
GeneralPathX gp = new GeneralPathX(); |
|
248 |
if (coords == null){ |
|
249 |
return gp; |
|
250 |
} |
|
251 |
double[] buffer = new double[coords.getDimension()]; |
|
252 |
try { |
|
253 |
if (coords.hasNext()){ |
|
254 |
coords.next(buffer); |
|
255 |
gp.moveTo(buffer[0], buffer[1]); |
|
256 |
} |
|
257 |
while(coords.hasNext()){ |
|
258 |
coords.next(buffer); |
|
259 |
gp.lineTo(buffer[0], buffer[1]); |
|
260 |
} |
|
261 |
} catch (IOException e) { |
|
262 |
getErrorHandler().addError(e); |
|
263 |
} |
|
264 |
return gp; |
|
265 |
} |
|
266 |
|
|
267 |
/* (non-Javadoc) |
|
268 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startPolygon(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
269 |
*/ |
|
270 |
|
|
271 |
public Object startPolygon(String id, ICoordinateIterator coords, String srs) { |
|
272 |
return createSurface(coords); |
|
273 |
} |
|
274 |
|
|
275 |
private Surface createSurface(ICoordinateIterator coords){ |
|
276 |
GeneralPathX gp = createGeneralPathX(coords); |
|
277 |
try { |
|
278 |
Surface surface = null; |
|
279 |
if (coords.getDimension() == 2){ |
|
280 |
surface = (Surface) geomManager.create(TYPES.SURFACE, SUBTYPES.GEOM2D); |
|
281 |
}else if (coords.getDimension() == 3){ |
|
282 |
surface = (Surface) geomManager.create(TYPES.SURFACE, SUBTYPES.GEOM3D); |
|
283 |
} |
|
284 |
surface.setGeneralPath(gp); |
|
285 |
return surface; |
|
286 |
} catch (CreateGeometryException e) { |
|
287 |
getErrorHandler().addError(e); |
|
288 |
} |
|
289 |
return null; |
|
290 |
} |
|
291 |
|
|
292 |
|
|
293 |
/* (non-Javadoc) |
|
294 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startInnerPolygon(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
295 |
*/ |
|
296 |
public Object startInnerPolygon(String id, ICoordinateIterator coords, |
|
297 |
String srs) { |
|
298 |
return createSurface(coords); |
|
299 |
} |
|
300 |
|
|
301 |
/* |
|
302 |
* (non-Javadoc) |
|
303 |
* @see org.gvsig.gpe.IGPEContentHandler#addGeometryToFeature(java.lang.Object, java.lang.Object) |
|
304 |
*/ |
|
305 |
public void addGeometryToFeature(Object geometry, Object feature) { |
|
306 |
((GPEFeature)feature).setGeometry((Geometry)geometry); |
|
307 |
} |
|
308 |
|
|
309 |
/* |
|
310 |
* (non-Javadoc) |
|
311 |
* @see org.gvsig.gpe.IGPEContentHandler#addBboxToLayer(java.lang.Object, java.lang.Object) |
|
312 |
*/ |
|
313 |
public void addBboxToLayer(Object bbox, Object layer) { |
|
314 |
// if (layer != null){ |
|
315 |
// GPEBBox gpeBBox = (GPEBBox)bbox; |
|
316 |
// if (gpeBBox.getSrs() != null){ |
|
317 |
// IProjection projection = null; |
|
318 |
// try{ |
|
319 |
// CRSFactory.getCRS(gpeBBox.getSrs()); |
|
320 |
// }catch(Exception e){ |
|
321 |
// //If the CRS factory has an error. |
|
322 |
// } |
|
323 |
// if ((projection != null) && (!(projection.equals(((FLayer)layer).getProjection())))){ |
|
324 |
// //TODO reproyectar la bbox y asignarsela a la capa |
|
325 |
// } |
|
326 |
// } |
|
327 |
// ((IGPEDriver)layer).setExtent(gpeBBox.getBbox2D()); |
|
328 |
// } |
|
329 |
} |
|
330 |
|
|
331 |
/* |
|
332 |
* (non-Javadoc) |
|
333 |
* @see org.gvsig.gpe.IGPEContentHandler#addElementToFeature(java.lang.Object, java.lang.Object) |
|
334 |
*/ |
|
335 |
public void addElementToFeature(Object element, Object feature) { |
|
336 |
GPEElement gpeElement = (GPEElement)element; |
|
337 |
((GPEFeature)feature).addElement(gpeElement); |
|
338 |
} |
|
339 |
|
|
340 |
/* |
|
341 |
* (non-Javadoc) |
|
342 |
* @see org.gvsig.gpe.IGPEContentHandler#addFeatureToLayer(java.lang.Object, java.lang.Object) |
|
343 |
*/ |
|
344 |
public void addFeatureToLayer(Object feature, Object layer) { |
|
345 |
GPEFeature gpefeature = (GPEFeature)feature; |
|
346 |
Envelope currentEnvelope = gpefeature.getEnvelope(); |
|
347 |
if (featureType == null){ |
|
348 |
createFeatureType(gpefeature); |
|
349 |
|
|
350 |
//Initialize the envelope |
|
351 |
try { |
|
352 |
envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D); |
|
353 |
} catch (CreateEnvelopeException e) { |
|
354 |
getErrorHandler().addError(e); |
|
355 |
} |
|
356 |
//Calculates the envelope |
|
357 |
envelope = currentEnvelope; |
|
358 |
}else{ |
|
359 |
//Calculates the envelope |
|
360 |
if (currentEnvelope != null){ |
|
361 |
envelope.add(currentEnvelope); |
|
362 |
} |
|
363 |
} |
|
364 |
//If it is null is a multilayer: not supported yet |
|
365 |
if (layer != null){ |
|
366 |
FeatureProvider data = new DefaultFeatureProvider(featureType.getNotEditableCopy(), storeProvider.createNewOID()); |
|
367 |
Map elements = gpefeature.getelements(); |
|
368 |
Iterator keys = elements.keySet().iterator(); |
|
369 |
String gid = gpefeature.getId(); |
|
370 |
data.setOID(gid); |
|
371 |
while (keys.hasNext()){ |
|
372 |
String elementName = (String)keys.next(); |
|
373 |
data.set(elementName, ((GPEElement)elements.get(elementName)).getValue()); |
|
374 |
} |
|
375 |
data.setDefaultGeometry(gpefeature.getGeometry()); |
|
376 |
data.set(featureType.getDefaultGeometryAttributeIndex(), gpefeature.getGeometry()); |
|
377 |
((HashMap)layer).put(gid, data); |
|
378 |
} |
|
379 |
} |
|
380 |
|
|
381 |
private void createFeatureType(GPEFeature gpefeature){ |
|
382 |
featureType = store.createFeatureType(); |
|
383 |
|
|
384 |
//Adding the Geometry field |
|
385 |
EditableFeatureAttributeDescriptor attributeDescriptor = featureType.add("the_geom", DataTypes.GEOMETRY).setGeometryType(geometryType); |
|
386 |
attributeDescriptor.setGeometrySubType(SUBTYPES.GEOM2D); |
|
387 |
attributeDescriptor.setSRS(srs); |
|
388 |
featureType.setDefaultGeometryAttributeName("the_geom"); |
|
389 |
|
|
390 |
//Adding the ID |
|
391 |
featureType.add("gid", DataTypes.LONG); |
|
392 |
featureType.setHasOID(true); |
|
393 |
|
|
394 |
if (gpefeature != null){ |
|
395 |
Map elements = gpefeature.getelements(); |
|
396 |
Iterator keys = elements.keySet().iterator(); |
|
397 |
while (keys.hasNext()){ |
|
398 |
String elementName = (String)keys.next(); |
|
399 |
if (!elementName.equals("the_geom")){ |
|
400 |
featureType.add(elementName, DataTypes.STRING); |
|
401 |
} |
|
402 |
} |
|
403 |
} |
|
404 |
|
|
405 |
FeatureType defaultType = featureType.getNotEditableCopy(); |
|
406 |
List types = new ArrayList(1); |
|
407 |
types.add(defaultType); |
|
408 |
this.store.setFeatureTypes(types, defaultType); |
|
409 |
} |
|
410 |
|
|
411 |
/* |
|
412 |
* (non-Javadoc) |
|
413 |
* @see org.gvsig.gpe.IGPEContentHandler#addInnerPolygonToPolygon(java.lang.Object, java.lang.Object) |
|
414 |
*/ |
|
415 |
public void addInnerPolygonToPolygon(Object innerPolygon, Object Polygon) { |
|
416 |
//((Geometry)Polygon).addGeometry((GPEGeometry)innerPolygon); |
|
417 |
} |
|
418 |
|
|
419 |
/* |
|
420 |
* (non-Javadoc) |
|
421 |
* @see org.gvsig.gpe.IGPEContentHandler#addNameToFeature(java.lang.String, java.lang.Object) |
|
422 |
*/ |
|
423 |
public void addNameToFeature(String name, Object feature) { |
|
424 |
|
|
425 |
} |
|
426 |
|
|
427 |
/* |
|
428 |
* (non-Javadoc) |
|
429 |
* @see org.gvsig.gpe.IGPEContentHandler#addParentElementToElement(java.lang.Object, java.lang.Object) |
|
430 |
*/ |
|
431 |
public void addParentElementToElement(Object parent, Object element) { |
|
432 |
|
|
433 |
} |
|
434 |
|
|
435 |
/* |
|
436 |
* (non-Javadoc) |
|
437 |
* @see org.gvsig.gpe.IGPEContentHandler#addSrsToLayer(java.lang.String, java.lang.Object) |
|
438 |
*/ |
|
439 |
public void addSrsToLayer(String srs, Object Layer) { |
|
440 |
// this.srs = srs; |
|
441 |
} |
|
442 |
|
|
443 |
|
|
444 |
/* (non-Javadoc) |
|
445 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startBbox(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
446 |
*/ |
|
447 |
public Object startBbox(String id, ICoordinateIterator coords, String srs) { |
|
448 |
Envelope envelope = null; |
|
449 |
try { |
|
450 |
if (coords.getDimension() == 2){ |
|
451 |
envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D); |
|
452 |
}else if (coords.getDimension() == 3){ |
|
453 |
envelope = geomManager.createEnvelope(SUBTYPES.GEOM3D); |
|
454 |
} |
|
455 |
double[] buffer = new double[coords.getDimension()]; |
|
456 |
|
|
457 |
if (coords.hasNext()){ |
|
458 |
coords.next(buffer); |
|
459 |
envelope.setLowerCorner(createPoint(buffer)); |
|
460 |
} |
|
461 |
if (coords.hasNext()){ |
|
462 |
coords.next(buffer); |
|
463 |
envelope.setUpperCorner(createPoint(buffer)); |
|
464 |
} |
|
465 |
} catch (IOException e) { |
|
466 |
getErrorHandler().addError(e); |
|
467 |
} catch (CreateEnvelopeException e) { |
|
468 |
getErrorHandler().addError(e); |
|
469 |
} |
|
470 |
return envelope; |
|
471 |
} |
|
472 |
|
|
473 |
/* |
|
474 |
* (non-Javadoc) |
|
475 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startElement(java.lang.String, java.lang.String, java.lang.Object, org.gvsig.gpe.parser.IAttributesIterator, java.lang.Object) |
|
476 |
*/ |
|
477 |
public Object startElement(String namespace, String name, Object value, |
|
478 |
IAttributesIterator attributesIterator, Object parentElement) { |
|
479 |
return new GPEElement(name, value, (GPEElement)parentElement); |
|
480 |
} |
|
481 |
|
|
482 |
/* |
|
483 |
* (non-Javadoc) |
|
484 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startFeature(java.lang.String, java.lang.String, java.lang.String, org.gvsig.gpe.parser.IAttributesIterator, java.lang.Object) |
|
485 |
*/ |
|
486 |
public Object startFeature(String id, String namespace, String name, |
|
487 |
IAttributesIterator attributes, Object layer){ |
|
488 |
String sId; |
|
489 |
if (id == null){ |
|
490 |
sId = new String(new Long(featureId).toString()); |
|
491 |
}else{ |
|
492 |
sId = id; |
|
493 |
} |
|
494 |
featureId++; |
|
495 |
//Check the xml schema... |
|
496 |
// for (int i=0 ; i<schemas.size() ; i++){ |
|
497 |
// IXSSchema schema = schemas.get(i); |
|
498 |
// IXSElementDeclaration element = schema.getElementDeclarationByName(namespace, name); |
|
499 |
// if (element != null){ |
|
500 |
// featureType = store.createFeatureType(); |
|
501 |
// IXSTypeDefinition type = element.getTypeDefinition(); |
|
502 |
// if (type instanceof IXSComplexTypeDefinition){ |
|
503 |
// IXSComplexTypeDefinition complexType = (IXSComplexTypeDefinition)type; |
|
504 |
// complexType.getContentType(). |
|
505 |
// } |
|
506 |
// |
|
507 |
// featureType.add("the_geom", DataTypes.GEOMETRY).setGeometryType(TYPES.GEOMETRY); |
|
508 |
// featureType.setDefaultGeometryAttributeName("the_geom"); |
|
509 |
// featureType.setHasOID(true); |
|
510 |
// while (keys.hasNext()){ |
|
511 |
// String elementName = (String)keys.next(); |
|
512 |
// featureType.add(elementName, DataTypes.STRING); |
|
513 |
// } |
|
514 |
// FeatureType defaultType = featureType.getNotEditableCopy(); |
|
515 |
// List types = new ArrayList(1); |
|
516 |
// types.add(defaultType); |
|
517 |
// this.store.setFeatureTypes(types, defaultType); |
|
518 |
// |
|
519 |
// //Initialize the envelope |
|
520 |
// try { |
|
521 |
// envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D); |
|
522 |
// } catch (CreateEnvelopeException e) { |
|
523 |
// getErrorHandler().addError(e); |
|
524 |
// } |
|
525 |
// } |
|
526 |
// } |
|
527 |
return new GPEFeature(sId, |
|
528 |
name, name); |
|
529 |
} |
|
530 |
|
|
531 |
/* (non-Javadoc) |
|
532 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startLinearRing(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
533 |
*/ |
|
534 |
public Object startLinearRing(String id, ICoordinateIterator coords, |
|
535 |
String srs) { |
|
536 |
return createSurface(coords); |
|
537 |
} |
|
538 |
|
|
539 |
/* |
|
540 |
* (non-Javadoc) |
|
541 |
* @see org.gvsig.gpe.IGPEContentHandler#startMultiPoint(java.lang.String, java.lang.String) |
|
542 |
*/ |
|
543 |
public Object startMultiPoint(String id, String srs) { |
|
544 |
try { |
|
545 |
return geomManager.create(TYPES.MULTIPOINT, SUBTYPES.GEOM2D); |
|
546 |
} catch (CreateGeometryException e) { |
|
547 |
getErrorHandler().addError(e); |
|
548 |
} |
|
549 |
return null; |
|
550 |
} |
|
551 |
|
|
552 |
/* |
|
553 |
* (non-Javadoc) |
|
554 |
* @see org.gvsig.gpe.IGPEContentHandler#addPointToMultiPoint(java.lang.Object, java.lang.Object) |
|
555 |
*/ |
|
556 |
public void addPointToMultiPoint(Object point, Object multiPoint) { |
|
557 |
((MultiPoint)multiPoint).addPoint((Point)point); |
|
558 |
} |
|
559 |
|
|
560 |
/* |
|
561 |
* (non-Javadoc) |
|
562 |
* @see org.gvsig.gpe.IGPEContentHandler#startMultiLineString(java.lang.String, java.lang.String) |
|
563 |
*/ |
|
564 |
public Object startMultiLineString(String id, String srs) { |
|
565 |
super.startMultiLineString(id, srs); |
|
566 |
try { |
|
567 |
return geomManager.create(TYPES.MULTICURVE, SUBTYPES.GEOM2D); |
|
568 |
} catch (CreateGeometryException e) { |
|
569 |
getErrorHandler().addError(e); |
|
570 |
} |
|
571 |
return null; |
|
572 |
} |
|
573 |
|
|
574 |
/* |
|
575 |
* (non-Javadoc) |
|
576 |
* @see org.gvsig.gpe.IGPEContentHandler#addLineStringToMultiLineString(java.lang.Object, java.lang.Object) |
|
577 |
*/ |
|
578 |
public void addLineStringToMultiLineString(Object lineString, Object multiLineString) { |
|
579 |
((MultiCurve)multiLineString).addCurve((Curve)lineString); |
|
580 |
} |
|
581 |
|
|
582 |
/* |
|
583 |
* (non-Javadoc) |
|
584 |
* @see org.gvsig.gpe.IGPEContentHandler#startMultiPolygon(java.lang.String, java.lang.String) |
|
585 |
*/ |
|
586 |
public Object startMultiPolygon(String id, String srs) { |
|
587 |
super.startMultiPolygon(id, srs); |
|
588 |
try { |
|
589 |
return geomManager.create(TYPES.MULTISURFACE, SUBTYPES.GEOM2D); |
|
590 |
} catch (CreateGeometryException e) { |
|
591 |
getErrorHandler().addError(e); |
|
592 |
} |
|
593 |
return null; |
|
594 |
} |
|
595 |
|
|
596 |
/* |
|
597 |
* (non-Javadoc) |
|
598 |
* @see org.gvsig.gpe.IGPEContentHandler#addPolygonToMultiPolygon(java.lang.Object, java.lang.Object) |
|
599 |
*/ |
|
600 |
public void addPolygonToMultiPolygon(Object polygon, Object multiPolygon) { |
|
601 |
((MultiSurface)multiPolygon).addSurface((Surface)polygon); |
|
602 |
} |
|
603 |
|
|
604 |
/* (non-Javadoc) |
|
605 |
* @see org.gvsig.gpe.GPEContentHandler#addCurveToMultiCurve(java.lang.Object, java.lang.Object) |
|
606 |
*/ |
|
607 |
public void addCurveToMultiCurve(Object curve, Object multiCurve) { |
|
608 |
((MultiCurve)multiCurve).addCurve((Curve)curve); |
|
609 |
} |
|
610 |
|
|
611 |
/* (non-Javadoc) |
|
612 |
* @see org.gvsig.gpe.GPEContentHandler#addSegmentToCurve(java.lang.Object, java.lang.Object) |
|
613 |
*/ |
|
614 |
public void addSegmentToCurve(Object segment, Object curve) { |
|
615 |
((Curve)curve).addVertex((Point)segment); |
|
616 |
} |
|
617 |
|
|
618 |
/* (non-Javadoc) |
|
619 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startCurve(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
620 |
*/ |
|
621 |
public Object startCurve(String id, ICoordinateIterator coords, String srs) { |
|
622 |
return createCurve(coords); |
|
623 |
} |
|
624 |
|
|
625 |
/* (non-Javadoc) |
|
626 |
* @see org.gvsig.gpe.GPEContentHandler#startCurve(java.lang.String, java.lang.String) |
|
627 |
*/ |
|
628 |
public Object startCurve(String id, String srs) { |
|
629 |
return createCurve(null); |
|
630 |
} |
|
631 |
|
|
632 |
/* (non-Javadoc) |
|
633 |
* @see org.gvsig.gpe.GPEContentHandler#startMultiCurve(java.lang.String, java.lang.String) |
|
634 |
*/ |
|
635 |
public Object startMultiCurve(String id, String srs) { |
|
636 |
try { |
|
637 |
return geomManager.create(TYPES.MULTICURVE, SUBTYPES.GEOM2D); |
|
638 |
} catch (CreateGeometryException e) { |
|
639 |
getErrorHandler().addError(e); |
|
640 |
} |
|
641 |
return null; |
|
642 |
} |
|
643 |
|
|
644 |
/* (non-Javadoc) |
|
645 |
* @see org.gvsig.gpe.GPEContentHandler#addGeometryToMultiGeometry(java.lang.Object, java.lang.Object) |
|
646 |
*/ |
|
647 |
public void addGeometryToMultiGeometry(Object geometry, Object multiGeometry) { |
|
648 |
((MultiPrimitive)multiGeometry).addPrimitive((Primitive)geometry); |
|
649 |
} |
|
650 |
|
|
651 |
/* (non-Javadoc) |
|
652 |
* @see org.gvsig.gpe.GPEContentHandler#startMultiGeometry(java.lang.String, java.lang.String) |
|
653 |
*/ |
|
654 |
public Object startMultiGeometry(String id, String srs) { |
|
655 |
try { |
|
656 |
return geomManager.create(TYPES.AGGREGATE, SUBTYPES.GEOM2D); |
|
657 |
} catch (CreateGeometryException e) { |
|
658 |
getErrorHandler().addError(e); |
|
659 |
} |
|
660 |
return null; |
|
661 |
} |
|
662 |
|
|
663 |
/** |
|
664 |
* @return a new OID |
|
665 |
*/ |
|
666 |
public Object createNewOID() { |
|
667 |
featureId++; |
|
668 |
return String.valueOf(featureId); |
|
669 |
} |
|
670 |
|
|
671 |
/** |
|
672 |
* @param envelope the envelope to set |
|
673 |
*/ |
|
674 |
public void setEnvelope(Envelope envelope) { |
|
675 |
this.envelope = envelope; |
|
676 |
} |
|
677 |
|
|
678 |
/** |
|
679 |
* @param featureType the featureType to set |
|
680 |
*/ |
|
681 |
public void setFeatureType(EditableFeatureType featureType) { |
|
682 |
this.featureType = featureType; |
|
683 |
} |
|
684 |
} |
|
0 | 685 |
tags/v2_0_0_Build_2051/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_2051/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_2051/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.gvsig.fmap.geom.Geometry; |
|
6 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
7 |
import org.gvsig.fmap.geom.GeometryManager; |
|
8 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
9 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
10 |
import org.slf4j.Logger; |
|
11 |
import org.slf4j.LoggerFactory; |
|
12 |
|
|
13 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
14 |
* |
|
15 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
16 |
* |
|
17 |
* This program is free software; you can redistribute it and/or |
|
18 |
* modify it under the terms of the GNU General Public License |
|
19 |
* as published by the Free Software Foundation; either version 2 |
|
20 |
* of the License, or (at your option) any later version. |
|
21 |
* |
|
22 |
* This program is distributed in the hope that it will be useful, |
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
25 |
* GNU General Public License for more details. |
|
26 |
* |
|
27 |
* You should have received a copy of the GNU General Public License |
|
28 |
* along with this program; if not, write to the Free Software |
|
29 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
30 |
* |
|
31 |
* For more information, contact: |
|
32 |
* |
|
33 |
* Generalitat Valenciana |
|
34 |
* Conselleria d'Infraestructures i Transport |
|
35 |
* Av. Blasco Ib??ez, 50 |
|
36 |
* 46010 VALENCIA |
|
37 |
* SPAIN |
|
38 |
* |
|
39 |
* +34 963862235 |
|
40 |
* gvsig@gva.es |
|
41 |
* www.gvsig.gva.es |
|
42 |
* |
|
43 |
* or |
|
44 |
* |
|
45 |
* IVER T.I. S.A |
|
46 |
* Salamanca 50 |
|
47 |
* 46005 Valencia |
|
48 |
* Spain |
|
49 |
* |
|
50 |
* +34 963163400 |
|
51 |
* dac@iver.es |
|
52 |
*/ |
|
53 |
/* CVS MESSAGES: |
|
54 |
* |
|
55 |
* $Id$ |
|
56 |
* $Log$ |
|
57 |
* |
|
58 |
*/ |
|
59 |
/** |
|
60 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
61 |
*/ |
|
62 |
public class GPEFeature { |
|
63 |
private static final GeometryManager GEOMETRY_MANAGER = GeometryLocator.getGeometryManager(); |
|
64 |
private static final Logger LOG = LoggerFactory.getLogger(GPEFeature.class); |
|
65 |
|
|
66 |
private static int idFeature = 0; |
|
67 |
private Geometry geometry = null; |
|
68 |
private LinkedHashMap elements = null; |
|
69 |
private String id = null; |
|
70 |
private String name = null; |
|
71 |
private String typeName = null; |
|
72 |
|
|
73 |
public GPEFeature(String id, String name, String typeName) { |
|
74 |
this(); |
|
75 |
this.id = id; |
|
76 |
this.name = name; |
|
77 |
this.typeName = typeName; |
|
78 |
} |
|
79 |
|
|
80 |
public GPEFeature(){ |
|
81 |
elements = new LinkedHashMap(); |
|
82 |
} |
|
83 |
|
|
84 |
/** |
|
85 |
* @return the id |
|
86 |
*/ |
|
87 |
public String getId() { |
|
88 |
return id; |
|
89 |
} |
|
90 |
|
|
91 |
/** |
|
92 |
* @param id the id to set |
|
93 |
*/ |
|
94 |
public void setId(String id) { |
|
95 |
this.id = id; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* @return the geometry |
|
100 |
*/ |
|
101 |
public Geometry getGeometry() { |
|
102 |
if (geometry == null){ |
|
103 |
try { |
|
104 |
this.geometry = GEOMETRY_MANAGER.create(Geometry.TYPES.NULL, Geometry.SUBTYPES.GEOM3D); |
|
105 |
} catch (CreateGeometryException e) { |
|
106 |
LOG.error("Not possible to create a geometry", e); |
|
107 |
} |
|
108 |
} |
|
109 |
return geometry; |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* @param geometry the geometry to set |
|
114 |
*/ |
|
115 |
public void setGeometry(Geometry geometry) { |
|
116 |
this.geometry = geometry; |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
120 |
* @return the elements |
|
121 |
*/ |
|
122 |
public LinkedHashMap getelements() { |
|
123 |
return elements; |
|
124 |
} |
|
125 |
|
|
126 |
/** |
|
127 |
* @param elements the elements to set |
|
128 |
*/ |
|
129 |
public void setElements(LinkedHashMap elements) { |
|
130 |
this.elements = elements; |
|
131 |
} |
|
132 |
|
|
133 |
/** |
|
134 |
* It adds a new element |
|
135 |
* @param element |
|
136 |
* The element to add |
|
137 |
*/ |
|
138 |
public void addElement(GPEElement element){ |
|
139 |
elements.put(element.getName(), element); |
|
140 |
} |
|
141 |
|
|
142 |
/** |
|
143 |
* @return the name |
|
144 |
*/ |
|
145 |
public String getName() { |
|
146 |
return name; |
|
147 |
} |
|
148 |
|
|
149 |
/** |
|
150 |
* @return the typeName |
|
151 |
*/ |
|
152 |
public String getTypeName() { |
|
153 |
return typeName; |
|
154 |
} |
|
155 |
|
|
156 |
/** |
|
157 |
* Initialize the feature id |
|
158 |
*/ |
|
159 |
public static void initIdFeature(){ |
|
160 |
idFeature = 0; |
|
161 |
} |
|
162 |
|
|
163 |
public Envelope getEnvelope() { |
|
164 |
if (geometry == null){ |
|
165 |
return null; |
|
166 |
} |
|
167 |
return geometry.getEnvelope(); |
|
168 |
} |
|
169 |
} |
|
0 | 170 |
tags/v2_0_0_Build_2051/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 |
|
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.util.ArrayList; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.DALFileLibrary; |
|
34 |
import org.gvsig.fmap.dal.DALFileLocator; |
|
35 |
import org.gvsig.fmap.dal.DALLibrary; |
|
36 |
import org.gvsig.fmap.dal.DALLocator; |
|
37 |
import org.gvsig.fmap.dal.DataTypes; |
|
38 |
import org.gvsig.fmap.dal.FileHelper; |
|
39 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
40 |
import org.gvsig.fmap.geom.Geometry; |
|
41 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
42 |
import org.gvsig.fmap.geom.GeometryManager; |
|
43 |
import org.gvsig.fmap.geom.operation.writegml2.CurveWriteGml2Operation; |
|
44 |
import org.gvsig.fmap.geom.operation.writegml2.MultiCurveWriteGml2Operation; |
|
45 |
import org.gvsig.fmap.geom.operation.writegml2.MultiPointWriteGml2Operation; |
|
46 |
import org.gvsig.fmap.geom.operation.writegml2.MultiSurfaceWriteGml2Operation; |
|
47 |
import org.gvsig.fmap.geom.operation.writegml2.PointWriteGml2Operation; |
|
48 |
import org.gvsig.fmap.geom.operation.writegml2.SurfaceWriteGml2Operation; |
|
49 |
import org.gvsig.fmap.geom.operation.writegml2.WriteGml2Operation; |
|
50 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
51 |
import org.gvsig.tools.library.AbstractLibrary; |
|
52 |
import org.gvsig.tools.library.LibraryException; |
|
53 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
54 |
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator; |
|
55 |
import org.gvsig.xmlschema.lib.api.XMLSchemaManager; |
|
56 |
|
|
57 |
/** |
|
58 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
59 |
*/ |
|
60 |
public class DALGPELibrary extends AbstractLibrary { |
|
61 |
|
|
62 |
@Override |
|
63 |
public void doRegistration() { |
|
64 |
registerAsServiceOf(DALLibrary.class); |
|
65 |
require(DALFileLibrary.class); |
|
66 |
} |
|
67 |
|
|
68 |
protected void doInitialize() throws LibraryException { |
Also available in: Unified diff