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 / WMTSLayer_1_0_0.java @ 2613

History | View | Annotate | Download (4.35 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.base.WMTSServerDescription;
28
import org.gvsig.raster.wmts.ogc.impl.struct.WMTSLayerImpl;
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
 * Describes the attributes of a layer in a WMTS server using the protocol version 1.0.0
35
 *
36
 * @author Nacho Brodin (nachobrodin@gmail.com)
37
 */
38
public class WMTSLayer_1_0_0 extends WMTSLayerImpl {
39
        
40
        public WMTSLayer_1_0_0(WMTSServerDescription status) {
41
                super(status);
42
        }
43
        
44
        /**
45
     * Parses a WMTS layer
46
     * @param parser
47
     * @throws IOException
48
     * @throws XmlPullParserException
49
     */
50
        public void parse(KXmlParser parser) throws IOException, XmlPullParserException {
51
            int currentTag;
52
            boolean end = false;
53
            
54
            currentTag = parser.next();
55
            
56
            while (!end) {
57
                         switch(currentTag) {
58
                                case KXmlParser.START_TAG:
59
                                        if (compareName(parser, Tags.WMTS_TITLE)) {
60
                                                setTitle(nextText(parser));
61
                                        } else if (compareName(parser, Tags.WMTS_WGS84BOUNDINGBOX)) {
62
                                                WMTSBoundingBox_1_0_0 bbox = new WMTSBoundingBox_1_0_0();
63
                                                //bbox.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder);
64
                                                bbox.parse(parser);  
65
                                                setWGS84BBox(bbox);
66
                                        } else if (compareName(parser, Tags.WMTS_IDENTIFIER)) {
67
                                                setIdentifier(nextText(parser)); 
68
                                        } else if (compareName(parser, Tags.WMTS_ABSTRACT)) {
69
                                                setAbstract(nextText(parser)); 
70
                                        } else if (compareName(parser, Tags.WMTS_KEYWORDS)) {
71
                                                WMTSKeywords_1_0_0 keywords = new WMTSKeywords_1_0_0();
72
                                                keywords.parse(parser);
73
                                                setKeywords(keywords.getKeywords());
74
                                        } else if (compareName(parser, Tags.WMTS_BOUNDINGBOX)) {
75
                                                WMTSBoundingBox_1_0_0 bbox = new WMTSBoundingBox_1_0_0();
76
                                                //bbox.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder);
77
                                                bbox.parse(parser);  
78
                                                setBBox(bbox);
79
                                        } else if (compareName(parser, Tags.WMTS_STYLE)) {
80
                                                WMTSStyle_1_0_0 style = new WMTSStyle_1_0_0();
81
                                                style.parse(parser); 
82
                                                getStyle().add(style);
83
                                        } else if (compareName(parser, Tags.WMTS_FORMAT)) {
84
                                                getFormat().add(nextText(parser));
85
                                        } else if (compareName(parser, Tags.WMTS_INFOFORMAT)) {
86
                                                getInfoFormat().add(nextText(parser)); 
87
                                        } else if (compareName(parser, Tags.WMTS_DIMENSION)) {
88
                                                WMTSDimension_1_0_0 dimension = new WMTSDimension_1_0_0();
89
                                                dimension.parse(parser);  
90
                                                getDimensions().add(dimension);
91
                                        } else if (compareName(parser, Tags.WMTS_METADATA)) {
92
                                                setMetadata(nextText(parser)); 
93
                                        } else if (compareName(parser, Tags.WMTS_TILEMATRIXSETLINK)) {
94
                                                WMTSTileMatrixSetLinkImpl tileMatrixSetLink = new WMTSTileMatrixSetLink_1_0_0();
95
                                                tileMatrixSetLink.setForceChangeAxisOrder(forceChangeAxisOrder);
96
                                                tileMatrixSetLink.parse(parser);
97
                                                getTileMatrixSetLink().add(tileMatrixSetLink); 
98
                                        } else if (compareName(parser, Tags.WMTS_RESOURCEURL)) {
99
                                                WMTSResourceURL_1_0_0 resourceURL = new WMTSResourceURL_1_0_0();
100
                                                resourceURL.parse(parser, currentTag); 
101
                                                getResourceURL().add(resourceURL);
102
                                        } 
103
                                        
104
                                        break;
105
                                case KXmlParser.END_TAG:
106
                                        if (compareName(parser, Tags.WMTS_LAYER))
107
                                                end = true;
108
                                        break;
109
                                case KXmlParser.TEXT:                                        
110
                                break;
111
                         }
112
             if (!end)
113
                 currentTag = parser.next();
114
            }
115
            
116
                   status.getLayerList().add(this);
117
    }
118
}