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

History | View | Annotate | Download (2.72 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.struct.WMTSBaseStruct;
30
import org.gvsig.remoteclient.wmts.struct.WMTSTheme;
31
import org.gvsig.remoteclient.wmts.struct.WMTSThemes;
32
import org.kxml2.io.KXmlParser;
33
import org.xmlpull.v1.XmlPullParserException;
34

    
35
/**
36
 * Layer hierarchy using the protocol version 1.0.0
37
 *
38
 * @author Nacho Brodin (nachobrodin@gmail.com)
39
 */
40
public class WMTSThemes_1_0_0 extends WMTSThemes {
41
        private static final long serialVersionUID = 1L;
42

    
43
        /**
44
     * Parses the list of themes
45
     * @param parser
46
     * @param content
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, CapabilitiesTags.WMTS_THEME)) {
60
                                                WMTSTheme newTheme = new WMTSTheme_1_0_0();
61
                                                newTheme.parse(parser);
62
                                                add(newTheme);
63
                                        }                         
64
                                        break;
65
                                case KXmlParser.END_TAG:
66
                                        if (compareName(parser, CapabilitiesTags.WMTS_THEMES))
67
                                                end = true;
68
                                        break;
69
                                case KXmlParser.TEXT:                                        
70
                                break;
71
                         }
72
             if (!end)
73
                 currentTag = parser.next();
74
            }
75
    }
76
    
77
    /**
78
     * Compares the next name in the selected parser with the string passed
79
     * by value.
80
     * @param parser
81
     * @param name
82
     * @return
83
     */
84
    public boolean compareName(KXmlParser parser, String name) {
85
            String s = parser.getName();
86
            if(s.compareTo(name) == 0 || s.compareTo(WMTSBaseStruct.gmlTag + name) == 0)
87
                    return true;
88
            return false;
89
    }
90
}