[ka-Map-users] Overlay mouse handler implementation

The Bun rosario.carbone at ipl.com
Thu Oct 25 08:53:45 EDT 2007




Stéphane RIFF wrote:
> 
> Hi every one,
> 
> I have implement a simple overlay mouse event handler.
> I send you the code and hope it can help someone.
> Here is how it works. You can add to your xml definition in the "point" 
> element three new attributes "onclik, onmouseover, onmouseout" :
> 
> <point id="the_id"  x="x" y="y" redraw="true" onclick="pclick" 
> onmouseover="pover" onmouseout="pout">
> 
> the pclick, pover and pout are your own functions names that take the 
> pid for argument
> 
> example :
> function pclick (pid) {
>   alert(pid);
> }
> 
> Here is the modification I add :
> 
> Modify the kaXmlOverlay.js file like this :
> (the line starts with "++" are the ones I add)
> 
> kaXmlPoint.prototype.parse = function(point_element) {
> 
>     var i;
>     var x = parseFloat(point_element.getAttribute("x"));
>     var y = parseFloat(point_element.getAttribute("y"));
>     var redraw_a = point_element.getAttribute("redraw");
>     var redraw = false;
>     if (redraw_a == "true")    redraw = true;
> ++    var point_id = this.pid;
> ++    var clickHandler = point_element.getAttribute("onclick");
> ++    if(clickHandler) {
> ++      this.div.onclick = function () { 
> eval(clickHandler+"(\""+point_id+"\");"); };
> ++    }
> ++    var overHandler = point_element.getAttribute("onmouseover");
> ++    if(overHandler)
> ++      this.div.onmouseover = function () { 
> eval(overHandler+"(\""+point_id+"\");"); };
> ++    var outHandler = point_element.getAttribute("onmouseout");
> ++    if(outHandler)
> ++      this.div.onmouseout = function () { 
> eval(outHandler+"(\""+point_id+"\");"); };
>            
>     if (!this.shown) {
>         this.placeOnMap(x,y);
>         this.shown = true;
>     } else {
>         this.setPosition(x,y);
> ................
> }
> 
> I hope it's clear and it can help somebody.
> It's good for and seems to works well.
> 
> I can answer some questions if you needs
> 
> Thanks
> 
> -- 
> Stéphane RIFF
> stephane.riff at cerene.fr
> 
> CERENE SERVICES SA
> 3, rue Archimède
> 10600 La Chapelle-Saint-Luc - France
> Tel : 33 (0)3 25 74 11 78
> Fax : 33 (0)3 25 78 39 67
> ----------------------------
> "Ce message peut contenir des informations confidentielles et/ou
> protégées. Il est à l'usage exclusif de son destinataire. Toute
> utilisation non autorisée peut être illicite. Si vous recevez ce
> message par erreur, nous vous remercions d'en aviser immédiatement
> l'expéditeur en utilisant la fonction réponse de votre gestionnaire
> de courrier électronique."
> 
> "This email may contain confidential information and/or copyright
> material. This email is intended for the use of the addressee only.
> Any unauthorised use may be unlawful. If you receive this email by
> mistake, please advise the sender immediately by using the reply
> facility in your email software." 
> 
> 
> begin:vcard
> fn;quoted-printable:St=C3=A9phane RIFF
> n;quoted-printable:RIFF;St=C3=A9phane
> org;quoted-printable:CERENE Services;Informatique et D=C3=A9veloppement
> adr;quoted-printable:;;3, rue Archim=C3=A8de;La Chappelle
> Saint-Luc;Aube;10600;FRANCE
> email;internet:stephane.riff at cerene.fr
> title:Informatique
> tel;work:+33 3 25 74 11 78
> tel;fax:+33 3 25 78 39 67
> tel;cell:+33 6 32 84 37 79
> note;quoted-printable:"Ce message peut contenir des informations
> confidentielles et/ou=0D=0A=
> 	prot=C3=A9g=C3=A9es. Il est =C3=A0 l'usage exclusif de son destinataire.=
> 	 Toute=0D=0A=
> 	utilisation non autoris=C3=A9e peut =C3=AAtre illicite. Si vous recevez=
> 	 ce=0D=0A=
> 	message par erreur, nous vous remercions d'en aviser
> imm=C3=A9diatement=0D=0A=
> 	l'exp=C3=A9diteur en utilisant la fonction r=C3=A9ponse de votre
> gestionn=
> 	aire=0D=0A=
> 	de courrier =C3=A9lectronique."=0D=0A=
> 	=0D=0A=
> 	"This email may contain confidential information and/or copyright=0D=0A=
> 	material. This email is intended for the use of the addressee
> only.=0D=0A=
> 	Any unauthorised use may be unlawful. If you receive this email by=0D=0A=
> 	mistake, please advise the sender immediately by using the reply=0D=0A=
> 	facility in your email software."
> url:http://www.cerene.fr
> version:2.1
> end:vcard
> 
> 
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
> 
> 

Hi Stéphane I have already sent you an email but my intention was to post
here in the forum, so sorry about this. Anyway that was only to tell again
that your solution is a good and better one of mine ( few posts down ). You
only forgot to say that you need to write your handler but this is pretty
obvious:

function pover( point_id ) {
                        alert( point_id.pid );
                     };    

I only need another extra help from someone who has already developed
something similar. We are essentially trying to replace Google Maps with
kamap, one of the things we like of Google are the windows generated with
the 2 methodss of the main GMap2 object of Google openInfoWindowHtml and
openInfoWindow where you can add data and html formatted text, like for
example "em", "href", "a" etc. I do not pretend to have something which is
the same with the shadow etc, but the "alert" function to communicate with
the user is obviously unaccetable.

I tried to analyze the Google code but honestly it is obfuscated so well
that for understanding what they doo it could take days or weeks of hard
work, I don't pretend to have the bubble with the arrow and the shadow
although that would be ideal but something better than the windows message
generated by the "alert" function. Any help would be greatly appreciated.

Kind Regards
Rosario Carbone

-- 
View this message in context: http://www.nabble.com/Overlay-mouse-handler-implementation-tf4684319.html#a13406065
Sent from the ka-map-users mailing list archive at Nabble.com.




More information about the ka-Map-users mailing list