root / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClientOld / request / GetMapRequest.java @ 3321
History | View | Annotate | Download (7.07 KB)
1 | 3321 | luisw2 | package org.gvsig.remoteClientOld.request; |
---|---|---|---|
2 | |||
3 | import java.awt.geom.Rectangle2D; |
||
4 | |||
5 | |||
6 | public class GetMapRequest extends BaseRequest |
||
7 | { |
||
8 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
9 | *
|
||
10 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
11 | *
|
||
12 | * This program is free software; you can redistribute it and/or
|
||
13 | * modify it under the terms of the GNU General Public License
|
||
14 | * as published by the Free Software Foundation; either version 2
|
||
15 | * of the License, or (at your option) any later version.
|
||
16 | *
|
||
17 | * This program is distributed in the hope that it will be useful,
|
||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
20 | * GNU General Public License for more details.
|
||
21 | *
|
||
22 | * You should have received a copy of the GNU General Public License
|
||
23 | * along with this program; if not, write to the Free Software
|
||
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
25 | *
|
||
26 | * For more information, contact:
|
||
27 | *
|
||
28 | * Generalitat Valenciana
|
||
29 | * Conselleria d'Infraestructures i Transport
|
||
30 | * Av. Blasco Ib??ez, 50
|
||
31 | * 46010 VALENCIA
|
||
32 | * SPAIN
|
||
33 | *
|
||
34 | * +34 963862235
|
||
35 | * gvsig@gva.es
|
||
36 | * www.gvsig.gva.es
|
||
37 | *
|
||
38 | * or
|
||
39 | *
|
||
40 | * IVER T.I. S.A
|
||
41 | * Salamanca 50
|
||
42 | * 46005 Valencia
|
||
43 | * Spain
|
||
44 | *
|
||
45 | * +34 963163400
|
||
46 | * dac@iver.es
|
||
47 | */
|
||
48 | /**
|
||
49 | * Estructura de datos para almacenar los par?metros de una petici?n GetMap
|
||
50 | *
|
||
51 | * @author Fernando Gonz?lez Cort?s
|
||
52 | */
|
||
53 | private String queryHeader; |
||
54 | private String layers; |
||
55 | private String styles; |
||
56 | private String SRS; |
||
57 | private String BBOX; |
||
58 | private int width; |
||
59 | private int height; |
||
60 | private String format; |
||
61 | private boolean transparent = true; |
||
62 | private String BGColor = null; |
||
63 | private String time = null; |
||
64 | private int elevation = -1; |
||
65 | |||
66 | /**
|
||
67 | * Creates a new MapQuery object.
|
||
68 | */
|
||
69 | public GetMapRequest(String queryHeader) { |
||
70 | this.queryHeader = queryHeader;
|
||
71 | } |
||
72 | |||
73 | /**
|
||
74 | * Obtiene la representaci?n de la query en la forma de las peticiones GET
|
||
75 | *
|
||
76 | * @return string
|
||
77 | */
|
||
78 | public String build() { |
||
79 | String ret = ""; |
||
80 | ret = ret + queryHeader + "REQUEST=GetMap&SERVICE=WMS&";
|
||
81 | ret = ret + getPartialQuery(); |
||
82 | if (exceptions != null) { |
||
83 | ret += ("&EXCEPTIONS=" + exceptions);
|
||
84 | } else {
|
||
85 | ret += ("&EXCEPTIONS=XML");
|
||
86 | } |
||
87 | |||
88 | |||
89 | return ret;
|
||
90 | } |
||
91 | |||
92 | /**
|
||
93 | * Obtiene la query que se comparte con la petici?n de
|
||
94 | * getFeatureInfo
|
||
95 | *
|
||
96 | * @return String con la query
|
||
97 | */
|
||
98 | public String getPartialQuery() { |
||
99 | String ret = "LAYERS=" + layers + "&STYLES=" + styles + "&SRS=" + SRS + |
||
100 | "&BBOX=" + BBOX + "&WIDTH=" + width + "&HEIGHT=" + height + |
||
101 | "&FORMAT=" + format;
|
||
102 | |||
103 | if (transparent) {
|
||
104 | ret += "&TRANSPARENT=TRUE";
|
||
105 | } |
||
106 | |||
107 | if (BGColor != null) { |
||
108 | ret += ("&COLOR=" + BGColor);
|
||
109 | } |
||
110 | |||
111 | if (time != null) { |
||
112 | ret += ("&TIME=" + time);
|
||
113 | } |
||
114 | |||
115 | if (elevation != -1) { |
||
116 | ret += ("&ELEVATION=" + elevation);
|
||
117 | } |
||
118 | |||
119 | return ret.replaceAll(" ", "%20"); |
||
120 | } |
||
121 | |||
122 | /**
|
||
123 | * Obtiene el par?metro BBOX
|
||
124 | *
|
||
125 | * @return
|
||
126 | */
|
||
127 | public String getBBOX() { |
||
128 | return BBOX;
|
||
129 | } |
||
130 | |||
131 | /**
|
||
132 | * Obtiene el par?metro
|
||
133 | *
|
||
134 | * @return
|
||
135 | */
|
||
136 | public String getBGColor() { |
||
137 | return BGColor;
|
||
138 | } |
||
139 | |||
140 | /**
|
||
141 | * Obtiene el par?metro
|
||
142 | *
|
||
143 | * @return
|
||
144 | */
|
||
145 | public int getElevation() { |
||
146 | return elevation;
|
||
147 | } |
||
148 | |||
149 | /**
|
||
150 | * Obtiene el par?metro
|
||
151 | *
|
||
152 | * @return
|
||
153 | */
|
||
154 | public String getExceptions() { |
||
155 | return exceptions;
|
||
156 | } |
||
157 | |||
158 | /**
|
||
159 | * Obtiene el par?metro
|
||
160 | *
|
||
161 | * @return
|
||
162 | */
|
||
163 | public String getFormat() { |
||
164 | return format;
|
||
165 | } |
||
166 | |||
167 | /**
|
||
168 | * Obtiene el par?metro
|
||
169 | *
|
||
170 | * @return
|
||
171 | */
|
||
172 | public int getHeight() { |
||
173 | return height;
|
||
174 | } |
||
175 | |||
176 | /**
|
||
177 | * Obtiene el par?metro
|
||
178 | *
|
||
179 | * @return
|
||
180 | */
|
||
181 | public String getLayers() { |
||
182 | return layers;
|
||
183 | } |
||
184 | |||
185 | /**
|
||
186 | * Obtiene el par?metro
|
||
187 | *
|
||
188 | * @return
|
||
189 | */
|
||
190 | public String getSRS() { |
||
191 | return SRS;
|
||
192 | } |
||
193 | |||
194 | /**
|
||
195 | * Obtiene el par?metro
|
||
196 | *
|
||
197 | * @return
|
||
198 | */
|
||
199 | public String getStyles() { |
||
200 | return styles;
|
||
201 | } |
||
202 | |||
203 | /**
|
||
204 | * Obtiene el par?metro
|
||
205 | *
|
||
206 | * @return
|
||
207 | */
|
||
208 | public String getTime() { |
||
209 | return time;
|
||
210 | } |
||
211 | |||
212 | /**
|
||
213 | * Obtiene el par?metro
|
||
214 | *
|
||
215 | * @return
|
||
216 | */
|
||
217 | public boolean isTransparent() { |
||
218 | return transparent;
|
||
219 | } |
||
220 | |||
221 | /**
|
||
222 | * Obtiene el par?metro
|
||
223 | *
|
||
224 | * @return
|
||
225 | */
|
||
226 | public int getWidth() { |
||
227 | return width;
|
||
228 | } |
||
229 | |||
230 | /**
|
||
231 | * Establece el par?metro bbox
|
||
232 | *
|
||
233 | * @param minx
|
||
234 | * @param miny
|
||
235 | * @param maxx
|
||
236 | * @param maxy
|
||
237 | */
|
||
238 | public void setBBOX(String minx, String miny, String maxx, String maxy) { |
||
239 | BBOX = minx + "," + miny + "," + maxy + "," + maxy; |
||
240 | } |
||
241 | |||
242 | /**
|
||
243 | * Establece el par?metro bbox
|
||
244 | *
|
||
245 | * @param rect
|
||
246 | */
|
||
247 | public void setBBOX(Rectangle2D rect) { |
||
248 | BBOX = rect.getMinX() + "," + rect.getMinY() + "," + rect.getMaxX() + |
||
249 | "," + rect.getMaxY();
|
||
250 | } |
||
251 | |||
252 | /**
|
||
253 | * Establece el par?metro
|
||
254 | *
|
||
255 | * @param color
|
||
256 | */
|
||
257 | public void setBGColor(String color) { |
||
258 | BGColor = color; |
||
259 | } |
||
260 | |||
261 | /**
|
||
262 | * Establece el par?metro
|
||
263 | *
|
||
264 | * @param i
|
||
265 | */
|
||
266 | public void setElevation(int i) { |
||
267 | elevation = i; |
||
268 | } |
||
269 | |||
270 | /**
|
||
271 | * Establece el par?metro
|
||
272 | *
|
||
273 | * @param string
|
||
274 | */
|
||
275 | public void setExceptions(String string) { |
||
276 | exceptions = string; |
||
277 | } |
||
278 | |||
279 | /**
|
||
280 | * Establece el par?metro
|
||
281 | *
|
||
282 | * @param string
|
||
283 | */
|
||
284 | public void setFormat(String string) { |
||
285 | format = string; |
||
286 | } |
||
287 | |||
288 | /**
|
||
289 | * Establece el par?metro
|
||
290 | *
|
||
291 | * @param i
|
||
292 | */
|
||
293 | public void setHeight(int i) { |
||
294 | height = i; |
||
295 | } |
||
296 | |||
297 | /**
|
||
298 | * Establece el par?metro
|
||
299 | *
|
||
300 | * @param string
|
||
301 | */
|
||
302 | public void setLayers(String string) { |
||
303 | layers = string; |
||
304 | } |
||
305 | |||
306 | /**
|
||
307 | * Establece el par?metro
|
||
308 | *
|
||
309 | * @param string
|
||
310 | */
|
||
311 | public void setSRS(String string) { |
||
312 | SRS = string; |
||
313 | } |
||
314 | |||
315 | /**
|
||
316 | * Establece el par?metro
|
||
317 | *
|
||
318 | * @param string
|
||
319 | */
|
||
320 | public void setStyles(String string) { |
||
321 | styles = string; |
||
322 | } |
||
323 | |||
324 | /**
|
||
325 | * Establece el par?metro
|
||
326 | *
|
||
327 | * @param date
|
||
328 | */
|
||
329 | public void setTime(String date) { |
||
330 | time = date; |
||
331 | } |
||
332 | |||
333 | /**
|
||
334 | * Establece el par?metro
|
||
335 | *
|
||
336 | * @param b
|
||
337 | */
|
||
338 | public void setTransparent(boolean b) { |
||
339 | transparent = b; |
||
340 | } |
||
341 | |||
342 | /**
|
||
343 | * Establece el par?metro
|
||
344 | *
|
||
345 | * @param i
|
||
346 | */
|
||
347 | public void setWidth(int i) { |
||
348 | width = i; |
||
349 | } |
||
350 | |||
351 | /**
|
||
352 | * Establece el par?metro
|
||
353 | *
|
||
354 | * @param string
|
||
355 | */
|
||
356 | public void setBBOX(String string) { |
||
357 | BBOX = string; |
||
358 | } |
||
359 | /**
|
||
360 | * @return Returns the queryHeader.
|
||
361 | */
|
||
362 | public String getQueryHeader() { |
||
363 | return queryHeader;
|
||
364 | } |
||
365 | /**
|
||
366 | * @param queryHeader The queryHeader to set.
|
||
367 | */
|
||
368 | public void setQueryHeader(String queryHeader) { |
||
369 | this.queryHeader = queryHeader;
|
||
370 | } |
||
371 | } |