[josm-dev] Selecting a line nearest a point

Paul Hartmann phaaurlt at googlemail.com
Mon May 28 17:33:20 BST 2012


2012/5/28 Josh Doe <josh at joshdoe.com>:
> I have a plugin (conflation) with a custom layer which draws arrows
> between matched pairs of objects, and I'd like to enable these to be
> clicked to select the match so it can be merged or deleted. I'm not
> familiar with JOSM's map display code, so I'm not sure where to look.
> I need to find the line closest to a point, or more simply the first
> line which is within N-pixels of the clicked point. It would be nice
> if it could be performant as well, by only checking lines which are
> shown on the screen (spatial index?).

NavigatableComponent.getNearestWaySegment does the job for normal
mouse selection.

Paul



More information about the josm-dev mailing list