gvsig-raster / org.gvsig.raster.wms / trunk / org.gvsig.raster.wms / org.gvsig.raster.wms.remoteclient / src / main / java / org / gvsig / remoteclient / wms / wms_1_3_0 / request / WMSGetFeatureInfoRequest1_1_3.java @ 3392
History | View | Annotate | Download (4.2 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 |
package org.gvsig.remoteclient.wms.wms_1_3_0.request; |
26 |
|
27 |
import java.util.Vector; |
28 |
|
29 |
import org.gvsig.compat.CompatLocator; |
30 |
import org.gvsig.compat.lang.StringUtils; |
31 |
import org.gvsig.remoteclient.epsg.CrsAxisOrder; |
32 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
33 |
import org.gvsig.remoteclient.utils.Utilities; |
34 |
import org.gvsig.remoteclient.wms.WMSProtocolHandler; |
35 |
import org.gvsig.remoteclient.wms.WMSStatus; |
36 |
import org.gvsig.remoteclient.wms.request.WMSGetFeatureInfoRequest; |
37 |
|
38 |
/**
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
40 |
*/
|
41 |
public class WMSGetFeatureInfoRequest1_1_3 extends WMSGetFeatureInfoRequest{ |
42 |
|
43 |
private static final StringUtils stringUtils = CompatLocator.getStringUtils(); |
44 |
|
45 |
public WMSGetFeatureInfoRequest1_1_3(WMSStatus status,
|
46 |
WMSProtocolHandler protocolHandler, int x, int y) { |
47 |
super(status, protocolHandler, x, y);
|
48 |
} |
49 |
|
50 |
/*
|
51 |
* (non-Javadoc)
|
52 |
* @see org.gvsig.remoteClient.ogc.request.OGCRequest#getHttpGetRequest(java.lang.String)
|
53 |
*/
|
54 |
protected String getHttpGetRequest(String onlineResource) { |
55 |
StringBuffer req = new StringBuffer(); |
56 |
req.append(onlineResource); |
57 |
req.append("REQUEST=GetFeatureInfo&SERVICE=WMS&");
|
58 |
req.append("QUERY_LAYERS=").append(Utilities.Vector2CS(status.getLayerNames())); |
59 |
req.append("&VERSION=").append(protocolHandler.getVersion()).append("&INFO_FORMAT=" + status.getInfoFormat() + "&"); |
60 |
req.append(getPartialQuery(status)).append("&I="+ x + "&J=" + y); |
61 |
req.append("&FEATURE_COUNT=10000");
|
62 |
req.append("&EXCEPTIONS=" + getExceptionsFormat());
|
63 |
return req.toString();
|
64 |
} |
65 |
|
66 |
/**
|
67 |
* Gets the part of the OGC request that share GetMap and GetFeatureInfo
|
68 |
* @return String request
|
69 |
*/
|
70 |
protected String getPartialQuery(WMSStatus status) { |
71 |
StringBuffer req = new StringBuffer(); |
72 |
double coord1, coord2, coord3, coord4;
|
73 |
String epsgCode = status.getSrs();
|
74 |
if (status.isXyAxisOrder() || CrsAxisOrder.isXyAxisOrder(epsgCode)) {
|
75 |
coord1 = status.getExtent().getMinX(); |
76 |
coord2 = status.getExtent().getMinY(); |
77 |
coord3 = status.getExtent().getMaxX(); |
78 |
coord4 = status.getExtent().getMaxY(); |
79 |
} |
80 |
else {
|
81 |
// use reverse coordinate order as defined by EPSG registry
|
82 |
coord1 = status.getExtent().getMinY(); |
83 |
coord2 = status.getExtent().getMinX(); |
84 |
coord3 = status.getExtent().getMaxY(); |
85 |
coord4 = status.getExtent().getMaxX(); |
86 |
} |
87 |
|
88 |
|
89 |
req.append("LAYERS=" + Utilities.Vector2CS(status.getLayerNames())) |
90 |
.append("&CRS=" + status.getSrs())
|
91 |
.append("&BBOX=" + coord1 + "," ) |
92 |
.append(coord2 + ",")
|
93 |
.append(coord3 + ",")
|
94 |
.append(coord4) |
95 |
.append("&WIDTH=" + status.getWidth())
|
96 |
.append("&HEIGHT=" + status.getHeight())
|
97 |
.append("&FORMAT=" + status.getFormat())
|
98 |
.append("&STYLES=");
|
99 |
Vector v = status.getStyles();
|
100 |
if (v!=null && v.size()>0) |
101 |
req.append(Utilities.Vector2CS(v));
|
102 |
v = status.getDimensions(); |
103 |
if (v!=null && v.size()>0) |
104 |
req.append("&" + Utilities.Vector2URLParamString(v)); |
105 |
if (status.getTransparency()) {
|
106 |
req.append("&TRANSPARENT=TRUE");
|
107 |
} |
108 |
return req.toString();
|
109 |
} |
110 |
|
111 |
/**
|
112 |
* @return the exceptions format
|
113 |
*/
|
114 |
protected String getExceptionsFormat(){ |
115 |
return CapabilitiesTags.EXCEPTIONS_1_3_0;
|
116 |
} |
117 |
|
118 |
|
119 |
|
120 |
} |
121 |
|