Statistics
| Revision:

root / branches / gvSIG_WMSv2 / extensions / extWMS / src / com / iver / cit / gvsig / fmap / layers / WMSLayerNode.java @ 3655

History | View | Annotate | Download (7.91 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

    
42
/* CVS MESSAGES:
43
*
44
* $Id: WMSLayerNode.java 3655 2006-01-17 12:59:53Z jaume $
45
* $Log$
46
* Revision 1.1.2.9  2006-01-17 12:55:40  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.1.2.8  2006/01/05 23:15:53  jaume
50
* *** empty log message ***
51
*
52
* Revision 1.1.2.7  2006/01/04 18:09:02  jaume
53
* Time dimension
54
*
55
* Revision 1.1.2.6  2006/01/03 18:08:40  jaume
56
* *** empty log message ***
57
*
58
* Revision 1.1.2.5  2006/01/02 18:08:01  jaume
59
* Tree de estilos
60
*
61
* Revision 1.1.2.4  2005/12/30 08:56:19  jaume
62
* *** empty log message ***
63
*
64
* Revision 1.1.2.3  2005/12/29 08:26:54  jaume
65
* some gui issues where fixed
66
*
67
* Revision 1.1.2.2  2005/12/26 16:51:40  jaume
68
* Handles STYLES, layer saving does nothing ??
69
*
70
* Revision 1.1.2.1  2005/12/21 15:59:04  jaume
71
* Refatoring maintenance
72
*
73
*
74
*/
75
/**
76
 * 
77
 */
78
package com.iver.cit.gvsig.fmap.layers;
79

    
80
import java.util.ArrayList;
81
import java.util.Vector;
82

    
83
import org.gvsig.remoteClient.utils.BoundaryBox;
84

    
85
/**
86
 * Class defining the node of the layer tree of a common WMS service.
87
 * @author jaume
88
 *
89
 */
90
public class WMSLayerNode {
91
    private String _name;
92
    private String _title;
93
    private Vector srs;
94
    private boolean queryable;
95
    private boolean transparency;
96
    private String lAbstract;
97
    private String latLonBox;
98
    
99
    private ArrayList styles;
100
    private ArrayList dimensions;
101
    
102
    private ArrayList children = new ArrayList();
103
    private WMSLayerNode _parent;
104
    
105
    /**
106
     * @return Returns the name.
107
     */
108
    public String getName() {
109
        return _name;
110
    }
111
    /**
112
     * @return
113
     */
114
    public ArrayList getChildren() {
115
        return children;
116
    }
117
    /**
118
     * @param name The name to set.
119
     */
120
    public void setName(String name) {
121
        this._name = name;
122
    }
123
    /**
124
     * @return Returns the namedStyles.
125
     */
126
    public ArrayList getStyles() {
127
        return styles;
128
    }
129
    
130
    /**
131
     * @return Returns the queryable.
132
     */
133
    public boolean isQueryable() {
134
        return queryable;
135
    }
136
    /**
137
     * @param queryable The queryable to set.
138
     */
139
    public void setQueryable(boolean queryable) {
140
        this.queryable = queryable;
141
    }
142
    /**
143
     * @return Returns the srs.
144
     */
145
    public Vector getAllSrs() {
146
        if ((srs.size() == 0) && _parent!=null)
147
            return _parent.getAllSrs();
148
        return srs;
149
    }
150
    /**
151
     * @param srs The srs to set.
152
     */
153
    public void setSrs(Vector srs) {
154
        this.srs = srs;
155
    }
156
    /**
157
     * @return Returns the title.
158
     */
159
    public String getTitle() {
160
        return _title;
161
    }
162
    /**
163
     * @param title The title to set.
164
     */
165
    public void setTitle(String title) {
166
        this._title = title.trim();
167
    }
168
    /**
169
     * @return Returns the transparency.
170
     */
171
    public boolean isTransparent() {
172
        return transparency;
173
    }
174
    /**
175
     * @param transparency The transparency to set.
176
     */
177
    public void setTransparency(boolean transparency) {
178
        this.transparency = transparency;
179
    }
180
    
181
    public void setChildren(ArrayList children) {
182
        this.children = children;
183
    }
184
    
185
    /**
186
     * returns the layer whose this is son of. 
187
     * @return
188
     */
189
    public WMSLayerNode getParent(){
190
        return _parent;
191
    }
192
    /**
193
     * @param parentNode
194
     */
195
    public void setParent(WMSLayerNode parentNode) {
196
        this._parent = parentNode;
197
    }
198
    
199
    public ArrayList getDimensions(){
200
        return dimensions;
201
    }
202
    
203
    public String toString(){
204
        return getTitle();
205
    }
206
    /**
207
     * @param _name
208
     * @param _title
209
     * @param _abstract
210
     */
211
    public void addStyle(String name, String title, String _abstract) {
212
        if (styles==null)
213
            styles = new ArrayList();
214
        styles.add(new FMapWMSStyle(name, title, _abstract, this));
215
    }
216
    
217
    
218

    
219
    /**
220
     * Creates a new instance of WMSLayerNode containing a copy of this, 
221
     * but with no children and parent set.
222
     */
223
    public Object clone(){
224
        WMSLayerNode clone = new WMSLayerNode();
225
        clone._name        = this._name;
226
        clone.queryable    = this.queryable;
227
        clone.srs          = this.srs;
228
        clone._title       = this._title;
229
        clone.transparency = this.transparency;
230
        clone.styles       = new ArrayList();
231
        clone.lAbstract    = this.lAbstract;
232
        clone.latLonBox    = this.latLonBox;
233
        if (styles!=null)
234
                for (int i=0; i<styles.size(); i++){
235
                        clone.styles.add(((FMapWMSStyle) this.styles.get(i)).clone());
236
                }
237
        if (dimensions!=null)
238
                for (int i = 0; i < dimensions.size(); i++) {
239
                        clone.dimensions = new ArrayList();
240
                        clone.dimensions.add((IFMapWMSDimension) this.dimensions.get(i));
241
                }
242
        // TODO clonar dimensiones;
243
        return clone;
244
    }
245
    /**
246
     * @return Returns the abstract.
247
     */
248
    public String getAbstract() {
249
        return lAbstract;
250
    }
251
    /**
252
     * @param abstract1 The abstract to set.
253
     */
254
    public void setAbstract(String _abstract) {
255
        lAbstract = _abstract;
256
    }
257

    
258
    /**
259
     * @param name
260
     * @param units
261
     * @param unitSymbol
262
     * @param dimensionExpression
263
     */
264
    public void addDimension(String name, String units, String unitSymbol, String dimExpression) {
265
        if (dimensions == null)
266
            dimensions = new ArrayList();
267
        if (name.toLowerCase().equals("time")){
268
            dimensions.add(new TimeDimension(units, unitSymbol, dimExpression));
269
        } else if (name.toLowerCase().equals("elevation")){
270
            //dimensions.add(new ElevationDimension(units, unitSymbol, dimensionExpression));
271
        } else {
272
            //dimensions.add(new FMapWMSDimension(name, units, unitSymbol, dimensionExpression));
273
        }
274
    }
275
    
276
    public class FMapWMSStyle {
277
        public String name;
278
        public String title;
279
        public String styleAbstract;
280
        public WMSLayerNode parent;
281
        
282
        public FMapWMSStyle(String name, String title, String styleAbstract, WMSLayerNode parent){
283
            this.name = name;
284
            this.title = title;
285
            this.styleAbstract = styleAbstract;
286
            this.parent = parent;
287
        }
288
        
289
        public String toString(){
290
            return title;
291
        }
292
        
293
        public Object clone() {
294
            FMapWMSStyle clone = new FMapWMSStyle(this.name, this.title, this.styleAbstract, this.parent);
295
            return clone;
296
        }
297
    }
298

    
299
    /**
300
     * Sets the Latitude-Longitude box text to be shown in an user interface layer descriptor.
301
     * @param latLonBox
302
     */
303
    public void setLatLonBox(String _latLonBox) {
304
        latLonBox = _latLonBox;
305
    }
306
    /**
307
     * Returns the Latitude-Longitude box text to be shown in an user interface layer descriptor.
308
     * @return
309
     */
310
    public String getLatLonBox() {
311
        return latLonBox;
312
    }
313

    
314

    
315
        
316
}