Hi Sébastien,<br><i><br></i>Are you referring to features superimposed on the same layer ? If so what you described would be a useful thing<br>to have when multiple features are superimposed. I dont think I have come across anything of this nature. Has anyone else ?<br>
<br>However if the two superimposed features are on different layers, the currently activated selectFeature control for that <br>particular layer would select only features from the mentioned layer. But if multiple features are superimposed on the <br>
selected layer you run in to the issue mentioned above.<br><br>Regards,<br>Indika<br><br><br><div class="gmail_quote">2008/12/4 Sébastien Geindre <span dir="ltr"><<a href="mailto:sebastien.geindre@meteo.fr">sebastien.geindre@meteo.fr</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Do you think there is a way to select the layer after the event is thrown ?<br>
<br>
Imagine, you click the mouse on a feature, in fact on 2 features - superimposed -, the UI shows you the both features, and you could select one....draw the attributes of the selected one....<br>
<br>
but for that, we need have event thrown on each layer...<br>
which is not possible...<br>
<br>
am i right ?<br>
<br>
<br>
Indika Tantrigoda a écrit :<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
Hi,<br>
<br>
Thanks for the info Eric.<br>
I'll follow up on activating/deactivating the select feature control.<br>
Maybe it would increase the performance of the application since the controls are created only once.<br>
<br>
Indika<br>
<br>
<br></div>
2008/11/26 Eric Lemoine <<a href="mailto:eric.c2c@gmail.com" target="_blank">eric.c2c@gmail.com</a> <mailto:<a href="mailto:eric.c2c@gmail.com" target="_blank">eric.c2c@gmail.com</a>>><div class="Ih2E3d"><br>
<br>
Indika<br>
<br>
So you just let the user choose what layer feature selection works<br>
for, right?<br>
<br>
I don't know about Sebastien's case but in lots of situations this<br>
isn't acceptable - it's a pain for the user to select the type of<br>
objects he's going to query.<br>
<br>
On an unrelated note, I notice that you create a new control each time<br>
the user switches layer type, instead you could probably have two<br>
select feature controls and activate/deactivate them based on the<br>
selected radio button.<br>
<br>
Eric<br>
<br>
2008/11/26, Indika Tantrigoda <<a href="mailto:indika85@gmail.com" target="_blank">indika85@gmail.com</a><br></div>
<mailto:<a href="mailto:indika85@gmail.com" target="_blank">indika85@gmail.com</a>>>:<div><div></div><div class="Wj3C7c"><br>
> Hi,<br>
><br>
> After looking at<br>
><br>
<a href="http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/styles_unique_with_group_wfs.htmlI" target="_blank">http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/styles_unique_with_group_wfs.htmlI</a><br>
> managed to find a<br>
> work around . I have two wfs point layers, and can activate the<br>
> selectFeature for the currently selected layer via a radio button.<br>
><br>
> Some of my features were superimposed on top of other layers.<br>
However when<br>
> the needed layer is selected via the radio buttons the selected<br>
layer is<br>
> superimposed.<br>
><br>
> Heres my code<br>
><br>
> //inside init()<br>
><br>
> var myHTML = "<input type=radio name=myRadio<br>
> onclick=test(2)><label>Cities</label> <img<br>
src='./img/marker-blue.png'><br>
> <br>" myHTML += "<input type=radio name=myRadio<br>
> onclick=test(3)><label>Stations</label> <img<br>
src='./img/marker-gold.png'>"<br>
><br>
> document.getElementById("controls").innerHTML = myHTML;<br>
> //<br>
><br>
> //outside init()<br>
><br>
> var myLayer; //global variable<br>
> var myObj; //global variable<br>
><br>
> function test(id) {<br>
><br>
> myLayer =id;<br>
><br>
> if(selectControl)<br>
> {<br>
> //alert("Hiiiiiiiiiiiii");<br>
> selectControl.destroy();<br>
> }<br>
><br>
> selectControl = new<br>
> OpenLayers.Control.SelectFeature(map.layers[id],<br>
><br>
> {<br>
><br>
> onSelect : onFeatureSelect,<br>
><br>
> onUnselect: onFeatureUnselect<br>
><br>
> });<br>
><br>
> map.addControl(selectControl);<br>
> selectControl.activate();<br>
><br>
> //I didnt think this it necessary to unregister<br>
because the<br>
> control is destroyed above<br>
> //map.layers[id].events.unregister('featureselected',<br>
> map.layers[id], regFeatureSelected);<br>
> //map.layers[id].events.unregister('featureunselected',<br>
> map.layers[id], regFeatureUnselected);<br>
> }<br>
><br>
> function onFeatureSelect()<br>
> {<br>
> var currentLayer = map.layers[myLayer];<br>
> var obj = currentLayer.selectedFeatures[0];<br>
> myObj = obj<br>
> //alert(obj.attributes['name']);<br>
><br>
> popup = new OpenLayers.Popup.FramedCloud("chicken",<br>
><br>
> obj.geometry.getBounds().getCenterLonLat(),<br>
> null,<br>
> "<div style='font-size:.8em'>" +<br>
> obj.attributes['name'] +"<br />" + "</div>",<br>
> null, true, onPopupClose);<br>
> obj.popup = popup;<br>
> map.addPopup(popup);<br>
> }<br>
><br>
> function onPopupClose(evt) {<br>
> selectControl.unselect(myObj);<br>
> }<br>
><br>
> function onFeatureUnselect()<br>
> {<br>
> //alert("from regFeatureUnselected");<br>
><br>
> map.removePopup(myObj.popup);<br>
> myObj.popup.destroy();<br>
> myObj.popup = null;<br>
> }<br>
><br>
><br>
> Hope this was helpful.<br>
><br>
> Indika<br>
><br>
><br>
> 2008/11/26 Eric Lemoine <<a href="mailto:eric.c2c@gmail.com" target="_blank">eric.c2c@gmail.com</a><br></div></div>
<mailto:<a href="mailto:eric.c2c@gmail.com" target="_blank">eric.c2c@gmail.com</a>>><div class="Ih2E3d"><br>
><br>
>> On Wed, Nov 26, 2008 at 10:20 AM, Sébastien Geindre<br></div>
>> <<a href="mailto:sebastien.geindre@meteo.fr" target="_blank">sebastien.geindre@meteo.fr</a> <mailto:<a href="mailto:sebastien.geindre@meteo.fr" target="_blank">sebastien.geindre@meteo.fr</a>>><div class="Ih2E3d">
<br>
wrote:<br>
>> > Eric Lemoine a écrit :<br>
>> >><br>
>> >> Seb, I don't understand your question. If you're trying to<br>
get the<br>
>> >> select feature control to work with multiple layers then you<br>
must know<br>
>> >> that that isn't currently supported by OpenLayers. Sorry for not<br>
>> >> understanding your question. Eric<br>
>> ><br>
>> > you guessed it !<br>
>> ><br>
>> > is there any workaround ?<br>
>> ><br>
>> > all features must be on the same layer ?<br>
>><br>
>> Yes.<br>
>><br>
>> --<br>
>> Eric<br>
>> _______________________________________________<br>
>> Users mailing list<br></div>
>> <a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a> <mailto:<a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a>><div class="Ih2E3d"><br>
>> <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
>><br>
><br>
<br>
<br>
</div></blockquote>
<br>
<br>
</blockquote></div><br>