[ka-Map-users] Query dynamic point

Fabian Rami fabian.rami at wowcompany.com
Fri Feb 23 02:22:19 EST 2007


I found a something :
    - When i try to add icon, only one kind of icon work....
    the other don t show up ...

    here is the kind of icone (gif) i wana show :
working icone = this one work very well.
bad iconebad iconebad iconebad icone = this one don t work

The first time i put these icones on the XmlOverlay they work very well.

When i delete all the point and i add it again , it doesn't work 
anymore  except for the first icone show before .

Here is what i am doing to add these points:



function sendDynPixelPosition(xCoordinate, yCoordinate, rCoordinate, 
RefPosition, vehiculeIcon)
{
    top.main.mapImage.vehicleOverlayGen.removePoint();
    //Delete all the icon of the overlay
    if (this.vehicleOverlay)
    {
        vehicleOverlay.removePoint();
    }
    else
    {
       // if the overlay doesn't exist, we create a new one
        vehicleOverlay = new top.main.mapImage.kaXmlOverlay( 
top.main.mapImage.myKaMap , 98 );
    }
    //Switch off the interface lock
    blockApplic(false);

   // For every array of position
    for (j=0; j < xCoordinate.length; j++)
    {
       // these 2 var are used to build the name of the picture to use
        var Size = 32; //set the size of the icon
        var zero = (vehiculeIcon[j] < 10) ? '0':'';
       //For every position in the array
        for (i=0 ;i < xCoordinate[j].length ; i++)
        {
         
            if(xCoordinate[j][i] != null)
            {
                //building the name of the  point
                var Pid = 'V'+j+'P'+RefPosition[j][i];
                // adding a new point to the overlay
                var NewVehicle =  vehicleOverlay.addNewPoint(Pid 
,xCoordinate[j][i],yCoordinate[j][i]);
                //Building the name of the Icon
                var Icone = vehiculeIconPath + '0_icone'+ zero + 
vehiculeIcon[j] +'.gif';
                // Creating a new icon
                var Vehicle_Icon = new top.main.mapImage.kaXmlIcon();
                Vehicle_Icon.icon_w = Size;
                Vehicle_Icon.icon_h = Size;
                Vehicle_Icon.icon_src = Icone;
                Vehicle_Icon.rot = rCoordinate[j][i];
                // adding icon to point
                NewVehicle.addGraphic(Vehicle_Icon);
            }
        }
         
    }
    // Save the position
    main_xCoordinate = xCoordinate;
    main_yCoordinate = yCoordinate;
    main_rCoordinate = rCoordinate;
    main_RefPosition = RefPosition;
    main_vehiculeIcon = vehiculeIcon;
     
   
    // data used to make a little train ( doesnt matter to the problem )
    main_CurrentPos = new Array();
    for(j=0; j < xCoordinate.length; j++)
    {
    main_CurrentPos[j] = main_xCoordinate[j].length - 1;
    }

    main_CurrentPosBlock = new Array();
    for(j=0; j < xCoordinate.length; j++)
    {
    main_CurrentPosBlock[j] = 0;
    }

    main_lastPointCounter = new Array();
    for(j=0; j < xCoordinate.length; j++)
    {
    main_lastPointCounter[j] = 0;
    }
}


Am i doing the right thing ?

Before use the overlay i have done this :
    myKaMap.registerForEvent( KAMAP_MAP_INITIALIZED, null, 
myMapInitialized );

function myMapInitialized()
{
    vehicleOverlayGen = new kaXmlOverlay( myKaMap , 99 );
 
    top.frames["main"].localiseBaliseOnLogin();
}

Can you try to figure out what happen??? I can make all the test you 
want !!!

I have also download the lastest Excanvas.js from google and apply the 
patch for working with kamap.

The canvas are supported by explorer ( at least the example given with 
the excanvas.js work fine )


Best regards,

Fabian


> There is such an experimental implementation.
> Probably will be on CVS in a few days. Look for "handler_onclick" in 
> the comments of kaXmlOverlay.js
>
>  -Pg
>
> 2007/2/19, Fabian Rami < fabian.rami at wowcompany.com 
> <mailto:fabian.rami at wowcompany.com>>:
>
>     Hi all,
>
>     I have added dynamic point (with a icon on the map).
>
>     I want be able to query this point when i click on it.
>
>     My point are in a  XmlOverlay layer
>     Is it possible  for me to  click on the icon and then request
>     doing an
>     ajax query to my database ?
>
>     Can i directly have the PID of the point i just click on ?
>
>     Best regards,
>     Fabian
>     _______________________________________________
>     ka-Map-users mailing list
>     ka-Map-users at lists.maptools.org
>     <mailto:ka-Map-users at lists.maptoo%0Als.org>
>     http://lists.maptools.org/mailman/listinfo/ka-map-users
>
>




More information about the ka-Map-users mailing list