function init() { //snapping is enabled for this sample - change the tooltip to reflect this esri.bundle.toolbars.draw.start = esri.bundle.toolbars.draw.start + "<br/>Press <b>CTRL</b> to enable snapping"; esri.bundle.toolbars.draw.addPoint = esri.bundle.toolbars.draw.addPoint + "<br/>Press <b>CTRL</b> to enable snapping"; //This sample requires a proxy page to handle communications with the ArcGIS Server services. You will need to //replace the url below with the location of a proxy on your machine. See the 'Using the proxy page' help topic //for details on setting up a proxy page. esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";
//This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications esri.config.defaults.geometryService = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
var extent = new esri.geometry.Extent({ "xmin": -8576501, "ymin": 4705377, "xmax": -8574612, "ymax": 4706867, "spatialReference": { "wkid": 102100 } }); map = new esri.Map("map", { extent: extent }); dojo.connect(map, "onLoad", function() { //resize the map when the browser resizes dojo.connect(dijit.byId('map'), 'resize', map,map.resize); }); dojo.connect(map, "onLayersAddResult", initEditing); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"); map.addLayer(basemap);
var operationsPointLayer = new esri.layers.FeatureLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer...", { mode: esri.layers.FeatureLayer.MODE_ONDEMAND, outFields: ["*"] }); undoManager = new esri.UndoManager({maxOperations:8}); dijit.byId("undo").set("iconClass","undoGrayIcon"); dijit.byId("redo").set("iconClass","redoGrayIcon"); dojo.connect(undoManager,"onChange",function(){ //enable or disable buttons depending on current state of application if (undoManager.canUndo) { dijit.byId("undo").set("disabled", false); dijit.byId("undo").set("iconClass","undoIcon"); } else { dijit.byId("undo").set("disabled", true); dijit.byId("undo").set("iconClass","undoGrayIcon"); } if (undoManager.canRedo) { dijit.byId("redo").set("disabled", false); dijit.byId("redo").set("iconClass","redoIcon"); } else { dijit.byId("redo").set("disabled", true); dijit.byId("redo").set("iconClass","redoGrayIcon"); } }); //listen for the undo/redo button click events dojo.connect(dojo.byId('undo'), 'onclick', function(e) { console.log("Je undo ", undoManager); undoManager.undo(); }); dojo.connect(dojo.byId('redo'), 'onclick', function(e) { console.log("Je redo ", undoManager); undoManager.redo(); }); map.addLayers([operationsPointLayer]); map.infoWindow.resize(400, 300); }
function initEditing(results) { console.log("initEditing =>", results); var featureLayerInfos = dojo.map(results, function(result) { return { 'featureLayer': result.layer }; });
var params = { settings: settings }; var editorWidget = new esri.dijit.editing.Editor(params, 'editorDiv'); var options = {snapKey:dojo.keys.copyKey}; map.enableSnapping(options); editorWidget.startup();
so you are able to undo/redo edit operations that involve feature geometry changes? How does it track what was done during each edit in order to rollback?