Statistics
| Revision:

root / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClient / request / wms / GetMapRequest.java @ 2988

History | View | Annotate | Download (7.16 KB)

1
package org.gvsig.remoteClient.request.wms;
2

    
3
import java.awt.geom.Rectangle2D;
4

    
5
import org.gvsig.remoteClient.request.BaseRequest;
6

    
7
public class GetMapRequest extends BaseRequest
8
{
9
        /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
         *
11
         * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
         *
13
         * This program is free software; you can redistribute it and/or
14
         * modify it under the terms of the GNU General Public License
15
         * as published by the Free Software Foundation; either version 2
16
         * of the License, or (at your option) any later version.
17
         *
18
         * This program is distributed in the hope that it will be useful,
19
         * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
         * GNU General Public License for more details.
22
         *
23
         * You should have received a copy of the GNU General Public License
24
         * along with this program; if not, write to the Free Software
25
         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
         *
27
         * For more information, contact:
28
         *
29
         *  Generalitat Valenciana
30
         *   Conselleria d'Infraestructures i Transport
31
         *   Av. Blasco Ib??ez, 50
32
         *   46010 VALENCIA
33
         *   SPAIN
34
         *
35
         *      +34 963862235
36
         *   gvsig@gva.es
37
         *      www.gvsig.gva.es
38
         *
39
         *    or
40
         *
41
         *   IVER T.I. S.A
42
         *   Salamanca 50
43
         *   46005 Valencia
44
         *   Spain
45
         *
46
         *   +34 963163400
47
         *   dac@iver.es
48
         */
49
/**
50
 * Estructura de datos para almacenar los par?metros de una petici?n GetMap
51
 *
52
 * @author Fernando Gonz?lez Cort?s
53
 */
54
        private String queryHeader;
55
    private String layers;
56
    private String styles;
57
    private String SRS;
58
    private String BBOX;
59
    private int width;
60
    private int height;
61
    private String format;
62
    private boolean transparent = true;
63
    private String BGColor = null;
64
    private String exceptions = null;
65
    private String time = null;
66
    private int elevation = -1;
67

    
68
    /**
69
     * Creates a new MapQuery object.
70
     */
71
    public GetMapRequest(String queryHeader) {
72
            this.queryHeader = queryHeader;
73
    }
74

    
75
    /**
76
     * Obtiene la representaci?n de la query en la forma de las peticiones GET
77
     *
78
     * @return string
79
     */
80
    public String build() {
81
        String ret = "";
82
        ret = ret + queryHeader + "REQUEST=GetMap&SERVICE=WMS&";
83
        ret = ret + getPartialQuery();
84
        if (exceptions != null) {
85
            ret += ("&EXCEPTIONS=" + exceptions);
86
        } else {
87
            ret += ("&EXCEPTIONS=XML");
88
        }
89

    
90

    
91
        return ret;
92
    }
93

    
94
    /**
95
     * Obtiene la query que se comparte con la petici?n de 
96
     * getFeatureInfo
97
     *
98
     * @return String con la query
99
     */
100
    public String getPartialQuery() {
101
        String ret = "LAYERS=" + layers + "&STYLES=" + styles + "&SRS=" + SRS +
102
            "&BBOX=" + BBOX + "&WIDTH=" + width + "&HEIGHT=" + height +
103
            "&FORMAT=" + format;
104

    
105
        if (transparent) {
106
            ret += "&TRANSPARENT=TRUE";
107
        }
108

    
109
        if (BGColor != null) {
110
            ret += ("&COLOR=" + BGColor);
111
        }
112

    
113
        if (time != null) {
114
            ret += ("&TIME=" + time);
115
        }
116

    
117
        if (elevation != -1) {
118
            ret += ("&ELEVATION=" + elevation);
119
        }
120

    
121
        return ret.replaceAll(" ", "%20");
122
    }
123

    
124
    /**
125
     * Obtiene el par?metro BBOX
126
     *
127
     * @return
128
     */
129
    public String getBBOX() {
130
        return BBOX;
131
    }
132

    
133
    /**
134
     * Obtiene el par?metro
135
     *
136
     * @return
137
     */
138
    public String getBGColor() {
139
        return BGColor;
140
    }
141

    
142
    /**
143
     * Obtiene el par?metro
144
     *
145
     * @return
146
     */
147
    public int getElevation() {
148
        return elevation;
149
    }
150

    
151
    /**
152
     * Obtiene el par?metro
153
     *
154
     * @return
155
     */
156
    public String getExceptions() {
157
        return exceptions;
158
    }
159

    
160
    /**
161
     * Obtiene el par?metro
162
     *
163
     * @return
164
     */
165
    public String getFormat() {
166
        return format;
167
    }
168

    
169
    /**
170
     * Obtiene el par?metro
171
     *
172
     * @return
173
     */
174
    public int getHeight() {
175
        return height;
176
    }
177

    
178
    /**
179
     * Obtiene el par?metro
180
     *
181
     * @return
182
     */
183
    public String getLayers() {
184
        return layers;
185
    }
186

    
187
    /**
188
     * Obtiene el par?metro
189
     *
190
     * @return
191
     */
192
    public String getSRS() {
193
        return SRS;
194
    }
195

    
196
    /**
197
     * Obtiene el par?metro
198
     *
199
     * @return
200
     */
201
    public String getStyles() {
202
        return styles;
203
    }
204

    
205
    /**
206
     * Obtiene el par?metro
207
     *
208
     * @return
209
     */
210
    public String getTime() {
211
        return time;
212
    }
213

    
214
    /**
215
     * Obtiene el par?metro
216
     *
217
     * @return
218
     */
219
    public boolean isTransparent() {
220
        return transparent;
221
    }
222

    
223
    /**
224
     * Obtiene el par?metro
225
     *
226
     * @return
227
     */
228
    public int getWidth() {
229
        return width;
230
    }
231

    
232
    /**
233
     * Establece el par?metro bbox
234
     *
235
     * @param minx
236
     * @param miny
237
     * @param maxx
238
     * @param maxy
239
     */
240
    public void setBBOX(String minx, String miny, String maxx, String maxy) {
241
        BBOX = minx + "," + miny + "," + maxy + "," + maxy;
242
    }
243

    
244
    /**
245
     * Establece el par?metro bbox
246
     *
247
     * @param rect
248
     */
249
    public void setBBOX(Rectangle2D rect) {
250
        BBOX = rect.getMinX() + "," + rect.getMinY() + "," + rect.getMaxX() +
251
            "," + rect.getMaxY();
252
    }
253

    
254
    /**
255
     * Establece el par?metro
256
     *
257
     * @param color
258
     */
259
    public void setBGColor(String color) {
260
        BGColor = color;
261
    }
262

    
263
    /**
264
     * Establece el par?metro
265
     *
266
     * @param i
267
     */
268
    public void setElevation(int i) {
269
        elevation = i;
270
    }
271

    
272
    /**
273
     * Establece el par?metro
274
     *
275
     * @param string
276
     */
277
    public void setExceptions(String string) {
278
        exceptions = string;
279
    }
280

    
281
    /**
282
     * Establece el par?metro
283
     *
284
     * @param string
285
     */
286
    public void setFormat(String string) {
287
        format = string;
288
    }
289

    
290
    /**
291
     * Establece el par?metro
292
     *
293
     * @param i
294
     */
295
    public void setHeight(int i) {
296
        height = i;
297
    }
298

    
299
    /**
300
     * Establece el par?metro
301
     *
302
     * @param string
303
     */
304
    public void setLayers(String string) {
305
        layers = string;
306
    }
307

    
308
    /**
309
     * Establece el par?metro
310
     *
311
     * @param string
312
     */
313
    public void setSRS(String string) {
314
        SRS = string;
315
    }
316

    
317
    /**
318
     * Establece el par?metro
319
     *
320
     * @param string
321
     */
322
    public void setStyles(String string) {
323
        styles = string;
324
    }
325

    
326
    /**
327
     * Establece el par?metro
328
     *
329
     * @param date
330
     */
331
    public void setTime(String date) {
332
        time = date;
333
    }
334

    
335
    /**
336
     * Establece el par?metro
337
     *
338
     * @param b
339
     */
340
    public void setTransparent(boolean b) {
341
        transparent = b;
342
    }
343

    
344
    /**
345
     * Establece el par?metro
346
     *
347
     * @param i
348
     */
349
    public void setWidth(int i) {
350
        width = i;
351
    }
352

    
353
    /**
354
     * Establece el par?metro
355
     *
356
     * @param string
357
     */
358
    public void setBBOX(String string) {
359
        BBOX = string;
360
    }
361
        /**
362
         * @return Returns the queryHeader.
363
         */
364
        public String getQueryHeader() {
365
                return queryHeader;
366
        }
367
        /**
368
         * @param queryHeader The queryHeader to set.
369
         */
370
        public void setQueryHeader(String queryHeader) {
371
                this.queryHeader = queryHeader;
372
        }
373
}