[ka-Map-users] kaXmlOverlay (from CVS) to query object with mouse click event.

The Bun rosario.carbone at ipl.com
Fri Oct 19 11:25:17 EDT 2007


After many hours of testing I finally found a way to add an image and query
all from the client and I think this can be useful to share with others
ka-Mappers. I simply added some code and assigned an handler to
“xml_overlay.handler_onclick” for each point added at the beginning of the
myMapInitialized function of the startUp.js source.

Next step now is adding handlers when points objects are added with
myXmlOverlay.loadXml('points.php'); the following code is to be considered
as starting point, in fact it is hard coded:

    myXmlOverlay = new kaXmlOverlay( myKaMap, 250 );
    //add this code to load the points xml file with point data to overlay
    // Add the first point
    var my_point = myXmlOverlay.addNewPoint("P3", 191041.51, 2695345.23);
    var my_icon = new kaXmlIcon();
    my_icon.icon_w = 28;
    my_icon.icon_h = 28;
    my_icon.icon_src = 'kamap.gif';
    my_point.addGraphic(my_icon);
    my_point.xml_overlay.handler_onclick = function ( my_point ) {
                                                                    alert(
my_point.pid );
                                                                 };    
    my_point.enableOnclick();
    // Add the second point
    var my_point2 = myXmlOverlay.addNewPoint("P4", 171041.51, 2895345.23);
    var my_icon2 = new kaXmlIcon();
    my_icon2.icon_w = 28;
    my_icon2.icon_h = 28;
    my_icon2.icon_src = 'kamap.gif';
    my_point2.addGraphic(my_icon2);
    my_point2.xml_overlay.handler_onclick = function ( my_point ) {
                                                                    alert(
my_point.pid );
                                                                 };    
    my_point.enableOnclick();	

N.B. I used the kaXmlOverlay.js of the the ka-Map daily CVS image because
the standard version doesn’t implement any event handling, you, at this time
I am testing don’t need to do any change at the code.

Have fun!

Rosario
-- 
View this message in context: http://www.nabble.com/kaXmlOverlay-%28from-CVS%29-to-query-object-with-mouse-click-event.-tf4653999.html#a13296863
Sent from the ka-map-users mailing list archive at Nabble.com.




More information about the ka-Map-users mailing list