Measurement area tool doesn't draw the entire polygon

369
2
05-29-2013 11:35 AM
TracySchloss
Frequent Contributor
I have the measurement dijit activated in a floating pane, which opens with a button.  I have the common issue of needing to both measure and identify and keep track of each.  In general, this is working for me, until I noticed that the polygon I was drawing for measuring the area was only showing me one segment at a time, not the whole polygon!

I'm declaring the measurement dijit in the init function as
 measurement = new esri.dijit.Measurement({
        map: map,
        defaultAreaUnit: esri.Units.ACRES,
        defaultLengthUnit: esri.Units.FEET
      }, dojo.byId('measureDiv2'));
      measurement.startup();


The function for opening the floating pane also sets the variable I'm using in the identify function for whether or not the measure tool is currently active

function openMeasure () {
    measureActive = true;
        var fp = dijit.byId('floater_measure');
        if ((fp.style =="visibility: hidden;") || (fp.style="VISIBILITY:hidden;")) {
            fp.style.visibility="visible";
            fp.show();
        }
      var snapManager = map.enableSnapping({snapKey:dojo.keys.copyKey});

dojo.connect(measurement.length, "onClick", function(){
            measureActive = true;
          console.log("Distance Tool activated");

    });
dojo.connect(measurement.area, "onClick", function(){
            measureActive = true;
          console.log("Area Tool activated");
    });
   
    dojo.connect(measurement, "onMeasureEnd", function(activeTool, geometry){
        this.setTool(activeTool, false);
        measureActive = false;
        setTimeout(function(){
            measurement.clearResult();
        }, 5000);
        map.graphics.enableMouseEvents();
       identifyHandler = dojo.connect(map, 'onClick' , doIdentify);
       
     //   console.log("Measurement done");
    }); 
}


I've tried this in Firefox and IE and I get the same results.  I'm still using the 3.2 version of the API library.  I got an error in measurement.js when I tried version 3.3 and it didn't do anything different trying 3.4.
0 Kudos
2 Replies
MatthewLawton
Occasional Contributor
I'm getting the same issue. For me it occurs after I call measurement.clearResult(); or if I call map.graphics.clear();

Something gets screwed up with the graphics of the area tool and it appears to be one click behind if either of the above functions is called. However, I noticed if I click the area tool icon (instead of the two functions above) then it resets correctly. Obviously it is doing something different or better. Unfortunately it seems like the documentation for the measurement dijit is rather minimal. There aren't even any properties documented for checking the currently selected tool. If there were, then I could identify when the area tool was selected and then reset it instead of clearing graphics or clearing the measurement results.

If anybody has discovered some hidden properties that exist in the measurement tool, especially identifying the currently active tool, then I would be much appreciative for sharing them.
0 Kudos
JianHuang
Occasional Contributor III
0 Kudos