svn-gvsig-desktop / trunk / libraries / libGPE / src / org / gvsig / gpe / writers / GPEWriterHandler.java @ 19579
History | View | Annotate | Download (18.9 KB)
1 |
package org.gvsig.gpe.writers; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.io.OutputStream; |
5 |
|
6 |
import org.gvsig.gpe.parser.GPEErrorHandler; |
7 |
import org.gvsig.gpe.utils.GeographicalUtils; |
8 |
import org.gvsig.gpe.utils.TypedObjectStack; |
9 |
import org.gvsig.gpe.utils.TypedObjectStack.TypedObject; |
10 |
import org.gvsig.gpe.warnings.NotSupportedElementWarning; |
11 |
import org.gvsig.gpe.warnings.NotSupportedFeatureWarning; |
12 |
import org.gvsig.gpe.warnings.NotSupportedLayerWarning; |
13 |
import org.gvsig.gpe.warnings.PolygonAutomaticallyClosedWarning; |
14 |
import org.gvsig.xmlschema.som.IXSElementDeclaration; |
15 |
import org.gvsig.xmlschema.som.IXSSchemaDocument; |
16 |
|
17 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
18 |
*
|
19 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
20 |
*
|
21 |
* This program is free software; you can redistribute it and/or
|
22 |
* modify it under the terms of the GNU General Public License
|
23 |
* as published by the Free Software Foundation; either version 2
|
24 |
* of the License, or (at your option) any later version.
|
25 |
*
|
26 |
* This program is distributed in the hope that it will be useful,
|
27 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
* GNU General Public License for more details.
|
30 |
*
|
31 |
* You should have received a copy of the GNU General Public License
|
32 |
* along with this program; if not, write to the Free Software
|
33 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
34 |
*
|
35 |
* For more information, contact:
|
36 |
*
|
37 |
* Generalitat Valenciana
|
38 |
* Conselleria d'Infraestructures i Transport
|
39 |
* Av. Blasco Ib??ez, 50
|
40 |
* 46010 VALENCIA
|
41 |
* SPAIN
|
42 |
*
|
43 |
* +34 963862235
|
44 |
* gvsig@gva.es
|
45 |
* www.gvsig.gva.es
|
46 |
*
|
47 |
* or
|
48 |
*
|
49 |
* IVER T.I. S.A
|
50 |
* Salamanca 50
|
51 |
* 46005 Valencia
|
52 |
* Spain
|
53 |
*
|
54 |
* +34 963163400
|
55 |
* dac@iver.es
|
56 |
*/
|
57 |
/* CVS MESSAGES:
|
58 |
*
|
59 |
* $Id: GPEWriterHandler.java 203 2007-12-03 09:36:17Z jpiera $
|
60 |
* $Log$
|
61 |
* Revision 1.15 2007/06/29 12:19:14 jorpiell
|
62 |
* The schema validation is made independently of the concrete writer
|
63 |
*
|
64 |
* Revision 1.14 2007/06/28 13:04:33 jorpiell
|
65 |
* The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class
|
66 |
*
|
67 |
* Revision 1.13 2007/06/22 12:19:52 jorpiell
|
68 |
* The targetNamespace is now writen fine
|
69 |
*
|
70 |
* Revision 1.12 2007/06/20 09:35:37 jorpiell
|
71 |
* Add the javadoc comments
|
72 |
*
|
73 |
* Revision 1.11 2007/06/14 13:50:06 jorpiell
|
74 |
* The schema jar name has been changed
|
75 |
*
|
76 |
* Revision 1.10 2007/06/07 14:52:28 jorpiell
|
77 |
* Add the schema support
|
78 |
*
|
79 |
* Revision 1.9 2007/05/16 12:06:22 jorpiell
|
80 |
* Add Deafult methods
|
81 |
*
|
82 |
* Revision 1.8 2007/05/07 12:57:55 jorpiell
|
83 |
* Add some methods to manage the multigeometries
|
84 |
*
|
85 |
* Revision 1.7 2007/05/07 07:06:26 jorpiell
|
86 |
* Add a constructor with the name and the description fields
|
87 |
*
|
88 |
* Revision 1.6 2007/04/26 14:29:15 jorpiell
|
89 |
* Add a getStringProperty method to the GEPDeafults
|
90 |
*
|
91 |
* Revision 1.5 2007/04/19 11:50:20 csanchez
|
92 |
* Actualizacion protoripo libGPE
|
93 |
*
|
94 |
* Revision 1.4 2007/04/19 07:23:20 jorpiell
|
95 |
* Add the add methods to teh contenhandler and change the register mode
|
96 |
*
|
97 |
* Revision 1.3 2007/04/14 16:06:13 jorpiell
|
98 |
* The writer handler has been updated
|
99 |
*
|
100 |
* Revision 1.2 2007/04/13 13:14:55 jorpiell
|
101 |
* Created the base tests and add some methods to the content handler
|
102 |
*
|
103 |
* Revision 1.1 2007/04/13 07:17:54 jorpiell
|
104 |
* Add the writting tests for the simple geometries
|
105 |
*
|
106 |
* Revision 1.2 2007/04/12 17:06:42 jorpiell
|
107 |
* First GML writing tests
|
108 |
*
|
109 |
* Revision 1.1 2007/04/12 10:20:40 jorpiell
|
110 |
* Add the writer
|
111 |
*
|
112 |
*
|
113 |
*/
|
114 |
/**
|
115 |
* This class make the XML schema validation and call
|
116 |
* to the concrete parser to write the output file.
|
117 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
118 |
* @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
|
119 |
*/
|
120 |
public class GPEWriterHandler { |
121 |
private IGPEWriterHandlerImplementor writerImplementor = null; |
122 |
//Used to know the current parsed elements
|
123 |
private TypedObjectStack layerStack = null; |
124 |
private TypedObjectStack featureStack = null; |
125 |
private TypedObjectStack elementStack = null; |
126 |
//Boolean variable that indicates that an object has
|
127 |
//to be removed because it is not valid
|
128 |
private boolean isRemoved = false; |
129 |
|
130 |
/**
|
131 |
* The constructor
|
132 |
* @param writerImplementor
|
133 |
* The concrete writer handler implementation
|
134 |
*/
|
135 |
public GPEWriterHandler(IGPEWriterHandlerImplementor writerImplementor){
|
136 |
this.writerImplementor = writerImplementor;
|
137 |
layerStack = new TypedObjectStack();
|
138 |
featureStack = new TypedObjectStack();
|
139 |
elementStack = new TypedObjectStack();
|
140 |
} |
141 |
|
142 |
/*
|
143 |
* (non-Javadoc)
|
144 |
* @see java.lang.Object#toString()
|
145 |
*/
|
146 |
public String toString(){ |
147 |
return writerImplementor.toString();
|
148 |
} |
149 |
|
150 |
/**
|
151 |
* @return the description
|
152 |
*/
|
153 |
public String getDescription() { |
154 |
return writerImplementor.getDescription();
|
155 |
} |
156 |
|
157 |
/**
|
158 |
* @return the name
|
159 |
*/
|
160 |
public String getName() { |
161 |
return writerImplementor.getName();
|
162 |
} |
163 |
|
164 |
/**
|
165 |
* @return the deafult writting version
|
166 |
*/
|
167 |
public String getDefaultVersion(){ |
168 |
return writerImplementor.getDefaultVersion();
|
169 |
} |
170 |
|
171 |
/**
|
172 |
* @return the deafult format
|
173 |
*/
|
174 |
public String getDefaultFormat(){ |
175 |
return writerImplementor.getDefaultFormat();
|
176 |
} |
177 |
|
178 |
/**
|
179 |
* Creates the output file and
|
180 |
* @return the file
|
181 |
*/
|
182 |
public File getOutputFile() { |
183 |
return writerImplementor.getOutputFile();
|
184 |
} |
185 |
|
186 |
/**
|
187 |
* Creates the output file and
|
188 |
* @return the file
|
189 |
*/
|
190 |
public File getOutputStreamFile() { |
191 |
return writerImplementor.getOutputFile();
|
192 |
} |
193 |
|
194 |
/**
|
195 |
* @return the errorHandler
|
196 |
*/
|
197 |
public GPEErrorHandler getErrorHandler() {
|
198 |
return writerImplementor.getErrorHandler();
|
199 |
} |
200 |
|
201 |
/**
|
202 |
* @param errorHandler the errorHandler to set
|
203 |
*/
|
204 |
public void setErrorHandler(GPEErrorHandler errorHandler) { |
205 |
writerImplementor.setErrorHandler(errorHandler); |
206 |
} |
207 |
|
208 |
/**
|
209 |
* @return the fileName
|
210 |
*/
|
211 |
public String getFileName() { |
212 |
return writerImplementor.getFileName();
|
213 |
} |
214 |
|
215 |
/**
|
216 |
* @param fileName the fileName to set
|
217 |
*/
|
218 |
public void setFileName(String fileName) { |
219 |
writerImplementor.setFileName(fileName); |
220 |
} |
221 |
|
222 |
/**
|
223 |
* @param fileName the fileName to set
|
224 |
*/
|
225 |
public void setOutputStream(OutputStream os) { |
226 |
writerImplementor.setOutputStream(os); |
227 |
} |
228 |
|
229 |
/**
|
230 |
* @return the format
|
231 |
*/
|
232 |
public String[] getFormats() { |
233 |
return writerImplementor.getFormats();
|
234 |
} |
235 |
|
236 |
/**
|
237 |
* @return the format
|
238 |
*/
|
239 |
public String getFormat() { |
240 |
return writerImplementor.getFormat();
|
241 |
} |
242 |
|
243 |
/**
|
244 |
* @param format the format to set
|
245 |
*/
|
246 |
public void setFormat(String format) { |
247 |
writerImplementor.setFormat(format); |
248 |
} |
249 |
|
250 |
/**
|
251 |
* @return the version
|
252 |
*/
|
253 |
public String[] getVersions() { |
254 |
return writerImplementor.getVersions();
|
255 |
} |
256 |
|
257 |
/**
|
258 |
* @return the version
|
259 |
*/
|
260 |
public String getVersion() { |
261 |
return writerImplementor.getVersion();
|
262 |
} |
263 |
|
264 |
/**
|
265 |
* @param version the version to set
|
266 |
*/
|
267 |
public void setVersion(String version) { |
268 |
writerImplementor.setVersion(version); |
269 |
} |
270 |
|
271 |
/*
|
272 |
* (non-Javadoc)
|
273 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startPoint(java.lang.String, double, double, double, java.lang.String)
|
274 |
*/
|
275 |
public void startPoint(String id, double x, double y, double z, String srs) { |
276 |
if (isRemoved) return; |
277 |
writerImplementor.startPoint(id, x, y, z, srs); |
278 |
} |
279 |
|
280 |
/*
|
281 |
* (non-Javadoc)
|
282 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endPoint()
|
283 |
*/
|
284 |
public void endPoint() { |
285 |
if (isRemoved) return; |
286 |
writerImplementor.endPoint(); |
287 |
} |
288 |
|
289 |
/*
|
290 |
* (non-Javadoc)
|
291 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startLineString(java.lang.String, double[], double[], double[], java.lang.String)
|
292 |
*/
|
293 |
public void startLineString(String id, double[] x, double[] y, double[] z, String srs) { |
294 |
if (isRemoved) return; |
295 |
writerImplementor.startLineString(id, x, y, z, srs); |
296 |
} |
297 |
|
298 |
/*
|
299 |
* (non-Javadoc)
|
300 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endLineString()
|
301 |
*/
|
302 |
public void endLineString() { |
303 |
if (isRemoved) return; |
304 |
writerImplementor.endLineString(); |
305 |
} |
306 |
|
307 |
/*
|
308 |
* (non-Javadoc)
|
309 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startLinearRing(java.lang.String, double[], double[], double[], java.lang.String)
|
310 |
*/
|
311 |
public void startLinearRing(String id, double[] x, double[] y, double[] z, String srs) { |
312 |
if (isRemoved) return; |
313 |
if (!GeographicalUtils.isClosed(x, y, z)){
|
314 |
x = GeographicalUtils.closePolygon(x); |
315 |
y = GeographicalUtils.closePolygon(y); |
316 |
z = GeographicalUtils.closePolygon(z); |
317 |
getErrorHandler().addWarning(new PolygonAutomaticallyClosedWarning(x,y,z));
|
318 |
} |
319 |
writerImplementor.startLinearRing(id, x, y, z, srs); |
320 |
} |
321 |
|
322 |
/*
|
323 |
* (non-Javadoc)
|
324 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endLinearRing()
|
325 |
*/
|
326 |
public void endLinearRing() { |
327 |
if (isRemoved) return; |
328 |
writerImplementor.endLinearRing(); |
329 |
} |
330 |
|
331 |
/*
|
332 |
* (non-Javadoc)
|
333 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startPolygon(java.lang.String, double[], double[], double[], java.lang.String)
|
334 |
*/
|
335 |
public void startPolygon(String id, double[] x, double[] y, double[] z, String srs) { |
336 |
if (isRemoved) return; |
337 |
if (!GeographicalUtils.isClosed(x, y, z)){
|
338 |
x = GeographicalUtils.closePolygon(x); |
339 |
y = GeographicalUtils.closePolygon(y); |
340 |
z = GeographicalUtils.closePolygon(z); |
341 |
getErrorHandler().addWarning(new PolygonAutomaticallyClosedWarning(x,y,z));
|
342 |
} |
343 |
writerImplementor.startPolygon(id, x, y, z, srs); |
344 |
} |
345 |
|
346 |
/*
|
347 |
* (non-Javadoc)
|
348 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endPolygon()
|
349 |
*/
|
350 |
public void endPolygon() { |
351 |
if (isRemoved) return; |
352 |
writerImplementor.endPolygon(); |
353 |
} |
354 |
|
355 |
/*
|
356 |
* (non-Javadoc)
|
357 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startInnerBoundary(java.lang.String, double[], double[], double[], java.lang.String)
|
358 |
*/
|
359 |
public void startInnerBoundary(String id, double[] x, double[] y, double[] z, String srs) { |
360 |
if (isRemoved) return; |
361 |
if (!GeographicalUtils.isClosed(x, y, z)){
|
362 |
x = GeographicalUtils.closePolygon(x); |
363 |
y = GeographicalUtils.closePolygon(y); |
364 |
z = GeographicalUtils.closePolygon(z); |
365 |
getErrorHandler().addWarning(new PolygonAutomaticallyClosedWarning(x,y,z));
|
366 |
} |
367 |
writerImplementor.startInnerBoundary(id, x, y, z, srs); |
368 |
} |
369 |
|
370 |
/*
|
371 |
* (non-Javadoc)
|
372 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endInnerBoundary()
|
373 |
*/
|
374 |
public void endInnerBoundary() { |
375 |
if (isRemoved) return; |
376 |
writerImplementor.endInnerBoundary(); |
377 |
} |
378 |
|
379 |
/*
|
380 |
* (non-Javadoc)
|
381 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#initialize()
|
382 |
*/
|
383 |
public void initialize() { |
384 |
if (isRemoved) return; |
385 |
writerImplementor.initialize(); |
386 |
} |
387 |
|
388 |
/*
|
389 |
* (non-Javadoc)
|
390 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#close()
|
391 |
*/
|
392 |
public void close() { |
393 |
writerImplementor.close(); |
394 |
} |
395 |
|
396 |
/*
|
397 |
* (non-Javadoc)
|
398 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startBbox(java.lang.String, double[], double[], double[], java.lang.String)
|
399 |
*/
|
400 |
public void startBbox(String id, double[] x, double[] y, double[] z, String srs) { |
401 |
if (isRemoved) return; |
402 |
writerImplementor.startBbox(id, x, y, z, srs); |
403 |
} |
404 |
|
405 |
/*
|
406 |
* (non-Javadoc)
|
407 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endBbox()
|
408 |
*/
|
409 |
public void endBbox() { |
410 |
if (isRemoved) return; |
411 |
writerImplementor.endBbox(); |
412 |
} |
413 |
|
414 |
/*
|
415 |
* (non-Javadoc)
|
416 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startElement(java.lang.String, java.lang.Object, java.lang.Object)
|
417 |
*/
|
418 |
public void startElement(String name, Object value, String xsElementName) { |
419 |
if (isRemoved){
|
420 |
elementStack.push(name,xsElementName,isRemoved); |
421 |
return;
|
422 |
} |
423 |
TypedObject feature = featureStack.lastElement(); |
424 |
//If is a simple element
|
425 |
if (elementStack.size() == 0){ |
426 |
//If the feature has type
|
427 |
if (feature.getType() != null){ |
428 |
IXSElementDeclaration xsFeature = getSchemaDocument().getElementDeclarationByName(feature.getType()); |
429 |
//If the feature is null has been declarated inside the layer
|
430 |
if (xsFeature == null){ |
431 |
TypedObject layer = layerStack.lastElement(); |
432 |
//The layer has to have a type
|
433 |
IXSElementDeclaration xsLayer = getSchemaDocument().getElementDeclarationByName(layer.getType()); |
434 |
xsFeature = xsLayer.getSubElementByName(feature.getType()); |
435 |
} |
436 |
//If the feature has a type it will be always on the schema
|
437 |
IXSElementDeclaration xsElement = xsFeature.getSubElementByName(name); |
438 |
//If the element doesn't exist on the feature
|
439 |
if (xsElement == null){ |
440 |
isRemoved = true;
|
441 |
getErrorHandler().addWarning(new NotSupportedElementWarning(name,
|
442 |
xsElementName, |
443 |
feature.getName(), |
444 |
feature.getType())); |
445 |
} |
446 |
} |
447 |
}else{ //Is a complex element |
448 |
TypedObject parentElement = elementStack.lastElement(); |
449 |
//TODO complex element validation
|
450 |
} |
451 |
elementStack.push(name,xsElementName,isRemoved); |
452 |
if (!isRemoved){
|
453 |
writerImplementor.startElement(name, value, xsElementName); |
454 |
} |
455 |
} |
456 |
|
457 |
/*+
|
458 |
* (non-Javadoc)
|
459 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endElement()
|
460 |
*/
|
461 |
public void endElement() { |
462 |
TypedObject element = elementStack.pop(); |
463 |
if (!element.isRemoved()){
|
464 |
writerImplementor.endElement(); |
465 |
}else{
|
466 |
if (!layerStack.lastElement().isRemoved()){
|
467 |
if (!featureStack.lastElement().isRemoved()){
|
468 |
if (elementStack.size() == 0){ |
469 |
isRemoved = false;
|
470 |
}else{
|
471 |
TypedObject parentElement = elementStack.lastElement(); |
472 |
isRemoved = parentElement.isRemoved(); |
473 |
} |
474 |
} |
475 |
} |
476 |
} |
477 |
} |
478 |
|
479 |
/*
|
480 |
* (non-Javadoc)
|
481 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startLayer(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
482 |
*/
|
483 |
public void startLayer(String id, String name, String description, String srs, String xsElementName) { |
484 |
if (isRemoved){
|
485 |
layerStack.push(name,xsElementName,isRemoved); |
486 |
return;
|
487 |
} |
488 |
//If is a root layer
|
489 |
if (layerStack.size() == 0){ |
490 |
//If it has a schema
|
491 |
if (xsElementName != null){ |
492 |
//If the schema doesn't exists the layer can't be added
|
493 |
if (getSchemaDocument().getElementDeclarationByName(xsElementName) == null){ |
494 |
isRemoved = true;
|
495 |
getErrorHandler().addWarning(new NotSupportedLayerWarning(name,
|
496 |
xsElementName)); |
497 |
} |
498 |
} |
499 |
}else{//It is a child layer |
500 |
TypedObject parentLayer = layerStack.lastElement(); |
501 |
//If the parent layer has a XML schema type
|
502 |
if (parentLayer.getType() != null){ |
503 |
IXSElementDeclaration xsParentLayer = getSchemaDocument().getElementDeclarationByName(parentLayer.getType()); |
504 |
//If the parent layer has a schema
|
505 |
if (xsParentLayer != null){ |
506 |
IXSElementDeclaration xsLayer = xsParentLayer.getSubElementByName(xsElementName); |
507 |
//If the layer name doesn't exist on the parent schema
|
508 |
if (xsLayer == null){ |
509 |
isRemoved = true;
|
510 |
getErrorHandler().addWarning(new NotSupportedLayerWarning(name,
|
511 |
xsElementName, |
512 |
parentLayer.getName(), |
513 |
parentLayer.getType())); |
514 |
} |
515 |
} |
516 |
} |
517 |
} |
518 |
layerStack.push(name,xsElementName,isRemoved); |
519 |
if (!isRemoved){
|
520 |
writerImplementor.startLayer(id, name, description, srs, xsElementName); |
521 |
} |
522 |
} |
523 |
|
524 |
/*
|
525 |
* (non-Javadoc)
|
526 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endLayer()
|
527 |
*/
|
528 |
public void endLayer() { |
529 |
TypedObject layer = layerStack.pop(); |
530 |
if (!layer.isRemoved()){
|
531 |
writerImplementor.endLayer(); |
532 |
}else{
|
533 |
if (layerStack.size() == 0){ |
534 |
isRemoved = false;
|
535 |
}else{
|
536 |
TypedObject parentLayer = layerStack.lastElement(); |
537 |
isRemoved = parentLayer.isRemoved(); |
538 |
} |
539 |
} |
540 |
} |
541 |
|
542 |
/*
|
543 |
* (non-Javadoc)
|
544 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startFeature(java.lang.String, java.lang.String)
|
545 |
*/
|
546 |
public void startFeature(String id, String name, String xsElementName) { |
547 |
if (isRemoved){
|
548 |
featureStack.push(name,xsElementName,isRemoved); |
549 |
return;
|
550 |
} |
551 |
TypedObject layer = layerStack.lastElement(); |
552 |
//If the parent layer has type
|
553 |
if (layer.getType() != null){ |
554 |
IXSElementDeclaration xsLayer = getSchemaDocument().getElementDeclarationByName(layer.getType()); |
555 |
//If the layer schema exists
|
556 |
if (xsLayer != null){ |
557 |
IXSElementDeclaration xsFeature = xsLayer.getSubElementByName(xsElementName); |
558 |
//If the feature type doesn't exist on the layer
|
559 |
if (xsFeature == null){ |
560 |
isRemoved = true;
|
561 |
getErrorHandler().addWarning(new NotSupportedFeatureWarning(name,
|
562 |
xsElementName, |
563 |
layer.getName(), |
564 |
layer.getType())); |
565 |
} |
566 |
} |
567 |
}else{//The layer doesn't has type |
568 |
//If the feature has type
|
569 |
if (xsElementName != null){ |
570 |
//If the feature type is not on the schema
|
571 |
if (getSchemaDocument().getElementDeclarationByName(xsElementName) == null){ |
572 |
isRemoved = true;
|
573 |
getErrorHandler().addWarning(new NotSupportedFeatureWarning(name,
|
574 |
xsElementName)); |
575 |
} |
576 |
} |
577 |
} |
578 |
featureStack.push(name,xsElementName,isRemoved); |
579 |
if (!isRemoved){
|
580 |
writerImplementor.startFeature(id, name, xsElementName); |
581 |
} |
582 |
} |
583 |
|
584 |
/*
|
585 |
* (non-Javadoc)
|
586 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endFeature()
|
587 |
*/
|
588 |
public void endFeature() { |
589 |
TypedObject feature = featureStack.pop(); |
590 |
if (!feature.isRemoved()){
|
591 |
writerImplementor.endFeature(); |
592 |
}else{
|
593 |
if (!layerStack.lastElement().isRemoved()){
|
594 |
if (featureStack.size() == 0){ |
595 |
isRemoved = false;
|
596 |
}else{
|
597 |
TypedObject parentFeature = featureStack.lastElement(); |
598 |
isRemoved = parentFeature.isRemoved(); |
599 |
} |
600 |
} |
601 |
} |
602 |
} |
603 |
|
604 |
/*
|
605 |
* (non-Javadoc)
|
606 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startMultiPoint(java.lang.String, java.lang.String)
|
607 |
*/
|
608 |
public void startMultiPoint(String id, String srs) { |
609 |
if (isRemoved) return; |
610 |
writerImplementor.startMultiPoint(id, srs); |
611 |
} |
612 |
|
613 |
/*
|
614 |
* (non-Javadoc)
|
615 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endMuliPoint()
|
616 |
*/
|
617 |
public void endMultiPoint() { |
618 |
if (isRemoved) return; |
619 |
writerImplementor.endMultiPoint(); |
620 |
} |
621 |
|
622 |
/*
|
623 |
* (non-Javadoc)
|
624 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startMultiLineString(java.lang.String, java.lang.String)
|
625 |
*/
|
626 |
public void startMultiLineString(String id, String srs) { |
627 |
if (isRemoved) return; |
628 |
writerImplementor.startMultiLineString(id, srs); |
629 |
} |
630 |
|
631 |
/*
|
632 |
* (non-Javadoc)
|
633 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endMultiLineString()
|
634 |
*/
|
635 |
public void endMultiLineString() { |
636 |
if (isRemoved) return; |
637 |
writerImplementor.endMultiLineString(); |
638 |
} |
639 |
|
640 |
/*
|
641 |
* (non-Javadoc)
|
642 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startMultiPolygon(java.lang.String, java.lang.String)
|
643 |
*/
|
644 |
public void startMultiPolygon(String id, String srs) { |
645 |
if (isRemoved) return; |
646 |
writerImplementor.startMultiPolygon(id, srs); |
647 |
} |
648 |
|
649 |
/*
|
650 |
* (non-Javadoc)
|
651 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endMultiPolygon()
|
652 |
*/
|
653 |
public void endMultiPolygon() { |
654 |
if (isRemoved) return; |
655 |
writerImplementor.endMultiPolygon(); |
656 |
} |
657 |
|
658 |
/*
|
659 |
* (non-Javadoc)
|
660 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#startMultiGeometry(java.lang.String, java.lang.String)
|
661 |
*/
|
662 |
public void startMultiGeometry(String id, String srs) { |
663 |
if (isRemoved) return; |
664 |
writerImplementor.startMultiGeometry(id, srs); |
665 |
} |
666 |
|
667 |
/*
|
668 |
* (non-Javadoc)
|
669 |
* @see org.gvsig.gpe.writers.IGPEWriterHandler#endMultiGeometry()
|
670 |
*/
|
671 |
public void endMultiGeometry() { |
672 |
if (isRemoved) return; |
673 |
writerImplementor.endMultiGeometry(); |
674 |
} |
675 |
|
676 |
/**
|
677 |
* @return the schemaDocument
|
678 |
*/
|
679 |
public IXSSchemaDocument getSchemaDocument() {
|
680 |
return writerImplementor.getSchemaDocument();
|
681 |
} |
682 |
|
683 |
/**
|
684 |
* @param schemaDocument the schemaDocument to set
|
685 |
*/
|
686 |
public void setSchemaDocument(IXSSchemaDocument schemaDocument) { |
687 |
writerImplementor.setSchemaDocument(schemaDocument); |
688 |
} |
689 |
} |