Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClient / wms / WMSStatus.java @ 3520

History | View | Annotate | Download (3.47 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
    // extent required by the WMS client
22
    private Rectangle2D extent;
23
    private boolean transparency;
24
    public WMSStatus()
25
    {
26
            layers = new Vector();
27
            styles = new Vector();                        
28
    }
29
    
30
    // sets the list of layers required by the WMS client
31
    public void setLayerNames(Vector _layers) {        
32
        layers = _layers;
33
    } 
34

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

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

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

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

    
76
/**
77
 * <p>sets the styles list required by the WMS client</p>
78
 * 
79
 * 
80
 * @param _styles, list to be set as the required styles.
81
 */
82
    public void setStyles(Vector _styles) {        
83
        styles = _styles;
84
    } 
85

    
86
/**
87
 * <p>Adds a style name to the styles list required by the WMS client</p>
88
 * 
89
 * 
90
 * @param _name, style name to be added
91
 */
92
    public void addStyleName(String _name) {        
93
        styles.add( _name);
94
    } 
95

    
96
/**
97
 * <p>Removes a style from the list of styles required by the WMS client</p>
98
 * 
99
 * 
100
 * @param _name, style name to be removed
101
 */
102
    public boolean removeStyleName(String _name) {        
103
        return styles.remove(_name);
104
    } 
105
/**
106
 * <p>Gets the extent defined by the map</p>
107
 */
108
    public Rectangle2D getExtent() {        
109
        return extent;
110
    } 
111
/**
112
 * <p>Sets the extent defined by the map</p>
113
 */
114
    public void setExtent(Rectangle2D extent) {        
115
        this.extent = extent;
116
    } 
117
 
118
    public boolean equals(Object obj){
119
        if (obj instanceof WMSStatus)
120
            return false;
121
        WMSStatus s = (WMSStatus) obj;
122
        return  (s.getExtent().equals(this.getExtent()) 
123
             &&  s.getFormat().equals(this.getFormat())
124
             && (s.getHeight() == this.getHeight())
125
             && (s.getWidth()  == this.getWidth())
126
             &&  s.getLayerNames().equals(this.getLayerNames())
127
             &&  s.getStyles().equals(this.getStyles()) 
128
             &&  (s.getTransparency()==this.getTransparency()));
129
    }
130

    
131
    /**
132
     * @return
133
     */
134
    private boolean getTransparency() {
135
        return transparency;
136
    }
137

    
138
    /**
139
     * @param wmsTransparency
140
     */
141
    public void setTransparency(boolean wmsTransparency) {
142
        transparency = wmsTransparency;
143
    }
144
    
145
}