root / branches / v1_9_0 / libGPE-GML / src / org / gvsig / gpe / gml / parser / v2 / geometries / MultiPointPropertyTypeBinding.java @ 53
History | View | Annotate | Download (4 KB)
1 |
package org.gvsig.gpe.gml.parser.v2.geometries; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import javax.xml.namespace.QName; |
6 |
|
7 |
import org.gvsig.gpe.gml.parser.GPEDefaultGmlParser; |
8 |
import org.gvsig.gpe.gml.utils.GMLTags; |
9 |
import org.gvsig.gpe.xml.stream.EventType; |
10 |
import org.gvsig.gpe.xml.stream.IXmlStreamReader; |
11 |
import org.gvsig.gpe.xml.stream.XmlStreamException; |
12 |
import org.gvsig.gpe.xml.utils.CompareUtils; |
13 |
|
14 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
15 |
*
|
16 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
17 |
*
|
18 |
* This program is free software; you can redistribute it and/or
|
19 |
* modify it under the terms of the GNU General Public License
|
20 |
* as published by the Free Software Foundation; either version 2
|
21 |
* of the License, or (at your option) any later version.
|
22 |
*
|
23 |
* This program is distributed in the hope that it will be useful,
|
24 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
* GNU General Public License for more details.
|
27 |
*
|
28 |
* You should have received a copy of the GNU General Public License
|
29 |
* along with this program; if not, write to the Free Software
|
30 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
31 |
*
|
32 |
* For more information, contact:
|
33 |
*
|
34 |
* Generalitat Valenciana
|
35 |
* Conselleria d'Infraestructures i Transport
|
36 |
* Av. Blasco Ib??ez, 50
|
37 |
* 46010 VALENCIA
|
38 |
* SPAIN
|
39 |
*
|
40 |
* +34 963862235
|
41 |
* gvsig@gva.es
|
42 |
* www.gvsig.gva.es
|
43 |
*
|
44 |
* or
|
45 |
*
|
46 |
* IVER T.I. S.A
|
47 |
* Salamanca 50
|
48 |
* 46005 Valencia
|
49 |
* Spain
|
50 |
*
|
51 |
* +34 963163400
|
52 |
* dac@iver.es
|
53 |
*/
|
54 |
/* CVS MESSAGES:
|
55 |
*
|
56 |
* $Id:MultiPointPropertyTypeBinding.java 371 2008-01-10 09:30:19Z jpiera $
|
57 |
* $Log$
|
58 |
* Revision 1.2 2007/05/24 07:29:47 csanchez
|
59 |
* A?adidos Alias GML2
|
60 |
*
|
61 |
* Revision 1.1 2007/05/15 07:30:38 jorpiell
|
62 |
* Add the geometryProperties tags
|
63 |
*
|
64 |
*
|
65 |
*/
|
66 |
/**
|
67 |
* It parses a gml:multiPointTProperty object. Example:
|
68 |
* <p>
|
69 |
* <pre>
|
70 |
* <code>
|
71 |
* <multiPointProperty>
|
72 |
* <MultiPoint>
|
73 |
* <pointMember>
|
74 |
* <Point gid="P6776">
|
75 |
* <coord><X>50.0</X><Y>50.0</Y></coord>
|
76 |
* </Point>
|
77 |
* </pointMember>
|
78 |
* <pointMember>
|
79 |
* <Point gid="P6777">
|
80 |
* <coord><X>50.0</X><Y>50.0</Y></coord>
|
81 |
* </Point>
|
82 |
* </pointMember>
|
83 |
* <MultiPoint>
|
84 |
* </multiPointProperty>
|
85 |
* </code>
|
86 |
* </pre>
|
87 |
* </p>
|
88 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
89 |
*/
|
90 |
public class MultiPointPropertyTypeBinding extends GeometryBinding{ |
91 |
|
92 |
/**
|
93 |
* It parses the gml:multiPointProperty tag
|
94 |
* @param parser
|
95 |
* The XML parser
|
96 |
* @param handler
|
97 |
* The GPE parser that contains the content handler and
|
98 |
* the error handler
|
99 |
* @return
|
100 |
* A multipoint
|
101 |
* @throws XmlStreamException
|
102 |
* @throws IOException
|
103 |
*/
|
104 |
public Object parse(IXmlStreamReader parser,GPEDefaultGmlParser handler) throws XmlStreamException, IOException { |
105 |
|
106 |
parser.require(EventType.START_ELEMENT, GMLTags.GML_MULTIPOINTPROPERTY); |
107 |
|
108 |
boolean endFeature = false; |
109 |
EventType currentTag; |
110 |
Object multiPoint = null; |
111 |
|
112 |
super.setAtributtes(parser, handler.getErrorHandler());
|
113 |
|
114 |
QName tag = parser.getElementName();
|
115 |
currentTag = parser.getEventType(); |
116 |
|
117 |
while (!endFeature){
|
118 |
switch(currentTag.getCode()){
|
119 |
case EventType.START_ELEMENT_CODE:
|
120 |
if (CompareUtils.compareWithNamespace(tag,GMLTags.GML_MULTIPOINT)){
|
121 |
multiPoint = handler.getProfile().getMultiPointTypeBinding(). |
122 |
parse(parser, handler); |
123 |
} |
124 |
break;
|
125 |
case EventType.END_ELEMENT_CODE:
|
126 |
if ((CompareUtils.compareWithNamespace(tag,GMLTags.GML_MULTIPOINTPROPERTY))||
|
127 |
(CompareUtils.compareWithNamespace(tag,GMLTags.GML_MULTILOCATION))|| |
128 |
(CompareUtils.compareWithNamespace(tag,GMLTags.GML_MULTICENTEROF))|| |
129 |
(CompareUtils.compareWithNamespace(tag,GMLTags.GML_MULTIPOSITION))){ |
130 |
endFeature = true;
|
131 |
} |
132 |
break;
|
133 |
} |
134 |
if (!endFeature){
|
135 |
currentTag = parser.nextTag(); |
136 |
tag = parser.getElementName(); |
137 |
} |
138 |
} |
139 |
return multiPoint;
|
140 |
} |
141 |
} |
142 |
|