Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wms / WMSExtent.java @ 40559

History | View | Annotate | Download (3.54 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.wms;
25

    
26
import java.io.IOException;
27

    
28
import org.kxml2.io.KXmlParser;
29
import org.xmlpull.v1.XmlPullParserException;
30

    
31
import org.gvsig.remoteclient.utils.CapabilitiesTags;
32

    
33
public class WMSExtent {
34
            
35
    private String name; 
36
    /**
37
     * Indicates that the server will round off inexact dimension values
38
     * to the nearest valid value, or (if it is null or zero) it will not.
39
     */
40
    private String nearestValue; 
41
    /**
42
     * Indicates that temporal data are normally kept current and that the
43
     * request parameter TIME <b>may</b> include the keyword 'current' 
44
     * instead of an ending value. 
45
     */
46
    private String current;
47
    
48
    /**
49
     * cotains the expression for this dimension's extent.
50
     */
51
    private String extentExpression;
52
    private String extDefaultValue;
53

    
54
    public String getName() {        
55
        return name;
56
    } 
57
    
58
    /**
59
     * Tells that the temporal data are normally kept current and that
60
     * the request parameter TIME may include the keyword 'current'
61
     * instead of an ending value.
62
     *
63
     * @return <b>true</b> if the server does keep the data, <b>false</b> else.
64
     */
65
    public boolean allowsCurrentTime() {
66
        return (current!=null && !current.equals("0"));
67
    }
68
    
69
    /**
70
     * Gets the value that would be used along this dimension if a Web
71
     * request omits a value for the dimension.
72
     * 
73
     * @return Returns the defaultValue.
74
     */
75
    public String getDefaultValue() {
76
        return extDefaultValue;
77
    }
78
    
79
    /**
80
     * Returns the extent expression as it was written in the Capabilities 
81
     * document.
82
     * @return String
83
     */
84
    public String getExtentExpression() {
85
        return extentExpression;
86
    }
87
       
88

    
89
    /**
90
     * @return Returns the nearestValues.
91
     */
92
    public boolean allowsNearestValue() {
93
        return (nearestValue!=null && !nearestValue.equals("0"));
94
    }         
95

    
96
           /**
97
         * Parses the EXTENT tag in the WMS capabilities, filling the Extend fills of the
98
         * WMSDimension object and loading the data into memory to be easily accesed.
99
         */
100
        public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
101
            parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.EXTENT);
102
            name                         = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_NAME);
103
            extDefaultValue  = parser.getAttributeValue("", CapabilitiesTags.DEFAULT);
104
            nearestValue    = parser.getAttributeValue("", CapabilitiesTags.EXTENT_NEAREST_VALUE);
105
            current          = parser.getAttributeValue("", CapabilitiesTags.EXTENT_CURRENT);
106
            extentExpression = parser.nextText();
107
        }        
108
}