Statistics
| Revision:

root / trunk / libraries / libArcIMS / src / org / gvsig / remoteClient / arcims / ArcImsStatus.java @ 8109

History | View | Annotate | Download (9.92 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Prodevelop 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
 *   Prodevelop Integraci?n de Tecnolog?as SL
34
 *   Conde Salvatierra de ?lava , 34-10
35
 *   46004 Valencia
36
 *   Spain
37
 *
38
 *   +34 963 510 612
39
 *   +34 963 510 968
40
 *   gis@prodevelop.es
41
 *   http://www.prodevelop.es
42
 */
43

    
44
package org.gvsig.remoteClient.arcims;
45

    
46
import org.gvsig.remoteClient.*;
47
import org.gvsig.remoteClient.arcims.utils.ServiceInformation;
48

    
49
import java.awt.geom.Rectangle2D;
50

    
51
import java.util.Vector;
52

    
53

    
54
/**
55
 * Describes the status of a ArcImsclient, so it adds to the Remote client status
56
 * a list of layers, a list of layer styles, the extent of the map.
57
 * Provides the functionality to modify these lists.
58
 * @see org.gvsig.remoteClient.RemoteClientStatus
59
 * @author jcarrasco
60
 * @author jsanz
61
 *
62
 */
63
public class ArcImsStatus extends RemoteClientStatus implements Cloneable {
64
    /**
65
     * List of layer to be retrieved by the ArcIms
66
     */
67
    private Vector layers;
68

    
69
    /**
70
     * List of layer styles
71
     */
72
    private Vector styles;
73

    
74
    /**
75
     * Extent required by the ArcIms client
76
     */
77
    private Rectangle2D extent;
78

    
79
    /**
80
     * The ArcIMS Service delivers images with transparency
81
     */
82
    private boolean transparency;
83
    private String onlineResource;
84
    private String service;
85
    private Vector dimensions;
86
    private ServiceInformation serviceInfo;
87
    public boolean verbose;
88

    
89
    // Added by jldominguez to allow image identification with
90
    // the arcimsstatus variables
91
    private String server;
92

    
93
    /**
94
     * Constructor
95
     *
96
     */
97
    public ArcImsStatus() {
98
        layers = new Vector();
99
        styles = new Vector();
100
        verbose = false;
101
    }
102

    
103
    /**
104
     * Retrieves a vector of Dimensions
105
     * @return Vector, the list of dimensions
106
     */
107
    public Vector getDimensions() {
108
        return dimensions;
109
    }
110

    
111
    /**
112
     * Sets the dimensions of the client
113
     * @param dimensions A vector of dimensions
114
     */
115
    public void setDimensions(Vector dimensions) {
116
        this.dimensions = dimensions;
117
    }
118

    
119
    /**
120
     * <p>Retrieves the layer list required by the ArcIms client</p>
121
     * @return Vector, the list of layers
122
     */
123
    public Vector getLayerIds() {
124
        return layers;
125
    }
126

    
127
    /**
128
     * Sets the list of layers required by the ArcIms client
129
     * @param _layers Vector, the list of layers to set
130
     */
131
    public void setLayerIds(Vector _layers) {
132
        layers = _layers;
133
    }
134

    
135
    /**
136
     * <p> Adds a layer to the list of layers required by the ArcIms client</p>
137
     * @param alayerName name of the layer to be added.
138
     */
139
    public void addLayerName(String alayerName) {
140
        layers.add(alayerName);
141
    }
142

    
143
    /**
144
     * <p>Removes a layer from the layer list</p>
145
     * @param alayerName
146
     * @return true if the layer name has been deleted from the list
147
     */
148
    public boolean removeLayerName(String alayerName) {
149
        return layers.remove(alayerName);
150
    }
151

    
152
    /**
153
     * <p>Gets the styles list required by the ArcIms client</p>
154
     * @return Vector with the list of layer styles
155
     */
156
    public Vector getStyles() {
157
        return styles;
158
    }
159

    
160
    /**
161
     * <p>sets the styles list required by the ArcIms client</p>
162
     *
163
     *
164
     * @param astyles list to be set as the required styles.
165
     */
166
    public void setStyles(Vector astyles) {
167
        styles = astyles;
168
    }
169

    
170
    /**
171
     * <p>Adds a style name to the styles list required by the ArcIms client</p>
172
     *
173
     *
174
     * @param aname style name to be added
175
     */
176
    public void addStyleName(String aname) {
177
        styles.add(aname);
178
    }
179

    
180
    /**
181
     * <p>Removes a style from the list of styles required by the ArcIms client</p>
182
     *
183
     *
184
     * @param aname style name to be removed
185
     */
186
    public boolean removeStyleName(String aname) {
187
        return styles.remove(aname);
188
    }
189

    
190
    /**
191
     * <p>Gets the extent defined by the map</p>
192
     */
193
    public Rectangle2D getExtent() {
194
        return extent;
195
    }
196

    
197
    /**
198
     * <p>Sets the extent defined by the map</p>
199
     */
200
    public void setExtent(Rectangle2D extent) {
201
        this.extent = extent;
202
    }
203

    
204
    /**
205
     * Gets transparency
206
     * @return boolean
207
     */
208
    public boolean getTransparency() {
209
        return transparency;
210
    }
211

    
212
    /**
213
     * Sets transparency
214
     * @param arcimsTransparency
215
     */
216
    public void setTransparency(boolean arcimsTransparency) {
217
        transparency = arcimsTransparency;
218
    }
219

    
220
    /* (non-Javadoc)
221
     * @see java.lang.Object#equals(java.lang.Object)
222
     */
223
    public boolean equals(Object obj) {
224
        if (!(obj instanceof ArcImsStatus)) {
225
            return false;
226
        }
227

    
228
        ArcImsStatus s = (ArcImsStatus) obj;
229

    
230
        // Compare layer names
231
        if (!(((s.getLayerIds() == null) && (this.getLayerIds() == null)) ||
232
                s.getLayerIds().equals(this.getLayerIds()))) {
233
            return false;
234
        }
235

    
236
        // Compare extent
237
        if (!(((s.getExtent() == null) && (this.getExtent() == null)) ||
238
                s.getExtent().equals(this.getExtent()))) {
239
            return false;
240
        }
241

    
242
        // Compare height
243
        if (s.getHeight() != this.getHeight()) {
244
            return false;
245
        }
246

    
247
        // Compare width
248
        if (s.getWidth() != this.getWidth()) {
249
            return false;
250
        }
251

    
252
        // Compare styles
253
        if (!(((s.getStyles() == null) && (this.getStyles() == null)) ||
254
                s.getStyles().equals(this.getStyles()))) {
255
            return false;
256
        }
257

    
258
        // Compare transparencies
259
        if (s.getTransparency() != this.getTransparency()) {
260
            return false;
261
        }
262

    
263
        // Compare srs
264
        if (!(((s.getSrs() == null) && (this.getSrs() == null)) ||
265
                s.getSrs().equals(this.getSrs()))) {
266
            return false;
267
        }
268

    
269
        // Compare exception formats
270
        if (!(((s.getExceptionFormat() == null) &&
271
                (this.getExceptionFormat() == null)) ||
272
                s.getExceptionFormat().equals(this.getExceptionFormat()))) {
273
            return false;
274
        }
275

    
276
        // Compare formats
277
        if (!(((s.getFormat() == null) && (this.getFormat() == null)) ||
278
                s.getFormat().equals(this.getFormat()))) {
279
            return false;
280
        }
281

    
282
        // Compare online resources
283
        if (!(((s.getOnlineResource() == null) &&
284
                (this.getOnlineResource() == null)) ||
285
                s.getOnlineResource().equals(this.getOnlineResource()))) {
286
            return false;
287
        }
288

    
289
        return true;
290
    }
291

    
292
    /* (non-Javadoc)
293
     * @see java.lang.Object#clone()
294
     */
295
    public Object clone() {
296
        ArcImsStatus newObject = new ArcImsStatus();
297
        Vector v = this.getLayerIds();
298

    
299
        if (v != null) {
300
            newObject.setLayerIds((Vector) v.clone());
301
        }
302

    
303
        Rectangle2D r = this.getExtent();
304

    
305
        if (r != null) {
306
            newObject.setExtent((Rectangle2D) r.clone());
307
        }
308

    
309
        newObject.setHeight(this.getHeight());
310
        newObject.setWidth(this.getWidth());
311
        v = this.getStyles();
312

    
313
        if (v != null) {
314
            newObject.setStyles((Vector) v.clone());
315
        }
316

    
317
        newObject.setTransparency(this.getTransparency());
318
        newObject.setSrs(this.getSrs());
319
        newObject.setFormat(this.getFormat());
320
        newObject.setOnlineResource(this.getOnlineResource());
321

    
322
        ServiceInformation si = this.getServiceInfo();
323

    
324
        if (si != null) {
325
            newObject.setServiceInformation((ServiceInformation) si.clone());
326
        }
327

    
328
        return newObject;
329
    }
330

    
331
    /**
332
     * Returns the URL that the server specified for a ArcIms request if any was described in
333
     * its capabilities document.
334
     * @return <b>String</b> containing the URL for this operationName or <B>null</B> if none was
335
     *                specified.
336
     */
337
    public String getOnlineResource() {
338
        return onlineResource;
339
    }
340

    
341
    /**
342
     * Sets the string literal containing the URL of an online resource for a specific
343
     * ArcIms request.
344
     * @param url String containing the URL for the given ArcIms request
345
     */
346
    public void setOnlineResource(String url) {
347
        onlineResource = url;
348
    }
349

    
350
    /**
351
     * Gets service
352
     * @return service
353
     */
354
    public String getService() {
355
        return service;
356
    }
357

    
358
    /**
359
     * Sets service
360
     * @param service
361
     */
362
    public void setService(String service) {
363
        this.service = service;
364
    }
365

    
366
    /**
367
     * Sets the Service Information object of the status
368
     * @param si
369
     */
370
    public void setServiceInformation(ServiceInformation si) {
371
        this.serviceInfo = si;
372
    }
373

    
374
    /**
375
     * Gets the Servcie Information
376
     */
377
    public ServiceInformation getServiceInfo() {
378
        return serviceInfo;
379
    }
380

    
381
    /**
382
     * Gets server
383
     */
384
    public String getServer() {
385
        return server;
386
    }
387

    
388
    /**
389
     * Sets server
390
     * @param server
391
     */
392
    public void setServer(String server) {
393
        this.server = server;
394
    }
395
}