I would like to deactivate the identify when doing measurement.
here is my function identify code:
function initFunctionality() {
//map.on("click", doIdentify);
dojo.connect(map, "onClick", doIdentify);
identifyTask = new IdentifyTask(".../MapServer");
identifyParams = new IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [21, 54, 36];
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.width = map.width;
identifyParams.height = map.height;
map.infoWindow.resize(650, 200);
map.infoWindow.setContent(registry.byId("tabs").domNode);
map.infoWindow.setTitle("Utilities Identify Results");
symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0]), 2),
new Color([255, 255, 0, 0.25]));
}
and I am calling this function on the following event:
//dojo.connect(map, "onLoad", initFunctionality);
//map.on("load", initFunctionality);
map.on("layers-add-result", initFunctionality);
This makes the identify window showing up each time I click on the map. I would like to only call the identify only when I click on the identify button on the toolbar to activate the identify function. But when I try to call the initFunctionality() from a button click event, the identify won't work. for some reason, it is only working when called from map.on("load") or map.on("layers-add-result").
Solved! Go to Solution.
Thank you Steven,
here is what I did and it works fine:
function doIdentify(event) {
var measureMode = dojo.query(".esriButton .dijitButtonNode").some(function (node, index, arr) {
if (node.childNodes[0].checked) {
//at least one of the measure tools is active so disable identify
return true;
}
});
if (!measureMode) {
//insert the identify task code here...
};
}