Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wmts / wmts_1_0_0 / struct / WMTSThemes_1_0_0.java @ 34393

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

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

    
41
        /**
42
     * Parses the list of themes
43
     * @param parser
44
     * @param content
45
     * @throws IOException
46
     * @throws XmlPullParserException
47
     */
48
        public void parse(KXmlParser parser) throws IOException, XmlPullParserException {
49
            int currentTag;
50
            boolean end = false;
51
            
52
            currentTag = parser.next();
53
            
54
            while (!end) {
55
                         switch(currentTag) {
56
                                case KXmlParser.START_TAG:
57
                                        if (compareName(parser, CapabilitiesTags.WMTS_THEME)) {
58
                                                WMTSTheme newTheme = new WMTSTheme_1_0_0();
59
                                                newTheme.parse(parser);
60
                                                add(newTheme);
61
                                        }                         
62
                                        break;
63
                                case KXmlParser.END_TAG:
64
                                        if (compareName(parser, CapabilitiesTags.WMTS_THEMES))
65
                                                end = true;
66
                                        break;
67
                                case KXmlParser.TEXT:                                        
68
                                break;
69
                         }
70
             if (!end)
71
                 currentTag = parser.next();
72
            }
73
    }
74
    
75
    /**
76
     * Compares the next name in the selected parser with the string passed
77
     * by value.
78
     * @param parser
79
     * @param name
80
     * @return
81
     */
82
    public boolean compareName(KXmlParser parser, String name) {
83
            String s = parser.getName();
84
            if(s.compareTo(name) == 0 || s.compareTo(WMTSBaseStruct.gmlTag + name) == 0)
85
                    return true;
86
            return false;
87
    }
88
}