Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_RELEASE / libraries / libRemoteServices / src / org / gvsig / remoteClient / wms / WMSDimension.java @ 11432

History | View | Annotate | Download (3.74 KB)

1 3520 jaume
2
package org.gvsig.remoteClient.wms;
3
4
import java.io.IOException;
5 4926 jaume
6 3520 jaume
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 3533 jaume
    private String dimDefaultValue;
24 3520 jaume
    /**
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 3533 jaume
    private String extDefaultValue;
46
47
    private String dimensionExpression;
48 4314 ldiaz
49 3520 jaume
    public String getName() {
50
        return name;
51
    }
52 4314 ldiaz
53 3520 jaume
    public String getUnits() {
54
        return units;
55
    }
56 4314 ldiaz
57 3520 jaume
    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 3533 jaume
    public String getDimDefaultValue() {
80
        return dimDefaultValue;
81 3520 jaume
    }
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 4314 ldiaz
    }
97 3520 jaume
98
99
    /**
100 3535 jaume
     * @return Returns the dimensionExpression.
101
     */
102
    public String getDimensionExpression() {
103
        return dimensionExpression;
104
    }
105 4409 jaume
106 4314 ldiaz
    public void setDimensionExpression(String exp) {
107
        dimensionExpression = exp;
108
    }
109 3535 jaume
110
    /**
111 3520 jaume
     * @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 4222 jaume
     * and loading the data into memory to be easily accesed
121 3520 jaume
     */
122
    public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
123
        parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.DIMENSION);
124 3533 jaume
        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 3520 jaume
    }
130
131
}