VDS Technologies

 

Distance Tool

2/6/2013 5:24:22 AM
Total Posts 28

Distance Tool

Presently distance shown at the bottom. How to distance will be showd  at cursor tip.

2/6/2013 5:39:45 AM
MVP
Total Posts 323

Re: Distance Tool

Using the distanceTool (and mouseMove) event, the distance information can be displayed anywhere you want.

2/6/2013 9:50:22 AM
Total Posts 28

Re: Distance Tool

please provide example if possible

2/6/2013 10:09:10 AM
Total Posts 50

Re: Distance Tool

Yes. I really need this sample too.

How to make distance information using Popup windows?

2/7/2013 1:23:46 AM
MVP
Total Posts 323

Re: Distance Tool

From the documentation: Map.distanceTool Event

function
onDistanceTool(sender, e /* DistanceToolEventArgs */) { var label = document.getElementById("labelDiv"); label.innerHTML = "Miles: " + e.miles + " Kilometers: " + e.kilometers; } map.add_distanceTool(onDistanceTool);
2/7/2013 3:28:31 AM
Total Posts 28

Re: Distance Tool

This code is valid for AspMap 4.6.2 or higher. Is this possible for 4.6.1 ?

2/7/2013 3:50:08 AM
MVP
Total Posts 323

Re: Distance Tool

The distanceTool event was added in 4.6.2.

7/11/2014 10:37:04 AM
Total Posts 14

Re: Distance Tool

Hi

I have added this code:

function onDistanceTool(sender, e) {
    var label = document.getElementById("lblMeasureDistance");
    label.innerHTML = "Miles: " + e.miles + " Kilometers: " + e.kilometers;
};

var map = AspMap.getMap('<%=amMap.ClientID%>');
map.add_distanceTool(onDistanceTool);

This works apart from when I cancel the Measure Distance by double-clicking or changing my map tool, the label (lblMeasureDistance) stays how it was last, with the measurements in it.

Ideally the label should become invisible when I have finished Measuring Distances, how do I implement this into the code above? The documentation says the e (DistanceToolEventArgs) only has two fields: Miles & Kilometres.

Thanks.

7/12/2014 1:10:22 AM
MVP
Total Posts 323

Re: Distance Tool

This event only notifies about distance changes.