MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Where did I click on that line?

This is a discussion on Where did I click on that line? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; On my application I have a list box which displays a journey with time and location gathered from a GPS ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-30-2004
Junior Member
White Belt
 
Join Date: Nov 2004
Posts: 3
Where did I click on that line?

On my application I have a list box which displays a journey with time and location gathered from a GPS log. Next to it I draw a track on a map of the journey by generating a collection of locations for journey points and calling the AddPolyLine method to create a visible track to add to the shapes collection.

When the user clicks on any journey point in the list box I go to that point on the map so the map display is updated with where he is.

What I would like to do also is work the other way. Allow the user to click on the track and reposition the listbox display to the corresponding journey point. This is needed since the journey can consist of thousands of points and there is important other information gathered with the GPS signal.

My first thought was to use the map SelectionChange event which fires when the user first clicks on the line. From that determine the what had been selected (the line) from the GetItemType method. But that is going no where! There are no parameters in the event that I can use to determine what part of the line was clicked - the whole line is selected, not a point or a line segment.


Any ideas how I can work back to the location nearest to the point I clicked on the line?

TIA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 11-30-2004
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 787
Blog Entries: 5
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 12-01-2004
Junior Member
White Belt
 
Join Date: Nov 2004
Posts: 3
Ouch! I was afraid I would have to find a brute strength answer. Unfortunately the tracks can be complex and often parallel (journey to and return). Hence picking out the nearest vertex could often miss the spot by hours.

However you have got me thinking

If i develop a brute strength scheme which provides alternative hits then I could examine the line equation between vertices and determine mathematically if the point lies on that line.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 12-08-2004
Junior Member
White Belt
 
Join Date: Nov 2004
Posts: 3
Solved

Instead of plotting one long line for the track I split it up into segments no more than 15 minutes journey time long. Each journey segment is assigned a shape name which includes the listbox index of the first vertex on the line. When the user clicks on the track I use the name of the shape selected to work back to the listbox ensure the originating reading is selected and visible.

So the user doesn't get to the nearest point on the track but within a reasonable region of the journey (given that reading at most every 30 seconds). It is slower to plot the track for a long journey but 15 minute segments is a good compromise.


Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
How to add click event for VB.Net ? Anonymous MapPoint 2006/2009 Discussion 2 12-31-2003 12:15 AM
Double Click on map Anonymous MapPoint 2006/2009 Discussion 0 08-08-2003 06:42 PM
How can I create a line between two line with VB6 Anonymous MapPoint 2006/2009 Discussion 0 04-29-2003 05:44 PM
What happens when YOU click on a street? schuchhardp MapPoint 2006/2009 Discussion 5 01-03-2003 10:37 AM
As I draw a line and then a pushpin on that line, .... Anonymous MapPoint 2006/2009 Discussion 1 07-16-2002 08:35 AM


All times are GMT -5. The time now is 01:26 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Ski Holidays France
Ski holidays in France are popular with both beginners and experienced skiers alike. It's easy to see why in light of the huge diversity of slopes and the numerous entertainment options.

Portugal Holidays
Find great Portugal Holidays with Travel Counsellors. A personal Travel Counsellor can help you plan the perfect holiday to Portugal.

Holidays Thailand
Holidays in Thailand are hugely diverse with wonderful luxury resorts and beaches but also some lovely forested mountains with interesting hill tribes. See dealchecker.co.uk.

Holidays in Egypt
A holiday in Egypt will stimulate your mind, captivate your heart and spark your senses. Visit this exceptional country, book today!

Cheap Spain Holidays
Stay well informed when you are searching for cheap holidays online. For useful advice on when to book cheap Spain holidays make sure you look on ulookubook.com

Cheap Travel
Travel.co.uk has some excellent offers on cheap travel. Click here.

Sharm el Sheikh Holidays
Visit Egypt! Get info on Sharm El Sheikh holidays, only at On The Beach.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51