Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClient / wms / WMSLayer.java @ 3380

History | View | Annotate | Download (5.93 KB)

1
package org.gvsig.remoteClient.wms;
2

    
3
import java.io.IOException;
4
import java.util.ArrayList;
5
import java.util.Hashtable;
6
import java.util.TreeMap;
7
import java.util.Vector;
8

    
9
import org.gvsig.remoteClient.utils.BoundaryBox;
10
import org.gvsig.remoteClient.wms.wms_1_1_1.WMSLayer1_1_1;
11
import org.kxml2.io.KXmlParser;
12
import org.xmlpull.v1.XmlPullParserException;
13

    
14
/**
15
 * <p>Abstract class that defines an WMSLayer.</p>
16
 * 
17
 */
18
public abstract class WMSLayer implements org.gvsig.remoteClient.ILayer {
19

    
20
        protected ArrayList children;
21
        protected WMSLayer1_1_1 parent;
22
        
23
/**
24
 * <p>Layer Abstract field in the capabilities document </p> 
25
 */
26
    private String layerAbstract;
27

    
28
/**
29
 * <p>Themes provided by the WMS for the layer</p> 
30
 */
31
    public Hashtable styles = new Hashtable();
32
    
33
/**
34
 * <p>Layer name</p>
35
 */
36
    private String name;
37

    
38
/**
39
 * <p>Layer title</p>
40
 */
41
    private String title;
42

    
43
/**
44
 * <p>Layer srs.</p>
45
 */
46
    private Vector srs = new Vector();
47

    
48
/**
49
 * <p>extents for each srs the layer can be reproyected to</p>
50
 */
51
    private Hashtable bBoxes = new Hashtable();
52
    
53
/**
54
 * <p>extents that defines the bbox for the LatLon projection
55
 * It can be included in the bBoxes vector as well, because it is the most used, we keep it separeted too, according
56
 *  with the OGC WMSCapabilities specifications...
57
 */    
58
    private org.gvsig.remoteClient.utils.BoundaryBox latLonBbox;
59

    
60
/**
61
 * <p>min scale for the layer to be visible</p>
62
 */
63
    private double scaleMin;
64

    
65
/**
66
 * <p>max scale for the layer to be visible</p>
67
 */
68
    private double scaleMax;
69

    
70
/**
71
 * <p>Dimensions defined for the layer in the capabilities doc</p>
72
 */
73
    private java.util.Hashtable dimensions = new Hashtable();
74

    
75
    private boolean queryable;
76
    
77
    /**
78
     * <p>Parses the LAYER tag in the WMS capabilities, filling the WMSLayer object
79
     * loading the data in memory to be easily accesed</p>
80
     * 
81
     */
82
        public abstract void parse(KXmlParser parser)   
83
        throws IOException, XmlPullParserException;    
84

    
85
        
86
        public void setQueryable(boolean isQueryable)
87
        {
88
                queryable = isQueryable;
89
        }
90
        public boolean isQueryable()
91
        {
92
                return queryable;
93
        }
94

    
95
/**
96
 * <p>Adds a style to the styles vector</p>
97
 * @param _style 
98
 */
99
    public void addStyle(org.gvsig.remoteClient.wms.WMSStyle _style) {        
100
        styles.put( _style.getName(), _style );
101
    } 
102

    
103
/**
104
 * <p>returns the style with that name in the styles vector</p> 
105
 * @param _name 
106
 */
107
    public WMSStyle getStyle(String _name) {        
108
        return (WMSStyle)styles.get(_name);
109
    } 
110

    
111
/**
112
 * <p>Gets the style vector</p> 
113
 * @return 
114
 */
115
    public Hashtable getStyles() {        
116
        return styles;
117
    } 
118

    
119
    /**
120
     * <p>Adds a bbox to the Bboxes vector</p>
121
     * @param bbox
122
     */
123
        public void addBBox(BoundaryBox bbox) {        
124
            bBoxes.put(bbox.getSrs(), bbox);
125
        } 
126

    
127
    /**
128
     * <p>returns the bbox with that id in the Bboxes vector</p> 
129
     * @param id 
130
     */
131
        public BoundaryBox getBbox(String id) {                    
132
                return (BoundaryBox)bBoxes.get(id);
133
        } 
134

    
135
    /**
136
     * <p>Gets the bBoxes vector</p> 
137
     * @return 
138
     */
139
        public Hashtable getBboxes() {        
140
            return bBoxes;
141
        } 
142

    
143
    
144
    //Methods to manipulate the box that defines the layer extent in LatLon SRS.
145
   public BoundaryBox getLatLonBox()
146
   {
147
           return latLonBbox;
148
   }
149
   public void setLatLonBox(BoundaryBox box)
150
   {
151
           latLonBbox = box;
152
   }   
153
    /**
154
     * <p>adds a new srs to the srs vector</p>  
155
     */    
156
    public void addSrs(String srs)
157
    {
158
            this.srs.add(srs);
159
    }
160
    
161
    public Vector getAllSrs()
162
    {
163
            return (Vector)this.srs.clone();
164
    }
165
/**
166
 * <p>gets the maximum scale for this layer</p>
167
 * @return 
168
 */
169
    public double getScaleMax() {        
170
        return scaleMax;
171
    } 
172

    
173
/**
174
 * <p>gets the minimum scale for this layer</p>
175
 * @return 
176
 */
177
    public double getScaleMin() {        
178
        return scaleMin;
179
    } 
180

    
181
/**
182
 * <p>sets the minimum scale for this layer to be visible.</p>
183
 * 
184
 * @param scale 
185
 */
186
    public void setScaleMin(double scale) {        
187
        scaleMin = scale;
188
    } 
189

    
190
/**
191
 * <p>sets the maximum scale for this layer to be visible</p>
192
 * @param scale 
193
 */
194
    public void setScaleMax(double scale) {        
195
        scaleMax = scale;
196
    } 
197

    
198
/**
199
 * <p> gets the dimension vector defined in this layer</p>
200
 * @return 
201
 */
202
    public Hashtable getDimensions() {        
203
        return dimensions;
204
    } 
205

    
206
/**
207
 * <p>Sets the dimension vector defined for this layer</p>
208
 * @param v 
209
 */
210
    public void setDimensions(Hashtable v) {        
211
        dimensions = (Hashtable)v.clone(); 
212
    } 
213

    
214
/**
215
 * <p>Adds a dimension to the dimension vector </p>
216
 * @param dimension 
217
 */
218
    public void addDimension(org.gvsig.remoteClient.wms.Dimension dimension) {        
219
        dimensions.put(dimension.getName(), dimension);
220
    } 
221

    
222
/**
223
 * <p>Gets layer name</p>
224
 * @return 
225
 */
226
    public String getName() {        
227
        return this.name;
228
    } 
229

    
230
/**
231
 * <p>Sets layer name</p>
232
 * @param _name 
233
 */
234
    public void setName(String name) {        
235
        this.name = name;            
236
    } 
237

    
238
/**
239
 * <p>Gets layer title</p>
240
 * @return 
241
 */
242
    public String getTitle() {        
243
        return title;
244
    } 
245

    
246
/**
247
 * <p>Sets the layer title</p>
248
 * @param _title 
249
 */
250
    public void setTitle(String title) {        
251
        this.title = title;
252
    } 
253

    
254
/**
255
 * <p>Gets the layer abstract</p>
256
 * @return 
257
 */
258
    public String getAbstract() {        
259
        return layerAbstract;
260
    } 
261

    
262
/**
263
 * <p>Sets the layer abstract</p>
264
 * @param m_abstract 
265
 */
266
    public void setAbstract(String _abstract) {        
267
        layerAbstract = _abstract;
268
    }
269

    
270

    
271
public ArrayList getChildren() {
272
        return children;
273
}
274

    
275

    
276
public void setChildren(ArrayList children) {
277
        this.children = children;
278
}
279

    
280

    
281
public WMSLayer1_1_1 getParent() {
282
        return parent;
283
}
284

    
285

    
286
public void setParent(WMSLayer1_1_1 parent) {
287
        this.parent = parent;
288
} 
289
 }