svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wms / request / WMSRequest.java @ 40559
History | View | Annotate | Download (3.05 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/*
|
25 |
* AUTHORS (In addition to CIT):
|
26 |
* 2009 Iver T.I. {{Task}}
|
27 |
*/
|
28 |
|
29 |
/**
|
30 |
* This class sends a WMS request and returns the
|
31 |
* reply in a local File. It tries if the server
|
32 |
* supports both HTTP Get and Post requests.
|
33 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
34 |
*/
|
35 |
package org.gvsig.remoteclient.wms.request; |
36 |
|
37 |
import java.util.Vector; |
38 |
|
39 |
import org.gvsig.remoteclient.ogc.request.OGCRequest; |
40 |
import org.gvsig.remoteclient.utils.Utilities; |
41 |
import org.gvsig.remoteclient.wms.WMSProtocolHandler; |
42 |
import org.gvsig.remoteclient.wms.WMSStatus; |
43 |
|
44 |
/**
|
45 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
46 |
*/
|
47 |
public abstract class WMSRequest extends OGCRequest{ |
48 |
protected WMSStatus status = null; |
49 |
|
50 |
public WMSRequest(WMSStatus status,
|
51 |
WMSProtocolHandler protocolHandler) { |
52 |
super(status, protocolHandler);
|
53 |
this.status = status;
|
54 |
} |
55 |
|
56 |
|
57 |
/*
|
58 |
* (non-Javadoc)
|
59 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation()
|
60 |
*/
|
61 |
protected String getSchemaLocation() { |
62 |
return null; |
63 |
} |
64 |
|
65 |
/**
|
66 |
* Gets the part of the OGC request that share GetMap and GetFeatureInfo
|
67 |
* @return String request
|
68 |
*/
|
69 |
protected String getPartialQuery(WMSStatus status) |
70 |
{ |
71 |
StringBuffer req = new StringBuffer(); |
72 |
req.append("LAYERS=" + Utilities.Vector2CS(status.getLayerNames())) |
73 |
.append("&SRS=" + status.getSrs())
|
74 |
.append("&BBOX=" + status.getExtent().getMinX()+ "," ) |
75 |
.append(status.getExtent().getMinY()+ ",")
|
76 |
.append(status.getExtent().getMaxX()+ ",")
|
77 |
.append(status.getExtent().getMaxY()) |
78 |
.append("&WIDTH=" + status.getWidth())
|
79 |
.append("&HEIGHT=" + status.getHeight())
|
80 |
.append("&FORMAT=" + status.getFormat())
|
81 |
.append("&STYLES=");
|
82 |
Vector v = status.getStyles();
|
83 |
if (v!=null && v.size()>0) |
84 |
req.append(Utilities.Vector2CS(v));
|
85 |
v = status.getDimensions(); |
86 |
if (v!=null && v.size()>0) |
87 |
req.append("&" + Utilities.Vector2URLParamString(v)); |
88 |
if (status.getTransparency()) {
|
89 |
req.append("&TRANSPARENT=TRUE");
|
90 |
} |
91 |
return req.toString();
|
92 |
} |
93 |
|
94 |
} |