function RegionSelection() { if (action1 != undefined) { action1.pause(); } if (action2 != undefined) { action2.pause(); } if (action4 != undefined) { action4.pause(); } if (action3 == undefined) { alert("RegionSelection7"); map.graphics.clear(); var highlightSymbol = new SimpleFillSymbol( SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1), new Color([125, 125, 125, 0.35])); action3 = on.pausable(petroFieldsFL2, "click", function (evt) { map.graphics.clear(); highlightGraphic = new Graphic(evt.graphic.geometry, highlightSymbol); map.graphics.add(highlightGraphic); var query = new Query(); query.geometry = highlightGraphic.geometry.getExtent(); }); //petroFieldsFL2.on("click", function (evt) { // map.graphics.clear(); // highlightGraphic = new Graphic(evt.graphic.geometry, highlightSymbol); // map.graphics.add(highlightGraphic); // var query = new Query(); // query.geometry = highlightGraphic.geometry.getExtent(); //}) } else { action3.resume(); } }
var action1, action2, action3; registry.byId("polygon").on("click", function() { if (action2 != undefined) { action2.pause(); } if (action3 != undefined) { action3.pause(); } if (action1 == undefined) { activateTool(this.id); } else { action1.resume(); } }); registry.byId("freehandpolygon").on("click", function() { if (action1 != undefined) { action1.pause(); } if (action3 != undefined) { action3.pause(); } if (action2 == undefined) { activateTool(this.id); } else { action2.resume(); } }); registry.byId("RegionSelection").on("click", function() { if (action1 != undefined) { action1.pause(); } if (action2 != undefined) { action2.pause(); } if (action3 == undefined) { map.graphics.clear(); var highlightSymbol = new SimpleFillSymbol( SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1), new Color([125, 125, 125, 0.35])); action3 = on.pausable(petroFieldsFL2, "click", function(evt) { map.graphics.clear(); highlightGraphic = new Graphic(evt.graphic.geometry, highlightSymbol); map.graphics.add(highlightGraphic); var query = new Query(); query.geometry = highlightGraphic.geometry.getExtent(); }); } else { action3.resume(); } }); function activateTool(tool) { map.graphics.clear(); // The draw.activate expects a string like "polygon" or "freehand_polygon". selectionToolbar.activate(tool); }
<button id="polygon" data-dojo-type="dijit/form/Button" data-dojo-props="iconClass:'polyIcon', showLabel:false"> Polygon </button> <button id="freehandpolygon" data-dojo-type="dijit.form.Button" data-dojo-props="iconClass:'freehandIcon', showLabel:false"> Freehand </button> <button id="RegionSelection" data-dojo-type="dijit.form.Button" data-dojo-props="iconClass:'freehandIcon', showLabel:false"> RegionSelection </button> <button id="Buffer" data-dojo-type="dijit.form.Button" data-dojo-props="iconClass:'freehandIcon', showLabel:false"> Buffer </button>
var action1, action2; var action3, action4; registry.byId("polygon").on("click", function() { if (action1 != undefined) { action2.pause(); action3.pause(); action4.pause(); } if (action1 == undefined) { petroFieldsFL2.on("click", function (evt) { map.graphics.clear(); }); activateTool(this.id); } else { action1.resume(); } }); registry.byId("freehandpolygon").on("click", function() { if (action1 != undefined) { action1.pause(); action3.pause(); action4.pause(); } if (action2 == undefined) { //alert("Freehand"); petroFieldsFL2.on("click", function (evt) { map.graphics.clear(); }); activateTool(this.id); } else { action2.resume(); } }); registry.byId("RegionSelection").on("click", function() { if (action1 != undefined) { action1.pause(); action2.pause(); action4.pause(); } if (action3 == undefined) { action3 = RegionalSelectionMap(map); } else { action3.resume(); } }); registry.byId("Buffer").on("click", function() { if (action1 != undefined) { action1.pause(); action2.pause(); action3.pause(); } if (action4 == undefined) { map.graphics.clear(); action3 = FourthButton(map); } else { action4.resume(); } }); function RegionalSelectionMap() { map.graphics.clear(); selectionToolbar.deactivate(); var highlightSymbol = new SimpleFillSymbol( SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1), new Color([125, 125, 125, 0.35])); petroFieldsFL2.on("click", function (evt) { map.graphics.clear(); highlightGraphic = new Graphic(evt.graphic.geometry, highlightSymbol); map.graphics.add(highlightGraphic); var query = new Query(); query.geometry = highlightGraphic.geometry.getExtent(); }); } function FourthButton() { map.graphics.clear(); selectionToolbar.deactivate(); petroFieldsFL2.on("click", function (evt) { map.graphics.clear(); }); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.