Reg : Close Measurement Tool programmtically

612
1
03-05-2014 12:05 PM
VikramS
Occasional Contributor
Hello all,

How to close the measurement tool (out of the box) tool programmatically ?
0 Kudos
1 Reply
BrianLord1
Occasional Contributor
Here is how i have done it in the past, although there is probably a better way.

Basically, I create a div that holds the measurement tools.

[HTML] <div id="measureWindow" style="display: none">
            <div id="measurementDiv"></div>
            <div id="Div1"></div>
            <span style="font-size:smaller;padding:5px 5px;">Press <b>CTRL</b> to enable snapping.</span>
        </div> [/HTML]

Then I use the following code to close / hide the measurement div.  I also include code to uncheck all the corresponding buttons and clear the graphics from the map.
var nodeMeasure = dojo.byId('measureWindow');
        if (dojo.coords(nodeMeasure).h > 0) {
            WipeOutControl(nodeMeasure, 300);
            measurement.clearResult();
            measurement.setTool("location", false);
            measurement.setTool("distance", false);
            measurement.setTool("area", false);
        }
        dijit.byId('btnMeasure').setAttribute('checked', false);


And here is the code that actually wipes out the div when called.
//Dojo function to animate address container
function WipeOutControl(node, duration) {
    dojo.fx.wipeOut({
        node: node,
        duration: duration
    }).play();
}


Good luck,
Mark
0 Kudos