Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wmts / wmts_1_0_0 / struct / WMTSTheme_1_0_0.java @ 37808

History | View | Annotate | Download (2.64 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.remoteclient.wmts.wmts_1_0_0.struct;
23

    
24
import java.io.IOException;
25

    
26
import org.gvsig.remoteclient.utils.CapabilitiesTags;
27
import org.gvsig.remoteclient.wmts.struct.WMTSTheme;
28
import org.kxml2.io.KXmlParser;
29
import org.xmlpull.v1.XmlPullParserException;
30

    
31
/**
32
 * Layer hierarchy using the protocol version 1.0.0
33
 *
34
 * @author Nacho Brodin (nachobrodin@gmail.com)
35
 */
36
public class WMTSTheme_1_0_0 extends WMTSTheme {
37
        
38
        /**
39
     * Parses a theme
40
     * @param parser
41
     * @param content
42
     * @throws IOException
43
     * @throws XmlPullParserException
44
     */
45
        public void parse(KXmlParser parser) throws IOException, XmlPullParserException {
46
            int currentTag;
47
            boolean end = false;
48
            
49
            currentTag = parser.next();
50
            
51
            while (!end) {
52
                         switch(currentTag) {
53
                                case KXmlParser.START_TAG:
54
                                        if (compareName(parser, CapabilitiesTags.WMTS_IDENTIFIER)) {
55
                                                setIdentifier(nextText(parser));
56
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_TITLE)) {
57
                                                setTitle(nextText(parser));
58
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_ABSTRACT)) {
59
                                                setAbstract(nextText(parser));
60
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_KEYWORDS)) {
61
                                                parser.skipSubTree();
62
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_THEME)) {
63
                                                WMTSTheme newTheme = new WMTSTheme_1_0_0();
64
                                                newTheme.parse(parser);
65
                                                getThemeList().add(newTheme);
66
                                        } else if (compareName(parser, CapabilitiesTags.WMTS_LAYERREF)) {
67
                                                getLayerRef().add(nextText(parser));
68
                                        }                         
69
                                        break;
70
                                case KXmlParser.END_TAG:
71
                                        if (compareName(parser, CapabilitiesTags.WMTS_THEME))
72
                                                end = true;
73
                                        break;
74
                                case KXmlParser.TEXT:                                        
75
                                break;
76
                         }
77
             if (!end)
78
                 currentTag = parser.next();
79
            }
80
    }
81
}