Statistics
| Revision:

svn-gvsig-desktop / branches / v05 / libraries / libRemoteServices / src / org / gvsig / remoteClient / wms / WMSExtent.java @ 4428

History | View | Annotate | Download (2.53 KB)

1
package org.gvsig.remoteClient.wms;
2

    
3
import java.io.IOException;
4
import org.gvsig.remoteClient.utils.CapabilitiesTags;
5
import org.kxml2.io.KXmlParser;
6
import org.xmlpull.v1.XmlPullParserException;
7

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

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

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

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