svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wmts / wmts_1_0_0 / struct / WMTSTileMatrixLimits_1_0_0.java @ 40769
History | View | Annotate | Download (3.4 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.remoteclient.wmts.wmts_1_0_0.struct; |
25 |
|
26 |
import java.io.IOException; |
27 |
import java.util.ArrayList; |
28 |
|
29 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
30 |
import org.gvsig.remoteclient.wmts.struct.WMTSBaseStruct; |
31 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixLimits; |
32 |
import org.kxml2.io.KXmlParser; |
33 |
import org.xmlpull.v1.XmlPullParserException; |
34 |
|
35 |
/**
|
36 |
* Describes the attributes of a layer in a WMTS server using the protocol version 1.0.0
|
37 |
*
|
38 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
39 |
*/
|
40 |
public class WMTSTileMatrixLimits_1_0_0 extends WMTSTileMatrixLimits { |
41 |
|
42 |
public void parse(KXmlParser parser, ArrayList list) throws IOException, XmlPullParserException { |
43 |
int currentTag;
|
44 |
boolean end = false; |
45 |
|
46 |
currentTag = parser.next(); |
47 |
|
48 |
while (!end) {
|
49 |
switch(currentTag) {
|
50 |
case KXmlParser.START_TAG:
|
51 |
if (compareName(parser, CapabilitiesTags.WMTS_TILEMATRIX)) {
|
52 |
setRefToTileMatrix(parser.nextText()); |
53 |
} else if (compareName(parser, CapabilitiesTags.WMTS_MINTILEROW)) { |
54 |
int n = 0; |
55 |
try {
|
56 |
n = Integer.parseInt(parser.nextText());
|
57 |
} catch(NumberFormatException e) {} |
58 |
setMinTileRow(n); |
59 |
} else if (compareName(parser, CapabilitiesTags.WMTS_MAXTILEROW)) { |
60 |
int n = 0; |
61 |
try {
|
62 |
n = Integer.parseInt(parser.nextText());
|
63 |
} catch(NumberFormatException e) {} |
64 |
setMaxTileRow(n); |
65 |
} else if (compareName(parser, CapabilitiesTags.WMTS_MINTILECOL)) { |
66 |
int n = 0; |
67 |
try {
|
68 |
n = Integer.parseInt(parser.nextText());
|
69 |
} catch(NumberFormatException e) {} |
70 |
setMinTileCol(n); |
71 |
} else if (compareName(parser, CapabilitiesTags.WMTS_MAXTILECOL)) { |
72 |
int n = 0; |
73 |
try {
|
74 |
n = Integer.parseInt(parser.nextText());
|
75 |
} catch(NumberFormatException e) {} |
76 |
setMaxTileCol(n); |
77 |
} |
78 |
break;
|
79 |
case KXmlParser.END_TAG:
|
80 |
if (compareName(parser, CapabilitiesTags.WMTS_TILEMATRIXLIMITS))
|
81 |
end = true;
|
82 |
break;
|
83 |
case KXmlParser.TEXT:
|
84 |
break;
|
85 |
} |
86 |
if (!end)
|
87 |
currentTag = parser.next(); |
88 |
} |
89 |
list.add(this);
|
90 |
} |
91 |
|
92 |
/**
|
93 |
* Compares the next name in the selected parser with the string passed
|
94 |
* by value.
|
95 |
* @param parser
|
96 |
* @param name
|
97 |
* @return
|
98 |
*/
|
99 |
public boolean compareName(KXmlParser parser, String name) { |
100 |
String s = parser.getName();
|
101 |
if(s.compareTo(name) == 0 || s.compareTo(WMTSBaseStruct.gmlTag + name) == 0) |
102 |
return true; |
103 |
return false; |
104 |
} |
105 |
} |