gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.ogc / org.gvsig.raster.wmts.ogc.impl / src / main / java / org / gvsig / raster / wmts / ogc / impl / wmts_1_0_0 / struct / WMTSTileMatrixSetLink_1_0_0.java @ 1811
History | View | Annotate | Download (2.64 KB)
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 |
package org.gvsig.raster.wmts.ogc.impl.wmts_1_0_0.struct; |
23 |
|
24 |
import java.io.IOException; |
25 |
|
26 |
import org.gvsig.raster.wmts.ogc.impl.Tags; |
27 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSBaseStruct; |
28 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSTileMatrixLimitsImpl; |
29 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSTileMatrixSetLinkImpl; |
30 |
import org.kxml2.io.KXmlParser; |
31 |
import org.xmlpull.v1.XmlPullParserException; |
32 |
|
33 |
/**
|
34 |
* Set of tiles using the protocol version 1.0.0
|
35 |
*
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
37 |
*/
|
38 |
public class WMTSTileMatrixSetLink_1_0_0 extends WMTSTileMatrixSetLinkImpl { |
39 |
|
40 |
public void parse(KXmlParser parser) throws IOException, XmlPullParserException { |
41 |
int currentTag;
|
42 |
boolean end = false; |
43 |
|
44 |
currentTag = parser.next(); |
45 |
|
46 |
while (!end) {
|
47 |
switch(currentTag) {
|
48 |
case KXmlParser.START_TAG:
|
49 |
if (compareName(parser, Tags.WMTS_TILEMATRIXSET)) {
|
50 |
setTileMatrixSetId(parser.nextText()); |
51 |
} else if (compareName(parser, Tags.WMTS_TILEMATRIXLIMITS)) { |
52 |
WMTSTileMatrixLimitsImpl limits = new WMTSTileMatrixLimits_1_0_0();
|
53 |
limits.parse(parser, getTileMatrixLimits()); |
54 |
} |
55 |
break;
|
56 |
case KXmlParser.END_TAG:
|
57 |
if (compareName(parser, Tags.WMTS_TILEMATRIXSETLINK))
|
58 |
end = true;
|
59 |
break;
|
60 |
case KXmlParser.TEXT:
|
61 |
break;
|
62 |
} |
63 |
if (!end)
|
64 |
currentTag = parser.next(); |
65 |
} |
66 |
} |
67 |
|
68 |
/**
|
69 |
* Compares the next name in the selected parser with the string passed
|
70 |
* by value.
|
71 |
* @param parser
|
72 |
* @param name
|
73 |
* @return
|
74 |
*/
|
75 |
public boolean compareName(KXmlParser parser, String name) { |
76 |
String s = parser.getName();
|
77 |
if(s.compareTo(name) == 0 || s.compareTo(WMTSBaseStruct.gmlTag + name) == 0) |
78 |
return true; |
79 |
return false; |
80 |
} |
81 |
} |