Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wms / WMSDimension.java @ 40559

History | View | Annotate | Download (4.68 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

    
25
package org.gvsig.remoteclient.wms;
26

    
27
import java.io.IOException;
28

    
29
import org.kxml2.io.KXmlParser;
30
import org.xmlpull.v1.XmlPullParserException;
31

    
32
import org.gvsig.remoteclient.utils.CapabilitiesTags;
33

    
34
/**
35
 * <p></p>
36
 * 
37
 */
38
public class WMSDimension {
39
    
40
    private String name;
41
    private String units;
42
    private String unitSymbol;
43
    /**
44
     * Declares what value would be used along this dimension if a Web
45
     * request omits a value for this dimension.
46
     */
47
    private String dimDefaultValue;
48
    /**
49
     * Indicates that the request may include multiple values or
50
     * (if it is null or zero) have to include <b>only<b/> single 
51
     * value for this dimension. 
52
     */
53
    private String multipleValues;
54
    /**
55
     * Indicates that the server will round off inexact dimension values
56
     * to the nearest valid value, or (if it is null or zero) it will not.
57
     */
58
    private String nearestValues;
59
    /**
60
     * Indicates that temporal data are normally kept current and that the
61
     * request parameter TIME <b>may</b> include the keyword 'current' 
62
     * instead of an ending value. 
63
     */
64
    private String current;
65
    /**
66
     * cotains the expression for this dimension's extent.
67
     */
68
    private String extentExpression;
69
    private String extDefaultValue;
70

    
71
    private String dimensionExpression;
72
   
73
    public String getName() {        
74
        return name;
75
    } 
76
 
77
    public String getUnits() {        
78
        return units;
79
    }
80
  
81
    public String getUnitSymbol() {        
82
        return unitSymbol;
83
    } 
84
    
85
    /**
86
     * Tells that the temporal data are normally kept current and that
87
     * the request parameter TIME may include the keyword 'current'
88
     * instead of an ending value.
89
     *
90
     * @return <b>true</b> if the server does keep the data, <b>false</b> else.
91
     */
92
    public boolean allowsCurrentTime() {
93
        return (current!=null && !current.equals("0"));
94
    }
95
    
96
    
97
    /**
98
     * Gets the value that would be used along this dimension if a Web
99
     * request omits a value for the dimension.
100
     * 
101
     * @return Returns the defaultValue.
102
     */
103
    public String getDimDefaultValue() {
104
        return dimDefaultValue;
105
    }
106
    
107
    /**
108
     * Returns the extent expression as it was written in the Capabilities 
109
     * document.
110
     * @return String
111
     */
112
    public String getExtentExpression() {
113
        return extentExpression;
114
    }
115
    /**
116
     * @return Returns the multipleValues.
117
     */
118
    public boolean allowsMultipleValues() {
119
        return (multipleValues!=null && !multipleValues.equals("0"));
120
    }   
121
    
122
    
123
    /**
124
     * @return Returns the dimensionExpression.
125
     */
126
    public String getDimensionExpression() {
127
        return dimensionExpression;
128
    }
129
    
130
    public void setDimensionExpression(String exp) {
131
        dimensionExpression = exp;
132
    }
133

    
134
    /**
135
     * @return Returns the nearestValues.
136
     */
137
    public boolean allowsNearestValues() {
138
        return (nearestValues!=null && !nearestValues.equals("0"));
139
    }
140
    
141

    
142
    /**
143
     * Parses the DIMENSION tag in the WMS capabilities, filling the WMSDimension object
144
     * and loading the data into memory to be easily accesed
145
     */
146
    public void parse(KXmlParser parser) throws IOException, XmlPullParserException{
147
        parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.DIMENSION);
148
        name                = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_NAME);
149
        units               = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNITS);
150
        unitSymbol          = parser.getAttributeValue("", CapabilitiesTags.DIMENSION_UNIT_SYMBOL);
151
        dimDefaultValue     = parser.getAttributeValue("", CapabilitiesTags.DEFAULT);
152
        dimensionExpression = parser.nextText(); 
153
    }
154
    
155
}