Revision 11464
trunk/libraries/libGPE/src/org/gvsig/gpe/writers/GPEWriterHandler.java | ||
---|---|---|
49 | 49 |
* |
50 | 50 |
* $Id$ |
51 | 51 |
* $Log$ |
52 |
* Revision 1.6 2007-04-26 14:29:15 jorpiell |
|
52 |
* Revision 1.7 2007-05-07 07:06:26 jorpiell |
|
53 |
* Add a constructor with the name and the description fields |
|
54 |
* |
|
55 |
* Revision 1.6 2007/04/26 14:29:15 jorpiell |
|
53 | 56 |
* Add a getStringProperty method to the GEPDeafults |
54 | 57 |
* |
55 | 58 |
* Revision 1.5 2007/04/19 11:50:20 csanchez |
... | ... | |
79 | 82 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
80 | 83 |
*/ |
81 | 84 |
public abstract class GPEWriterHandler implements IGPEWriterHandler{ |
85 |
private String name = null; |
|
86 |
private String description = null; |
|
82 | 87 |
private String format = null; |
83 | 88 |
private String version = null; |
84 | 89 |
private String fileName = null; |
85 | 90 |
private File outputFile = null; |
86 | 91 |
private GPEErrorHandler errorHandler = null; |
87 | 92 |
|
88 |
public GPEWriterHandler(){ |
|
89 |
|
|
90 |
} |
|
93 |
/** |
|
94 |
* All the GPE writer handlers must implement a constructor |
|
95 |
* with this two arguments. |
|
96 |
* @param name |
|
97 |
* Parser name |
|
98 |
* @param description |
|
99 |
* Parser description |
|
100 |
**/ |
|
101 |
public GPEWriterHandler(String name, String description){ |
|
102 |
this.name = name; |
|
103 |
this.description = description; |
|
104 |
} |
|
91 | 105 |
|
92 | 106 |
/** |
93 | 107 |
* Gets the deafult writting version |
... | ... | |
309 | 323 |
// TODO Auto-generated method stub |
310 | 324 |
|
311 | 325 |
} |
326 |
|
|
327 |
/** |
|
328 |
* @return the description |
|
329 |
*/ |
|
330 |
public String getDescription() { |
|
331 |
return description; |
|
332 |
} |
|
333 |
|
|
334 |
/** |
|
335 |
* @return the name |
|
336 |
*/ |
|
337 |
public String getName() { |
|
338 |
return name; |
|
339 |
} |
|
312 | 340 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/GPERegister.java | ||
---|---|---|
51 | 51 |
* |
52 | 52 |
* $Id$ |
53 | 53 |
* $Log$ |
54 |
* Revision 1.10 2007-04-19 11:50:20 csanchez |
|
54 |
* Revision 1.11 2007-05-07 07:06:26 jorpiell |
|
55 |
* Add a constructor with the name and the description fields |
|
56 |
* |
|
57 |
* Revision 1.10 2007/04/19 11:50:20 csanchez |
|
55 | 58 |
* Actualizacion protoripo libGPE |
56 | 59 |
* |
57 | 60 |
* Revision 1.9 2007/04/19 07:23:20 jorpiell |
... | ... | |
113 | 116 |
*/ |
114 | 117 |
public static void addGpeParser(String name, String description,Class clazz) throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{ |
115 | 118 |
if (clazz != null){ |
116 |
GPEParser parser = (GPEParser)clazz.getConstructor(null).newInstance(null); |
|
119 |
Class[] types = {String.class, String.class}; |
|
120 |
Object[] values = {name, description}; |
|
121 |
GPEParser parser = (GPEParser)clazz.getConstructor(types).newInstance(values); |
|
117 | 122 |
parsers.put(name, parser); |
118 | 123 |
} |
119 | 124 |
} |
... | ... | |
135 | 140 |
*/ |
136 | 141 |
public static void addGpeWriterHandler(String name, String description,Class clazz) throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{ |
137 | 142 |
if (clazz != null){ |
138 |
GPEWriterHandler parser = (GPEWriterHandler)clazz.getConstructor(null).newInstance(null); |
|
139 |
writers.put(name, parser); |
|
143 |
Class[] types = {String.class, String.class}; |
|
144 |
Object[] values = {name, description}; |
|
145 |
GPEWriterHandler writer = (GPEWriterHandler)clazz.getConstructor(types).newInstance(values); |
|
146 |
writers.put(name, writer); |
|
140 | 147 |
} |
141 | 148 |
} |
142 | 149 |
|
... | ... | |
157 | 164 |
public static GPEParser createParser(String name) throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{ |
158 | 165 |
Object parser = parsers.get(name); |
159 | 166 |
if (parser != null){ |
160 |
return (GPEParser)parser.getClass().getConstructor(null).newInstance(null); |
|
167 |
Class[] types = {String.class, String.class}; |
|
168 |
Object[] values = {((GPEParser)parser).getName(), |
|
169 |
((GPEParser)parser).getDescription()}; |
|
170 |
return (GPEParser)parser.getClass().getConstructor(types).newInstance(values); |
|
161 | 171 |
} |
162 | 172 |
return null; |
163 | 173 |
} |
... | ... | |
196 | 206 |
* @throws InvocationTargetException |
197 | 207 |
* @throws IllegalAccessException |
198 | 208 |
* @throws InstantiationException |
199 |
* @throws SecurityException |
|
209 |
* @throws SecurityExcepticreateParseron
|
|
200 | 210 |
* @throws IllegalArgumentException |
201 | 211 |
*/ |
202 | 212 |
public static GPEWriterHandler createWriter(String name) throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{ |
203 | 213 |
Object writer = writers.get(name); |
204 | 214 |
if (writer != null){ |
205 |
return (GPEWriterHandler)writer.getClass().getConstructor(null).newInstance(null); |
|
215 |
Class[] types = {String.class, String.class}; |
|
216 |
Object[] values = {((GPEWriterHandler)writer).getName(), |
|
217 |
((GPEWriterHandler)writer).getDescription()}; |
|
218 |
return (GPEWriterHandler)writer.getClass().getConstructor(types).newInstance(values); |
|
206 | 219 |
} |
207 | 220 |
return null; |
208 | 221 |
} |
trunk/libraries/libGPE/src/org/gvsig/gpe/GPEParser.java | ||
---|---|---|
46 | 46 |
* |
47 | 47 |
* $Id$ |
48 | 48 |
* $Log$ |
49 |
* Revision 1.10 2007-04-20 12:04:10 csanchez |
|
49 |
* Revision 1.11 2007-05-07 07:06:26 jorpiell |
|
50 |
* Add a constructor with the name and the description fields |
|
51 |
* |
|
52 |
* Revision 1.10 2007/04/20 12:04:10 csanchez |
|
50 | 53 |
* Actualizacion protoripo libGPE, AƱadidos test para el parser, parseo con XSOM |
51 | 54 |
* |
52 | 55 |
* Revision 1.9 2007/04/19 11:50:20 csanchez |
... | ... | |
86 | 89 |
public abstract class GPEParser { |
87 | 90 |
private GPEErrorHandler errorHandler; |
88 | 91 |
private GPEContentHandler contentHandler; |
92 |
private String name = null; |
|
93 |
private String description = null; |
|
89 | 94 |
private File mainFile; |
90 | 95 |
|
91 | 96 |
/** |
92 |
* All the GPE parser must implement a constructor without |
|
93 |
* arguments. |
|
97 |
* All the GPE parser must implement a constructor with this |
|
98 |
* two arguments. |
|
99 |
* @param name |
|
100 |
* Parser name |
|
101 |
* @param description |
|
102 |
* Parser description |
|
94 | 103 |
**/ |
95 |
public GPEParser(){ |
|
96 |
|
|
104 |
public GPEParser(String name, String description){ |
|
105 |
this.name = name; |
|
106 |
this.description = description; |
|
97 | 107 |
} |
98 | 108 |
|
99 | 109 |
/** |
... | ... | |
160 | 170 |
return mainFile; |
161 | 171 |
} |
162 | 172 |
|
173 |
/** |
|
174 |
* @return the description |
|
175 |
*/ |
|
176 |
public String getDescription() { |
|
177 |
return description; |
|
178 |
} |
|
179 |
|
|
180 |
/** |
|
181 |
* @return the name |
|
182 |
*/ |
|
183 |
public String getName() { |
|
184 |
return name; |
|
185 |
} |
|
186 |
|
|
163 | 187 |
} |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/GPEGmlParser.java | ||
---|---|---|
71 | 71 |
* |
72 | 72 |
* $Id$ |
73 | 73 |
* $Log$ |
74 |
* Revision 1.6 2007-04-25 11:08:38 csanchez |
|
74 |
* Revision 1.7 2007-05-07 07:06:46 jorpiell |
|
75 |
* Add a constructor with the name and the description fields |
|
76 |
* |
|
77 |
* Revision 1.6 2007/04/25 11:08:38 csanchez |
|
75 | 78 |
* Parseo correcto con XSOM de esquemas, EntityResolver para los imports |
76 | 79 |
* |
77 | 80 |
* Revision 1.5 2007/04/20 12:04:10 csanchez |
... | ... | |
101 | 104 |
* <GPEGmlParser> |
102 | 105 |
* Constructor Method |
103 | 106 |
*********************/ |
104 |
public GPEGmlParser() { |
|
105 |
// TODO Ap?ndice de constructor generado autom?ticamente
|
|
107 |
public GPEGmlParser(String name, String description) {
|
|
108 |
super(name, description);
|
|
106 | 109 |
} |
107 | 110 |
|
108 | 111 |
/************************************************************** |
... | ... | |
130 | 133 |
} |
131 | 134 |
return false; |
132 | 135 |
} |
133 |
|
|
134 |
/*********************************************************** |
|
135 |
* <getWriter> |
|
136 |
* (non-Javadoc) |
|
137 |
* @see org.gvsig.gpe.GPEParser#getWriter(java.lang.String) |
|
138 |
***********************************************************/ |
|
139 |
public GPEWriterHandler getWriter(String format) { |
|
140 |
return new GPEGmlWriterHandler(); |
|
141 |
} |
|
142 | 136 |
|
143 | 137 |
/********************************************** |
144 | 138 |
* <getVersions> |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/writer/GPEGmlWriterHandler.java | ||
---|---|---|
75 | 75 |
* |
76 | 76 |
* $Id$ |
77 | 77 |
* $Log$ |
78 |
* Revision 1.9 2007-04-26 14:40:03 jorpiell |
|
78 |
* Revision 1.10 2007-05-07 07:08:02 jorpiell |
|
79 |
* Add a constructor with the name and the description fields |
|
80 |
* |
|
81 |
* Revision 1.9 2007/04/26 14:40:03 jorpiell |
|
79 | 82 |
* Some writer handler methods updated |
80 | 83 |
* |
81 | 84 |
* Revision 1.8 2007/04/19 07:25:49 jorpiell |
... | ... | |
120 | 123 |
private String currentFeature = null; |
121 | 124 |
private String currentElement = null; |
122 | 125 |
|
123 |
public GPEGmlWriterHandler(){
|
|
124 |
super(); |
|
126 |
public GPEGmlWriterHandler(String name, String description) {
|
|
127 |
super(name, description);
|
|
125 | 128 |
} |
126 | 129 |
|
127 | 130 |
/* |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/bindings/geometries/CoordinatesBinding.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.bindings.geometries; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
|
|
5 |
import org.gvsig.gpe.gml.GMLTags; |
|
6 |
import org.gvsig.gpe.gml.GPEGmlParser; |
|
7 |
import org.kxml2.io.KXmlParser; |
|
8 |
import org.xmlpull.v1.XmlPullParser; |
|
9 |
import org.xmlpull.v1.XmlPullParserException; |
|
10 |
|
|
11 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
12 |
* |
|
13 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
28 |
* |
|
29 |
* For more information, contact: |
|
30 |
* |
|
31 |
* Generalitat Valenciana |
|
32 |
* Conselleria d'Infraestructures i Transport |
|
33 |
* Av. Blasco Ib??ez, 50 |
|
34 |
* 46010 VALENCIA |
|
35 |
* SPAIN |
|
36 |
* |
|
37 |
* +34 963862235 |
|
38 |
* gvsig@gva.es |
|
39 |
* www.gvsig.gva.es |
|
40 |
* |
|
41 |
* or |
|
42 |
* |
|
43 |
* IVER T.I. S.A |
|
44 |
* Salamanca 50 |
|
45 |
* 46005 Valencia |
|
46 |
* Spain |
|
47 |
* |
|
48 |
* +34 963163400 |
|
49 |
* dac@iver.es |
|
50 |
*/ |
|
51 |
/* CVS MESSAGES: |
|
52 |
* |
|
53 |
* $Id$ |
|
54 |
* $Log$ |
|
55 |
* Revision 1.1 2007-05-07 07:06:46 jorpiell |
|
56 |
* Add a constructor with the name and the description fields |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
/** |
|
61 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
62 |
*/ |
|
63 |
public class CoordinatesBinding { |
|
64 |
|
|
65 |
/** |
|
66 |
* It retuns a matrix of doubles with 3 columns (x,y,z) and |
|
67 |
* one row for each coordinate. |
|
68 |
* @param parser |
|
69 |
* @param handler |
|
70 |
* @return |
|
71 |
* @throws XmlPullParserException |
|
72 |
* @throws IOException |
|
73 |
* @throws KmlBodyParseException |
|
74 |
*/ |
|
75 |
public static double[][] parse(XmlPullParser parser,GPEGmlParser handler) throws XmlPullParserException, IOException { |
|
76 |
boolean endFeature = false; |
|
77 |
int currentTag; |
|
78 |
|
|
79 |
double[][] aCoordinates = null; |
|
80 |
|
|
81 |
String tag = parser.getName(); |
|
82 |
currentTag = parser.getEventType(); |
|
83 |
|
|
84 |
while (!endFeature){ |
|
85 |
switch(currentTag){ |
|
86 |
case KXmlParser.START_TAG: |
|
87 |
if (tag.compareTo(GMLTags.GML_COORDINATES) == 0){ |
|
88 |
parser.next(); |
|
89 |
//Calcular los car?cteres de separaci?n |
|
90 |
String TUPLES_SEPARATOR = null; |
|
91 |
String COORDINATES_SEPARATOR = null; |
|
92 |
String DOUBLE_SEPARATOR = null; |
|
93 |
|
|
94 |
String[] coordinates = parser.getText().split(TUPLES_SEPARATOR); |
|
95 |
aCoordinates = new double[3][coordinates.length]; |
|
96 |
for (int i=0 ; i<coordinates.length ; i++){ |
|
97 |
String[] coordinate = coordinates[i].trim().split(COORDINATES_SEPARATOR); |
|
98 |
aCoordinates[0][i] = Double.valueOf(coordinate[0]).doubleValue(); |
|
99 |
aCoordinates[1][i] = Double.valueOf(coordinate[1]).doubleValue(); |
|
100 |
//Tener en cuenta que puede no haber una tercera coordenada |
|
101 |
aCoordinates[2][i] = Double.valueOf(coordinate[2]).doubleValue(); |
|
102 |
} |
|
103 |
} |
|
104 |
break; |
|
105 |
case KXmlParser.END_TAG: |
|
106 |
if (tag.compareTo(GMLTags.GML_COORDINATES) == 0){ |
|
107 |
endFeature = true; |
|
108 |
} |
|
109 |
break; |
|
110 |
case KXmlParser.TEXT: |
|
111 |
|
|
112 |
break; |
|
113 |
} |
|
114 |
if (!endFeature){ |
|
115 |
currentTag = parser.next(); |
|
116 |
tag = parser.getName(); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
return aCoordinates; |
|
121 |
} |
|
122 |
|
|
123 |
} |
|
0 | 124 |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/bindings/geometries/AGeometryBinding.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.bindings.geometries; |
|
2 |
|
|
3 |
import org.gvsig.gpe.gml.GMLTags; |
|
4 |
import org.gvsig.gpe.gml.GPEGmlParser; |
|
5 |
import org.xmlpull.v1.XmlPullParser; |
|
6 |
|
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
8 |
* |
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or |
|
12 |
* modify it under the terms of the GNU General Public License |
|
13 |
* as published by the Free Software Foundation; either version 2 |
|
14 |
* of the License, or (at your option) any later version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, |
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
* GNU General Public License for more details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License |
|
22 |
* along with this program; if not, write to the Free Software |
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
24 |
* |
|
25 |
* For more information, contact: |
|
26 |
* |
|
27 |
* Generalitat Valenciana |
|
28 |
* Conselleria d'Infraestructures i Transport |
|
29 |
* Av. Blasco Ib??ez, 50 |
|
30 |
* 46010 VALENCIA |
|
31 |
* SPAIN |
|
32 |
* |
|
33 |
* +34 963862235 |
|
34 |
* gvsig@gva.es |
|
35 |
* www.gvsig.gva.es |
|
36 |
* |
|
37 |
* or |
|
38 |
* |
|
39 |
* IVER T.I. S.A |
|
40 |
* Salamanca 50 |
|
41 |
* 46005 Valencia |
|
42 |
* Spain |
|
43 |
* |
|
44 |
* +34 963163400 |
|
45 |
* dac@iver.es |
|
46 |
*/ |
|
47 |
/* CVS MESSAGES: |
|
48 |
* |
|
49 |
* $Id$ |
|
50 |
* $Log$ |
|
51 |
* Revision 1.1 2007-05-07 07:06:46 jorpiell |
|
52 |
* Add a constructor with the name and the description fields |
|
53 |
* |
|
54 |
* |
|
55 |
*/ |
|
56 |
/** |
|
57 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
58 |
*/ |
|
59 |
public class AGeometryBinding { |
|
60 |
|
|
61 |
/** |
|
62 |
* It returns the GML srs attribute value |
|
63 |
* @param parser |
|
64 |
* @param handler |
|
65 |
* @return |
|
66 |
*/ |
|
67 |
public static String getSrsName(XmlPullParser parser,GPEGmlParser handler){ |
|
68 |
String srsName = null; |
|
69 |
for (int i=0 ; i<parser.getAttributeCount() ; i++){ |
|
70 |
if (parser.getAttributeName(i).compareTo(GMLTags.GML_SRS_NAME) == 0){ |
|
71 |
srsName = parser.getAttributeValue(i); |
|
72 |
} |
|
73 |
} |
|
74 |
//TODO Convertir el SRS de GML a normal |
|
75 |
return srsName; |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* It returns the GML geometry id attribute value |
|
80 |
* @param parser |
|
81 |
* @param handler |
|
82 |
* @return |
|
83 |
*/ |
|
84 |
public static String getID(XmlPullParser parser,GPEGmlParser handler){ |
|
85 |
String id = null; |
|
86 |
for (int i=0 ; i<parser.getAttributeCount() ; i++){ |
|
87 |
if (parser.getAttributeName(i).compareTo(GMLTags.GML_ID) == 0){ |
|
88 |
id = parser.getAttributeValue(i); |
|
89 |
} |
|
90 |
} |
|
91 |
return id; |
|
92 |
} |
|
93 |
} |
|
0 | 94 |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/bindings/geometries/LineStringTypeBinding.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.bindings.geometries; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
|
|
5 |
import org.gvsig.gpe.gml.GMLTags; |
|
6 |
import org.gvsig.gpe.gml.GPEGmlParser; |
|
7 |
import org.kxml2.io.KXmlParser; |
|
8 |
import org.xmlpull.v1.XmlPullParser; |
|
9 |
import org.xmlpull.v1.XmlPullParserException; |
|
10 |
|
|
11 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
12 |
* |
|
13 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
28 |
* |
|
29 |
* For more information, contact: |
|
30 |
* |
|
31 |
* Generalitat Valenciana |
|
32 |
* Conselleria d'Infraestructures i Transport |
|
33 |
* Av. Blasco Ib??ez, 50 |
|
34 |
* 46010 VALENCIA |
|
35 |
* SPAIN |
|
36 |
* |
|
37 |
* +34 963862235 |
|
38 |
* gvsig@gva.es |
|
39 |
* www.gvsig.gva.es |
|
40 |
* |
|
41 |
* or |
|
42 |
* |
|
43 |
* IVER T.I. S.A |
|
44 |
* Salamanca 50 |
|
45 |
* 46005 Valencia |
|
46 |
* Spain |
|
47 |
* |
|
48 |
* +34 963163400 |
|
49 |
* dac@iver.es |
|
50 |
*/ |
|
51 |
/* CVS MESSAGES: |
|
52 |
* |
|
53 |
* $Id$ |
|
54 |
* $Log$ |
|
55 |
* Revision 1.1 2007-05-07 07:06:46 jorpiell |
|
56 |
* Add a constructor with the name and the description fields |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
/** |
|
61 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
62 |
*/ |
|
63 |
public class LineStringTypeBinding { |
|
64 |
|
|
65 |
public static Object parse(XmlPullParser parser,GPEGmlParser handler) throws XmlPullParserException, IOException { |
|
66 |
boolean endFeature = false; |
|
67 |
int currentTag; |
|
68 |
Object lineString = null; |
|
69 |
|
|
70 |
String srsName = AGeometryBinding.getSrsName(parser, handler); |
|
71 |
String id = AGeometryBinding.getID(parser, handler); |
|
72 |
|
|
73 |
|
|
74 |
String tag = parser.getName(); |
|
75 |
currentTag = parser.getEventType(); |
|
76 |
|
|
77 |
while (!endFeature){ |
|
78 |
switch(currentTag){ |
|
79 |
case KXmlParser.START_TAG: |
|
80 |
if (tag.compareTo(GMLTags.GML_COORDINATES) == 0){ |
|
81 |
double[][] coordinates = CoordinatesBinding.parse(parser, handler); |
|
82 |
lineString = handler.getContentHandler().startLineString(id, |
|
83 |
coordinates[0], |
|
84 |
coordinates[1], |
|
85 |
coordinates[2], |
|
86 |
srsName); |
|
87 |
} |
|
88 |
break; |
|
89 |
case KXmlParser.END_TAG: |
|
90 |
if (tag.compareTo(GMLTags.GML_LINESTRING) == 0){ |
|
91 |
endFeature = true; |
|
92 |
handler.getContentHandler().endLineString(lineString); |
|
93 |
} |
|
94 |
break; |
|
95 |
case KXmlParser.TEXT: |
|
96 |
|
|
97 |
break; |
|
98 |
} |
|
99 |
if (!endFeature){ |
|
100 |
currentTag = parser.next(); |
|
101 |
tag = parser.getName(); |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
return lineString; |
|
106 |
} |
|
107 |
} |
|
0 | 108 |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/bindings/geometries/PolygonBinding.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.bindings.geometries; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
|
|
5 |
import org.gvsig.gpe.gml.GMLTags; |
|
6 |
import org.gvsig.gpe.gml.GPEGmlParser; |
|
7 |
import org.kxml2.io.KXmlParser; |
|
8 |
import org.xmlpull.v1.XmlPullParser; |
|
9 |
import org.xmlpull.v1.XmlPullParserException; |
|
10 |
|
|
11 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
12 |
* |
|
13 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
28 |
* |
|
29 |
* For more information, contact: |
|
30 |
* |
|
31 |
* Generalitat Valenciana |
|
32 |
* Conselleria d'Infraestructures i Transport |
|
33 |
* Av. Blasco Ib??ez, 50 |
|
34 |
* 46010 VALENCIA |
|
35 |
* SPAIN |
|
36 |
* |
|
37 |
* +34 963862235 |
|
38 |
* gvsig@gva.es |
|
39 |
* www.gvsig.gva.es |
|
40 |
* |
|
41 |
* or |
|
42 |
* |
|
43 |
* IVER T.I. S.A |
|
44 |
* Salamanca 50 |
|
45 |
* 46005 Valencia |
|
46 |
* Spain |
|
47 |
* |
|
48 |
* +34 963163400 |
|
49 |
* dac@iver.es |
|
50 |
*/ |
|
51 |
/* CVS MESSAGES: |
|
52 |
* |
|
53 |
* $Id$ |
|
54 |
* $Log$ |
|
55 |
* Revision 1.1 2007-05-07 07:06:46 jorpiell |
|
56 |
* Add a constructor with the name and the description fields |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
/** |
|
61 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
62 |
*/ |
|
63 |
public class PolygonBinding { |
|
64 |
public static Object parse(XmlPullParser parser,GPEGmlParser handler) throws XmlPullParserException, IOException { |
|
65 |
boolean endFeature = false; |
|
66 |
int currentTag; |
|
67 |
Object polygon = null; |
|
68 |
|
|
69 |
String srsName = AGeometryBinding.getSrsName(parser, handler); |
|
70 |
String id = AGeometryBinding.getID(parser, handler); |
|
71 |
|
|
72 |
|
|
73 |
String tag = parser.getName(); |
|
74 |
currentTag = parser.getEventType(); |
|
75 |
|
|
76 |
while (!endFeature){ |
|
77 |
switch(currentTag){ |
|
78 |
case KXmlParser.START_TAG: |
|
79 |
// if (tag.compareTo(KmlTags.OUTERBOUNDARYIS) == 0){ |
|
80 |
// double[][] coordinates = OuterBoundaryIsBinding.parse(parser, handler); |
|
81 |
// polygon = handler.getContentHandler().startPolygon(id, |
|
82 |
// coordinates[0], |
|
83 |
// coordinates[1], |
|
84 |
// coordinates[2], |
|
85 |
// KmlTags.DEFAULT_SRS); |
|
86 |
// }else if (tag.compareTo(KmlTags.INNERBOUNDARYIS) == 0){ |
|
87 |
// double[][] coordinates = InnerBoundaryIsBinding.parse(parser, handler); |
|
88 |
// Object innerPolygon = handler.getContentHandler().startInnerPolygon(null, |
|
89 |
// coordinates[0], |
|
90 |
// coordinates[1], |
|
91 |
// coordinates[2], |
|
92 |
// KmlTags.DEFAULT_SRS); |
|
93 |
// handler.getContentHandler().endInnerPolygon(innerPolygon); |
|
94 |
// handler.getContentHandler().addInnerPolygonToPolygon(innerPolygon,polygon); |
|
95 |
// } |
|
96 |
break; |
|
97 |
case KXmlParser.END_TAG: |
|
98 |
if (tag.compareTo(GMLTags.GML_POLYGON) == 0){ |
|
99 |
endFeature = true; |
|
100 |
handler.getContentHandler().endPolygon(polygon); |
|
101 |
} |
|
102 |
break; |
|
103 |
case KXmlParser.TEXT: |
|
104 |
|
|
105 |
break; |
|
106 |
} |
|
107 |
if (!endFeature){ |
|
108 |
currentTag = parser.next(); |
|
109 |
tag = parser.getName(); |
|
110 |
} |
|
111 |
} |
|
112 |
|
|
113 |
return polygon; |
|
114 |
} |
|
115 |
} |
|
0 | 116 |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/gml/bindings/geometries/PointBinding.java | ||
---|---|---|
1 |
package org.gvsig.gpe.gml.bindings.geometries; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
|
|
5 |
import org.gvsig.gpe.gml.GMLTags; |
|
6 |
import org.gvsig.gpe.gml.GPEGmlParser; |
|
7 |
import org.kxml2.io.KXmlParser; |
|
8 |
import org.xmlpull.v1.XmlPullParser; |
|
9 |
import org.xmlpull.v1.XmlPullParserException; |
|
10 |
|
|
11 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
12 |
* |
|
13 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
28 |
* |
|
29 |
* For more information, contact: |
|
30 |
* |
|
31 |
* Generalitat Valenciana |
|
32 |
* Conselleria d'Infraestructures i Transport |
|
33 |
* Av. Blasco Ib??ez, 50 |
|
34 |
* 46010 VALENCIA |
|
35 |
* SPAIN |
|
36 |
* |
|
37 |
* +34 963862235 |
|
38 |
* gvsig@gva.es |
|
39 |
* www.gvsig.gva.es |
|
40 |
* |
|
41 |
* or |
|
42 |
* |
|
43 |
* IVER T.I. S.A |
|
44 |
* Salamanca 50 |
|
45 |
* 46005 Valencia |
|
46 |
* Spain |
|
47 |
* |
|
48 |
* +34 963163400 |
|
49 |
* dac@iver.es |
|
50 |
*/ |
|
51 |
/* CVS MESSAGES: |
|
52 |
* |
|
53 |
* $Id$ |
|
54 |
* $Log$ |
|
55 |
* Revision 1.1 2007-05-07 07:06:46 jorpiell |
|
56 |
* Add a constructor with the name and the description fields |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
/** |
|
61 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
62 |
*/ |
|
63 |
public class PointBinding { |
|
64 |
|
|
65 |
public static Object parse(XmlPullParser parser,GPEGmlParser handler) throws XmlPullParserException, IOException { |
|
66 |
boolean endFeature = false; |
|
67 |
int currentTag; |
|
68 |
Object point = null; |
|
69 |
|
|
70 |
String srsName = AGeometryBinding.getSrsName(parser, handler); |
|
71 |
String id = AGeometryBinding.getID(parser, handler); |
|
72 |
|
|
73 |
String tag = parser.getName(); |
|
74 |
currentTag = parser.getEventType(); |
|
75 |
|
|
76 |
while (!endFeature){ |
|
77 |
switch(currentTag){ |
|
78 |
case KXmlParser.START_TAG: |
|
79 |
if (tag.compareTo(GMLTags.GML_COORDINATES) == 0){ |
|
80 |
double[][] coordinates = CoordinatesBinding.parse(parser, handler); |
|
81 |
point = handler.getContentHandler().startPoint(id, |
|
82 |
coordinates[0][0], |
|
83 |
coordinates[1][0], |
|
84 |
coordinates[2][0], |
|
85 |
srsName); |
|
86 |
} |
|
87 |
break; |
|
88 |
case KXmlParser.END_TAG: |
|
89 |
if (tag.compareTo(GMLTags.GML_POINT) == 0){ |
|
90 |
endFeature = true; |
|
91 |
handler.getContentHandler().endPoint(point); |
|
92 |
} |
|
93 |
break; |
|
94 |
case KXmlParser.TEXT: |
|
95 |
|
|
96 |
break; |
|
97 |
} |
|
98 |
if (!endFeature){ |
|
99 |
currentTag = parser.next(); |
|
100 |
tag = parser.getName(); |
|
101 |
} |
|
102 |
} |
|
103 |
return point; |
|
104 |
} |
|
105 |
} |
|
0 | 106 |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/xml/GPEXmlParser.java | ||
---|---|---|
56 | 56 |
* |
57 | 57 |
* $Id$ |
58 | 58 |
* $Log$ |
59 |
* Revision 1.6 2007-04-19 12:01:55 jorpiell |
|
59 |
* Revision 1.7 2007-05-07 07:07:04 jorpiell |
|
60 |
* Add a constructor with the name and the description fields |
|
61 |
* |
|
62 |
* Revision 1.6 2007/04/19 12:01:55 jorpiell |
|
60 | 63 |
* Updated the getEncoding method |
61 | 64 |
* |
62 | 65 |
* Revision 1.5 2007/04/19 11:56:03 csanchez |
... | ... | |
85 | 88 |
private InputStream inputStream = null; |
86 | 89 |
private XmlPullParser parser = null; |
87 | 90 |
|
88 |
public GPEXmlParser() { |
|
89 |
super();
|
|
91 |
public GPEXmlParser(String name, String description) {
|
|
92 |
super(name, description);
|
|
90 | 93 |
} |
91 | 94 |
|
92 | 95 |
/* |
trunk/libraries/libGPE-GML/src/org/gvsig/gpe/xml/writer/GPEXmlWriterHandler.java | ||
---|---|---|
64 | 64 |
* |
65 | 65 |
* $Id$ |
66 | 66 |
* $Log$ |
67 |
* Revision 1.7 2007-04-26 14:40:03 jorpiell |
|
67 |
* Revision 1.8 2007-05-07 07:07:04 jorpiell |
|
68 |
* Add a constructor with the name and the description fields |
|
69 |
* |
|
70 |
* Revision 1.7 2007/04/26 14:40:03 jorpiell |
|
68 | 71 |
* Some writer handler methods updated |
69 | 72 |
* |
70 | 73 |
* Revision 1.6 2007/04/19 07:25:49 jorpiell |
... | ... | |
94 | 97 |
protected Writer writer = null; |
95 | 98 |
private String targetNamespace = null; |
96 | 99 |
|
97 |
public GPEXmlWriterHandler() { |
|
98 |
|
|
99 |
}
|
|
100 |
public GPEXmlWriterHandler(String name, String description) {
|
|
101 |
super(name, description); |
|
102 |
} |
|
100 | 103 |
|
101 | 104 |
/** |
102 | 105 |
* Writes the XML header |
trunk/libraries/libGPE-KML/src/org/gvsig/gpe/kml/GPEKmlParser.java | ||
---|---|---|
67 | 67 |
* |
68 | 68 |
* $Id$ |
69 | 69 |
* $Log$ |
70 |
* Revision 1.5 2007-04-20 08:38:59 jorpiell |
|
70 |
* Revision 1.6 2007-05-07 07:07:18 jorpiell |
|
71 |
* Add a constructor with the name and the description fields |
|
72 |
* |
|
73 |
* Revision 1.5 2007/04/20 08:38:59 jorpiell |
|
71 | 74 |
* Tests updating |
72 | 75 |
* |
73 | 76 |
* Revision 1.4 2007/04/14 16:08:07 jorpiell |
... | ... | |
89 | 92 |
*/ |
90 | 93 |
public class GPEKmlParser extends GPEXmlParser { |
91 | 94 |
|
92 |
public GPEKmlParser() { |
|
93 |
super();
|
|
95 |
public GPEKmlParser(String name, String description) {
|
|
96 |
super(name, description);
|
|
94 | 97 |
} |
95 | 98 |
|
96 | 99 |
/* |
trunk/libraries/libGPE-KML/src/org/gvsig/gpe/kml/writer/GPEKmlWriterHandler.java | ||
---|---|---|
75 | 75 |
* |
76 | 76 |
* $Id$ |
77 | 77 |
* $Log$ |
78 |
* Revision 1.7 2007-05-02 11:46:50 jorpiell |
|
78 |
* Revision 1.8 2007-05-07 07:07:18 jorpiell |
|
79 |
* Add a constructor with the name and the description fields |
|
80 |
* |
|
81 |
* Revision 1.7 2007/05/02 11:46:50 jorpiell |
|
79 | 82 |
* Writing tests updated |
80 | 83 |
* |
81 | 84 |
* Revision 1.6 2007/04/20 08:38:59 jorpiell |
... | ... | |
103 | 106 |
*/ |
104 | 107 |
public class GPEKmlWriterHandler extends GPEXmlWriterHandler{ |
105 | 108 |
private int layerLevel = 0; |
106 |
|
|
107 |
public GPEKmlWriterHandler() { |
|
108 |
super();
|
|
109 |
|
|
110 |
public GPEKmlWriterHandler(String name, String description) {
|
|
111 |
super(name, description);
|
|
109 | 112 |
} |
110 |
|
|
113 |
|
|
111 | 114 |
/* |
112 | 115 |
* (non-Javadoc) |
113 | 116 |
* @see org.gvsig.gpe.xml.writer.GPEXmlWriterHandler#createOutputStream() |
Also available in: Unified diff