Statistics
| Revision:

root / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClient / wms / WMSStatus.java @ 3592

History | View | Annotate | Download (3.86 KB)

1

    
2
package org.gvsig.remoteClient.wms;
3

    
4
import java.awt.geom.Rectangle2D;
5
import java.text.Format;
6
import java.util.Vector;
7

    
8
/**
9
 * Describes the status of a WMSclient, so it adds to the Remote client status
10
 * a list of layers, a list of layer styles, the extent of the map.
11
 * Provides the functionality to modify these lists.
12
 * 
13
 */
14
public class WMSStatus extends org.gvsig.remoteClient.RemoteClientStatus {
15

    
16

    
17
        // list of leayer to be retrieved by the WMS
18
    private Vector layers;
19
    // List of layer styles
20
    private Vector styles;
21
    private Vector dimensions;
22
    // extent required by the WMS client
23
    private Rectangle2D extent;
24
    private boolean transparency;
25
    public WMSStatus()
26
    {
27
            layers = new Vector();
28
            styles = new Vector();                        
29
    }
30
    
31
    // sets the list of layers required by the WMS client
32
    public void setLayerNames(Vector _layers) {        
33
        layers = _layers;
34
    } 
35

    
36
/**
37
 * <p>Retrieves the layer list required by the WMS client</p>
38
 * 
39
 * 
40
 * @return Vector, the list of layers
41
 */
42
    public Vector getLayerNames() {        
43
        return layers;
44
    } 
45

    
46
/**
47
 * <p> Adds a layer to the list of layers required by the WMS client</p>
48
 * 
49
 * 
50
 * @param _layerName, name of the layer to be added. 
51
 */
52
    public void addLayerName(String _layerName) {        
53
        layers.add(_layerName);
54
    } 
55

    
56
/**
57
 * <p>removes a layer from the layer list</p>
58
 * 
59
 * 
60
 * @param _layerName 
61
 * @return true if the layer name has been deleted from the list
62
 */
63
    public boolean removeLayerName(String _layerName) {
64
            return layers.remove(_layerName);       
65
    } 
66

    
67
/**
68
 * <p>gets the styles list required by the WMS client</p>
69
 * 
70
 * 
71
 * @return Vector with the list of layer styles
72
 */
73
    public Vector getStyles() {        
74
        return styles;
75
    } 
76

    
77
/**
78
 * <p>sets the styles list required by the WMS client</p>
79
 * 
80
 * 
81
 * @param _styles, list to be set as the required styles.
82
 */
83
    public void setStyles(Vector _styles) {        
84
        styles = _styles;
85
    }
86
    
87
    /**
88
     * <p>sets the styles list required by the WMS client</p>
89
     * 
90
     * 
91
     * @param _styles, list to be set as the required styles.
92
     */
93
    public void setDimensions(Vector _dimensions) {        
94
        
95
        dimensions = _dimensions;
96
    } 
97

    
98
/**
99
 * <p>Adds a style name to the styles list required by the WMS client</p>
100
 * 
101
 * 
102
 * @param _name, style name to be added
103
 */
104
    public void addStyleName(String _name) {        
105
        styles.add( _name);
106
    } 
107

    
108
/**
109
 * <p>Removes a style from the list of styles required by the WMS client</p>
110
 * 
111
 * 
112
 * @param _name, style name to be removed
113
 */
114
    public boolean removeStyleName(String _name) {        
115
        return styles.remove(_name);
116
    } 
117
/**
118
 * <p>Gets the extent defined by the map</p>
119
 */
120
    public Rectangle2D getExtent() {        
121
        return extent;
122
    } 
123
/**
124
 * <p>Sets the extent defined by the map</p>
125
 */
126
    public void setExtent(Rectangle2D extent) {        
127
        this.extent = extent;
128
    } 
129
 
130
    public boolean equals(Object obj){
131
        if (obj instanceof WMSStatus)
132
            return false;
133
        WMSStatus s = (WMSStatus) obj;
134
        return  (s.getExtent().equals(this.getExtent()) 
135
             &&  s.getFormat().equals(this.getFormat())
136
             && (s.getHeight() == this.getHeight())
137
             && (s.getWidth()  == this.getWidth())
138
             &&  s.getLayerNames().equals(this.getLayerNames())
139
             &&  s.getStyles().equals(this.getStyles()) 
140
             &&  (s.getTransparency()==this.getTransparency()));
141
    }
142

    
143
    /**
144
     * @return
145
     */
146
    public boolean getTransparency() {
147
        return transparency;
148
    }
149

    
150
    /**
151
     * @param wmsTransparency
152
     */
153
    public void setTransparency(boolean wmsTransparency) {
154
        transparency = wmsTransparency;
155
    }
156

    
157
    /**
158
     * @return
159
     */
160
    public Vector getDimensions() {
161
        return dimensions;
162
    }
163
    
164
}