Statistics
| Revision:

svn-gvsig-desktop / tags / v2_0_0_Build_2020 / libraries / libRemoteServices / src / org / gvsig / remoteclient / wms / WMSExtent.java @ 33856

History | View | Annotate | Download (2.61 KB)

1
package org.gvsig.remoteclient.wms;
2

    
3
import java.io.IOException;
4

    
5
import org.kxml2.io.KXmlParser;
6
import org.xmlpull.v1.XmlPullParserException;
7

    
8
import org.gvsig.remoteclient.utils.CapabilitiesTags;
9

    
10
public class WMSExtent {
11
            
12
    private String name; 
13
    /**
14
     * Indicates that the server will round off inexact dimension values
15
     * to the nearest valid value, or (if it is null or zero) it will not.
16
     */
17
    private String nearestValue; 
18
    /**
19
     * Indicates that temporal data are normally kept current and that the
20
     * request parameter TIME <b>may</b> include the keyword 'current' 
21
     * instead of an ending value. 
22
     */
23
    private String current;
24
    
25
    /**
26
     * cotains the expression for this dimension's extent.
27
     */
28
    private String extentExpression;
29
    private String extDefaultValue;
30

    
31
    public String getName() {        
32
        return name;
33
    } 
34
    
35
    /**
36
     * Tells that the temporal data are normally kept current and that
37
     * the request parameter TIME may include the keyword 'current'
38
     * instead of an ending value.
39
     *
40
     * @return <b>true</b> if the server does keep the data, <b>false</b> else.
41
     */
42
    public boolean allowsCurrentTime() {
43
        return (current!=null && !current.equals("0"));
44
    }
45
    
46
    /**
47
     * Gets the value that would be used along this dimension if a Web
48
     * request omits a value for the dimension.
49
     * 
50
     * @return Returns the defaultValue.
51
     */
52
    public String getDefaultValue() {
53
        return extDefaultValue;
54
    }
55
    
56
    /**
57
     * Returns the extent expression as it was written in the Capabilities 
58
     * document.
59
     * @return String
60
     */
61
    public String getExtentExpression() {
62
        return extentExpression;
63
    }
64
       
65

    
66
    /**
67
     * @return Returns the nearestValues.
68
     */
69
    public boolean allowsNearestValue() {
70
        return (nearestValue!=null && !nearestValue.equals("0"));
71
    }         
72

    
73
           /**
74
         * Parses the EXTENT tag in the WMS capabilities, filling the Extend fills of the
75
         * WMSDimension object and loading the data into memory to be easily accesed.
76
         */
77
        public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
78
            parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.EXTENT);
79
            name                         = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_NAME);
80
            extDefaultValue  = parser.getAttributeValue("", CapabilitiesTags.DEFAULT);
81
            nearestValue    = parser.getAttributeValue("", CapabilitiesTags.EXTENT_NEAREST_VALUE);
82
            current          = parser.getAttributeValue("", CapabilitiesTags.EXTENT_CURRENT);
83
            extentExpression = parser.nextText();
84
        }        
85
}