Hi Phil,<br><br>that might be a good way to solve this as well. I'll give it a go!<br><br>Thanks,<br><br>Alex.<br><br>Date: Wed, 11 Aug 2010 10:07:01 +1200<br>
From: Phil Scadden <<a href="mailto:p.scadden@gns.cri.nz">p.scadden@gns.cri.nz</a>><br>
Subject: Re: [OpenLayers-Users] clickTolerance on selectFeature?<br>
To: <a href="mailto:users@openlayers.org">users@openlayers.org</a><br>
Message-ID: <<a href="mailto:4C61CD85.2010008@gns.cri.nz">4C61CD85.2010008@gns.cri.nz</a>><br>
Content-Type: text/plain; charset="ISO-8859-1"<br>
<br>
<br>
<br>
> I'm mainly dealing with polylines, but if that is the only way, then<br>
> so be it. How can I perform buffer calculations?<br>
><br>
Buffering every line in your display to see if selected is very<br>
intensive. If you are struggling with accurate selection of lines, can I<br>
suggest an alternative approach? If you use a highlight only hoverselect<br>
control as well as a select control, then you can move mouse till target<br>
is highlighted, then click to select.<br>
<br>
Code like:<br>
HoverSelectControl = new<br>
OpenLayers.Control.<div id=":12t">SelectFeature(myLayers,{hover:true, highlightOnly:<br>
true, renderIntent: "temporary" });<br>
SelectControl = new<br>
OpenLayers.Control.SelectFeature(myLayers,{clickout: true});<br>
SelectControl.events.on({<br>
"featurehighlighted": onFeatureSelect,<br>
"featureunhighlighted": onFeatureUnselect<br>
});<br>
map.addControl(HoverSelectControl);<br>
map.addControl(SelectControl);<br>
HoverSelectControl.activate();<br>
SelectControl.activate();<br>
<br>
The order you add controls is important - hover first. I find that this<br>
feels quite natural.<br>
<br>
If the layers cans handle wfs, you might be better to create a<br>
wfsprotocol object and do a spatial intersects<br>
query, passing a rectangle around the click point and then processing<br>
the return.<br><br><br><br>
</div>