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 / WMTSTileMatrixSet_1_0_0.java @ 2613
History | View | Annotate | Download (3.59 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 |
import java.util.List; |
26 |
|
27 |
import org.gvsig.raster.wmts.ogc.impl.Tags; |
28 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSBoundingBoxImpl; |
29 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSTileMatrixImpl; |
30 |
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSTileMatrixSetImpl; |
31 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet; |
32 |
import org.kxml2.io.KXmlParser; |
33 |
import org.xmlpull.v1.XmlPullParserException; |
34 |
|
35 |
|
36 |
/**
|
37 |
* <p>Defines a OGC style. Theme that describes the appeareance of certain layer.</p>
|
38 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
39 |
*/
|
40 |
public class WMTSTileMatrixSet_1_0_0 extends WMTSTileMatrixSetImpl { |
41 |
|
42 |
public void parse(KXmlParser parser, List<WMTSTileMatrixSet> matrixSetList) 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, Tags.WMTS_IDENTIFIER)) {
|
52 |
setIdentifier(nextText(parser)); |
53 |
} else if (compareName(parser, Tags.WMTS_TITLE)) { |
54 |
setTitle(nextText(parser)); |
55 |
} else if (compareName(parser, Tags.WMTS_ABSTRACT)) { |
56 |
setAbstract(nextText(parser)); |
57 |
} else if (compareName(parser, Tags.WMTS_KEYWORDS)) { |
58 |
parser.skipSubTree(); |
59 |
} else if (compareName(parser, Tags.WMTS_BOUNDINGBOX)) { |
60 |
getBoundingBox().parse(parser); |
61 |
} else if (compareName(parser, Tags.WMTS_SUPPORTEDCRS)) { |
62 |
setSupportedCRS(nextText(parser)); |
63 |
} else if (compareName(parser, Tags.WMTS_WELLKNOWNSCALESET)) { |
64 |
setWellKnownScaleSet(nextText(parser)); |
65 |
} else if (compareName(parser, Tags.WMTS_TILEMATRIX)) { |
66 |
WMTSTileMatrixImpl tileMatrix = new WMTSTileMatrix_1_0_0();
|
67 |
tileMatrix.setForceChangeAxisOrder(forceChangeAxisOrder); |
68 |
tileMatrix.parse(parser, getTileMatrix()); |
69 |
} |
70 |
break;
|
71 |
case KXmlParser.END_TAG:
|
72 |
if (compareName(parser, Tags.WMTS_TILEMATRIXSET)) {
|
73 |
end = true;
|
74 |
matrixSetList.add(this);
|
75 |
} |
76 |
break;
|
77 |
case KXmlParser.TEXT:
|
78 |
break;
|
79 |
} |
80 |
if (!end)
|
81 |
currentTag = parser.next(); |
82 |
} |
83 |
|
84 |
for (int i = 0; i < getTileMatrix().size(); i++) { |
85 |
if(bbox != null) |
86 |
((WMTSTileMatrixImpl)getTileMatrix().get(i)).setBBoxTileMatrixSet(bbox.toRectangle2D()); |
87 |
((WMTSTileMatrixImpl)getTileMatrix().get(i)).setSupportedCRS(getSupportedCRS()); |
88 |
((WMTSTileMatrixImpl)getTileMatrix().get(i)).checkChangeAxis(); |
89 |
} |
90 |
} |
91 |
|
92 |
public WMTSBoundingBoxImpl getBoundingBox() {
|
93 |
if(bbox == null) { |
94 |
bbox = new WMTSBoundingBox_1_0_0();
|
95 |
//bbox.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder);
|
96 |
} |
97 |
return bbox;
|
98 |
} |
99 |
} |