MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Unique pushpin object identifier?

This is a discussion on Unique pushpin object identifier? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I'm writing a Windows Forms app in .NET 2.0 that helps our routers and call center staff plot services stops ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  3 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 05-21-2007
citrix_99301's Avatar
Junior Member
White Belt
 
Join Date: Mar 2006
Posts: 11
Unique pushpin object identifier?

I'm writing a Windows Forms app in .NET 2.0 that helps our routers and call center staff plot services stops on a MapPoint 2006 Active-X map.

The trick is when a user clicks on a pushpin on the map, the axMapPoint_SelectionChange event is supposed to figure out the invoice number of the selected pushpin, the associated invoice number then highlight the corresponding node in a treeview adjacent to the map and display information about that stop.

I'm trying to figure out the best way to uniquely identify the pin objects on the map. I've tried capturing the pin.GetHashCode() values to a ADO.NET data table as the pins are created, however, I've noticed that sometimes these numbers don't stay the same even if I don't update the map. If any of the pushpin has code values change, I have no way of looking up which pin has been selected.

Right now I'm stuck setting the pin.Name property to the corresponding stop's invoice number but this is really awkward because I'd like to name the pin something more intuitive than the invoice number of the stop.

Does anybody have any recommendations for uniquely identifying pushpins on a map?

Thanks,



Andre Ranieri
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 05-21-2007
Senior Member
Blue Belt
 
Join Date: Dec 2002
Posts: 219
Re: Unique pushpin object identifier?

Andre,

Since no answers have been put forth, I'd like to say that I think the invoice
number are most appropriate - though you might rather put them in the Note
property or define the SetFieldsVisibleInBalloon property for .ImportData.

Mike Mattys
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 05-21-2007
citrix_99301's Avatar
Junior Member
White Belt
 
Join Date: Mar 2006
Posts: 11
Re: Unique pushpin object identifier?

Is .ImportData something that's exposed in the Active-X object through .NET 2.0? I thought it was somehow used for importing addressess from an Excel file, not for adding properties when coding through .NET.

My attempts to build a hash table around the pins' GetHashCode() method have been a miserable failure - for whatever reason, after the active map's _SelectionChange has been invoked a few times some or all of the pins' hash values change.

Andre Ranieri
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 05-22-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Re: Unique pushpin object identifier?

Hi,

Another possibilitie is that you hold an array of objects containing all the pushpins in your code. Another member of the object can be the number you wants.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 05-22-2007
Senior Member
Green Belt
 
Join Date: Sep 2005
Location: Marshall, Michigan
Posts: 122
Re: Unique pushpin object identifier?

Forgive me if I'm missing something, but I believe that your situation doesn't really require unique identifiers, since you have already "uniquely" selected a single pushpin object? Also, isn't it possible that multiple pushpins would represent a single invoice number?

This being the case, you should simply store the invoice number in the pushpin's Name property, or more effectively as a field in the DataSet.Fields collection just as Mike Mattys suggests.

In the latter method, you can easily find the pushpin's field data by using the Recordset.MoveToPushpin() method, and then accessing the recordset's underlying field data to "pop-up" the invoice information.

If this is unclear or you have questions, please post back. I'd be happy to provide some sample code.

HTH
Paul
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 05-22-2007
citrix_99301's Avatar
Junior Member
White Belt
 
Join Date: Mar 2006
Posts: 11
Re: Unique pushpin object identifier?

Paul, Mike, Willfired:

Thanks so much for the help - I might just need a nudge in the right direction to get me started.

In our lawn and tree care corporation, each unique invoice number represents a stop that the truck makes. A customer might have two invoices on a given day, if the truck is servicing both lawn and tree care for the customer. But the invoices have a one-to-one relationship with pushpins on the map.

Currently, I've populated the pins' Name field with the invoice number but the users find this cumbersome since the seven digit invoice number is not human-intuitive, especially when two or more invoices are at the same location and MapPoint brings up the "select a place" menu and shows a bunch of invoice numbers. I need some way to uniquely identify each pushpin in code so when the axMap's SelectionChanged event is fired I can sync the selection with what other controls on the form are displaying. I've been trying to do that with the pins' GetHashCode() method but it hasn't worked as the has code seems to change after a few clicks.

I would love to take you up on your offer for a few lines of sample code to show how to effectively create and populate a dataset's fields property.

Thanks again,


Andre
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 05-22-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Re: Unique pushpin object identifier?

Hi,

I was thinking on a separate class, something like this:

Code:
public class MyPushpin
{
   public Pushpin pp;
   public string invoice;
}
Now, for each pushpin you place on the map you create a new object and hold it in an array together with the invoice or any other information you need.

When user select a pushpin you parse your array to find the right one and you have the invoice number.

Of course you have to maintain the object list when added but also if user delete a pushpin on the map, unless you make deletion impossible for the user.
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


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/unique-pushpin-object-identifier-5888.html

Posted By For Type Date
MapPoint For Dummies - MP2K Magazine This thread Refback 06-01-2007 06:15 PM
MapPoint Forum Evolution - MapPoint News - MP2K Magazine This thread Refback 05-29-2007 03:57 AM
The Magazine for MapPoint - MP2K Magazine This thread Refback 05-21-2007 05:15 PM

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
Unique Identifier Property of a Pushpin? avxflyer MapPoint 2006/2009 Discussion 0 10-17-2006 05:42 PM
8 unique data ranges virgilar MapPoint 2006/2009 Discussion 0 08-22-2005 12:05 PM
Cannot see the Symbol ID from the Pushpin object after searc fedir MapPoint 2006/2009 Discussion 0 11-25-2003 07:06 PM
Hi, and RoadClass for pushpin object andrem MapPoint 2006/2009 Discussion 0 04-04-2003 02:00 AM
Numbered Pushpins (unique identifier) linawms MapPoint 2006/2009 Discussion 1 04-01-2003 05:02 AM


All times are GMT -5. The time now is 06:51 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

Flights Lanzarote
Volcanic landscapes to explore and warm white sandy beaches to relax on. For flights to Lanzarote search Holiday Hypermarket.

Flights to Portugal
Find and book flights to Portugal. Travel Counsellors can help with travel to Portugal including flights and accommodation.

Flights to Cape Town
Before booking flights to Cape Town visit dealchecker.co.uk to make sure you are getting the best deal in town. Visit online today and try the holiday search for free.

Dubai Holidays
Dubai holidays provide you with exotic sights, desert safaris and superb cuisine. There is an extensive range of things to do and see!

Cheap Egypt Holidays
Pick up a bargain cheap Egypt holiday online when you visit ulookubook.com. Just check out our tips to make sure you book at the right time to get a great holiday for a great price. Finding cheap Egypt holidays can be simple when you know how.

All inclusive holidays
To plan all inclusive holidays, use Travel.co.uk to explore all the possibilities.

Cheap Goa Holidays
Experience the world famous Wednesday Flea Market at Anjuna! Book cheap Goa holidays 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