root / branches / Mobile1.0 / org.gvsig.gpe.kml / src / org / gvsig / gpe / kml / parser / v21 / geometries / InnerBoundaryIsBinding.java @ 79
History | View | Annotate | Download (3.71 KB)
1 |
package org.gvsig.gpe.kml.parser.v21.geometries; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import javax.xml.namespace.QName; |
6 |
|
7 |
import org.gvsig.gpe.kml.parser.GPEDeafultKmlParser; |
8 |
import org.gvsig.gpe.kml.utils.Kml2_1_Tags; |
9 |
import org.gvsig.gpe.parser.ICoordinateIterator; |
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:InnerBoundaryIsBinding.java 357 2008-01-09 17:50:08Z jpiera $
|
57 |
* $Log$
|
58 |
* Revision 1.2 2007/06/07 14:53:59 jorpiell
|
59 |
* Add the schema support
|
60 |
*
|
61 |
* Revision 1.1 2007/05/11 07:06:29 jorpiell
|
62 |
* Refactoring of some package names
|
63 |
*
|
64 |
* Revision 1.2 2007/05/08 08:22:37 jorpiell
|
65 |
* Add comments to create javadocs
|
66 |
*
|
67 |
* Revision 1.1 2007/04/14 16:08:07 jorpiell
|
68 |
* Kml writing support added
|
69 |
*
|
70 |
*
|
71 |
*/
|
72 |
/**
|
73 |
* It parses the innerBoundaryIs tag. Example:
|
74 |
* <p>
|
75 |
* <pre>
|
76 |
* <code>
|
77 |
* <innerBoundaryIs>
|
78 |
* <LinearRing>
|
79 |
* <coordinates>10.0,10.0 10.0,40.0 40.0,40.0 40.0,10.0 10.0,10.0</coordinates>
|
80 |
* </LinearRing>
|
81 |
* </innerBoundaryIs>
|
82 |
* </code>
|
83 |
* </pre>
|
84 |
* </p>
|
85 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
86 |
* @see http://code.google.com/apis/kml/documentation/kml_tags_21.html#innerboundaryis
|
87 |
*/
|
88 |
public class InnerBoundaryIsBinding { |
89 |
|
90 |
/**
|
91 |
* It parses the innerBoundary tag
|
92 |
* @param parser
|
93 |
* The XML parser
|
94 |
* @param handler
|
95 |
* The GPE parser that contains the content handler and
|
96 |
* the error handler
|
97 |
* @return
|
98 |
* It retuns a matrix of doubles with 3 columns (x,y,z) and
|
99 |
* one row for each coordinate.
|
100 |
* @throws IOException
|
101 |
* @throws XmlStreamException
|
102 |
* @throws XmlStreamException
|
103 |
* @throws IOException
|
104 |
*/
|
105 |
public ICoordinateIterator parse(IXmlStreamReader parser,GPEDeafultKmlParser handler) throws XmlStreamException, IOException { |
106 |
boolean endFeature = false; |
107 |
int currentTag;
|
108 |
|
109 |
QName tag = parser.getName();
|
110 |
currentTag = parser.getEventType(); |
111 |
|
112 |
while (!endFeature){
|
113 |
switch(currentTag){
|
114 |
case IXmlStreamReader.START_ELEMENT:
|
115 |
if (CompareUtils.compareWithOutNamespace(tag,Kml2_1_Tags.LINEARRING)){
|
116 |
return handler.getProfile().getLinearRingBinding().
|
117 |
parse(parser, handler); |
118 |
} |
119 |
break;
|
120 |
case IXmlStreamReader.END_ELEMENT:
|
121 |
if (CompareUtils.compareWithOutNamespace(tag,Kml2_1_Tags.INNERBOUNDARYIS)){
|
122 |
endFeature = true;
|
123 |
} |
124 |
break;
|
125 |
case IXmlStreamReader.CHARACTERS:
|
126 |
|
127 |
break;
|
128 |
} |
129 |
if (!endFeature){
|
130 |
currentTag = parser.next(); |
131 |
tag = parser.getName(); |
132 |
} |
133 |
} |
134 |
return null; |
135 |
} |
136 |
} |