[mapguide-users] Two maps in the same layout

Rodolfo Moreno rmoreno at voxiva.com
Fri Jan 30 17:20:12 EST 2009


Thanks Paul, it works, it means that the parameter is being passed to the
mapLoaded function.
However I think that I have detected an issue with MAP_LOADED event in IE7
(in FF2 it works good) 
how you know I have two maps (MAP, MAP1). So the MAP_LOADED event is not
calling to mapLoaded function for MAP and whether do it for MAP1. It happens
in IE7. In FF2 both maps are calling to the mapLoaded function (work
correctly).

After I tested with MAP_BUSY_CHANGED event and I could detect the same
issue.
the following is a summarize of the test case:

	             # times called during the initial loading of the application
Events		            IE          FF

MAP_BUSY_CHANGED  map	1	4
	                 map1	3	4
			
MAP_LOADED	   map	0 (*) 	1 	                
                            map1	1	1
(*) 0 means that the function never is called

maybe the others EVENTS have the same error.

Regards,


Paul Spencer wrote:
> 
> This is trickier than it should be :(  Ideally it should pass an  
> argument which is the map that triggered the event or set the context  
> (this) to be the map, but neither happens.
> 
> Fortunately there are many ways around this ...
> 
> Map.registerForEvent(Fusion.Event.MAP_LOADED, mapLoaded.bind(null,  
> 'Map'));
> Map1.registerForEvent(Fusion.Event.MAP_LOADED, mapLoaded.bind(null,  
> 'Map1'));
> 
> ... which is essentially equivalent to ..
> 
> Map.registerForEvent(Fusion.Event.MAP_LOADED, function()  
> { mapLoaded('Map'); });
> Map1.registerForEvent(Fusion.Event.MAP_LOADED, function()  
> { mapLoaded('Map'); });
> 
> where mapLoaded now takes a parameter
> 
> function mapLoaded(s) {
>    switch(s) {
>      case 'Map':
>        //Map was loaded
>        break;
>      case 'Map1':
>        //Map1 was loaded
>        break;
>    }
> }
> 
> You can also do something really simple:
> 
> Map.registerForEvent(Fusion.Event.MAP_LOADED, mapLoaded);
> Map1.registerForEvent(Fusion.Event.MAP_LOADED, map1Loaded);
> 
> ...
> 
> function mapLoaded() {}
> 
> function map1Loaded() {}
> 
> Cheers
> 
> Paul
> 
> 
> On 29-Jan-09, at 10:06 AM, Rodolfo Moreno wrote:
> 
>>
>> Thanks Jackie and Paul for the quickly answer.
>> I was testing the two ways.
>>
>> Paul with respect to the FUSION viewer, I could place two maps in  
>> the same
>> layout, however I could not handle suitably the event MAP_LOADED.  
>> this is my
>> code:
>>
>> var Map;
>> var Map1;
>> var fusionInitialized = function() {
>>    $('AppContainer').resize({forceResize: true});
>>
>>    Map = Fusion.getWidgetById('Map');
>>    Map1 = Fusion.getWidgetById('Map1');
>>
>>    Map.registerForEvent(Fusion.Event.MAP_LOADED, mapLoaded);
>>    Map1.registerForEvent(Fusion.Event.MAP_LOADED, mapLoaded);
>>
>> }
>>
>> function mapLoaded()
>> {
>>  // Inside of this function I would like to detect which of the  
>> maps(Map or
>> Map1) has called
>> // to this function.
>>
>> }
>>
>> I would like that mapLoaded function to detect which of the maps(Map  
>> or
>> Map1) called it.
>> The other alternative (whether the other is not possible) would be I  
>> can
>> send parameters to the mapLoaded function, like this:
>>
>> {
>>   ...
>>    Map.registerForEvent(Fusion.Event.MAP_LOADED, mapLoaded,  
>> parameter1);
>> }
>>
>> function mapLoaded(parameter1)
>> {
>>
>> }
>>
>> Thanks in advance,
>>
>>
>>
>> Paul Spencer wrote:
>>>
>>> yes you can do it using the fusion viewer but you need to edit the
>>> ApplicationDefinition.xml file manually (you can't do it using  
>>> Studio).
>>>
>>> You need to have a MapGroup for each map you want to display and a
>>> WidgetSet for each map you want to display.  Then you need two divs  
>>> in
>>> your page, one for each WidgetSet (referenced by the MapWidget in the
>>> WidgetSet).  Widgets within each widget set will only work on the
>>> associated map.
>>>
>>> Cheers
>>>
>>> Paul
>>>
>>>
>>> On 22-Jan-09, at 3:21 PM, Rodolfo Moreno wrote:
>>>
>>>> Ivan good sugestion about the iframes, it's better than frameset.
>>>> However I
>>>> would like to do it using FUSION viewer. Is it possible?
>>>
>>> _______________________________________________
>>> mapguide-users mailing list
>>> mapguide-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>
>>>
>>
>>
>> -----
>> Rodolfo Moreno
>> CivilEng
>>
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Two-maps-in-the-same-layout-tp2189508p2239370.html
>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 


-----
Rodolfo Moreno
CivilEng

-- 
View this message in context: http://n2.nabble.com/Two-maps-in-the-same-layout-tp2189508p2247494.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list