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 7 of 7

Overview without Legend?

This is a discussion on Overview without Legend? within the MapPoint Desktop Discussion forums, part of the Map Forums category; I've been browsing these forums for a while, and have got quite a few good bits of info from them. ...

  1. #1
    wej's Avatar
    wej
    wej is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    4

    Overview without Legend?

    I've been browsing these forums for a while, and have got quite a few good bits of info from them. I can't seem to find anything relating to my question though, so I've decided to post it.

    I am trying to implement a way to display a smaller map, exactly like the Overview map in my custom vb.net application. I don't want to use the overview & legend toolbar, it's bulky and contains information that I do not require for my application. What I am wondering is: has anyone tried to display the overview map unattached as a sidebar in the mappoint control? If not, how can I go about adding a second MapPoint control to my form and keeping the view the same as the main map when panning around and such? Here is some code I've tried, but it hangs up about 90% of the time when trying to process the XYToLocation method. "mp" is my main MapPoint control, and mpMini is the overview mappoint control. oMap is just a pointer for mp.ActiveMap for easier typing. And I have tried the same code in both the AfterRedraw and AfterViewChange events.
    Code:
            mpMini.ActiveMap.Altitude = mp.ActiveMap.Altitude
            Dim temp As MapPoint.Pushpin, miniTemp As MapPoint.Pushpin, getLoc As MapPoint.Location
            Dim mpX As Integer = CInt(mp.Width / 2), mpY As Integer = CInt(mp.Height / 2)
            getLoc = oMap.XYToLocation(mpX, mpY)
            temp = oMap.AddPushpin(getLoc)
            miniTemp = mpMini.ActiveMap.AddPushpin(getLoc)
            miniTemp.Location.GoTo()
            temp.Delete()
            miniTemp.Delete()
            mpMini.ZoomOut():mpMini.ZoomOut() 'goes out 2 levels (for an overview)
    Any help will be greatly appreciated.

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

    If I understeand right then you wants 2 map, where the second map has the same centerpoint as the first, but with a different zoom level. So I would do it a little different, and first calculate the center of map 1, then pan the other map and leave the zoomlevel of the other map.

    Now wy it hangs. This is probably because you access MP2 from within an event of MP1. You confuse the engine I assume that it works fine if you execute same code from a button click event.

    What you can do is execute the code for MP2 "outsiide" the event. The most easy way to do that is to post a windows message to a custom message handler. This handler will execute as soon as vb.net enters the windows message pump, and that is Outside the event handler (a while later).

    Unfortionally Microsoft did not yet include PostMessage in the dotnet thing, but you can easy call the win32 API call by using P/Invoke. If you have a problem with that, then just yell here, and I post some code

    BTW: You could use a timer as whell (not a threading timer), but I should consider this as unprofessional programming style.

  3. #3
    wej's Avatar
    wej
    wej is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    4
    You are spot on with understanding what I am trying to do.

    It makes sense that it would be confusing the engine. Do you know if there is a way to pan the map to a certain location without having to place a pushpin first? I've looked at the ActiveMap.Pan method, but that is for making custom pan buttons, not for panning to a certain location.

    I tried putting the exact same code in a button instead of the mp control's event, but it still hangs up when trying to add the pushpin to the mini map. I'm thinking it's not possible to use the same location variable on two different maps. It hangs up on miniTemp = mpMini.ActiveMap.AddPushpin(getLoc) and getLoc is set from a location on the larger mappoint control.

    Thanks for the response, I'm gonna keep trying different ideas until I come up with something that works.

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

    I'm thinking it's not possible to use the same location variable on two different maps.
    I had to study your code better. No it definitively is impossible. Both MP are separate application (or CoApplicatiion), and you cannot give object pointere interaplication.

    Do you know if there is a way to pan the map to a certain location without having to place a pushpin first?
    - calculate lat/long for the center of map1.
    - then pan map2 to that position

    for the former you can use XYToLocation, and Gilles Kohl his code, for the latter just calll GotoLatLong.

  5. #5
    wej's Avatar
    wej
    wej is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    4
    I got it working with the following code, but it's very slow to update when trying to pan around the map without zooming. It works great for zooming in and out, but once you try and pan around it has to update both maps simultaneously and it just lags.
    Code:
        Private Sub mp_AfterViewChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles mp.AfterViewChange
    
            Dim temp As MapPoint.Pushpin, miniTemp As MapPoint.Pushpin, getLoc As MapPoint.Location
            Dim mpX As Integer = CInt(mp.Width / 2), mpY As Integer = CInt(mp.Height / 2)
            Dim tempLL As String
            getLoc = mp.ActiveMap.XYToLocation(mpX, mpY)
            temp = mp.ActiveMap.AddPushpin(getLoc)
            tempLL = CalcPos(getLoc, 0, 0)
            getLoc = mpMini.ActiveMap.GetLocation(globalLat, globalLong, 0)
            miniTemp = mpMini.ActiveMap.AddPushpin(getLoc)
            miniTemp.Location.GoTo()
            mpMini.ActiveMap.Altitude = mp.ActiveMap.Altitude
            mpMini.ActiveMap.ZoomOut()
            temp.Delete()
            miniTemp.Delete()
    
        End Sub

  6. #6
    wej's Avatar
    wej
    wej is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    4
    I realized I don't need to add the pushpins to the map since I already have the location of the center of the map using XYToLocation. It speeds up quite a bit not having to add the pushpins. I think I've got it all figured out now, just wanted to post this incase anyone else ever decides to try something like this.

    Code:
        Private Sub mp_AfterViewChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles mp.AfterViewChange
    
            Dim getLoc As MapPoint.Location
            Dim mpX As Integer = CInt(mp.Width / 2), mpY As Integer = CInt(mp.Height / 2)
            getLoc = mp.ActiveMap.XYToLocation(mpX, mpY)
            CalcPos(getLoc, 0, 0)
            getLoc = mpMini.ActiveMap.GetLocation(globalLat, globalLong, 0)
            getLoc.GoTo()
            mpMini.ActiveMap.Altitude = mp.ActiveMap.Altitude
            mpMini.ActiveMap.ZoomOut()
    
        End Sub
    Also, just for reference, the CalcPos function sets the globalLat and globalLong variables. I'm not just pulling them out of thin air.

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

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. More than 8 in the legend?
    By papaj in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-25-2005, 03:29 PM
  2. Microsoft Dynamics GP Offshore Remote Support Overview
    By Andrew Karasev in forum News and Announcements
    Replies: 0
    Last Post: 10-18-2005, 08:15 PM
  3. hide Legend and overview Pane
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-11-2004, 10:10 AM
  4. overview map scale
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 02-19-2004, 11:42 AM
  5. Legend
    By Larry in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 12-10-2002, 01:45 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96