MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Layer and Selection Question

This is a discussion on Layer and Selection Question within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, I got two questions for programming with map point 1) is there a way to programmatically change the layer? ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 12-05-2006
Junior Member
Yellow Belt
 
Join Date: Nov 2006
Posts: 20
Layer and Selection Question

Hi,
I got two questions for programming with map point

1) is there a way to programmatically change the layer?
i'm using map point 2006 and i'm trying to make a button click that will change the layer from "Road Map" -> "Road and Data Map" and back

2) is there a way to tell if a "drawn object" (like a drawn rectangle) is selected?
my program has a "delete" button, but it is only used to delete drawn objects. so i was hoping to have the delete button disabled if nothing was selected and enabled if something was selected.

thank so much
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 12-05-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Layer and Selection Question

Hi,

You can use SelectionChange event for yoiu second question. As for you first question, there is no layers in mappoint.
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-05-2006
Junior Member
Yellow Belt
 
Join Date: Nov 2006
Posts: 20
Re: Layer and Selection Question

Oh! To change the map style, it's
Quote:
axMappointControl.ActiveMap.MapStyle = MapPoint.GeoMapStyle.geoMapStyle____;
I used the SelectionChange to catch the selection change
I also used axMappointControl.ActiveMap.Selection to let me know if something was selected or not.
However, I'm not able to tell if the selection is a drawn object (which I want) or a selection of a label (City, State, landmark, etc...)

Last edited by Kevin_Williams; 12-05-2006 at 06:26 PM. Reason: Found the answer
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-07-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Layer and Selection Question

Hi,

You can check if the NewSelection argument is a Direction, Location, Pushpin, Shape, or Waypoint object. In your case you can take acton when it is a Shape object.
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 12-07-2006
Junior Member
Yellow Belt
 
Join Date: Nov 2006
Posts: 20
Re: Layer and Selection Question

Sorry I have to ask this, but how to get get to the NewSelection argument?

I'm not sure what to call get the type of the selected object
axMappointControl.ActiveMap.Selection only gives me a System.__ComObject
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 12-07-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Layer and Selection Question

Hi,

No problem. What is the programming language you do it ?
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 12-07-2006
Junior Member
Yellow Belt
 
Join Date: Nov 2006
Posts: 20
Re: Layer and Selection Question

I'm using C#
This is what I have so far (it's not much)
Quote:
private void axMappointControl_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
if (axMappointControl.ActiveMap.Selection == null)
{
// disable control
}
else
{
// enable control
}
}

Last edited by Kevin_Williams; 12-07-2006 at 02:43 PM. Reason: trying to get the code snippet to display correctly
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 12-08-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Layer and Selection Question

Hi,

Code:
Shape shape = e.pNewSelection as Shape
if (shape == null)
    return;
does this help ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 12-20-2006
Junior Member
Yellow Belt
 
Join Date: Nov 2006
Posts: 20
Re: Layer and Selection Question

Thanks Wilfried
The snippet worked

I have the following:
Code:
private void axMappointControl_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
  MapPoint.Shape shape = e.pNewSelection as MapPoint.Shape;
  if (shape == null)
  {
     // disable control
  }
  else
  {
    // enable control
   }
} 
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

Tags
layer, question, selection


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/layer-selection-question-5438.html

Posted By For Type Date
MapPoint Download - MP2K Magazine This thread Refback 12-06-2006 07:52 AM

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
multi-layer data mapping Anonymous Wish List 4 08-10-2004 03:51 PM
layer problem [urgent] Joeba MapPoint 2006/2009 Discussion 3 10-16-2003 10:11 AM
Adding a layer/image over a City Anonymous MapPoint 2006/2009 Discussion 2 11-22-2002 02:25 PM
specify label to all the objects of a layer Anonymous Wish List 0 08-28-2002 08:22 AM
Is there any way to refresh just one PushPin Layer.... Anonymous MapPoint 2006/2009 Discussion 1 07-27-2001 10:29 AM


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


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 52 53 54 55