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
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Easy way to reverse order with code

This is a discussion on Easy way to reverse order with code within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have to add locations in a particlar order because I do some calulations between them. Based on some of ...

  1. #1
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Easy way to reverse order with code

    I have to add locations in a particlar order because I do some calulations between them.
    Based on some of the information associated with each location, I will skip over it and not add the location to my map.

    At the end of it I need to reverse the order of the locations so that the names and ballons of the first ones added appear on top of the later ones.

    Because I don't know the number of locations that my routine added I think that I am looking for some code that would work something like this.

    (This is half code and half english)
    dim x ,y as int

    x = objmap.locations.count (or something like that)

    for y = x to 1 '(decending order)
    objmap.loc(y) geomove to top
    next y

    I do not want to set up a route if I can help it.

    Can anyone help me?
    Philip Macafee
    Last edited by PMACAFEE; 02-16-2013 at 04:36 PM.

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

    Re: Easy way to reverse order with code

    Hi,

    There is a ZOrder method to move to top, but I think this only works for shapes. I think you can also use Select() which select your object and I think it will move to top also.

    Another possibility is that you keep in your routine a list of the objects that are added to to map. Then you have control from out of your own list.

  3. #3
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Re: Easy way to reverse order with code

    I did some homework and experimentation with the select method, but I could not figure out how to use it. Could you provide an example?

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

    Re: Easy way to reverse order with code

    Hi,

    You have 2 options. If you can hold an array of the pushpins then you can uses your array (it will be the most fast of course). The other option is to use the FindPushpin method, but then you have to have an array with their names.

    Code:
    Pushpin pp = MP.ActiveMap.FindPushpin(name);
    pp.Select();
    Instead of select you can also switch balloon on / off from the pushpins you want:

    Code:
    PP.BalloonState = GeoBalloonState.geoDisplayName;
    pp.BalloonState = GeoBalloonState.geoDisplayBalloon;
    pp.BalloonState = GeoBalloonState.geoDisplayNone;

  5. #5
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Re: Easy way to reverse order with code

    Thanks;

    I guess I am still not sure how to get on baloon out from under another without removing them.

    I have use the following code so far.

    (First, get the number of positions)
    objmap.DataSets(1).RecordCount

    I want to sequence the points in a reverse order and for-next statements on increase the counter so I add a negative
    For xy = -(objmap.DataSets(1).RecordCount) To -1

    Here is where I have the problem.
    Zorder refers to shapes
    GeoOrderBy refers to route waypoints
    and datasortorder refers to the underlying data in a data chart.
    I can not find a command the will take a pushpin and move it up or down in the sequence or allow me to renumber them.

    So this failed:

    objPushPin(-(xy)) GeoOrderCmd = "geoBringToFront"
    Next xy

    Any ideas what to do when I get the pushpin object identified or selected?

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

    Re: Easy way to reverse order with code

    Hi,

    I guess I am still not sure how to get on baloon out from under another without removing them.
    Just hide the ballons you dont wanna see and display the ones you want the user to see. Waht do you think ? I think it is more easy !

  7. #7
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Re: Easy way to reverse order with code

    Wilfried;

    I am beginning to side with you about disappearing the ones that are in the way. The first pushpin has a note balloon with a lot if info and the subsequent pins have just a name. This is a vehicle tracking application, so when a vehicle slows or stops the older information stacks up and covers the most current (1st pushpin) balloon.

    I initially used a loop same counter that I did for setting addressing the pushpins. (They are dimmed in an array). But the application senses when the vehicle reports are really close together (probably stopped) so I skip adding the pushpin after finding the location. That make a hole in the array and I was getting errors trying to use the array again. That's why I wanted to detect the presence of the pushpin. Now I think the code should be something like this. Can you assist/comment?


    dim pp as Mappoint.pushpin
    dim xy as integer
    rem: we skip #1, the one we want to show
    for xy = 2 to objmap.Datasets(1).Recordcount
    pp = objmap.Datasets(1).Item(xy).Pushpin.Select
    pp.Balloonstate = geoBalloonStateNone
    next xy

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

    Re: Easy way to reverse order with code

    Hi,

    I'm not sure I follow. Just have a linked list of all your positions, and a linked list of the visible positions (the ones that has a pushpin).

  9. #9
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Re: Easy way to reverse order with code

    Yes, you'r right. If I call the recordcount for the Dataset, it will return the pushpin count and not the location count, which had led me down the wrong path. Now I want to step through the pushpin recordset and one by one set the balloon state to none.

    I also want to skip position #1 as that is first one at the bottom of the cluster and blocked by the other pushpin names.

    That will hide all but the first pushpin I think.

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

    Re: Easy way to reverse order with code

    Hi,

    Yes I think that will do it.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Newbie Question: Should be easy, but????
    By terrykrueger in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-05-2006, 04:29 PM
  2. [VB6] : Easy question (I think ;-) )
    By Vincent BENNER in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-03-2003, 06:02 AM
  3. I hope this one is easy
    By cenwesi in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-04-2002, 07:37 PM
  4. Is there an easy way to change the start and end t....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-19-2002, 01:49 PM
  5. Is there an easy way for me to just display the 48....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-12-2002, 05:08 PM

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 26 27 28 29 30 31 32 33 34 35 36