View Single Post

  #2 (permalink)  
Old 11-30-2004
Winwaed's Avatar
Winwaed Winwaed is offline
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
Hmm, I thought there was somewhere to get at a selected vertex, but I've just had a quick scan through the docs for the event and I can't see anything.

If you have "thousands" of vertices it might be a bit slow, but you could try a brute-force search.
Get the mouse position immediately after the event fireing.
Start at the beginning, compare each location in the track against the mouse position. Do with with a simple "DistanceTo" call. Choose the vertex with the lowest distance.

Depending on how complex your track is, there are probably ways to speed it up. Eg. if they tend to approximate straight lines then a simple "binary chop" algorithm will change the search space from N to log2(N).


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Reply With Quote