Statistics
| Revision:

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 @ 1806

History | View | Annotate | Download (3.29 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.ArrayList;
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.kxml2.io.KXmlParser;
32
import org.xmlpull.v1.XmlPullParserException;
33

    
34

    
35
/**
36
 * <p>Defines a OGC style. Theme that describes the appeareance of certain layer.</p>
37
 * @author Nacho Brodin (nachobrodin@gmail.com)
38
 */
39
public class WMTSTileMatrixSet_1_0_0 extends WMTSTileMatrixSetImpl {
40
        
41
        public void parse(KXmlParser parser, ArrayList matrixSetList) throws IOException, XmlPullParserException {
42
            int currentTag;
43
            boolean end = false;
44
            
45
            currentTag = parser.next();
46
            
47
            while (!end) {
48
                         switch(currentTag) {
49
                                case KXmlParser.START_TAG:
50
                                        if (compareName(parser, Tags.WMTS_IDENTIFIER)) {
51
                                                setIdentifier(nextText(parser));
52
                                        } else if (compareName(parser, Tags.WMTS_TITLE)) {
53
                                                setTitle(nextText(parser));
54
                                        } else if (compareName(parser, Tags.WMTS_ABSTRACT)) {
55
                                                setAbstract(nextText(parser));
56
                                        } else if (compareName(parser, Tags.WMTS_KEYWORDS)) {
57
                                                parser.skipSubTree();
58
                                        } else if (compareName(parser, Tags.WMTS_BOUNDINGBOX)) {
59
                                                getBoundingBox().parse(parser);
60
                                        } else if (compareName(parser, Tags.WMTS_SUPPORTEDCRS)) {
61
                                                setSupportedCRS(nextText(parser));
62
                                        } else if (compareName(parser, Tags.WMTS_WELLKNOWNSCALESET)) {
63
                                                setWellKnownScaleSet(nextText(parser));
64
                                        } else if (compareName(parser, Tags.WMTS_TILEMATRIX)) {
65
                                                WMTSTileMatrixImpl tileMatrix = new WMTSTileMatrix_1_0_0();
66
                                                if(bbox != null)
67
                                                        tileMatrix.setBBoxTileMatrixSet(bbox.toRectangle2D());
68
                                                tileMatrix.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder);
69
                                                tileMatrix.parse(parser, getTileMatrix()); 
70
                                        }
71
                                        break;
72
                                case KXmlParser.END_TAG:
73
                                        if (compareName(parser, Tags.WMTS_TILEMATRIXSET)) {
74
                                                end = true;
75
                                                matrixSetList.add(this);
76
                                        }
77
                                        break;
78
                                case KXmlParser.TEXT:                                        
79
                                break;
80
                         }
81
             if (!end)
82
                 currentTag = parser.next();
83
            }
84
    }
85
        
86
        public WMTSBoundingBoxImpl getBoundingBox() {
87
                if(bbox == null) {
88
                        bbox = new WMTSBoundingBox_1_0_0();
89
                        bbox.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder);
90
                }
91
                return bbox;
92
        }
93
}