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 @ 40769
History | View | Annotate | Download (2.98 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | *
|
||
6 | 40435 | jjdelcerro | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * of the License, or (at your option) any later version.
|
10 | 40559 | jjdelcerro | *
|
11 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | *
|
16 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | 40435 | jjdelcerro | * MA 02110-1301, USA.
|
20 | 40559 | jjdelcerro | *
|
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 | 40435 | jjdelcerro | */
|
24 | |||
25 | /**
|
||
26 | * This class sends a WMS request and returns the
|
||
27 | * reply in a local File. It tries if the server
|
||
28 | * supports both HTTP Get and Post requests.
|
||
29 | * @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
||
30 | */
|
||
31 | package org.gvsig.remoteclient.wms.request; |
||
32 | |||
33 | import java.util.Vector; |
||
34 | |||
35 | import org.gvsig.remoteclient.ogc.request.OGCRequest; |
||
36 | import org.gvsig.remoteclient.utils.Utilities; |
||
37 | import org.gvsig.remoteclient.wms.WMSProtocolHandler; |
||
38 | import org.gvsig.remoteclient.wms.WMSStatus; |
||
39 | |||
40 | /**
|
||
41 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
||
42 | */
|
||
43 | public abstract class WMSRequest extends OGCRequest{ |
||
44 | protected WMSStatus status = null; |
||
45 | |||
46 | public WMSRequest(WMSStatus status,
|
||
47 | WMSProtocolHandler protocolHandler) { |
||
48 | super(status, protocolHandler);
|
||
49 | this.status = status;
|
||
50 | } |
||
51 | |||
52 | |||
53 | /*
|
||
54 | * (non-Javadoc)
|
||
55 | * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation()
|
||
56 | */
|
||
57 | protected String getSchemaLocation() { |
||
58 | return null; |
||
59 | } |
||
60 | |||
61 | /**
|
||
62 | * Gets the part of the OGC request that share GetMap and GetFeatureInfo
|
||
63 | * @return String request
|
||
64 | */
|
||
65 | protected String getPartialQuery(WMSStatus status) |
||
66 | { |
||
67 | StringBuffer req = new StringBuffer(); |
||
68 | req.append("LAYERS=" + Utilities.Vector2CS(status.getLayerNames())) |
||
69 | .append("&SRS=" + status.getSrs())
|
||
70 | .append("&BBOX=" + status.getExtent().getMinX()+ "," ) |
||
71 | .append(status.getExtent().getMinY()+ ",")
|
||
72 | .append(status.getExtent().getMaxX()+ ",")
|
||
73 | .append(status.getExtent().getMaxY()) |
||
74 | .append("&WIDTH=" + status.getWidth())
|
||
75 | .append("&HEIGHT=" + status.getHeight())
|
||
76 | .append("&FORMAT=" + status.getFormat())
|
||
77 | .append("&STYLES=");
|
||
78 | Vector v = status.getStyles();
|
||
79 | if (v!=null && v.size()>0) |
||
80 | req.append(Utilities.Vector2CS(v));
|
||
81 | v = status.getDimensions(); |
||
82 | if (v!=null && v.size()>0) |
||
83 | req.append("&" + Utilities.Vector2URLParamString(v)); |
||
84 | if (status.getTransparency()) {
|
||
85 | req.append("&TRANSPARENT=TRUE");
|
||
86 | } |
||
87 | return req.toString();
|
||
88 | } |
||
89 | |||
90 | 40769 | jjdelcerro | } |