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