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@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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users