Powered by Jitbit AspNetForum free trial version.
home recent topics recent posts search register faq   AspNetForum v.4.7.0.0

 AfriGIS MapServer JavaScriptAPI :: Forum

user:
psw:
| lost password
Home » JavaScriptAPI - General » AGMap.AddPoint Method Messages in this topic - RSS
6/25/2008 8:50:59 PM
zs6cey
Posts 3
Hi,

Is there a way to give text with the icon without clicking on it. The idea is if I have a car icon, I want to put the reg number so I can identify the icon on the screen when you have more than one.

Thanks
Andy
8/5/2008 11:09:17 AM
riaanmas
Posts 2
Hi Andy,

If you want to do this I would suggest you use the "AddObject" method. Build a div tag with your image contained in it as well as the registration number. Rather send this to the API - this way you have more control and could even add your own click events etc.

riaan

--
Riaan Mastenbroek
GIS Developer
8/6/2008 1:03:20 PM
zs6cey
Posts 3
Hi Riaan,

I tried it but not luck. Here is a small part small of what I tried (in php):

$Data = '<div><img src="http://www.easytracking.co.za/Icons/car.gif"/>ND1234</div>';
echo ('imgObj = document.createElement("div");');
echo ('imgObj.src = "' . $Data . '";');
echo ('imgObj.id = "1";');
echo ('g_map.AddObject(imgObj, -30.1234, 30.1234, -10, -10);');

Any ideas?

Thanks Andy
8/22/2008 8:22:00 AM
zs6cey
Posts 3
I got this reply, and it works perfectly.

Hi Andy,

You may use javascript like the following to create an Html element to use in the method. The object named 'divider' would be the one you send to the method (AddObject), or alternatively, you could just send the anchor object.This script should be cross-browser comaptible.

var anchorText = document.createTextNode("My Point Label");
var anchor = document.createElement("a");
var divider = document.createElement("div");
anchor.appendChild(anchorText);
anchor.setAttribute("id", "myID1");
anchor.setAttribute("href", "javascript:window.alert('This is my Label')");
var poi_image = document.createElement("img");
poi_image.setAttribute("src", "images/3Dpin.png");
anchor.appendChild(poi_image);

divider.appendChild(anchor);

Regards

Maps team
pages: 1
|

Home » JavaScriptAPI - General » AGMap.AddPoint Method