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