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="FeatureSelectHandler.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>FeatureSelectHandler.js</h2>
|
72 |
|
|
|
73 |
|
|
</center>
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
<h4>Summary</h4>
|
79 |
|
|
<p>
|
80 |
|
|
|
81 |
|
|
No overview generated for 'FeatureSelectHandler.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="FeatureSelectHandler.html">FeatureSelectHandler</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 |
|
|
$Id: FeatureSelectHandler.js 3842 2008-02-13 17:22:04Z ahocevar $
|
114 |
|
|
*/</span>
|
115 |
|
|
<span class="comment">
|
116 |
|
|
// Ensure this object's dependancies are loaded.</span>
|
117 |
|
|
mapbuilder.loadScript(baseDir+<span class="literal">"/tool/ToolBase.js"</span>);
|
118 |
|
|
mapbuilder.loadScript(baseDir+<span class="literal">"/util/openlayers/OpenLayers.js"</span>);
|
119 |
|
|
|
120 |
|
|
<span class="comment">/**
|
121 |
|
|
* Manages mouseover and clicks on vector features in the map.
|
122 |
|
|
* This tool works with models that are linked to a OL vector layer,
|
123 |
|
|
* using eg. the GmlRendererOL widget. Models have to fire the
|
124 |
|
|
* 'gmlRendererLayer' event, which will activate the tool for the
|
125 |
|
|
* layer.
|
126 |
|
|
* This tool also fires "mouseoverFeature" and "mouseoutFeature"
|
127 |
|
|
* events, setting the fid of the feature below the mouse cursor
|
128 |
|
|
* as param of the model.
|
129 |
|
|
* <span class="attrib">@constructor</span>
|
130 |
|
|
* <span class="attrib">@base</span> ToolBase
|
131 |
|
|
* <span class="attrib">@author</span> Andreas Hocevar andreas.hocevarATgmail.com
|
132 |
|
|
* <span class="attrib">@param</span> toolNode The tool node from the config XML file.
|
133 |
|
|
* <span class="attrib">@param</span> model The model containing this tool.
|
134 |
|
|
*/</span>
|
135 |
|
|
<span class="reserved">function</span> FeatureSelectHandler(toolNode, model) {
|
136 |
|
|
ToolBase.apply(<span class="reserved">this</span>, new Array(toolNode, model));
|
137 |
|
|
|
138 |
|
|
<span class="comment">/**
|
139 |
|
|
* Map for this FeatureSelectHandler. We keep a reference
|
140 |
|
|
* to the map we created the control for, to prevent ourselves
|
141 |
|
|
* from removing the control from a map that does not exist
|
142 |
|
|
* anymore.
|
143 |
|
|
*/</span>
|
144 |
|
|
<span class="reserved">this</span>.map = null;
|
145 |
|
|
|
146 |
|
|
<span class="reserved">this</span>.sourceModels = new Array();
|
147 |
|
|
|
148 |
|
|
<span class="comment">/**
|
149 |
|
|
* Tool Initialisation - Step 1 of 3.
|
150 |
|
|
* This is called when the config finished loading, so we know
|
151 |
|
|
* our context (targetModel).
|
152 |
|
|
* <span class="attrib">@param</span> objRef This object
|
153 |
|
|
*/</span>
|
154 |
|
|
<span class="reserved">this</span>.configInit = <span class="reserved">function</span>(objRef) {
|
155 |
|
|
objRef.targetModel.addListener(<span class="literal">'loadModel'</span>, objRef.contextInit, objRef);
|
156 |
|
|
}
|
157 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">'init'</span>, <span class="reserved">this</span>.configInit, <span class="reserved">this</span>)
|
158 |
|
|
|
159 |
|
|
<span class="reserved">this</span>.clear = <span class="reserved">function</span>(objRef) {
|
160 |
|
|
<span class="reserved">if</span> (objRef.control) {
|
161 |
|
|
objRef.map = null;
|
162 |
|
|
objRef.control.destroy();
|
163 |
|
|
objRef.control = null;
|
164 |
|
|
}
|
165 |
|
|
}
|
166 |
|
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"newModel"</span>, <span class="reserved">this</span>.clear, <span class="reserved">this</span>);
|
167 |
|
|
|
168 |
|
|
<span class="comment">/**
|
169 |
|
|
* Tool Initialisation - Step 2 of 3.
|
170 |
|
|
* This is called when the context model finished loading, so we
|
171 |
|
|
* know that we have a map available.
|
172 |
|
|
* <span class="attrib">@param</span> objRef This object
|
173 |
|
|
*/</span>
|
174 |
|
|
<span class="reserved">this</span>.contextInit = <span class="reserved">function</span>(objRef) {
|
175 |
|
|
objRef.targetModel.addListener(<span class="literal">"newModel"</span>, objRef.clear, objRef);
|
176 |
|
|
objRef.model.addListener(<span class="literal">'gmlRendererLayer'</span>, objRef.init, objRef);
|
177 |
|
|
<span class="comment"> // Check carefully if we have to init manually. This is the case when</span>
|
178 |
|
|
<span class="comment"> // the gmlRendererLayer is rendered, but does not know about the</span>
|
179 |
|
|
<span class="comment"> // FeatureSelectHandler yet.</span>
|
180 |
|
|
<span class="reserved">if</span> (objRef.targetModel.map && objRef.model.getParam(<span class="literal">'gmlRendererLayer'</span>) && !objRef.control) {
|
181 |
|
|
objRef.init(objRef);
|
182 |
|
|
}
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
<span class="comment">/**
|
186 |
|
|
* Tool Initialisation - Step 3 of 3.
|
187 |
|
|
* Turns on feature select when the gmlRendererLayer event is fired.
|
188 |
|
|
* <span class="attrib">@param</span> objRef reference to this object.
|
189 |
|
|
* <span class="attrib">@return</span> {OpenLayers.Control} class of the OL control.
|
190 |
|
|
*/</span>
|
191 |
|
|
<span class="reserved">this</span>.init = <span class="reserved">function</span>(objRef) {
|
192 |
|
|
<span class="comment"> // get the source models</span>
|
193 |
|
|
var sourceModel;
|
194 |
|
|
<span class="comment"> // if we have mergeModels, take sourceModels from there</span>
|
195 |
|
|
<span class="reserved">if</span> (objRef.model.mergeModels) {
|
196 |
|
|
objRef.sourceModels = objRef.model.mergeModels;
|
197 |
|
|
} <span class="reserved">else</span> {
|
198 |
|
|
<span class="comment"> // if we hava a plain model, just use it</span>
|
199 |
|
|
objRef.sourceModels.push(objRef.model);
|
200 |
|
|
}
|
201 |
|
|
<span class="reserved">for</span> (var i=0; i<objRef.sourceModels.length; i++) {
|
202 |
|
|
objRef.sourceModels[i].addListener(<span class="literal">'highlightFeature'</span>, objRef.highlight, objRef);
|
203 |
|
|
objRef.sourceModels[i].addListener(<span class="literal">'dehighlightFeature'</span>, objRef.dehighlight, objRef);
|
204 |
|
|
}
|
205 |
|
|
<span class="comment">
|
206 |
|
|
// init the control</span>
|
207 |
|
|
var layer = objRef.model.getParam(<span class="literal">'gmlRendererLayer'</span>);
|
208 |
|
|
<span class="reserved">if</span> (objRef.map == objRef.targetModel.map &&
|
209 |
|
|
objRef.control && !layer) {
|
210 |
|
|
<span class="comment"> //objRef.control.deactivate();</span>
|
211 |
|
|
objRef.map.removeControl(objRef.control);
|
212 |
|
|
objRef.control.destroy();
|
213 |
|
|
objRef.control = null;
|
214 |
|
|
} <span class="reserved">else</span> <span class="reserved">if</span> (layer) {
|
215 |
|
|
<span class="reserved">if</span> (!objRef.control) {
|
216 |
|
|
objRef.control = new OpenLayers.Control.SelectFeature(layer, {
|
217 |
|
|
hover: true,
|
218 |
|
|
onSelect: objRef.onSelect,
|
219 |
|
|
onUnselect: objRef.onUnselect,
|
220 |
|
|
mbFeatureSelectHandler: objRef,
|
221 |
|
|
select: <span class="reserved">function</span>(feature) {
|
222 |
|
|
feature.mbFeatureSelectHandler = <span class="reserved">this</span>.mbFeatureSelectHandler;
|
223 |
|
|
<span class="reserved">if</span> (feature.mbSelectStyle) {
|
224 |
|
|
<span class="reserved">this</span>.selectStyle = feature.mbSelectStyle.createSymbolizer ?
|
225 |
|
|
feature.mbSelectStyle.createSymbolizer(feature) :
|
226 |
|
|
feature.mbSelectStyle;
|
227 |
|
|
}
|
228 |
|
|
OpenLayers.Control.SelectFeature.<span class="reserved">prototype</span>.select.apply(<span class="reserved">this</span>, arguments);
|
229 |
|
|
}
|
230 |
|
|
});
|
231 |
|
|
objRef.map = objRef.targetModel.map;
|
232 |
|
|
objRef.map.addControl(objRef.control);
|
233 |
|
|
}
|
234 |
|
|
objRef.control.activate();
|
235 |
|
|
}
|
236 |
|
|
}
|
237 |
|
|
|
238 |
|
|
<span class="comment">/**
|
239 |
|
|
* extension for the OpenLayers.Feature.Vector.destroy method.
|
240 |
|
|
* Will be applied to features touched by this tool.
|
241 |
|
|
*/</span>
|
242 |
|
|
var destroyFeature = <span class="reserved">function</span>() {
|
243 |
|
|
var featureSelectHandler = <span class="reserved">this</span>.mbFeatureSelectHandler;
|
244 |
|
|
<span class="reserved">if</span> (<span class="reserved">this</span>.layer.events && featureSelectHandler) {
|
245 |
|
|
<span class="reserved">this</span>.layer.events.unregister(<span class="literal">'mousedown'</span>, <span class="reserved">this</span>, featureSelectHandler.onClick);
|
246 |
|
|
<span class="reserved">this</span>.layer.events.unregister(<span class="literal">'mousemove'</span>, <span class="reserved">this</span>, featureSelectHandler.onHover);
|
247 |
|
|
}
|
248 |
|
|
<span class="reserved">this</span>.mbFeatureSelectHandler = null;
|
249 |
|
|
OpenLayers.Feature.Vector.<span class="reserved">prototype</span>.destroy.apply(<span class="reserved">this</span>, arguments);
|
250 |
|
|
}
|
251 |
|
|
|
252 |
|
|
<span class="comment">/**
|
253 |
|
|
* This method is triggered when the mouse is over a vector
|
254 |
|
|
* feature. It registers priority events mousedown and
|
255 |
|
|
* mousemove, which will call this widget's onClick/onHover
|
256 |
|
|
* method in the context of a feature. This way we address
|
257 |
|
|
* two problems with the OpenLayers SelectFeature control:<pre>
|
258 |
|
|
* - for the info popup, we need the screen coordinates
|
259 |
|
|
* which we do not get from the handler directly.
|
260 |
|
|
* - when the active tool changes, something in the
|
261 |
|
|
* priority of OL event handlers changes, so the
|
262 |
|
|
* click event on the feature gets lost. By registering
|
263 |
|
|
* our priority handler and calling Event.stop() in
|
264 |
|
|
* the target method, we make sure that our event is
|
265 |
|
|
* handled and no other event handlers are triggered.
|
266 |
|
|
* </pre>
|
267 |
|
|
* <span class="attrib">@param</span> feature OpenLayers feature
|
268 |
|
|
*/</span>
|
269 |
|
|
<span class="reserved">this</span>.onSelect = <span class="reserved">function</span>(feature) {
|
270 |
|
|
<span class="reserved">if</span> (!feature) <span class="reserved">return</span>;
|
271 |
|
|
var objRef = <span class="reserved">this</span>.mbFeatureSelectHandler;
|
272 |
|
|
<span class="reserved">for</span> (var i=0; i<objRef.sourceModels.length; i++) {
|
273 |
|
|
objRef.sourceModels[i].setParam(<span class="literal">"mouseoverFeature"</span>, feature.fid);
|
274 |
|
|
}
|
275 |
|
|
<span class="comment"> // check if onSelect was triggered by a mouse event. If not, do not register for</span>
|
276 |
|
|
<span class="comment"> // mousedown and mousemove events. This is the case when selection was externally</span>
|
277 |
|
|
<span class="comment"> // triggered by the highlightFeature event</span>
|
278 |
|
|
<span class="reserved">if</span> (feature.layer.events && !feature.mbNoMouseEvent) {
|
279 |
|
|
feature.destroy = destroyFeature;
|
280 |
|
|
feature.layer.events.registerPriority(<span class="literal">'mousedown'</span>, feature, objRef.onClick);
|
281 |
|
|
feature.layer.events.registerPriority(<span class="literal">'mousemove'</span>, feature, objRef.onHover);
|
282 |
|
|
} <span class="reserved">else</span> {
|
283 |
|
|
feature.mbNoMouseEvent = null;
|
284 |
|
|
}
|
285 |
|
|
}
|
286 |
|
|
|
287 |
|
|
<span class="comment">/**
|
288 |
|
|
* This method is triggered when the mouse is moving out
|
289 |
|
|
* of a vector feature. It removes the event handler we
|
290 |
|
|
* registered in this widget's onSelect method.
|
291 |
|
|
* <span class="attrib">@param</span> feature OpenLayers feature
|
292 |
|
|
*/</span>
|
293 |
|
|
<span class="reserved">this</span>.onUnselect = <span class="reserved">function</span>(feature) {
|
294 |
|
|
<span class="reserved">if</span> (!feature) <span class="reserved">return</span>;
|
295 |
|
|
var objRef = <span class="reserved">this</span>.mbFeatureSelectHandler || feature.mbFeatureSelectHandler;
|
296 |
|
|
<span class="reserved">for</span> (var i=0; i<objRef.sourceModels.length; i++) {
|
297 |
|
|
objRef.sourceModels[i].setParam(<span class="literal">"mouseoutFeature"</span>, feature.fid);
|
298 |
|
|
}
|
299 |
|
|
objRef.model.setParam(<span class="literal">"olFeatureOut"</span>, feature);
|
300 |
|
|
<span class="reserved">if</span> (feature.layer.events) {
|
301 |
|
|
feature.layer.events.unregister(<span class="literal">'mousedown'</span>, feature, objRef.onClick);
|
302 |
|
|
}
|
303 |
|
|
}
|
304 |
|
|
|
305 |
|
|
<span class="comment">/**
|
306 |
|
|
* This method is triggered when a user clicks on a feature.
|
307 |
|
|
* It is called by OpenLayers event handling in the context
|
308 |
|
|
* of a feature. This means that 'this' in this method refers
|
309 |
|
|
* to an {OpenLayers.Feature}. Widgets listening to the
|
310 |
|
|
* olFeatureSelect have access to the event, because setParam
|
311 |
|
|
* is used to set the reference to the event.
|
312 |
|
|
* <span class="attrib">@param</span> evt OpenLayers event
|
313 |
|
|
*/</span>
|
314 |
|
|
<span class="reserved">this</span>.onClick = <span class="reserved">function</span>(evt) {
|
315 |
|
|
<span class="comment"> // pass the feature to the event object</span>
|
316 |
|
|
evt.feature = <span class="reserved">this</span>;
|
317 |
|
|
var objRef = <span class="reserved">this</span>.mbFeatureSelectHandler;
|
318 |
|
|
objRef.model.setParam(<span class="literal">"olFeatureSelect"</span>, evt);
|
319 |
|
|
OpenLayers.Event.stop(evt);
|
320 |
|
|
}
|
321 |
|
|
|
322 |
|
|
<span class="comment">/**
|
323 |
|
|
* This method is triggered when the mouse is over a feature.
|
324 |
|
|
* It is called by OpenLayers event handling in the context
|
325 |
|
|
* of a feature. This means that 'this' in this method refers
|
326 |
|
|
* to an {OpenLayers.Feature}. Widgets listening to the
|
327 |
|
|
* olFeatureHover have access to the event, because setParam
|
328 |
|
|
* is used to set the reference to the event.
|
329 |
|
|
* <span class="attrib">@param</span> evt OpenLayers event
|
330 |
|
|
*/</span>
|
331 |
|
|
<span class="reserved">this</span>.onHover = <span class="reserved">function</span>(evt) {
|
332 |
|
|
var objRef = <span class="reserved">this</span>.mbFeatureSelectHandler;
|
333 |
|
|
<span class="reserved">if</span> (<span class="reserved">this</span>.layer && <span class="reserved">this</span>.layer.events) {
|
334 |
|
|
<span class="comment"> // unregister the mousemove event, because we already know that</span>
|
335 |
|
|
<span class="comment"> // the mouse moved and we can then proceed to our hover popup.</span>
|
336 |
|
|
<span class="reserved">this</span>.layer.events.unregister(<span class="literal">'mousemove'</span>, <span class="reserved">this</span>, objRef.onHover);
|
337 |
|
|
}
|
338 |
|
|
evt.feature = <span class="reserved">this</span>;
|
339 |
|
|
objRef.model.setParam(<span class="literal">"olFeatureHover"</span>, evt);
|
340 |
|
|
}
|
341 |
|
|
|
342 |
|
|
<span class="comment">/**
|
343 |
|
|
* Highlights the specified feature. This method is usually
|
344 |
|
|
* triggered by setting the 'highlightFeature' param to the
|
345 |
|
|
* fid of a feature to be highlighted.
|
346 |
|
|
* <span class="attrib">@param</span> objRef reference to this tool object
|
347 |
|
|
* <span class="attrib">@param</span> fid GML feature id of the feature to highlight. If
|
348 |
|
|
* not specified, this is taken from the highlightFeature
|
349 |
|
|
* model param.
|
350 |
|
|
*/</span>
|
351 |
|
|
<span class="reserved">this</span>.highlight = <span class="reserved">function</span>(objRef, fid) {
|
352 |
|
|
var model, feature;
|
353 |
|
|
var layer = objRef.model.getParam(<span class="literal">'gmlRendererLayer'</span>);
|
354 |
|
|
<span class="reserved">for</span> (var i=0; i<objRef.sourceModels.length; i++) {
|
355 |
|
|
model = objRef.sourceModels[i]
|
356 |
|
|
<span class="reserved">if</span> (!layer) <span class="reserved">return</span>;
|
357 |
|
|
<span class="reserved">if</span> (!fid) {
|
358 |
|
|
fid = model.getParam(<span class="literal">'highlightFeature'</span>);
|
359 |
|
|
}
|
360 |
|
|
feature = layer.getFeatureByFid(fid);
|
361 |
|
|
<span class="reserved">if</span> (feature && !feature.mbHidden) {
|
362 |
|
|
<span class="comment"> // add a tag to the feature to indicate that it was not selected by mouse action</span>
|
363 |
|
|
feature.mbNoMouseEvent = true;
|
364 |
|
|
objRef.control.select(feature);
|
365 |
|
|
}
|
366 |
|
|
}
|
367 |
|
|
}
|
368 |
|
|
|
369 |
|
|
<span class="comment">/**
|
370 |
|
|
* Dehighlights the specified feature. This method is usually
|
371 |
|
|
* triggered by setting the 'dehighlightFeature' param to the
|
372 |
|
|
* fid of a feature to be highlighted.
|
373 |
|
|
* <span class="attrib">@param</span> objRef reference to this tool object
|
374 |
|
|
* <span class="attrib">@param</span> fid GML feature id of the feature to highlight. If
|
375 |
|
|
* not specified, this is taken from the dehighlightFeature
|
376 |
|
|
* model param.
|
377 |
|
|
*/</span>
|
378 |
|
|
<span class="reserved">this</span>.dehighlight = <span class="reserved">function</span>(objRef, fid) {
|
379 |
|
|
var model, feature;
|
380 |
|
|
var layer = objRef.model.getParam(<span class="literal">'gmlRendererLayer'</span>);
|
381 |
|
|
<span class="reserved">for</span> (var i=0; i<objRef.sourceModels.length; i++) {
|
382 |
|
|
model = objRef.sourceModels[i];
|
383 |
|
|
<span class="reserved">if</span> (!layer) <span class="reserved">return</span>;
|
384 |
|
|
<span class="reserved">if</span> (!fid) {
|
385 |
|
|
fid = objRef.model.getParam(<span class="literal">'dehighlightFeature'</span>);
|
386 |
|
|
}
|
387 |
|
|
feature = layer.getFeatureByFid(fid);
|
388 |
|
|
<span class="reserved">if</span> (feature && !feature.mbHidden) {
|
389 |
|
|
objRef.control.unselect(feature);
|
390 |
|
|
}
|
391 |
|
|
}
|
392 |
|
|
}
|
393 |
|
|
|
394 |
|
|
}
|
395 |
|
|
</pre>
|
396 |
|
|
<hr>
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
|
400 |
|
|
<!-- ========== START OF NAVBAR ========== -->
|
401 |
|
|
<a name="navbar_top"><!-- --></a>
|
402 |
|
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
403 |
|
|
<tr>
|
404 |
|
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
405 |
|
|
<a name="navbar_top_firstrow"><!-- --></a>
|
406 |
|
|
<table border="0" cellpadding="0" cellspacing="3">
|
407 |
|
|
<tr align="center" valign="top">
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
411 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
415 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
416 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
417 |
|
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
418 |
|
|
</tr>
|
419 |
|
|
</table>
|
420 |
|
|
</td>
|
421 |
|
|
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
422 |
|
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
423 |
|
|
</td>
|
424 |
|
|
</tr>
|
425 |
|
|
|
426 |
|
|
<tr>
|
427 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
428 |
|
|
PREV
|
429 |
|
|
NEXT</font></td>
|
430 |
|
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
431 |
|
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
432 |
|
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
433 |
|
|
|
434 |
|
|
<script>
|
435 |
|
|
<!--
|
436 |
|
|
if(window==top) {
|
437 |
|
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
438 |
|
|
}
|
439 |
|
|
//-->
|
440 |
|
|
</script>
|
441 |
|
|
<noscript>
|
442 |
|
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
443 |
|
|
</noscript>
|
444 |
|
|
</font></td>
|
445 |
|
|
</tr>
|
446 |
|
|
</table>
|
447 |
|
|
<!-- =========== END OF NAVBAR =========== -->
|
448 |
|
|
|
449 |
|
|
<hr>
|
450 |
|
|
<font size="-1">
|
451 |
|
|
|
452 |
|
|
</font>
|
453 |
|
|
<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>
|
454 |
|
|
</body>
|
455 |
|
|
</html>
|