[ka-Map-users] overlay and myKaMap.addObjectGeo
Guilherme Pedrosa
guilherme_pl at yahoo.com.br
Thu Nov 9 17:45:07 EST 2006
Hi, first thanks for all information, this list is very important for new people, new developers.
I have a question:
Can i use overlay calling a xml file and add others objects with the myKaMap.addObjectGeo ?
I want to add points with the follow code. And add some polygon layers and line layers with overlay. It is possible?
ps: when i use them together the tooltip do not display onmouseover event. the rest of the page functions continuos the same. but i need the tooltips.
my code:
//my points array
var aPoints = new Array();
aPoints[0] = new Array(1000,1000,'Rabat','teste','outro');
aPoints[1] = new Array(2000,2000,'Barcelona','teste','outro');
//the function
var canvas = null;
var toolTip = null;
toolTip = new kaToolTip(myKaMap);
var offsetX=-6;//offset to move the image left-right
var offsetY=-19;//offset to move the image top-bottom
toolTip.setTipImage('images/tip-green.png',offsetX,offsetY);
function printMyTips () {
var idx = 50;//canvas zindex
canvas = myKaMap.createDrawingCanvas(idx);
for(i=0;i<aPoints.length;i++){
var div = document.createElement('div');
var img = document.createElement('img');
img.src = 'images/tip-red.png';
img.style.position='absolute';
img.style.left='-6px';
img.style.top='-19px';
//set the event
img.onmouseover=myTipClicked;
//set the label
img.mylabel = aPoints[i][2];
//append image the our div
div.appendChild(img);
//add the object to our map
var lon = aPoints[i][0];
var lat = aPoints[i][1];
myKaMap.addObjectGeo(canvas,lat,lon,div);
}
}
function myTipClicked(){
//alert(this.mylabel);
for(i=0;i<aPoints.length;i++){
if(aPoints[i][2] == this.mylabel){
var myurl = aPoints[i][3];
var myimg = aPoints[i][4];
var lon = aPoints[i][0];
var lat = aPoints[i][1];
var textToShow = '';
textToShow += '<div style="position:absolute;width:10px;right:10px;top:10px;color:red;border:1px solid black;"><a href="javascript:void(0)" onclick="toolTip.move()">X</a></div>';
textToShow += '<div style="position:absolute;width:200px;height:100px;background-color:#ffffff;">'+this.mylabel+' - <a href="javascript:void(0)" onmouseover="toolTip.move()">Fechar</a></div>';
//textToShow += '<a href="' + myurl + '" target="_blank"><img src="' + myimg + '" width="200px"></a>';
toolTip.setText( textToShow );
toolTip.moveGeo(lat,lon);
}
}
}
[]s
Guilherme Pedrosa
(21) 8261-0270 | 24274319
guilherme.pedrosa at superig.com.br
_______________________________________________________
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!
http://br.mobile.yahoo.com/mailalertas/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20061109/63e7eb2f/attachment.html
More information about the ka-Map-users
mailing list