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