There are many requirements for adding some client labels. Supermap is. there are two solutions to this problem in net. One is to use the Custom Action method to obtain coordinates and then add them to the customlayer layer, in addition, you can obtain the pixel coordinates of the map form by clicking the mouse, and then convert the pixel coordinates to the geographical coordinates. The following describes how to add a mark in the first method.
// Custom action. Add a mark when you click the map
Insertmarkt = function (){
This. type = "insertmarkt ";
This. init = function (mapcontrol) {This. mapcontrol = mapcontrol ;};
This. Destroy = function () {This. mapcontrol = NULL ;};
This. onclick = function (e ){
// When you click an event, the Add mark operation is triggered. The map object is an instantiated mapcontrol object.
Map. customlayer. addmark ("mark" + math. random (), E. mapcoord. x, E. mapcoord. y, null, null, "
// After adding a mark, set the map control to the pan operation.
VaR Pan = new Supermap. Is. panaction ();
Map. setaction (PAN );
};
This. ondblclick = function (e ){};
This. onmousemove = function (e ){};
This. onmousedown = function (e ){};
This. onmouseup = function (e ){};
This. oncontextmenu = function (e ){};
This. getjson = function () {return _ actiontojson (this. type, []);}
};
// Set the map control
VaR TT = NULL;
Function inserttable (){
If (! TT ){
Tt = new insertmarkt ();
}
Map. setaction (TT );
}
// The mouse click event that Mark responds
function test () {
alert ("query");
}