Revision 34072
tags/v2_0_0_Build_2021/extensions/extGPE-gvSIG/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<fileSet> |
|
8 |
<directory>config</directory> |
|
9 |
<outputDirectory>${extension.install.dir.name}</outputDirectory> |
|
10 |
</fileSet> |
|
11 |
<fileSet> |
|
12 |
<directory>images</directory> |
|
13 |
<outputDirectory>/${extension.install.dir.name}/images</outputDirectory> |
|
14 |
</fileSet> |
|
15 |
</fileSets> |
|
16 |
<files> |
|
17 |
<file> |
|
18 |
<source>package.info</source> |
|
19 |
<outputDirectory>${extension.install.dir.name}</outputDirectory> |
|
20 |
</file> |
|
21 |
</files> |
|
22 |
<dependencySets> |
|
23 |
<dependencySet> |
|
24 |
<useProjectArtifact>false</useProjectArtifact> |
|
25 |
<useProjectAttachments>true</useProjectAttachments> |
|
26 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
27 |
</outputDirectory> |
|
28 |
<includes> |
|
29 |
<include>org.gvsig:org.gvsig.gpe**</include> |
|
30 |
<include>org.gvsig:org.gvsig.xmlpull**</include> |
|
31 |
<include>org.gvsig:org.gvsig.xmlschema**</include> |
|
32 |
<include>stax:stax</include> |
|
33 |
</includes> |
|
34 |
</dependencySet> |
|
35 |
</dependencySets> |
|
36 |
</assembly> |
|
37 |
|
|
0 | 38 |
tags/v2_0_0_Build_2021/extensions/extGPE-gvSIG/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Mon Nov 08 09:57:08 CET 2010 |
|
3 |
buildNumber=2021 |
tags/v2_0_0_Build_2021/extensions/extGPE-gvSIG/src-test/org/gvsig/fmap/dal/store/gpe/GPEMobileTest.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 |
import java.util.Iterator; |
|
32 |
|
|
33 |
import junit.framework.TestCase; |
|
34 |
|
|
35 |
import org.gvsig.compat.se.SECompatLibrary; |
|
36 |
import org.gvsig.fmap.dal.DALFileLibrary; |
|
37 |
import org.gvsig.fmap.dal.DALLibrary; |
|
38 |
import org.gvsig.fmap.dal.DALLocator; |
|
39 |
import org.gvsig.fmap.dal.DataManager; |
|
40 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
41 |
import org.gvsig.fmap.dal.exception.DataException; |
|
42 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
43 |
import org.gvsig.fmap.dal.feature.Feature; |
|
44 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
45 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
46 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
47 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
48 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
49 |
import org.gvsig.fmap.dal.impl.DALDefaultImplLibrary; |
|
50 |
import org.gvsig.fmap.dal.impl.DefaultDataManager; |
|
51 |
import org.gvsig.fmap.dal.index.spatial.jts.JTSIndexLibrary; |
|
52 |
import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager; |
|
53 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
54 |
import org.gvsig.fmap.geom.Geometry; |
|
55 |
import org.gvsig.fmap.geom.impl.DefaultGeometryLibrary; |
|
56 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
57 |
import org.gvsig.gpe.lib.api.GPELocator; |
|
58 |
import org.gvsig.gpe.lib.api.GPEManager; |
|
59 |
import org.gvsig.tools.ToolsLibrary; |
|
60 |
import org.gvsig.tools.persistence.xml.XMLPersistenceLibrary; |
|
61 |
|
|
62 |
/** |
|
63 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
64 |
*/ |
|
65 |
public class GPEMobileTest extends TestCase{ |
|
66 |
public static final File file_prueba = new File("testdata/GML-points.gml"); |
|
67 |
|
|
68 |
private FilesystemServerExplorer myExplorer = null; |
|
69 |
private GPEManager gpeManager = null; |
|
70 |
|
|
71 |
private boolean baseTestInitialized=false; |
|
72 |
|
|
73 |
private DataManager dataManager; |
|
74 |
|
|
75 |
private FeatureStore store; |
|
76 |
|
|
77 |
public void setUp(){ |
|
78 |
DALLocator.registerDataManager(DefaultDataManager.class); |
|
79 |
DALLocator.registerResourceManager(DefaultResourceManager.class); |
|
80 |
if (baseTestInitialized) { |
|
81 |
return; |
|
82 |
} |
|
83 |
|
|
84 |
ToolsLibrary tools = new ToolsLibrary(); |
|
85 |
tools.initialize(); |
|
86 |
tools.postInitialize(); |
|
87 |
|
|
88 |
XMLPersistenceLibrary xmlPersistence = new XMLPersistenceLibrary(); |
|
89 |
xmlPersistence.initialize(); |
|
90 |
xmlPersistence.postInitialize(); |
|
91 |
|
|
92 |
DALLocator.registerDataManager(DefaultDataManager.class); |
|
93 |
DALLocator.registerResourceManager(DefaultResourceManager.class); |
|
94 |
|
|
95 |
DALLibrary lib = new DALLibrary(); |
|
96 |
lib.initialize(); |
|
97 |
lib.postInitialize(); |
|
98 |
|
|
99 |
DALDefaultImplLibrary libImpl = new DALDefaultImplLibrary(); |
|
100 |
libImpl.initialize(); |
|
101 |
libImpl.postInitialize(); |
|
102 |
|
|
103 |
DALFileLibrary libFile = new DALFileLibrary(); |
|
104 |
libFile.initialize(); |
|
105 |
libFile.postInitialize(); |
|
106 |
|
|
107 |
DefaultGeometryLibrary defGeomLib = new DefaultGeometryLibrary(); |
|
108 |
defGeomLib.initialize(); |
|
109 |
defGeomLib.postInitialize(); |
|
110 |
|
|
111 |
JTSIndexLibrary jtsIndex = new JTSIndexLibrary(); |
|
112 |
jtsIndex.initialize(); |
|
113 |
jtsIndex.postInitialize(); |
|
114 |
|
|
115 |
// DefaultGPEDataTypesLibrary gpeDataTypesLibrary = new DefaultGPEDataTypesLibrary(); |
|
116 |
// gpeDataTypesLibrary.initialize(); |
|
117 |
// gpeDataTypesLibrary.postInitialize(); |
|
118 |
|
|
119 |
DALGPELibrary gpeLibrary = new DALGPELibrary(); |
|
120 |
gpeLibrary.initialize(); |
|
121 |
gpeLibrary.postInitialize(); |
|
122 |
|
|
123 |
// DefaultGPELibrary defaultGPElibrary = new DefaultGPELibrary(); |
|
124 |
// defaultGPElibrary.initialize(); |
|
125 |
// defaultGPElibrary.postInitialize(); |
|
126 |
// |
|
127 |
|
|
128 |
// DefaultXmlLibrary defaultXmllibrary = new DefaultXmlLibrary(); |
|
129 |
// defaultXmllibrary.initialize(); |
|
130 |
// defaultXmllibrary.postInitialize(); |
|
131 |
|
|
132 |
// DefaultKmlLibrary kmlLibrary = new DefaultKmlLibrary(); |
|
133 |
// kmlLibrary.initialize(); |
|
134 |
// kmlLibrary.postInitialize(); |
|
135 |
|
|
136 |
// DefaultGmlLibrary gmlLibrary = new DefaultGmlLibrary(); |
|
137 |
// gmlLibrary.initialize(); |
|
138 |
// gmlLibrary.postInitialize(); |
|
139 |
|
|
140 |
SECompatLibrary compatLibrary = new SECompatLibrary(); |
|
141 |
compatLibrary.initialize(); |
|
142 |
compatLibrary.postInitialize(); |
|
143 |
|
|
144 |
gpeManager = GPELocator.getGPEManager(); |
|
145 |
|
|
146 |
dataManager = DALLocator.getDataManager(); |
|
147 |
|
|
148 |
baseTestInitialized = true; |
|
149 |
} |
|
150 |
|
|
151 |
|
|
152 |
public void testGetDataStore(){ |
|
153 |
try { |
|
154 |
DataStoreParameters params = this.getDefaultDataStoreParameters(); |
|
155 |
store = (FeatureStore)dataManager.createStore(params); |
|
156 |
//gpestore.setParserName("GML"); |
|
157 |
|
|
158 |
FeatureSet set; |
|
159 |
// FeatureType type = store.getDefaultFeatureType(); |
|
160 |
|
|
161 |
set = store.getFeatureSet(); |
|
162 |
|
|
163 |
System.out.println("Feature count: " + set.getSize()); |
|
164 |
Iterator it = set.iterator(); |
|
165 |
// Iterator ftIt; |
|
166 |
// FeatureAttributeDescriptor desc; |
|
167 |
|
|
168 |
int i = 0; |
|
169 |
Feature feature; |
|
170 |
while (it.hasNext()) { |
|
171 |
// ftIt = type.iterator(); |
|
172 |
|
|
173 |
System.out.println("====================================="); |
|
174 |
System.out.println("Feature " + i + ": "); |
|
175 |
System.out.println("-------------------------------------"); |
|
176 |
feature = (Feature) it.next(); |
|
177 |
Geometry geom = (Geometry) feature.getDefaultGeometry(); // .getGeometries().get(0); |
|
178 |
|
|
179 |
FeatureType ft = feature.getType(); |
|
180 |
FeatureAttributeDescriptor[] atts = ft.getAttributeDescriptors(); |
|
181 |
int len = atts.length; |
|
182 |
FeatureAttributeDescriptor att; |
|
183 |
for (int j=0; j<len; j++) { |
|
184 |
att = ft.getAttributeDescriptor(j); |
|
185 |
System.out.println("ATT: " + att.getName() + "; VAL = " + feature.get(j).toString()); |
|
186 |
} |
|
187 |
System.out.println("-------------------------------------"); |
|
188 |
Envelope env = geom.getEnvelope(); |
|
189 |
System.out.println("GEOM BB: " |
|
190 |
+ env.getMinimum(0) |
|
191 |
+ ", " + env.getMinimum(1) |
|
192 |
+ ", " + env.getMaximum(0) |
|
193 |
+ ", " + env.getMaximum(1)); |
|
194 |
System.out.println("====================================="); |
|
195 |
i++; |
|
196 |
} |
|
197 |
set.dispose(); |
|
198 |
store.dispose(); |
|
199 |
} catch (DataException e) { |
|
200 |
// TODO Auto-generated catch block |
|
201 |
e.printStackTrace(); |
|
202 |
} catch (ValidateDataParametersException e) { |
|
203 |
// TODO Auto-generated catch block |
|
204 |
e.printStackTrace(); |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
/* |
|
209 |
* (non-Javadoc) |
|
210 |
* |
|
211 |
* @see |
|
212 |
* org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters |
|
213 |
* () |
|
214 |
*/ |
|
215 |
public DataStoreParameters getDefaultDataStoreParameters() |
|
216 |
throws DataException { |
|
217 |
GPEStoreParameters parameters = null; |
|
218 |
|
|
219 |
parameters = (GPEStoreParameters) dataManager |
|
220 |
.createStoreParameters(GPEStoreProvider.NAME); |
|
221 |
|
|
222 |
parameters.setFileName(file_prueba.getAbsolutePath()); |
|
223 |
//IProjection proj = null; |
|
224 |
// parameters.setSRS(CRSFactory.getCRS("ESPG:23030")); |
|
225 |
//parameters.setSRS(proj); |
|
226 |
|
|
227 |
return parameters; |
|
228 |
} |
|
229 |
|
|
230 |
/* |
|
231 |
* (non-Javadoc) |
|
232 |
* |
|
233 |
* @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer() |
|
234 |
*/ |
|
235 |
public boolean hasExplorer() { |
|
236 |
return false; |
|
237 |
} |
|
238 |
|
|
239 |
/* (non-Javadoc) |
|
240 |
* @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#getDefaultNewDataStoreParameters() |
|
241 |
*/ |
|
242 |
public NewFeatureStoreParameters getDefaultNewDataStoreParameters() |
|
243 |
throws Exception { |
|
244 |
return null; |
|
245 |
// if (this.myExplorer == null) { |
|
246 |
// GPEStoreParameters gpeStoreParameters = (GPEStoreParameters) this |
|
247 |
// .getDefaultDataStoreParameters(); |
|
248 |
// FeatureStore store = (FeatureStore) dataManager |
|
249 |
// .createStore(gpeStoreParameters); |
|
250 |
// myExplorer = (FilesystemServerExplorer) store.getExplorer(); |
|
251 |
// store.dispose(); |
|
252 |
// } |
|
253 |
// |
|
254 |
// return (NewFeatureStoreParameters) myExplorer |
|
255 |
// .getAddParameters(dbf_prueba_destino); |
|
256 |
} |
|
257 |
|
|
258 |
/* (non-Javadoc) |
|
259 |
* @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#usesResources() |
|
260 |
*/ |
|
261 |
public boolean usesResources() { |
|
262 |
// TODO Auto-generated method stub |
|
263 |
return false; |
|
264 |
} |
|
265 |
|
|
266 |
public boolean resourcesNotifyChanges() { |
|
267 |
return true; |
|
268 |
} |
|
269 |
|
|
270 |
} |
|
271 |
|
|
0 | 272 |
tags/v2_0_0_Build_2021/extensions/extGPE-gvSIG/src-test/org/gvsig/fmap/dal/store/gpe/GPETest.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.gvsig.fmap.crs.CRSFactory; |
|
33 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
34 |
import org.gvsig.fmap.dal.exception.DataException; |
|
35 |
import org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore; |
|
36 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
37 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
38 |
import org.gvsig.gpe.lib.api.GPELocator; |
|
39 |
import org.gvsig.gpe.lib.api.GPEManager; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
43 |
*/ |
|
44 |
public class GPETest extends BaseTestEditableFeatureStore { |
|
45 |
public static final File file_prueba = new File("testdata/GML-points.gml"); |
|
46 |
|
|
47 |
private FilesystemServerExplorer myExplorer = null; |
|
48 |
private GPEManager gpeManager = null; |
|
49 |
|
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
super.doSetUp(); |
|
52 |
gpeManager = GPELocator.getGPEManager(); |
|
53 |
} |
|
54 |
|
|
55 |
/* |
|
56 |
* (non-Javadoc) |
|
57 |
* |
|
58 |
* @see |
|
59 |
* org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters |
|
60 |
* () |
|
61 |
*/ |
|
62 |
public DataStoreParameters getDefaultDataStoreParameters() |
|
63 |
throws DataException { |
|
64 |
GPEStoreParameters parameters = null; |
|
65 |
|
|
66 |
parameters = (GPEStoreParameters) dataManager |
|
67 |
.createStoreParameters(GPEStoreProvider.NAME); |
|
68 |
|
|
69 |
parameters.setFileName(file_prueba.getAbsolutePath()); |
|
70 |
parameters.setCRS(CRSFactory.getCRS("EPSG:23030")); |
|
71 |
return parameters; |
|
72 |
} |
|
73 |
|
|
74 |
/* |
|
75 |
* (non-Javadoc) |
|
76 |
* |
|
77 |
* @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer() |
|
78 |
*/ |
|
79 |
public boolean hasExplorer() { |
|
80 |
return false; |
|
81 |
} |
|
82 |
|
|
83 |
/* (non-Javadoc) |
|
84 |
* @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#getDefaultNewDataStoreParameters() |
|
85 |
*/ |
|
86 |
public NewFeatureStoreParameters getDefaultNewDataStoreParameters() |
|
87 |
throws Exception { |
|
88 |
return null; |
|
89 |
// if (this.myExplorer == null) { |
|
90 |
// GPEStoreParameters gpeStoreParameters = (GPEStoreParameters) this |
|
91 |
// .getDefaultDataStoreParameters(); |
|
92 |
// FeatureStore store = (FeatureStore) dataManager |
|
93 |
// .createStore(gpeStoreParameters); |
|
94 |
// myExplorer = (FilesystemServerExplorer) store.getExplorer(); |
|
95 |
// store.dispose(); |
|
96 |
// } |
|
97 |
// |
|
98 |
// return (NewFeatureStoreParameters) myExplorer |
|
99 |
// .getAddParameters(dbf_prueba_destino); |
|
100 |
} |
|
101 |
|
|
102 |
/* (non-Javadoc) |
|
103 |
* @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#usesResources() |
|
104 |
*/ |
|
105 |
public boolean usesResources() { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
return false; |
|
108 |
} |
|
109 |
|
|
110 |
public boolean resourcesNotifyChanges() { |
|
111 |
return true; |
|
112 |
} |
|
113 |
|
|
114 |
|
|
115 |
} |
|
116 |
|
|
0 | 117 |
tags/v2_0_0_Build_2021/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_2021/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_2021/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">© 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_2021/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_2021/extensions/extGPE-gvSIG/package.info | ||
---|---|---|
1 |
# |
|
2 |
#Mon Nov 08 09:57:13 CET 2010 |
|
3 |
state=devel |
|
4 |
name=extGPE-gvSIG |
|
5 |
official=true |
|
6 |
code=org.gvsig.gpe.extension |
|
7 |
operating-system=all |
|
8 |
architecture=all |
|
9 |
java-version=j1_5 |
|
10 |
gvSIG-version=2.0.0 |
|
11 |
version=2.0-SNAPSHOT |
|
12 |
type=plugin |
|
13 |
build=2021 |
|
14 |
description=GML and KML support |
|
15 |
model-version=1.0.0 |
tags/v2_0_0_Build_2021/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_2021/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.exception.DataException; |
|
14 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
15 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
16 |
import org.gvsig.fmap.dal.feature.Feature; |
|
17 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
18 |
import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider; |
|
19 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
|
20 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
|
21 |
import org.gvsig.fmap.dal.store.gpe.GPEStoreProvider; |
|
22 |
import org.gvsig.fmap.dal.store.gpe.model.GPEElement; |
|
23 |
import org.gvsig.fmap.dal.store.gpe.model.GPEFeature; |
|
24 |
import org.gvsig.fmap.geom.Geometry; |
|
25 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
26 |
import org.gvsig.fmap.geom.GeometryManager; |
|
27 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
28 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
29 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
|
30 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
|
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.Surface; |
|
39 |
import org.gvsig.gpe.lib.api.parser.IAttributesIterator; |
|
40 |
import org.gvsig.gpe.lib.api.parser.ICoordinateIterator; |
|
41 |
import org.gvsig.gpe.lib.api.parser.IGPEErrorHandler; |
|
42 |
import org.gvsig.gpe.lib.impl.parser.GPEContentHandler; |
|
43 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
44 |
* |
|
45 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
46 |
* |
|
47 |
* This program is free software; you can redistribute it and/or |
|
48 |
* modify it under the terms of the GNU General Public License |
|
49 |
* as published by the Free Software Foundation; either version 2 |
|
50 |
* of the License, or (at your option) any later version. |
|
51 |
* |
|
52 |
* This program is distributed in the hope that it will be useful, |
|
53 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
54 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
55 |
* GNU General Public License for more details. |
|
56 |
* |
|
57 |
* You should have received a copy of the GNU General Public License |
|
58 |
* along with this program; if not, write to the Free Software |
|
59 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
60 |
* |
|
61 |
* For more information, contact: |
|
62 |
* |
|
63 |
* Generalitat Valenciana |
|
64 |
* Conselleria d'Infraestructures i Transport |
|
65 |
* Av. Blasco Ib??ez, 50 |
|
66 |
* 46010 VALENCIA |
|
67 |
* SPAIN |
|
68 |
* |
|
69 |
* +34 963862235 |
|
70 |
* gvsig@gva.es |
|
71 |
* www.gvsig.gva.es |
|
72 |
* |
|
73 |
* or |
|
74 |
* |
|
75 |
* IVER T.I. S.A |
|
76 |
* Salamanca 50 |
|
77 |
* 46005 Valencia |
|
78 |
* Spain |
|
79 |
* |
|
80 |
* +34 963163400 |
|
81 |
* dac@iver.es |
|
82 |
*/ |
|
83 |
/* CVS MESSAGES: |
|
84 |
* |
|
85 |
* $Id$ |
|
86 |
* $Log$ |
|
87 |
* |
|
88 |
*/ |
|
89 |
/** |
|
90 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
91 |
*/ |
|
92 |
public class FmapContentHandler extends GPEContentHandler { |
|
93 |
private HashMap featureSet = null; |
|
94 |
private EditableFeatureType featureType = null; |
|
95 |
private FeatureStoreProviderServices store = null; |
|
96 |
private GPEStoreProvider storeProvider = null; |
|
97 |
private GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
98 |
private int featureId = 0; |
|
99 |
private Envelope envelope = null; |
|
100 |
private File file = null; |
|
101 |
private IProjection srs = null; |
|
102 |
private int geometryType = 0; |
|
103 |
|
|
104 |
public FmapContentHandler(IGPEErrorHandler errorHandler, FeatureStoreProviderServices store, |
|
105 |
GPEStoreProvider storeProvider, File file, IProjection srs, int geometryType) { |
|
106 |
super(); |
|
107 |
setErrorHandler(errorHandler); |
|
108 |
this.store = store; |
|
109 |
this.storeProvider = storeProvider; |
|
110 |
this.file = file; |
|
111 |
this.srs = srs; |
|
112 |
this.geometryType = geometryType; |
|
113 |
} |
|
114 |
|
|
115 |
public int getFeaturesCount(){ |
|
116 |
return featureSet.size(); |
|
117 |
} |
|
118 |
|
|
119 |
public Feature getFeatureAt(int index){ |
|
120 |
return (Feature)featureSet.get(new Integer(index)); |
|
121 |
} |
|
122 |
|
|
123 |
public EditableFeatureType getFeatureType(){ |
|
124 |
return featureType; |
|
125 |
} |
|
126 |
|
|
127 |
|
|
128 |
/** |
|
129 |
* @return the featureSet |
|
130 |
*/ |
|
131 |
public HashMap getFeatureSet() { |
|
132 |
return featureSet; |
|
133 |
} |
|
134 |
|
|
135 |
/* |
|
136 |
* (non-Javadoc) |
|
137 |
* @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) |
|
138 |
*/ |
|
139 |
public Object startLayer(String id, String namespace, String name, |
|
140 |
String description, String srs, IAttributesIterator iterator, Object parentLayer, Object box) { |
|
141 |
if (featureSet == null){ |
|
142 |
featureSet = new HashMap(); |
|
143 |
} |
|
144 |
// try { |
|
145 |
// schemaManager = new XMLSchemaManager(); |
|
146 |
// schemaManager.addSchemas(iterator, file); |
|
147 |
// } catch (Exception e) { |
|
148 |
// getErrorHandler().addError(e); |
|
149 |
// } |
|
150 |
return featureSet; |
|
151 |
} |
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
/* |
|
156 |
* (non-Javadoc) |
|
157 |
* @see org.gvsig.gpe.IGPEContentHandler#endLayer(java.lang.Object) |
|
158 |
*/ |
|
159 |
public void endLayer(Object layer) { |
|
160 |
storeProvider.setEnvelope(envelope); |
|
161 |
} |
|
162 |
|
|
163 |
/* |
|
164 |
* (non-Javadoc) |
|
165 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startPoint(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
166 |
*/ |
|
167 |
public Object startPoint(String id, ICoordinateIterator coords, String srs) { |
|
168 |
return createPoint(coords); |
|
169 |
} |
|
170 |
|
|
171 |
private Point createPoint(ICoordinateIterator coords){ |
|
172 |
double[] buffer = new double[coords.getDimension()]; |
|
173 |
try { |
|
174 |
coords.hasNext(); |
|
175 |
coords.next(buffer); |
|
176 |
Point point = null; |
|
177 |
if (coords.getDimension() == 2){ |
|
178 |
point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D); |
|
179 |
}else if (coords.getDimension() == 3){ |
|
180 |
point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM2DZ); |
|
181 |
} |
|
182 |
for (int i=0 ; i<buffer.length ; i++){ |
|
183 |
point.setCoordinateAt(i, buffer[i]); |
|
184 |
} |
|
185 |
return point; |
|
186 |
} catch (IOException e) { |
|
187 |
getErrorHandler().addError(e); |
|
188 |
} catch (CreateGeometryException e) { |
|
189 |
getErrorHandler().addError(e); |
|
190 |
} |
|
191 |
return null; |
|
192 |
} |
|
193 |
|
|
194 |
private Point createPoint(double[] buffer){ |
|
195 |
try { |
|
196 |
Point point = null; |
|
197 |
if (buffer.length == 2){ |
|
198 |
point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D); |
|
199 |
}else if (buffer.length == 3){ |
|
200 |
point = (Point) geomManager.create(TYPES.POINT, SUBTYPES.GEOM2DZ); |
|
201 |
} |
|
202 |
for (int i=0 ; i<buffer.length ; i++){ |
|
203 |
point.setCoordinateAt(i, buffer[i]); |
|
204 |
} |
|
205 |
return point; |
|
206 |
}catch (CreateGeometryException e) { |
|
207 |
getErrorHandler().addError(e); |
|
208 |
} |
|
209 |
return null; |
|
210 |
} |
|
211 |
|
|
212 |
|
|
213 |
/* (non-Javadoc) |
|
214 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startLineString(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
215 |
*/ |
|
216 |
public Object startLineString(String id, ICoordinateIterator coords, |
|
217 |
String srs) { |
|
218 |
return createCurve(coords); |
|
219 |
} |
|
220 |
|
|
221 |
private Curve createCurve(ICoordinateIterator coords){ |
|
222 |
GeneralPathX gp = createGeneralPathX(coords); |
|
223 |
try { |
|
224 |
Curve curve = null; |
|
225 |
if (coords.getDimension() == 2){ |
|
226 |
curve = (Curve) geomManager.create(TYPES.CURVE, SUBTYPES.GEOM2D); |
|
227 |
}else if (coords.getDimension() == 3){ |
|
228 |
curve = (Curve) geomManager.create(TYPES.CURVE, SUBTYPES.GEOM2DZ); |
|
229 |
} |
|
230 |
curve.setGeneralPath(gp); |
|
231 |
return curve; |
|
232 |
} catch (CreateGeometryException e) { |
|
233 |
getErrorHandler().addError(e); |
|
234 |
} |
|
235 |
return null; |
|
236 |
} |
|
237 |
|
|
238 |
private GeneralPathX createGeneralPathX(ICoordinateIterator coords){ |
|
239 |
GeneralPathX gp = new GeneralPathX(); |
|
240 |
if (coords == null){ |
|
241 |
return gp; |
|
242 |
} |
|
243 |
double[] buffer = new double[coords.getDimension()]; |
|
244 |
try { |
|
245 |
if (coords.hasNext()){ |
|
246 |
coords.next(buffer); |
|
247 |
gp.moveTo(buffer[0], buffer[1]); |
|
248 |
} |
|
249 |
while(coords.hasNext()){ |
|
250 |
coords.next(buffer); |
|
251 |
gp.lineTo(buffer[0], buffer[1]); |
|
252 |
} |
|
253 |
} catch (IOException e) { |
|
254 |
getErrorHandler().addError(e); |
|
255 |
} |
|
256 |
return gp; |
|
257 |
} |
|
258 |
|
|
259 |
/* (non-Javadoc) |
|
260 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startPolygon(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
261 |
*/ |
|
262 |
|
|
263 |
public Object startPolygon(String id, ICoordinateIterator coords, String srs) { |
|
264 |
return createSurface(coords); |
|
265 |
} |
|
266 |
|
|
267 |
private Surface createSurface(ICoordinateIterator coords){ |
|
268 |
GeneralPathX gp = createGeneralPathX(coords); |
|
269 |
try { |
|
270 |
Surface surface = null; |
|
271 |
if (coords.getDimension() == 2){ |
|
272 |
surface = (Surface) geomManager.create(TYPES.SURFACE, SUBTYPES.GEOM2D); |
|
273 |
}else if (coords.getDimension() == 3){ |
|
274 |
surface = (Surface) geomManager.create(TYPES.SURFACE, SUBTYPES.GEOM2DZ); |
|
275 |
} |
|
276 |
surface.setGeneralPath(gp); |
|
277 |
return surface; |
|
278 |
} catch (CreateGeometryException e) { |
|
279 |
getErrorHandler().addError(e); |
|
280 |
} |
|
281 |
return null; |
|
282 |
} |
|
283 |
|
|
284 |
|
|
285 |
/* (non-Javadoc) |
|
286 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startInnerPolygon(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
287 |
*/ |
|
288 |
public Object startInnerPolygon(String id, ICoordinateIterator coords, |
|
289 |
String srs) { |
|
290 |
return createSurface(coords); |
|
291 |
} |
|
292 |
|
|
293 |
/* |
|
294 |
* (non-Javadoc) |
|
295 |
* @see org.gvsig.gpe.IGPEContentHandler#addGeometryToFeature(java.lang.Object, java.lang.Object) |
|
296 |
*/ |
|
297 |
public void addGeometryToFeature(Object geometry, Object feature) { |
|
298 |
((GPEFeature)feature).setGeometry((Geometry)geometry); |
|
299 |
} |
|
300 |
|
|
301 |
/* |
|
302 |
* (non-Javadoc) |
|
303 |
* @see org.gvsig.gpe.IGPEContentHandler#addBboxToLayer(java.lang.Object, java.lang.Object) |
|
304 |
*/ |
|
305 |
public void addBboxToLayer(Object bbox, Object layer) { |
|
306 |
// if (layer != null){ |
|
307 |
// GPEBBox gpeBBox = (GPEBBox)bbox; |
|
308 |
// if (gpeBBox.getSrs() != null){ |
|
309 |
// IProjection projection = null; |
|
310 |
// try{ |
|
311 |
// CRSFactory.getCRS(gpeBBox.getSrs()); |
|
312 |
// }catch(Exception e){ |
|
313 |
// //If the CRS factory has an error. |
|
314 |
// } |
|
315 |
// if ((projection != null) && (!(projection.equals(((FLayer)layer).getProjection())))){ |
|
316 |
// //TODO reproyectar la bbox y asignarsela a la capa |
|
317 |
// } |
|
318 |
// } |
|
319 |
// ((IGPEDriver)layer).setExtent(gpeBBox.getBbox2D()); |
|
320 |
// } |
|
321 |
} |
|
322 |
|
|
323 |
/* |
|
324 |
* (non-Javadoc) |
|
325 |
* @see org.gvsig.gpe.IGPEContentHandler#addElementToFeature(java.lang.Object, java.lang.Object) |
|
326 |
*/ |
|
327 |
public void addElementToFeature(Object element, Object feature) { |
|
328 |
GPEElement gpeElement = (GPEElement)element; |
|
329 |
((GPEFeature)feature).addElement(gpeElement); |
|
330 |
} |
|
331 |
|
|
332 |
/* |
|
333 |
* (non-Javadoc) |
|
334 |
* @see org.gvsig.gpe.IGPEContentHandler#addFeatureToLayer(java.lang.Object, java.lang.Object) |
|
335 |
*/ |
|
336 |
public void addFeatureToLayer(Object feature, Object layer) { |
|
337 |
GPEFeature gpefeature = (GPEFeature)feature; |
|
338 |
Envelope currentEnvelope = gpefeature.getEnvelope(); |
|
339 |
if (featureType == null){ |
|
340 |
createFeatureType(gpefeature); |
|
341 |
|
|
342 |
//Initialize the envelope |
|
343 |
try { |
|
344 |
envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D); |
|
345 |
} catch (CreateEnvelopeException e) { |
|
346 |
getErrorHandler().addError(e); |
|
347 |
} |
|
348 |
//Calculates the envelope |
|
349 |
envelope = currentEnvelope; |
|
350 |
}else{ |
|
351 |
//Calculates the envelope |
|
352 |
envelope.add(currentEnvelope); |
|
353 |
} |
|
354 |
//If it is null is a multilayer: not supported yet |
|
355 |
if (layer != null){ |
|
356 |
FeatureProvider data; |
|
357 |
try { |
|
358 |
data = new DefaultFeatureProvider(featureType.getNotEditableCopy(), storeProvider.createNewOID()); |
|
359 |
Map elements = gpefeature.getelements(); |
|
360 |
Iterator keys = elements.keySet().iterator(); |
|
361 |
data.setDefaultGeometry(gpefeature.getGeometry()); |
|
362 |
data.set("the_geom", gpefeature.getGeometry()); |
|
363 |
data.setOID(gpefeature.getId()); |
|
364 |
while (keys.hasNext()){ |
|
365 |
String elementName = (String)keys.next(); |
|
366 |
if (!elementName.equals("the_geom")){ |
|
367 |
data.set(elementName, ((GPEElement)elements.get(elementName)).getValue()); |
|
368 |
} |
|
369 |
} |
|
370 |
Feature dalFeature = store.createFeature(data); |
|
371 |
((HashMap)layer).put(gpefeature.getId(),dalFeature); |
|
372 |
|
|
373 |
} catch (DataException e) { |
|
374 |
getErrorHandler().addError(e); |
|
375 |
} |
|
376 |
} |
|
377 |
} |
|
378 |
|
|
379 |
private void createFeatureType(GPEFeature gpefeature){ |
|
380 |
Map elements = gpefeature.getelements(); |
|
381 |
Iterator keys = elements.keySet().iterator(); |
|
382 |
featureType = store.createFeatureType(); |
|
383 |
EditableFeatureAttributeDescriptor attributeDescriptor = featureType.add("the_geom", DataTypes.GEOMETRY).setGeometryType(geometryType); |
|
384 |
attributeDescriptor.setGeometrySubType(SUBTYPES.GEOM2D); |
|
385 |
attributeDescriptor.setSRS(srs); |
|
386 |
featureType.setDefaultGeometryAttributeName("the_geom"); |
|
387 |
featureType.setHasOID(true); |
|
388 |
while (keys.hasNext()){ |
|
389 |
String elementName = (String)keys.next(); |
|
390 |
if (!elementName.equals("the_geom")){ |
|
391 |
featureType.add(elementName, DataTypes.STRING); |
|
392 |
} |
|
393 |
} |
|
394 |
FeatureType defaultType = featureType.getNotEditableCopy(); |
|
395 |
List types = new ArrayList(1); |
|
396 |
types.add(defaultType); |
|
397 |
this.store.setFeatureTypes(types, defaultType); |
|
398 |
} |
|
399 |
|
|
400 |
/* |
|
401 |
* (non-Javadoc) |
|
402 |
* @see org.gvsig.gpe.IGPEContentHandler#addInnerPolygonToPolygon(java.lang.Object, java.lang.Object) |
|
403 |
*/ |
|
404 |
public void addInnerPolygonToPolygon(Object innerPolygon, Object Polygon) { |
|
405 |
//((Geometry)Polygon).addGeometry((GPEGeometry)innerPolygon); |
|
406 |
} |
|
407 |
|
|
408 |
/* |
|
409 |
* (non-Javadoc) |
|
410 |
* @see org.gvsig.gpe.IGPEContentHandler#addNameToFeature(java.lang.String, java.lang.Object) |
|
411 |
*/ |
|
412 |
public void addNameToFeature(String name, Object feature) { |
|
413 |
|
|
414 |
} |
|
415 |
|
|
416 |
/* |
|
417 |
* (non-Javadoc) |
|
418 |
* @see org.gvsig.gpe.IGPEContentHandler#addParentElementToElement(java.lang.Object, java.lang.Object) |
|
419 |
*/ |
|
420 |
public void addParentElementToElement(Object parent, Object element) { |
|
421 |
|
|
422 |
} |
|
423 |
|
|
424 |
/* |
|
425 |
* (non-Javadoc) |
|
426 |
* @see org.gvsig.gpe.IGPEContentHandler#addSrsToLayer(java.lang.String, java.lang.Object) |
|
427 |
*/ |
|
428 |
public void addSrsToLayer(String srs, Object Layer) { |
|
429 |
// this.srs = srs; |
|
430 |
} |
|
431 |
|
|
432 |
|
|
433 |
/* (non-Javadoc) |
|
434 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startBbox(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
435 |
*/ |
|
436 |
public Object startBbox(String id, ICoordinateIterator coords, String srs) { |
|
437 |
Envelope envelope = null; |
|
438 |
try { |
|
439 |
if (coords.getDimension() == 2){ |
|
440 |
envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D); |
|
441 |
}else if (coords.getDimension() == 3){ |
|
442 |
envelope = geomManager.createEnvelope(SUBTYPES.GEOM2DZ); |
|
443 |
} |
|
444 |
double[] buffer = new double[coords.getDimension()]; |
|
445 |
|
|
446 |
if (coords.hasNext()){ |
|
447 |
coords.next(buffer); |
|
448 |
envelope.setLowerCorner(createPoint(buffer)); |
|
449 |
} |
|
450 |
if (coords.hasNext()){ |
|
451 |
coords.next(buffer); |
|
452 |
envelope.setUpperCorner(createPoint(buffer)); |
|
453 |
} |
|
454 |
} catch (IOException e) { |
|
455 |
getErrorHandler().addError(e); |
|
456 |
} catch (CreateEnvelopeException e) { |
|
457 |
getErrorHandler().addError(e); |
|
458 |
} |
|
459 |
return envelope; |
|
460 |
} |
|
461 |
|
|
462 |
/* |
|
463 |
* (non-Javadoc) |
|
464 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startElement(java.lang.String, java.lang.String, java.lang.Object, org.gvsig.gpe.parser.IAttributesIterator, java.lang.Object) |
|
465 |
*/ |
|
466 |
public Object startElement(String namespace, String name, Object value, |
|
467 |
IAttributesIterator attributesIterator, Object parentElement) { |
|
468 |
return new GPEElement(name, (String)value, (GPEElement)parentElement); |
|
469 |
} |
|
470 |
|
|
471 |
/* |
|
472 |
* (non-Javadoc) |
|
473 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startFeature(java.lang.String, java.lang.String, java.lang.String, org.gvsig.gpe.parser.IAttributesIterator, java.lang.Object) |
|
474 |
*/ |
|
475 |
public Object startFeature(String id, String namespace, String name, |
|
476 |
IAttributesIterator attributes, Object layer){ |
|
477 |
String sId; |
|
478 |
if (id == null){ |
|
479 |
sId = new String(new Long(featureId).toString()); |
|
480 |
}else{ |
|
481 |
sId = id; |
|
482 |
} |
|
483 |
featureId++; |
|
484 |
//Check the xml schema... |
|
485 |
// for (int i=0 ; i<schemas.size() ; i++){ |
|
486 |
// IXSSchema schema = schemas.get(i); |
|
487 |
// IXSElementDeclaration element = schema.getElementDeclarationByName(namespace, name); |
|
488 |
// if (element != null){ |
|
489 |
// featureType = store.createFeatureType(); |
|
490 |
// IXSTypeDefinition type = element.getTypeDefinition(); |
|
491 |
// if (type instanceof IXSComplexTypeDefinition){ |
|
492 |
// IXSComplexTypeDefinition complexType = (IXSComplexTypeDefinition)type; |
|
493 |
// complexType.getContentType(). |
|
494 |
// } |
|
495 |
// |
|
496 |
// featureType.add("the_geom", DataTypes.GEOMETRY).setGeometryType(TYPES.GEOMETRY); |
|
497 |
// featureType.setDefaultGeometryAttributeName("the_geom"); |
|
498 |
// featureType.setHasOID(true); |
|
499 |
// while (keys.hasNext()){ |
|
500 |
// String elementName = (String)keys.next(); |
|
501 |
// featureType.add(elementName, DataTypes.STRING); |
|
502 |
// } |
|
503 |
// FeatureType defaultType = featureType.getNotEditableCopy(); |
|
504 |
// List types = new ArrayList(1); |
|
505 |
// types.add(defaultType); |
|
506 |
// this.store.setFeatureTypes(types, defaultType); |
|
507 |
// |
|
508 |
// //Initialize the envelope |
|
509 |
// try { |
|
510 |
// envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D); |
|
511 |
// } catch (CreateEnvelopeException e) { |
|
512 |
// getErrorHandler().addError(e); |
|
513 |
// } |
|
514 |
// } |
|
515 |
// } |
|
516 |
return new GPEFeature(sId, |
|
517 |
name, name); |
|
518 |
} |
|
519 |
|
|
520 |
/* (non-Javadoc) |
|
521 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startLinearRing(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
522 |
*/ |
|
523 |
public Object startLinearRing(String id, ICoordinateIterator coords, |
|
524 |
String srs) { |
|
525 |
return createSurface(coords); |
|
526 |
} |
|
527 |
|
|
528 |
/* |
|
529 |
* (non-Javadoc) |
|
530 |
* @see org.gvsig.gpe.IGPEContentHandler#startMultiPoint(java.lang.String, java.lang.String) |
|
531 |
*/ |
|
532 |
public Object startMultiPoint(String id, String srs) { |
|
533 |
try { |
|
534 |
return geomManager.create(TYPES.MULTIPOINT, SUBTYPES.GEOM2D); |
|
535 |
} catch (CreateGeometryException e) { |
|
536 |
getErrorHandler().addError(e); |
|
537 |
} |
|
538 |
return null; |
|
539 |
} |
|
540 |
|
|
541 |
/* |
|
542 |
* (non-Javadoc) |
|
543 |
* @see org.gvsig.gpe.IGPEContentHandler#addPointToMultiPoint(java.lang.Object, java.lang.Object) |
|
544 |
*/ |
|
545 |
public void addPointToMultiPoint(Object point, Object multiPoint) { |
|
546 |
((MultiPoint)multiPoint).addPoint((Point)point); |
|
547 |
} |
|
548 |
|
|
549 |
/* |
|
550 |
* (non-Javadoc) |
|
551 |
* @see org.gvsig.gpe.IGPEContentHandler#startMultiLineString(java.lang.String, java.lang.String) |
|
552 |
*/ |
|
553 |
public Object startMultiLineString(String id, String srs) { |
|
554 |
super.startMultiLineString(id, srs); |
|
555 |
try { |
|
556 |
return geomManager.create(TYPES.MULTICURVE, SUBTYPES.GEOM2D); |
|
557 |
} catch (CreateGeometryException e) { |
|
558 |
getErrorHandler().addError(e); |
|
559 |
} |
|
560 |
return null; |
|
561 |
} |
|
562 |
|
|
563 |
/* |
|
564 |
* (non-Javadoc) |
|
565 |
* @see org.gvsig.gpe.IGPEContentHandler#addLineStringToMultiLineString(java.lang.Object, java.lang.Object) |
|
566 |
*/ |
|
567 |
public void addLineStringToMultiLineString(Object lineString, Object multiLineString) { |
|
568 |
((MultiCurve)multiLineString).addCurve((Curve)lineString); |
|
569 |
} |
|
570 |
|
|
571 |
/* |
|
572 |
* (non-Javadoc) |
|
573 |
* @see org.gvsig.gpe.IGPEContentHandler#startMultiPolygon(java.lang.String, java.lang.String) |
|
574 |
*/ |
|
575 |
public Object startMultiPolygon(String id, String srs) { |
|
576 |
super.startMultiPolygon(id, srs); |
|
577 |
try { |
|
578 |
return geomManager.create(TYPES.MULTISURFACE, SUBTYPES.GEOM2D); |
|
579 |
} catch (CreateGeometryException e) { |
|
580 |
getErrorHandler().addError(e); |
|
581 |
} |
|
582 |
return null; |
|
583 |
} |
|
584 |
|
|
585 |
/* |
|
586 |
* (non-Javadoc) |
|
587 |
* @see org.gvsig.gpe.IGPEContentHandler#addPolygonToMultiPolygon(java.lang.Object, java.lang.Object) |
|
588 |
*/ |
|
589 |
public void addPolygonToMultiPolygon(Object polygon, Object multiPolygon) { |
|
590 |
((MultiSurface)multiPolygon).addSurface((Surface)polygon); |
|
591 |
} |
|
592 |
|
|
593 |
/* (non-Javadoc) |
|
594 |
* @see org.gvsig.gpe.GPEContentHandler#addCurveToMultiCurve(java.lang.Object, java.lang.Object) |
|
595 |
*/ |
|
596 |
public void addCurveToMultiCurve(Object curve, Object multiCurve) { |
|
597 |
((MultiCurve)multiCurve).addCurve((Curve)curve); |
|
598 |
} |
|
599 |
|
|
600 |
/* (non-Javadoc) |
|
601 |
* @see org.gvsig.gpe.GPEContentHandler#addSegmentToCurve(java.lang.Object, java.lang.Object) |
|
602 |
*/ |
|
603 |
public void addSegmentToCurve(Object segment, Object curve) { |
|
604 |
((Curve)curve).addVertex((Point)segment); |
|
605 |
} |
|
606 |
|
|
607 |
/* (non-Javadoc) |
|
608 |
* @see org.gvsig.gpe.parser.GPEContentHandler#startCurve(java.lang.String, org.gvsig.gpe.parser.ICoordinateIterator, java.lang.String) |
|
609 |
*/ |
|
610 |
public Object startCurve(String id, ICoordinateIterator coords, String srs) { |
|
611 |
return createCurve(coords); |
|
612 |
} |
|
613 |
|
|
614 |
/* (non-Javadoc) |
|
615 |
* @see org.gvsig.gpe.GPEContentHandler#startCurve(java.lang.String, java.lang.String) |
|
616 |
*/ |
|
617 |
public Object startCurve(String id, String srs) { |
|
618 |
return createCurve(null); |
|
619 |
} |
|
620 |
|
|
621 |
/* (non-Javadoc) |
|
622 |
* @see org.gvsig.gpe.GPEContentHandler#startMultiCurve(java.lang.String, java.lang.String) |
|
623 |
*/ |
|
624 |
public Object startMultiCurve(String id, String srs) { |
|
625 |
try { |
|
626 |
return geomManager.create(TYPES.MULTICURVE, SUBTYPES.GEOM2D); |
|
627 |
} catch (CreateGeometryException e) { |
|
628 |
getErrorHandler().addError(e); |
|
629 |
} |
|
630 |
return null; |
|
631 |
} |
|
632 |
|
|
633 |
/* (non-Javadoc) |
|
634 |
* @see org.gvsig.gpe.GPEContentHandler#addGeometryToMultiGeometry(java.lang.Object, java.lang.Object) |
|
635 |
*/ |
|
636 |
public void addGeometryToMultiGeometry(Object geometry, Object multiGeometry) { |
|
637 |
((MultiCurve)multiGeometry).addCurve((Curve)geometry); |
|
638 |
} |
|
639 |
|
|
640 |
/* (non-Javadoc) |
|
641 |
* @see org.gvsig.gpe.GPEContentHandler#startMultiGeometry(java.lang.String, java.lang.String) |
|
642 |
*/ |
|
643 |
public Object startMultiGeometry(String id, String srs) { |
|
644 |
try { |
|
645 |
return geomManager.create(TYPES.AGGREGATE, SUBTYPES.GEOM2D); |
|
646 |
} catch (CreateGeometryException e) { |
|
647 |
getErrorHandler().addError(e); |
|
648 |
} |
|
649 |
return null; |
|
650 |
} |
|
651 |
|
|
652 |
/** |
|
653 |
* @return a new OID |
|
654 |
*/ |
|
655 |
public Object createNewOID() { |
|
656 |
featureId++; |
|
657 |
return String.valueOf(featureId); |
|
658 |
} |
|
659 |
|
|
660 |
} |
|
0 | 661 |
tags/v2_0_0_Build_2021/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 |
} |
Also available in: Unified diff