Revision 33934
tags/v2_0_0_Build_2020/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_2020/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_2020/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_2020/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_2020/extensions/extGPE-gvSIG/package.info | ||
---|---|---|
1 |
# |
|
2 |
#Tue Oct 26 12:07:09 CEST 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=2020 |
|
14 |
description=Base POM for all GvSIG extension projects. This pom knows\n\t\thow to build and made an extension for GvSIG. The property\n\t\t"build-dir" must be set up correctly. |
tags/v2_0_0_Build_2020/extensions/extGPE-gvSIG/src/org/gvsig/gpe/GPELibraryExtension.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.gpe; |
|
29 |
|
|
30 |
import org.gvsig.andami.plugins.Extension; |
|
31 |
|
|
32 |
|
|
33 |
/** |
|
34 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
35 |
*/ |
|
36 |
public class GPELibraryExtension extends Extension{ |
|
37 |
// private DALGPELibrary lib = null; |
|
38 |
|
|
39 |
/* (non-Javadoc) |
|
40 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
|
41 |
*/ |
|
42 |
public void execute(String actionCommand) { |
|
43 |
// TODO Auto-generated method stub |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
/* (non-Javadoc) |
|
48 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
49 |
*/ |
|
50 |
public void initialize() { |
|
51 |
// lib = new DALGPELibrary(); |
|
52 |
// lib.initialize(); |
|
53 |
} |
|
54 |
|
|
55 |
/* (non-Javadoc) |
|
56 |
* @see com.iver.andami.plugins.Extension#postInitialize() |
|
57 |
*/ |
|
58 |
public void postInitialize() { |
|
59 |
// lib.postInitialize(); |
|
60 |
} |
|
61 |
|
|
62 |
/* (non-Javadoc) |
|
63 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
|
64 |
*/ |
|
65 |
public boolean isEnabled() { |
|
66 |
return false; |
|
67 |
} |
|
68 |
|
|
69 |
/* (non-Javadoc) |
|
70 |
* @see com.iver.andami.plugins.IExtension#isVisible() |
|
71 |
*/ |
|
72 |
public boolean isVisible() { |
|
73 |
return false; |
|
74 |
} |
|
75 |
|
|
76 |
} |
|
77 |
|
|
0 | 78 |
tags/v2_0_0_Build_2020/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_2020/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_2020/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_2020/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 String value = null; |
|
57 |
private HashMap subElements = null; |
|
58 |
|
|
59 |
public GPEElement(String name, String value) { |
|
60 |
super(); |
|
61 |
this.name = name; |
|
62 |
this.value = value; |
|
63 |
subElements = new HashMap(); |
|
64 |
} |
|
65 |
|
|
66 |
public GPEElement(String name, String 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 String 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_2020/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.primitive.Envelope; |
|
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 GPEFeature { |
|
58 |
private static int idFeature = 0; |
|
59 |
private Geometry geometry = null; |
|
60 |
private LinkedHashMap elements = null; |
|
61 |
private String id = null; |
|
62 |
private String name = null; |
|
63 |
private String typeName = null; |
|
64 |
|
|
65 |
public GPEFeature(String id, String name, String typeName) { |
|
66 |
this(); |
|
67 |
this.id = id; |
|
68 |
this.name = name; |
|
69 |
this.typeName = typeName; |
|
70 |
} |
|
71 |
|
|
72 |
public GPEFeature(){ |
|
73 |
elements = new LinkedHashMap(); |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* @return the id |
|
78 |
*/ |
|
79 |
public String getId() { |
|
80 |
return id; |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* @param id the id to set |
|
85 |
*/ |
|
86 |
public void setId(String id) { |
|
87 |
this.id = id; |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* @return the geometry |
|
92 |
*/ |
|
93 |
public Geometry getGeometry() { |
|
94 |
return geometry; |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* @param geometry the geometry to set |
|
99 |
*/ |
|
100 |
public void setGeometry(Geometry geometry) { |
|
101 |
this.geometry = geometry; |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* @return the elements |
|
106 |
*/ |
|
107 |
public LinkedHashMap getelements() { |
|
108 |
return elements; |
|
109 |
} |
|
110 |
|
|
111 |
/** |
|
112 |
* @param elements the elements to set |
|
113 |
*/ |
|
114 |
public void setElements(LinkedHashMap elements) { |
|
115 |
this.elements = elements; |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* It adds a new element |
|
120 |
* @param element |
|
121 |
* The element to add |
|
122 |
*/ |
|
123 |
public void addElement(GPEElement element){ |
|
124 |
elements.put(element.getName(), element); |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* @return the name |
|
129 |
*/ |
|
130 |
public String getName() { |
|
131 |
return name; |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* @return the typeName |
|
136 |
*/ |
|
137 |
public String getTypeName() { |
|
138 |
return typeName; |
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* Initialize the feature id |
|
143 |
*/ |
|
144 |
public static void initIdFeature(){ |
|
145 |
idFeature = 0; |
|
146 |
} |
|
147 |
|
|
148 |
public Envelope getEnvelope() { |
|
149 |
if (geometry == null){ |
|
150 |
return null; |
|
151 |
} |
|
152 |
return geometry.getEnvelope(); |
|
153 |
} |
|
154 |
} |
|
0 | 155 |
tags/v2_0_0_Build_2020/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.metadata.exceptions.MetadataException; |
|
42 |
import org.gvsig.tools.library.AbstractLibrary; |
|
43 |
import org.gvsig.tools.library.Library; |
|
44 |
import org.gvsig.tools.library.LibraryException; |
|
45 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
46 |
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator; |
|
47 |
import org.gvsig.xmlschema.lib.api.XMLSchemaManager; |
|
48 |
import org.gvsig.xmlschema.lib.impl.DefaultXMLSchemaLibrary; |
|
49 |
|
|
50 |
/** |
|
51 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
52 |
*/ |
|
53 |
public class DALGPELibrary extends AbstractLibrary { |
|
54 |
|
|
55 |
public DALGPELibrary() { |
|
56 |
super(DALGPELibrary.class, Library.TYPE.IMPL); |
|
57 |
require(DALLibrary.class); |
|
58 |
require(DALFileLibrary.class); |
|
59 |
require(DefaultXMLSchemaLibrary.class); |
|
60 |
} |
|
61 |
|
|
62 |
protected void doInitialize() throws LibraryException { |
|
63 |
// Do nothing |
|
64 |
} |
|
65 |
|
|
66 |
protected void doPostInitialize() throws LibraryException { |
|
67 |
|
|
68 |
List exs = new ArrayList(); |
|
69 |
|
|
70 |
FileHelper.registerParametersDefinition( |
|
71 |
GPEStoreParameters.PARAMETERS_DEFINITION_NAME, |
|
72 |
GPEStoreParameters.class, "GPEParameters.xml"); |
|
73 |
try { |
|
74 |
FileHelper.registerMetadataDefinition( |
|
75 |
GPEStoreProvider.METADATA_DEFINITION_NAME, |
|
76 |
GPEStoreProvider.class, "GPEMetadata.xml"); |
|
77 |
} catch (MetadataException e) { |
|
78 |
exs.add(e); |
|
79 |
} |
|
80 |
|
Also available in: Unified diff