Statistics
| Revision:

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

History | View | Annotate | Download (3.74 KB)

1

    
2
package org.gvsig.remoteclient.wms;
3

    
4
import java.io.IOException;
5

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

    
10
/**
11
 * <p></p>
12
 * 
13
 */
14
public class WMSDimension {
15
    
16
    private String name;
17
    private String units;
18
    private String unitSymbol;
19
    /**
20
     * Declares what value would be used along this dimension if a Web
21
     * request omits a value for this dimension.
22
     */
23
    private String dimDefaultValue;
24
    /**
25
     * Indicates that the request may include multiple values or
26
     * (if it is null or zero) have to include <b>only<b/> single 
27
     * value for this dimension. 
28
     */
29
    private String multipleValues;
30
    /**
31
     * Indicates that the server will round off inexact dimension values
32
     * to the nearest valid value, or (if it is null or zero) it will not.
33
     */
34
    private String nearestValues;
35
    /**
36
     * Indicates that temporal data are normally kept current and that the
37
     * request parameter TIME <b>may</b> include the keyword 'current' 
38
     * instead of an ending value. 
39
     */
40
    private String current;
41
    /**
42
     * cotains the expression for this dimension's extent.
43
     */
44
    private String extentExpression;
45
    private String extDefaultValue;
46

    
47
    private String dimensionExpression;
48
   
49
    public String getName() {        
50
        return name;
51
    } 
52
 
53
    public String getUnits() {        
54
        return units;
55
    }
56
  
57
    public String getUnitSymbol() {        
58
        return unitSymbol;
59
    } 
60
    
61
    /**
62
     * Tells that the temporal data are normally kept current and that
63
     * the request parameter TIME may include the keyword 'current'
64
     * instead of an ending value.
65
     *
66
     * @return <b>true</b> if the server does keep the data, <b>false</b> else.
67
     */
68
    public boolean allowsCurrentTime() {
69
        return (current!=null && !current.equals("0"));
70
    }
71
    
72
    
73
    /**
74
     * Gets the value that would be used along this dimension if a Web
75
     * request omits a value for the dimension.
76
     * 
77
     * @return Returns the defaultValue.
78
     */
79
    public String getDimDefaultValue() {
80
        return dimDefaultValue;
81
    }
82
    
83
    /**
84
     * Returns the extent expression as it was written in the Capabilities 
85
     * document.
86
     * @return String
87
     */
88
    public String getExtentExpression() {
89
        return extentExpression;
90
    }
91
    /**
92
     * @return Returns the multipleValues.
93
     */
94
    public boolean allowsMultipleValues() {
95
        return (multipleValues!=null && !multipleValues.equals("0"));
96
    }   
97
    
98
    
99
    /**
100
     * @return Returns the dimensionExpression.
101
     */
102
    public String getDimensionExpression() {
103
        return dimensionExpression;
104
    }
105
    
106
    public void setDimensionExpression(String exp) {
107
        dimensionExpression = exp;
108
    }
109

    
110
    /**
111
     * @return Returns the nearestValues.
112
     */
113
    public boolean allowsNearestValues() {
114
        return (nearestValues!=null && !nearestValues.equals("0"));
115
    }
116
    
117

    
118
    /**
119
     * Parses the DIMENSION tag in the WMS capabilities, filling the WMSDimension object
120
     * and loading the data into memory to be easily accesed
121
     */
122
    public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
123
        parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.DIMENSION);
124
        name                = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_NAME);
125
        units               = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNITS);
126
        unitSymbol          = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNIT_SYMBOL);
127
        dimDefaultValue     = parser.getAttributeValue("", CapabilitiesTags.DEFAULT);
128
        dimensionExpression = parser.nextText(); 
129
    }
130
    
131
}