Statistics
| Revision:

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

History | View | Annotate | Download (4.51 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

    
28
import org.gvsig.remoteclient.utils.CapabilitiesTags;
29
import org.gvsig.remoteclient.wmts.WMTSServerDescription;
30
import org.gvsig.remoteclient.wmts.struct.WMTSBoundingBox;
31
import org.gvsig.remoteclient.wmts.struct.WMTSLayer;
32
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSetLink;
33
import org.kxml2.io.KXmlParser;
34
import org.xmlpull.v1.XmlPullParserException;
35

    
36
/**
37
 * Describes the attributes of a layer in a WMTS server using the protocol version 1.0.0
38
 *
39
 * @author Nacho Brodin (nachobrodin@gmail.com)
40
 */
41
public class WMTSLayer_1_0_0 extends WMTSLayer {
42
        
43
        public WMTSLayer_1_0_0(WMTSServerDescription status) {
44
                super(status);
45
        }
46
        
47
        /**
48
     * Parses a WMTS layer
49
     * @param parser
50
     * @throws IOException
51
     * @throws XmlPullParserException
52
     */
53
        public void parse(KXmlParser parser) throws IOException, XmlPullParserException {
54
            int currentTag;
55
            boolean end = false;
56
            
57
            currentTag = parser.next();
58
            
59
            while (!end) {
60
                         switch(currentTag) {
61
                                case KXmlParser.START_TAG:
62
                                        if (compareName(parser, CapabilitiesTags.WMTS_TITLE)) {
63
                                                setTitle(nextText(parser));
64
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_WGS84BOUNDINGBOX)) {
65
                                                getWGS84BBox().parse(parser); 
66
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_IDENTIFIER)) {
67
                                                setIdentifier(nextText(parser)); 
68
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_ABSTRACT)) {
69
                                                setAbstract(nextText(parser)); 
70
                                        } else if (compareName(parser, CapabilitiesTags.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, CapabilitiesTags.WMTS_BOUNDINGBOX)) {
75
                                                getBBox().parse(parser);  
76
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_STYLE)) {
77
                                                WMTSStyle_1_0_0 style = new WMTSStyle_1_0_0();
78
                                                style.parse(parser); 
79
                                                getStyle().add(style);
80
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_FORMAT)) {
81
                                                getFormat().add(nextText(parser));
82
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_INFOFORMAT)) {
83
                                                getInfoFormat().add(nextText(parser)); 
84
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_DIMENSION)) {
85
                                                getDimension().parse(parser);  
86
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_METADATA)) {
87
                                                setMetadata(nextText(parser)); 
88
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_TILEMATRIXSETLINK)) {
89
                                                WMTSTileMatrixSetLink tileMatrixSetLink = new WMTSTileMatrixSetLink_1_0_0();
90
                                                tileMatrixSetLink.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder);
91
                                                tileMatrixSetLink.parse(parser);
92
                                                getTileMatrixSetLink().add(tileMatrixSetLink); 
93
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_RESOURCEURL)) {
94
                                                getResourceURL().parse(parser); 
95
                                        } 
96
                                        
97
                                        break;
98
                                case KXmlParser.END_TAG:
99
                                        if (compareName(parser, CapabilitiesTags.WMTS_LAYER))
100
                                                end = true;
101
                                        break;
102
                                case KXmlParser.TEXT:                                        
103
                                break;
104
                         }
105
             if (!end)
106
                 currentTag = parser.next();
107
            }
108
            
109
                   status.getLayerList().add(this);
110
    }
111
        
112
        public WMTSBoundingBox getWGS84BBox() {
113
                if(wgs84bbox == null) {
114
                        wgs84bbox = new WMTSBoundingBox_1_0_0();
115
                        wgs84bbox.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder);
116
                }
117
                return wgs84bbox;
118
        }
119
        
120
        public WMTSBoundingBox getBBox() {
121
                if(bbox == null) {
122
                        bbox = new WMTSBoundingBox_1_0_0();
123
                        bbox.setForceLongitudeFirstAxisOrder(forceLongitudeFirstAxisOrder);
124
                }
125
                return bbox;
126
        }
127
}