Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wms / WMSExtent.java @ 29658

History | View | Annotate | Download (2.61 KB)

1
package org.gvsig.remoteclient.wms;
2

    
3
import java.io.IOException;
4

    
5
import org.gvsig.remoteclient.utils.CapabilitiesTags;
6
import org.kxml2.io.KXmlParser;
7
import org.xmlpull.v1.XmlPullParserException;
8

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

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

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

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