Dear all,<br>We have point layer on top of LineString layer. For both layers the Popup should appear on 'featureselected' event. But if user clicks on Point the Popup for the line should not appear.<br>The setup is:<br>
Ubuntu<br>Tomcat 6<br>Geoserver 2.0.0<br>OpenLayers 2.10<br>GeoExt 0.7<br><br>We tried the code below, but it is not always working. Sometimes both popups appear while clicking on point feature. It seems that sometimes lineControl’s 'featureselected' event is triggered before pointControl’s 'featureselected' event. Does anybody know why?<br>
Any help would be highly appreciated. <br><br>var ShowLinePopup = true;<br>var lines = new OpenLayers.Layer.WMS(…);<br>var points = new OpenLayers.Layer.WMS(…);<br><br>lineControl = new OpenLayers.Control.GetFeature({<br>
protocol: OpenLayers.Protocol.WFS.fromWMSLayer(lines),<br> box: false,<br> toggleKey: "ctrlKey",<br> maxFeatures: 1<br>});<br><br>pointControl = new OpenLayers.Control.GetFeature({<br> protocol: OpenLayers.Protocol.WFS.fromWMSLayer(points),<br>
box: false,<br> toggleKey: "ctrlKey",<br> maxFeatures: 1<br>});<br><br>lineControl.events.register('featureselected', this, function(e) {<br> if (showLinePopup){showLinePopupFunc();}<br>showLinePopup = true;<br>
});<br><br>pointControl.events.register('featureselected', this, function(e) {<br> showLinePopup = false;<br> showPointPopupFunc();<br>});<br><br>new Ext.Viewport({…, layers: [lines, points,], …});<br><br>map.addControl(lineControl);<br>
map.addControl(pointControl);<br>lineControl.activate();<br>pointControl.activate();<br>