Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 9 of 9

Layer and Selection Question

This is a discussion on Layer and Selection Question within the MapPoint Desktop 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? ...

  1. #1
    Kevin_Williams is offline 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

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    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.

  3. #3
    Kevin_Williams is offline Junior Member Yellow Belt
    Join Date
    Nov 2006
    Posts
    20

    Re: Layer and Selection Question

    Oh! To change the map style, it's
    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

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    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.

  5. #5
    Kevin_Williams is offline 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

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Layer and Selection Question

    Hi,

    No problem. What is the programming language you do it ?

  7. #7
    Kevin_Williams is offline 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)
    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

  8. #8
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Layer and Selection Question

    Hi,

    Code:
    Shape shape = e.pNewSelection as Shape
    if (shape == null)
        return;
    does this help ?

  9. #9
    Kevin_Williams is offline 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
       }
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. multi-layer data mapping
    By Anonymous in forum Wish List
    Replies: 4
    Last Post: 08-10-2004, 03:51 PM
  2. layer problem [urgent]
    By Joeba in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-16-2003, 10:11 AM
  3. Adding a layer/image over a City
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 11-22-2002, 02:25 PM
  4. specify label to all the objects of a layer
    By Anonymous in forum Wish List
    Replies: 0
    Last Post: 08-28-2002, 08:22 AM
  5. Is there any way to refresh just one PushPin Layer....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-27-2001, 10:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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