Advanced Draw

This is an Advanced Draw for ArcGIS Javascript API

by Bryan McIntosh

HTML

<link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.10/js/dojo/dijit/themes/claro/claro.css">
<head>
  <title>Advanced Draw</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <link rel="stylesheet" href="https://js.arcgis.com/3.10/js/dojo/dijit/themes/claro/claro.css">
  <link rel="stylesheet" href="https://js.arcgis.com/3.10/js/esri/css/esri.css">
  <style>
  html,
body {
  height: 97%;
  width: 98%;
  margin: 1%;
}

#DrawPane {
  width: 30%;
}

  </style>
  <script>
    var dojoConfig = {
      packages: [{
        "name": "myModules",
        "location": location.pathname.replace(/\/[^/]+$/, "")
      }]
    };

  </script>

  <script src="https://js.arcgis.com/3.10/"></script>
  <script>
    define("myModules/CustomOperation", [
      "dojo/_base/declare", "esri/OperationBase", "esri/toolbars/navigation"
    ], function(declare, OperationBase, Navigation) {
      var customOp = {};
      customOp.Add = declare(OperationBase, {
        label: "Add Graphic",
        constructor: function( /*graphicsLayer, addedGraphic*/ params) {
          params = params || {};
          if (!params.graphicsLayer) {
            console.error("graphicsLayer is not provided");
            return;
          }
          this.graphicsLayer = params.graphicsLayer;

          if (!params.addedGraphic) {
            console.error("no graphics provided");
            return;
          }
          this._addedGraphic = params.addedGraphic;
        },

        performUndo: function() {
          this.graphicsLayer.remove(this._addedGraphic);
        },

        performRedo: function() {
          this.graphicsLayer.add(this._addedGraphic);
        }
      });
      return customOp;
    });

  </script>
  <script>
    var map, editToolbar, ctxMenuForGraphics, ctxMenuForMap, buttonclick;
    var...