Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClient / wms / WMSDimension.java @ 3520

History | View | Annotate | Download (4.33 KB)

1

    
2
package org.gvsig.remoteClient.wms;
3

    
4
import java.io.IOException;
5

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

    
11
/**
12
 * <p></p>
13
 * 
14
 */
15
public class WMSDimension {
16
    
17
    /**
18
     * <p>Represents ...</p>
19
     * 
20
     */
21
    private String name;
22
    
23
    /**
24
     * <p>Represents ...</p>
25
     * 
26
     */
27
    private String units;
28
    private String unitSymbol;
29
    /**
30
     * Declares what value would be used along this dimension if a Web
31
     * request omits a value for this dimension.
32
     */
33
    private String defaultValue;
34
    /**
35
     * Indicates that the request may include multiple values or
36
     * (if it is null or zero) have to include <b>only<b/> single 
37
     * value for this dimension. 
38
     */
39
    private String multipleValues;
40
    /**
41
     * Indicates that the server will round off inexact dimension values
42
     * to the nearest valid value, or (if it is null or zero) it will not.
43
     */
44
    private String nearestValues;
45
    /**
46
     * Indicates that temporal data are normally kept current and that the
47
     * request parameter TIME <b>may</b> include the keyword 'current' 
48
     * instead of an ending value. 
49
     */
50
    private String current;
51
    /**
52
     * cotains the expression for this dimension's extent.
53
     */
54
    private String extentExpression;
55
    /**
56
     * <p>Does ...</p>
57
     * 
58
     * 
59
     * @return 
60
     */
61
    public String getName() {        
62
        return name;
63
    } 
64
    
65
    /**
66
     * <p>Does ...</p>
67
     * @return String
68
     */
69
    public String getUnits() {        
70
        return units;
71
    }
72
    /**
73
     * <p>Does ...</p>
74
     * @return String
75
     */
76
    public String getUnitSymbol() {        
77
        return unitSymbol;
78
    } 
79
    
80
    /**
81
     * Tells that the temporal data are normally kept current and that
82
     * the request parameter TIME may include the keyword 'current'
83
     * instead of an ending value.
84
     *
85
     * @return <b>true</b> if the server does keep the data, <b>false</b> else.
86
     */
87
    public boolean allowsCurrentTime() {
88
        return (current!=null && !current.equals("0"));
89
    }
90
    
91
    
92
    /**
93
     * Gets the value that would be used along this dimension if a Web
94
     * request omits a value for the dimension.
95
     * 
96
     * @return Returns the defaultValue.
97
     */
98
    public String getDefaultValue() {
99
        return defaultValue;
100
    }
101
    
102
    /**
103
     * Returns the extent expression as it was written in the Capabilities 
104
     * document.
105
     * @return String
106
     */
107
    public String getExtentExpression() {
108
        return extentExpression;
109
    }
110
    /**
111
     * @return Returns the multipleValues.
112
     */
113
    public boolean allowsMultipleValues() {
114
        return (multipleValues!=null && !multipleValues.equals("0"));
115
    }
116
    
117
    
118
    
119
    /**
120
     * @return Returns the nearestValues.
121
     */
122
    public boolean allowsNearestValues() {
123
        return (nearestValues!=null && !nearestValues.equals("0"));
124
    }
125
    
126

    
127
    /**
128
     * Parses the DIMENSION tag in the WMS capabilities, filling the WMSDimension object
129
     * loading the data in memory to be easily accesed
130
     */
131
    public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
132
        parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.DIMENSION);
133
        name       = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_NAME);
134
        units      = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNITS);
135
        unitSymbol = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNIT_SYMBOL);
136
    }
137
    
138
    /**
139
     * Parses the EXTENT tag in the WMS capabilities, filling the Extend fills of the
140
     * WMSDimension object loading the data in memory to be easily accesed.
141
     */
142
    public void parseExtent(KXmlParser parser) throws IOException, XmlPullParserException{
143
        parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.EXTENT);
144
        defaultValue     = parser.getAttributeValue("", CapabilitiesTags.DEFAULT);
145
        multipleValues   = parser.getAttributeValue("", CapabilitiesTags.EXTENT_MULTIPLE_VALUES);
146
        nearestValues    = parser.getAttributeValue("", CapabilitiesTags.EXTENT_NEAREST_VALUES);
147
        current          = parser.getAttributeValue("", CapabilitiesTags.EXTENT_CURRENT);
148
        extentExpression = parser.getText();
149
    }
150
}