Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wms / WMSDimension.java @ 38579

History | View | Annotate | Download (3.74 KB)

1 3520 jaume
2 29658 jpiera
package org.gvsig.remoteclient.wms;
3 3520 jaume
4
import java.io.IOException;
5 4926 jaume
6 3520 jaume
import org.kxml2.io.KXmlParser;
7
import org.xmlpull.v1.XmlPullParserException;
8
9 33738 jpiera
import org.gvsig.remoteclient.utils.CapabilitiesTags;
10
11 3520 jaume
/**
12
 * <p></p>
13
 *
14
 */
15
public class WMSDimension {
16
17
    private String name;
18
    private String units;
19
    private String unitSymbol;
20
    /**
21
     * Declares what value would be used along this dimension if a Web
22
     * request omits a value for this dimension.
23
     */
24 3533 jaume
    private String dimDefaultValue;
25 3520 jaume
    /**
26
     * Indicates that the request may include multiple values or
27
     * (if it is null or zero) have to include <b>only<b/> single
28
     * value for this dimension.
29
     */
30
    private String multipleValues;
31
    /**
32
     * Indicates that the server will round off inexact dimension values
33
     * to the nearest valid value, or (if it is null or zero) it will not.
34
     */
35
    private String nearestValues;
36
    /**
37
     * Indicates that temporal data are normally kept current and that the
38
     * request parameter TIME <b>may</b> include the keyword 'current'
39
     * instead of an ending value.
40
     */
41
    private String current;
42
    /**
43
     * cotains the expression for this dimension's extent.
44
     */
45
    private String extentExpression;
46 3533 jaume
    private String extDefaultValue;
47
48
    private String dimensionExpression;
49 4314 ldiaz
50 3520 jaume
    public String getName() {
51
        return name;
52
    }
53 4314 ldiaz
54 3520 jaume
    public String getUnits() {
55
        return units;
56
    }
57 4314 ldiaz
58 3520 jaume
    public String getUnitSymbol() {
59
        return unitSymbol;
60
    }
61
62
    /**
63
     * Tells that the temporal data are normally kept current and that
64
     * the request parameter TIME may include the keyword 'current'
65
     * instead of an ending value.
66
     *
67
     * @return <b>true</b> if the server does keep the data, <b>false</b> else.
68
     */
69
    public boolean allowsCurrentTime() {
70
        return (current!=null && !current.equals("0"));
71
    }
72
73
74
    /**
75
     * Gets the value that would be used along this dimension if a Web
76
     * request omits a value for the dimension.
77
     *
78
     * @return Returns the defaultValue.
79
     */
80 3533 jaume
    public String getDimDefaultValue() {
81
        return dimDefaultValue;
82 3520 jaume
    }
83
84
    /**
85
     * Returns the extent expression as it was written in the Capabilities
86
     * document.
87
     * @return String
88
     */
89
    public String getExtentExpression() {
90
        return extentExpression;
91
    }
92
    /**
93
     * @return Returns the multipleValues.
94
     */
95
    public boolean allowsMultipleValues() {
96
        return (multipleValues!=null && !multipleValues.equals("0"));
97 4314 ldiaz
    }
98 3520 jaume
99
100
    /**
101 3535 jaume
     * @return Returns the dimensionExpression.
102
     */
103
    public String getDimensionExpression() {
104
        return dimensionExpression;
105
    }
106 4409 jaume
107 4314 ldiaz
    public void setDimensionExpression(String exp) {
108
        dimensionExpression = exp;
109
    }
110 3535 jaume
111
    /**
112 3520 jaume
     * @return Returns the nearestValues.
113
     */
114
    public boolean allowsNearestValues() {
115
        return (nearestValues!=null && !nearestValues.equals("0"));
116
    }
117
118
119
    /**
120
     * Parses the DIMENSION tag in the WMS capabilities, filling the WMSDimension object
121 4222 jaume
     * and loading the data into memory to be easily accesed
122 3520 jaume
     */
123
    public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
124
        parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.DIMENSION);
125 3533 jaume
        name                = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_NAME);
126
        units               = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNITS);
127
        unitSymbol          = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNIT_SYMBOL);
128
        dimDefaultValue     = parser.getAttributeValue("", CapabilitiesTags.DEFAULT);
129
        dimensionExpression = parser.nextText();
130 3520 jaume
    }
131
132
}