MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Overview without Legend?

This is a discussion on Overview without Legend? within the MapPoint 2006/2009 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. ...


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

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



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-03-2005
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.
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 11-04-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
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.
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 11-04-2005
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.
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 11-04-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
Hi,

Quote:
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.

Quote:
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.
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 11-04-2005
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
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 11-04-2005
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.
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 11-04-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
Hi,

thanks for feedback !
glad it works for you..
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
legend, overview


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
More than 8 in the legend? papaj MapPoint 2006/2009 Discussion 1 10-25-2005 02:29 PM
Microsoft Dynamics GP Offshore Remote Support – Overview Andrew Karasev News and Announcements 0 10-18-2005 07:15 PM
hide Legend and overview Pane Anonymous MapPoint 2006/2009 Discussion 1 03-11-2004 09:10 AM
overview map scale Anonymous MapPoint 2006/2009 Discussion 1 02-19-2004 10:42 AM
Legend Larry MapPoint 2006/2009 Discussion 3 12-10-2002 12:45 PM


All times are GMT -5. The time now is 01:08 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Luxor Holiday
Book your Luxor holiday through UlookUbook and visit this destination stooped in history.



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