Mapguide Eventhandling with Fusion.

Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Mapguide Eventhandling with Fusion.

Tómas Guðmundsson
Hi all.

I just conducted a little experiment with the Event Handlers in Map.js

        map.registerForEvent(Fusion.Event.MAP_LOADING, alert('MAP_LOADING'));
        map.registerForEvent(Fusion.Event.MAP_LOADED,alert('MAP_LOADED'));
        map.registerForEvent(Fusion.Event.MAP_RELOADED,alert('MAP_RELOADED'));

And what I originally thought what would happen that it would give me an alert
at first when it was loading, and then when it would load. Then I thought it would
give me the third alert when i pressed the refresh map button. But, what happened
was before the map was ready or visible to me, they all loaded consecutively so
I got three alerts in a row.

If anyone can tell me why this is or what the reasons are behind that I would really
appreciate that. Also if anyone can tell me how to find out when the map is visible,
after a refresh or after any (first or last time a user) sees the gray background of
the map itself.

Regards,
Tómas.
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Mapguide Eventhandling with Fusion.

Paul Deschamps
Did you add this in map.js or your supporting application JS file in the
template? doing so would probably fire it in the manor of which you
described.


In the application template the supporting JS should have:

window.onload = function(){
  Fusion.initialize();
  Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED,
onInitialize);
}

// funsion initialized fire listeners.
function onInitialize() {
    // get the mapwidget via ID
    var map = Fusion.getMapById('mapArea');
    map.registerForEvent(Fusion.Event.MAP_LOADING, mapLoading);
    map.registerForEvent(Fusion.Event.MAP_LOADED, mapIsLoaded);
    map.registerForEvent(Fusion.Event.MAP_RELOADED, mapReloaded);
    map.registerForEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED,
activeLayerChanged);
    map.registerForEvent(Fusion.Event.MAP_SELECTION_ON, selectionOn);
}

// console.log requires  firebug. see. http://www.getfirebug.com/
function mapLoading(){
  console.log("MAP_LOADING");


function mapIsLoaded(){
  console.log("MAP_LOADED");
}

function mapReloaded(){
  console.log("MAP_RELOADED");
}

function activeLayerChanged(){
  console.log("MAP_ACTIVE_LAYER_CHANGED");
}

function selectionOn(){
  console.log("MAP_SELECTION_ON");
}

Hope this helps

Cheers

Paul D.


--
+----------------------------+
| Paul Deschamps             |
| Applications Specialist    |
|                            |
| DM Solutions Group         |
| http://dmsolutions.ca/     |
| P: 613.565.5056 ext 28     |
| F: 613.565.0925            |
+----------------------------+

On Wed, 2008-05-14 at 16:57 +0000, Tómas Guðmundsson wrote:

> Hi all.
>
> I just conducted a little experiment with the Event Handlers in Map.js
>
>         map.registerForEvent(Fusion.Event.MAP_LOADING, alert('MAP_LOADING'));
>         map.registerForEvent(Fusion.Event.MAP_LOADED,alert('MAP_LOADED'));
>         map.registerForEvent(Fusion.Event.MAP_RELOADED,alert('MAP_RELOADED'));
>
> And what I originally thought what would happen that it would give me an alert
> at first when it was loading, and then when it would load. Then I thought it would
> give me the third alert when i pressed the refresh map button. But, what happened
> was before the map was ready or visible to me, they all loaded consecutively so
> I got three alerts in a row.
>
> If anyone can tell me why this is or what the reasons are behind that I would really
> appreciate that. Also if anyone can tell me how to find out when the map is visible,
> after a refresh or after any (first or last time a user) sees the gray background of
> the map itself.
>
> Regards,
> Tómas.
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Mapguide Eventhandling with Fusion.

Paul Spencer-2
In reply to this post by Tómas Guðmundsson
Tómas,

these are not the droids you are looking for!  These events only  
relate to loading the map definition from the server, not drawing the  
map.  You want Fusion.Event.MAP_BUSY_CHANGED.  This gets called when  
the map starts drawing and again when it is finished, but you need to  
check map.isBusy to see if the map is still busy or not because  
several busy states can be queued up.

Cheers

Paul

On 14-May-08, at 12:57 PM, Tómas Guðmundsson wrote:

> Hi all.
>
> I just conducted a little experiment with the Event Handlers in Map.js
>
>        map.registerForEvent(Fusion.Event.MAP_LOADING,  
> alert('MAP_LOADING'));
>        
> map.registerForEvent(Fusion.Event.MAP_LOADED,alert('MAP_LOADED'));
>        
> map.registerForEvent(Fusion.Event.MAP_RELOADED,alert('MAP_RELOADED'));
>
> And what I originally thought what would happen that it would give  
> me an alert
> at first when it was loading, and then when it would load. Then I  
> thought it would
> give me the third alert when i pressed the refresh map button. But,  
> what happened
> was before the map was ready or visible to me, they all loaded  
> consecutively so
> I got three alerts in a row.
>
> If anyone can tell me why this is or what the reasons are behind  
> that I would really
> appreciate that. Also if anyone can tell me how to find out when the  
> map is visible,
> after a refresh or after any (first or last time a user) sees the  
> gray background of
> the map itself.
>
> Regards,
> Tómas.
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Mapguide Eventhandling with Fusion.

Tómas Guðmundsson
Paul,

I tried this and it works but it gives me an error.
Inside the function triggerEvent on line 1041 inside
fusion.js it gives me an error with a popup alert :
Fusion Error:
WARNING: Exception occurred in AJAX callback.
TypeError: this.events[eventID][i] has no properties
Location: undefined (1041)
xx)

Where undefined is actually fusion.js and line 1041.
Here is the function I have running in a javascript
widget that is being executed.
this.getMap().registerForEvent(Fusion.Event.MAP_BUSY_CHANGED, alert('MAP_BUSY_CHANGED'));

Regards,
Tómas.

-----Original Message-----
From: Paul Spencer [mailto:[hidden email]]
Sent: 14. maí 2008 17:39
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Mapguide Eventhandling with Fusion.

Tómas,

these are not the droids you are looking for!  These events only  
relate to loading the map definition from the server, not drawing the  
map.  You want Fusion.Event.MAP_BUSY_CHANGED.  This gets called when  
the map starts drawing and again when it is finished, but you need to  
check map.isBusy to see if the map is still busy or not because  
several busy states can be queued up.

Cheers

Paul

On 14-May-08, at 12:57 PM, Tómas Guðmundsson wrote:

> Hi all.
>
> I just conducted a little experiment with the Event Handlers in Map.js
>
>        map.registerForEvent(Fusion.Event.MAP_LOADING,  
> alert('MAP_LOADING'));
>        
> map.registerForEvent(Fusion.Event.MAP_LOADED,alert('MAP_LOADED'));
>        
> map.registerForEvent(Fusion.Event.MAP_RELOADED,alert('MAP_RELOADED'));
>
> And what I originally thought what would happen that it would give  
> me an alert
> at first when it was loading, and then when it would load. Then I  
> thought it would
> give me the third alert when i pressed the refresh map button. But,  
> what happened
> was before the map was ready or visible to me, they all loaded  
> consecutively so
> I got three alerts in a row.
>
> If anyone can tell me why this is or what the reasons are behind  
> that I would really
> appreciate that. Also if anyone can tell me how to find out when the  
> map is visible,
> after a refresh or after any (first or last time a user) sees the  
> gray background of
> the map itself.
>
> Regards,
> Tómas.
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Mapguide Eventhandling with Fusion.

Paul Spencer-2
Are you using Firefox and the (awesome) firebug extension?  If yes,  
then you can get a stack trace at that point.  I'm not sure what is  
going on, that event is defined and registered in Map.js so if you can  
call this.getMap().registerForEvent then the map widget has been  
initialized and that event should be available.

Can you send code (directly to myself if necessary) for your widgets  
so I can take a closer look?

Paul

On 15-May-08, at 5:37 AM, Tómas Guðmundsson wrote:

> Paul,
>
> I tried this and it works but it gives me an error.
> Inside the function triggerEvent on line 1041 inside
> fusion.js it gives me an error with a popup alert :
> Fusion Error:
> WARNING: Exception occurred in AJAX callback.
> TypeError: this.events[eventID][i] has no properties
> Location: undefined (1041)
> xx)
>
> Where undefined is actually fusion.js and line 1041.
> Here is the function I have running in a javascript
> widget that is being executed.
> this.getMap().registerForEvent(Fusion.Event.MAP_BUSY_CHANGED,  
> alert('MAP_BUSY_CHANGED'));
>
> Regards,
> Tómas.
>
> -----Original Message-----
> From: Paul Spencer [mailto:[hidden email]]
> Sent: 14. maí 2008 17:39
> To: Tómas Guðmundsson
> Cc: [hidden email]
> Subject: Re: [fusion-users] Mapguide Eventhandling with Fusion.
>
> Tómas,
>
> these are not the droids you are looking for!  These events only
> relate to loading the map definition from the server, not drawing the
> map.  You want Fusion.Event.MAP_BUSY_CHANGED.  This gets called when
> the map starts drawing and again when it is finished, but you need to
> check map.isBusy to see if the map is still busy or not because
> several busy states can be queued up.
>
> Cheers
>
> Paul
>
> On 14-May-08, at 12:57 PM, Tómas Guðmundsson wrote:
>
>> Hi all.
>>
>> I just conducted a little experiment with the Event Handlers in  
>> Map.js
>>
>>       map.registerForEvent(Fusion.Event.MAP_LOADING,
>> alert('MAP_LOADING'));
>>
>> map.registerForEvent(Fusion.Event.MAP_LOADED,alert('MAP_LOADED'));
>>
>> map
>> .registerForEvent(Fusion.Event.MAP_RELOADED,alert('MAP_RELOADED'));
>>
>> And what I originally thought what would happen that it would give
>> me an alert
>> at first when it was loading, and then when it would load. Then I
>> thought it would
>> give me the third alert when i pressed the refresh map button. But,
>> what happened
>> was before the map was ready or visible to me, they all loaded
>> consecutively so
>> I got three alerts in a row.
>>
>> If anyone can tell me why this is or what the reasons are behind
>> that I would really
>> appreciate that. Also if anyone can tell me how to find out when the
>> map is visible,
>> after a refresh or after any (first or last time a user) sees the
>> gray background of
>> the map itself.
>>
>> Regards,
>> Tómas.
>> _______________________________________________
>> fusion-users mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/fusion-users
>
>
> __________________________________________
>
>    Paul Spencer
>    Chief Technology Officer
>    DM Solutions Group Inc
>    http://www.dmsolutions.ca/
>


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Mapguide Eventhandling with Fusion.

makoychan
Is there any feature hover event?

i am trying to do an auto pan or auto select on the fusion map.

since i cant find one, all i can think now is do catch the feature hover
then switch to select mode, then when its away of the feature put it back to
pan mode.

been stuck on this for 3 days already

home someone could help.

thanks



--
Sent from: http://osgeo-org.1560.x6.nabble.com/Fusion-Users-f3780581.html
_______________________________________________
fusion-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/fusion-users