How to add multiple instances of the VEMap control?

Aug 11, 2009 at 6:57 PM

I'm trying to use the VEMap control via InfoStrat.VE and it works fine when I just use one of them in a Window.  But if I try to use more then one on a page the additional ones don't render the map at all.  I took a look at the InfoStrat code to see what would cause this problem, but nothing jumped out to me.

How do I get multiple instances of the VEMap control to work?





Aug 11, 2009 at 7:43 PM

One issue I see is that when the constructor for the second instance of VEMap is run the following line has a problem:

<font size="2" color="#0000ff"><font size="2" color="#0000ff">


</font></font><font size="2" color="#0000ff">



.globeControl = new PublicEventsGlobeControl(options);

While a new globeControl gets created, the Host for it has basically all null values for all of its fields.  Is there type of restriction on the number of globeControls, Hosts, or RenderEngines that one can have in a process/appdomain/thread/etc...???



Aug 11, 2009 at 9:34 PM

OK, I'm a bit closer now.  It appears that the calls to winVE.Show() and winVE.Hide() make it so that further requests to get globeControls result in globeControl.Hosts.RenderEngine's which are effectively null objects.  Why is this happening?  How can I make it so that I can get new globeControl's after I've invoked the Show/Hide method?



Aug 12, 2009 at 3:31 AM

Due to technical limitations in Virtual Earth 3D itself, only one instance of the 3D engine can be initialized per process.  There are singleton variables that VE3D uses internally so there is no way to have more than one. 

You can verify this using VE3D in the browser.  If you try to create more than one Bing Maps instance in an html page (reference the API then you set them all to 3D, the 2nd and beyond will display an error saying you can only do one in 3D mode.  (InfoStrat.VE only has a 3D mode. The 2D mode mode is an browser only feature.)