Supermap is. Net Custom Action add mark

Source: Internet
Author: User

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");
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.