1 |
4307
|
leinfelder
|
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
|
2 |
|
|
<html>
|
3 |
|
|
<head>
|
4 |
|
|
<title>
|
5 |
|
|
<a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008 Overview
|
6 |
|
|
</title>
|
7 |
|
|
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
8 |
|
|
<script>
|
9 |
|
|
function asd() {
|
10 |
|
|
|
11 |
|
|
parent.document.title="WfsGetFeature.js Overview";
|
12 |
|
|
|
13 |
|
|
}
|
14 |
|
|
</script>
|
15 |
|
|
</head>
|
16 |
|
|
<body bgcolor="white" onload="asd();">
|
17 |
|
|
|
18 |
|
|
<!-- ========== START OF NAVBAR ========== -->
|
19 |
|
|
<a name="navbar_top"><!-- --></a>
|
20 |
|
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
21 |
|
|
<tr>
|
22 |
|
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
23 |
|
|
<a name="navbar_top_firstrow"><!-- --></a>
|
24 |
|
|
<table border="0" cellpadding="0" cellspacing="3">
|
25 |
|
|
<tr align="center" valign="top">
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
29 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
33 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
34 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
35 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
36 |
|
|
</tr>
|
37 |
|
|
</table>
|
38 |
|
|
</td>
|
39 |
|
|
<td bgcolor="#EEEEFF" align="right" valign="top">
|
40 |
|
|
<em>
|
41 |
|
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
42 |
|
|
</td>
|
43 |
|
|
</tr>
|
44 |
|
|
|
45 |
|
|
<tr>
|
46 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
47 |
|
|
PREV
|
48 |
|
|
NEXT</font></td>
|
49 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
50 |
|
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
51 |
|
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
52 |
|
|
|
53 |
|
|
<script>
|
54 |
|
|
<!--
|
55 |
|
|
if(window==top) {
|
56 |
|
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
57 |
|
|
}
|
58 |
|
|
//-->
|
59 |
|
|
</script>
|
60 |
|
|
<noscript>
|
61 |
|
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
62 |
|
|
</noscript>
|
63 |
|
|
</font></td>
|
64 |
|
|
</tr>
|
65 |
|
|
</table>
|
66 |
|
|
<!-- =========== END OF NAVBAR =========== -->
|
67 |
|
|
|
68 |
|
|
<hr>
|
69 |
|
|
<center>
|
70 |
|
|
|
71 |
|
|
<h2>WfsGetFeature.js</h2>
|
72 |
|
|
|
73 |
|
|
</center>
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
<h4>Summary</h4>
|
79 |
|
|
<p>
|
80 |
|
|
|
81 |
|
|
No overview generated for 'WfsGetFeature.js'<BR/><BR/>
|
82 |
|
|
|
83 |
|
|
</p>
|
84 |
|
|
|
85 |
|
|
<hr>
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
<table border="1" cellpadding="3" cellspacing="0" width="100%">
|
89 |
|
|
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
|
90 |
|
|
<td colspan=2><font size="+2">
|
91 |
|
|
|
92 |
|
|
<b>Class Summary</b>
|
93 |
|
|
|
94 |
|
|
</font></td>
|
95 |
|
|
</tr>
|
96 |
|
|
|
97 |
|
|
<tr bgcolor="white" class="TableRowColor">
|
98 |
|
|
<td width="15%"><b><a href="WfsGetFeature.html">WfsGetFeature</a></b></td>
|
99 |
|
|
<td> </td>
|
100 |
|
|
</tr>
|
101 |
|
|
|
102 |
|
|
</table>
|
103 |
|
|
<hr/>
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
107 |
|
|
|
108 |
|
|
<!-- ========== END METHOD SUMMARY =========== -->
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
<pre class="sourceview"><span class="comment">/*
|
112 |
|
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
113 |
|
|
Dependancies: Context
|
114 |
|
|
$Id: WfsGetFeature.js 3899 2008-03-03 10:33:30Z ahocevar $
|
115 |
|
|
*/</span>
|
116 |
|
|
<span class="comment">
|
117 |
|
|
// Ensure this object's dependancies are loaded.</span>
|
118 |
|
|
mapbuilder.loadScript(baseDir+<span class="literal">"/widget/ButtonBase.js"</span>);
|
119 |
|
|
mapbuilder.loadScript(baseDir+<span class="literal">"/util/openlayers/OpenLayers.js"</span>);
|
120 |
|
|
<span class="comment">/**
|
121 |
|
|
* Builds then sends a WFS GetFeature GET request based on the WMC
|
122 |
|
|
* coordinates and click point.
|
123 |
|
|
* <span class="attrib">@constructor</span>
|
124 |
|
|
* <span class="attrib">@base</span> ButtonBase
|
125 |
|
|
* <span class="attrib">@author</span> Cameron Shorter
|
126 |
|
|
* <span class="attrib">@param</span> widgetNode The XML node in the Config file referencing this object.
|
127 |
|
|
* <span class="attrib">@param</span> model The Context object which this tool is associated with.
|
128 |
|
|
*/</span>
|
129 |
|
|
<span class="reserved">function</span> WfsGetFeature(widgetNode, model) {
|
130 |
|
|
<span class="comment"> // Extend ButtonBase</span>
|
131 |
|
|
ButtonBase.apply(<span class="reserved">this</span>, new Array(widgetNode, model));
|
132 |
|
|
|
133 |
|
|
<span class="reserved">this</span>.widgetNode = widgetNode;
|
134 |
|
|
<span class="comment"> // id of the transactionResponseModel</span>
|
135 |
|
|
<span class="reserved">this</span>.trm = <span class="reserved">this</span>.getProperty(<span class="literal">"mb:transactionResponseModel"</span>);
|
136 |
|
|
<span class="reserved">this</span>.httpPayload = new Object({
|
137 |
|
|
method: <span class="literal">"get"</span>,
|
138 |
|
|
postData: null
|
139 |
|
|
});
|
140 |
|
|
<span class="reserved">this</span>.typeName = <span class="reserved">this</span>.getProperty(<span class="literal">'mb:typeName'</span>);
|
141 |
|
|
<span class="reserved">this</span>.maxFeatures = <span class="reserved">this</span>.getProperty(<span class="literal">'mb:maxFeatures'</span>, 1);
|
142 |
|
|
<span class="reserved">this</span>.webServiceUrl= <span class="reserved">this</span>.getProperty(<span class="literal">'mb:webServiceUrl'</span>);
|
143 |
|
|
<span class="reserved">this</span>.webServiceUrl += <span class="reserved">this</span>.webServiceUrl.indexOf(<span class="literal">"?"</span>) > -1 ? <span class="literal">'&'</span> : <span class="literal">'?'</span>;
|
144 |
|
|
<span class="reserved">this</span>.webServiceSrs= new OpenLayers.Projection(<span class="reserved">this</span>.getProperty(<span class="literal">'mb:webServiceSrs'</span>, <span class="literal">"EPSG:4326"</span>));
|
145 |
|
|
<span class="comment">
|
146 |
|
|
// override default cursor by user</span>
|
147 |
|
|
<span class="comment"> // cursor can be changed by spefying a new cursor in config file</span>
|
148 |
|
|
<span class="reserved">this</span>.cursor = <span class="literal">"pointer"</span>;
|
149 |
|
|
|
150 |
|
|
<span class="reserved">this</span>.createControl = <span class="reserved">function</span>(objRef) {
|
151 |
|
|
var transactionResponseModel = config.objects[objRef.trm];
|
152 |
|
|
|
153 |
|
|
var Control = OpenLayers.Class( OpenLayers.Control, {
|
154 |
|
|
CLASS_NAME: <span class="literal">'mbControl.WfsGetFeature'</span>,
|
155 |
|
|
type: OpenLayers.Control.TYPE_TOOL, // constant from OpenLayers.Control
|
156 |
|
|
tolerance: new Number(objRef.getProperty(<span class="literal">'mb:tolerance'</span>)),
|
157 |
|
|
httpPayload: objRef.httpPayload,
|
158 |
|
|
maxFeatures: objRef.maxFeatures,
|
159 |
|
|
webServiceUrl: objRef.webServiceUrl,
|
160 |
|
|
transactionResponseModel: transactionResponseModel,
|
161 |
|
|
|
162 |
|
|
draw: <span class="reserved">function</span>() {
|
163 |
|
|
<span class="reserved">this</span>.handler = new OpenLayers.Handler.Box( <span class="reserved">this</span>,
|
164 |
|
|
{done: <span class="reserved">this</span>.selectBox}, {keyMask: <span class="reserved">this</span>.keyMask} );
|
165 |
|
|
},
|
166 |
|
|
|
167 |
|
|
selectBox: <span class="reserved">function</span> (position) {
|
168 |
|
|
var bounds, minXY, maxXY;
|
169 |
|
|
<span class="reserved">if</span> (position instanceof OpenLayers.Bounds) {
|
170 |
|
|
<span class="comment"> // it's a box</span>
|
171 |
|
|
minXY = <span class="reserved">this</span>.map.getLonLatFromPixel(
|
172 |
|
|
new OpenLayers.Pixel(position.left, position.bottom));
|
173 |
|
|
maxXY = <span class="reserved">this</span>.map.getLonLatFromPixel(
|
174 |
|
|
new OpenLayers.Pixel(position.right, position.top));
|
175 |
|
|
} <span class="reserved">else</span> {
|
176 |
|
|
<span class="comment"> // it's a pixel</span>
|
177 |
|
|
minXY = <span class="reserved">this</span>.map.getLonLatFromPixel(
|
178 |
|
|
new OpenLayers.Pixel(position.x-<span class="reserved">this</span>.tolerance, position.y+<span class="reserved">this</span>.tolerance));
|
179 |
|
|
maxXY = <span class="reserved">this</span>.map.getLonLatFromPixel(
|
180 |
|
|
new OpenLayers.Pixel(position.x+<span class="reserved">this</span>.tolerance, position.y-<span class="reserved">this</span>.tolerance));
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat, maxXY.lon, maxXY.lat);
|
184 |
|
|
<span class="reserved">if</span> (<span class="reserved">this</span>.map.projection.projCode != <span class="reserved">this</span>.objRef.webServiceSrs.projCode) {
|
185 |
|
|
bounds.transform(<span class="reserved">this</span>.map.projection, <span class="reserved">this</span>.objRef.webServiceSrs);
|
186 |
|
|
}
|
187 |
|
|
|
188 |
|
|
var typeName = objRef.typeName;
|
189 |
|
|
|
190 |
|
|
<span class="reserved">if</span> (!typeName) {
|
191 |
|
|
var queryList=objRef.targetModel.getQueryableLayers();
|
192 |
|
|
<span class="reserved">if</span> (queryList.length==0) {
|
193 |
|
|
alert(mbGetMessage(<span class="literal">"noQueryableLayers"</span>));
|
194 |
|
|
<span class="reserved">return</span>;
|
195 |
|
|
}
|
196 |
|
|
<span class="reserved">else</span> {
|
197 |
|
|
typeName = <span class="literal">""</span>;
|
198 |
|
|
<span class="reserved">for</span> (var i=0; i<queryList.length; ++i) {
|
199 |
|
|
var layerNode = queryList[i];
|
200 |
|
|
<span class="comment">
|
201 |
|
|
// Get the name of the layer</span>
|
202 |
|
|
var layerName = layerNode.selectSingleNode(<span class="literal">"wmc:Name"</span>);
|
203 |
|
|
layerName=(layerName)?getNodeValue(layerName):<span class="literal">""</span>;
|
204 |
|
|
<span class="comment">
|
205 |
|
|
// Get the layerId. Fallback to layerName if non-existent</span>
|
206 |
|
|
var layerId = layerNode.getAttribute(<span class="literal">"id"</span>) || layerName;
|
207 |
|
|
|
208 |
|
|
var hidden = objRef.targetModel.getHidden(layerId);
|
209 |
|
|
<span class="reserved">if</span> (hidden == 0) { //query only visible layers
|
210 |
|
|
<span class="reserved">if</span> (typeName != <span class="literal">""</span>) {
|
211 |
|
|
typeName += <span class="literal">","</span>;
|
212 |
|
|
}
|
213 |
|
|
typeName += layerName;
|
214 |
|
|
}
|
215 |
|
|
}
|
216 |
|
|
}
|
217 |
|
|
}
|
218 |
|
|
|
219 |
|
|
<span class="reserved">if</span> (typeName==<span class="literal">""</span>) {
|
220 |
|
|
alert(mbGetMessage(<span class="literal">"noQueryableLayersVisible"</span>));
|
221 |
|
|
<span class="reserved">return</span>;
|
222 |
|
|
}
|
223 |
|
|
<span class="comment">
|
224 |
|
|
// now create request url</span>
|
225 |
|
|
<span class="reserved">this</span>.httpPayload.url = <span class="reserved">this</span>.webServiceUrl+OpenLayers.Util.getParameterString({
|
226 |
|
|
SERVICE: <span class="literal">"WFS"</span>,
|
227 |
|
|
VERSION: <span class="literal">"1.0.0"</span>,
|
228 |
|
|
REQUEST: <span class="literal">"GetFeature"</span>,
|
229 |
|
|
TYPENAME: typeName,
|
230 |
|
|
MAXFEATURES: <span class="reserved">this</span>.maxFeatures,
|
231 |
|
|
BBOX: bounds.toBBOX()
|
232 |
|
|
});
|
233 |
|
|
<span class="reserved">this</span>.transactionResponseModel.newRequest(<span class="reserved">this</span>.transactionResponseModel, <span class="reserved">this</span>.httpPayload);
|
234 |
|
|
}
|
235 |
|
|
});
|
236 |
|
|
<span class="reserved">return</span> Control;
|
237 |
|
|
}
|
238 |
|
|
}
|
239 |
|
|
</pre>
|
240 |
|
|
<hr>
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
<!-- ========== START OF NAVBAR ========== -->
|
245 |
|
|
<a name="navbar_top"><!-- --></a>
|
246 |
|
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
247 |
|
|
<tr>
|
248 |
|
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
249 |
|
|
<a name="navbar_top_firstrow"><!-- --></a>
|
250 |
|
|
<table border="0" cellpadding="0" cellspacing="3">
|
251 |
|
|
<tr align="center" valign="top">
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
255 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
259 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
260 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
261 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
262 |
|
|
</tr>
|
263 |
|
|
</table>
|
264 |
|
|
</td>
|
265 |
|
|
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
266 |
|
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
267 |
|
|
</td>
|
268 |
|
|
</tr>
|
269 |
|
|
|
270 |
|
|
<tr>
|
271 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
272 |
|
|
PREV
|
273 |
|
|
NEXT</font></td>
|
274 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
275 |
|
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
276 |
|
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
277 |
|
|
|
278 |
|
|
<script>
|
279 |
|
|
<!--
|
280 |
|
|
if(window==top) {
|
281 |
|
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
282 |
|
|
}
|
283 |
|
|
//-->
|
284 |
|
|
</script>
|
285 |
|
|
<noscript>
|
286 |
|
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
287 |
|
|
</noscript>
|
288 |
|
|
</font></td>
|
289 |
|
|
</tr>
|
290 |
|
|
</table>
|
291 |
|
|
<!-- =========== END OF NAVBAR =========== -->
|
292 |
|
|
|
293 |
|
|
<hr>
|
294 |
|
|
<font size="-1">
|
295 |
|
|
|
296 |
|
|
</font>
|
297 |
|
|
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Sun Apr 27 20:30:54 2008</div>
|
298 |
|
|
</body>
|
299 |
|
|
</html>
|