/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */

window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","esri.toolbars.edit"],["require","esri.toolbars._toolbar"],["require","esri.toolbars._GraphicMover"],["require","esri.toolbars._VertexEditor"],["require","esri.toolbars._Box"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["esri.toolbars.edit"]){_4._hasResource["esri.toolbars.edit"]=true;_4.provide("esri.toolbars.edit");_4.require("esri.toolbars._toolbar");_4.require("esri.toolbars._GraphicMover");_4.require("esri.toolbars._VertexEditor");_4.require("esri.toolbars._Box");(function(){var _7=document.createElement("link");_7.type="text/css";_7.rel="stylesheet";_7.href=_4.moduleUrl("esri","toolbars/css/edit.css").toString();document.getElementsByTagName("head").item(0).appendChild(_7);}());_4.declare("esri.toolbars.Edit",esri.toolbars._Toolbar,{constructor:function(_8,_9){this._map=_8;this._tool=0;this._scratchGL=_8.graphics;var _a=esri.isTouchEnabled;this._defaultOptions=_4.mixin({vertexSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,_a?20:12,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new _4.Color([0,0,0,0.5]),1),new _4.Color([128,128,128])),ghostVertexSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,_a?18:10,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new _4.Color([0,0,0,0.5]),1),new _4.Color([255,255,255,0.75])),ghostLineSymbol:new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DOT,new _4.Color([128,128,128]),2),allowDeleteVertices:true,allowAddVertices:true,rotateHandleOffset:_a?24:16,boxLineSymbol:new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH,new _4.Color([64,64,64]),1),boxHandleSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE,_a?16:9,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new _4.Color([0,0,0,0.5]),1),new _4.Color([255,255,255,0.75]))},_9||{});},activate:function(_b,_c,_d){this.deactivate();this._graphic=_c;this._options=_4.mixin(_4.mixin({},this._defaultOptions),_d||{});var _e=esri.toolbars.Edit.MOVE,_f=esri.toolbars.Edit.EDIT_VERTICES;var _10=esri.toolbars.Edit.SCALE,_11=esri.toolbars.Edit.ROTATE;var _12=false,_13=false,box=false;if((_b&_e)===_e){_12=this._enableMove(_c);}var _14=((_b&_10)===_10),_15=((_b&_11)===_11);if(_14||_15){box=this._enableBoxEditing(_c,_14,_15);}if((_b&_f)===_f){_13=this._enableVertexEditing(_c);}if(!(_12||_13||box)){throw new Error("[esri.toolbars.Edit::activate] "+esri.bundle.toolbars.edit.invalidType);}this._tool=_b;var map=this._map;if(this._tool){this._mapPanEndHandle=_4.connect(map,"onPanEnd",this,this._mapPanEndHandler);this._mapExtChgHandle=_4.connect(map,"onExtentChange",this,this._mapExtentChangeHandler);this.onActivate(this._tool,_c);}if(map.snappingManager&&(_12||_13)){map.snappingManager._startSelectionLayerQuery();}},deactivate:function(){var _16=this._tool,_17=this._graphic;if(!_16){return;}var _18=!!this._modified;this._clear();_4.disconnect(this._mapPanEndHandle);_4.disconnect(this._mapExtChgHandle);this._graphic=null;this.onDeactivate(_16,_17,{isModified:_18});if(this._map.snappingManager){this._map.snappingManager._stopSelectionLayerQuery();}},refresh:function(){this._refreshMoveables(true);},getCurrentState:function(){return {tool:this._tool,graphic:this._graphic,isModified:!!this._modified};},onActivate:function(_19,_1a){},onDeactivate:function(_1b,_1c,_1d){},onGraphicMoveStart:function(_1e){},onGraphicFirstMove:function(_1f){this._modified=true;},onGraphicMove:function(_20,_21){},onGraphicMoveStop:function(_22,_23){},onGraphicClick:function(_24,_25){},onVertexMoveStart:function(_26,_27){},onVertexFirstMove:function(_28,_29){this._modified=true;},onVertexMove:function(_2a,_2b,_2c){},onVertexMoveStop:function(_2d,_2e,_2f){},onVertexAdd:function(_30,_31){this._modified=true;},onVertexClick:function(_32,_33){},onVertexMouseOver:function(_34,_35){},onVertexMouseOut:function(_36,_37){},onVertexDelete:function(_38,_39){this._modified=true;},onScaleStart:function(_3a){},onScaleFirstMove:function(_3b){this._modified=true;},onScale:function(_3c,_3d){},onScaleStop:function(_3e,_3f){},onRotateStart:function(_40){},onRotateFirstMove:function(_41){this._modified=true;},onRotate:function(_42,_43){},onRotateStop:function(_44,_45){},_enableMove:function(_46){var map=this._map,_47=_46.geometry.type;switch(_47){case "point":case "polyline":case "polygon":this._graphicMover=new esri.toolbars._GraphicMover(_46,map,this);return true;case "multipoint":break;}return false;},_enableVertexEditing:function(_48){var map=this._map,_49=_48.geometry.type;switch(_49){case "point":break;case "multipoint":case "polyline":case "polygon":this._vertexEditor=esri.toolbars._GraphicVertexEditor.create(_48,map,this);return true;}return false;},_enableBoxEditing:function(_4a,_4b,_4c){var map=this._map,_4d=_4a.geometry.type;switch(_4d){case "point":case "multipoint":break;case "polyline":case "polygon":this._boxEditor=new esri.toolbars._Box(_4a,map,this,_4b,_4c);return true;}return false;},_disableMove:function(){var _4e=this._graphicMover;if(_4e){_4e.destroy();this._graphicMover=null;}},_disableVertexEditing:function(){var _4f=this._vertexEditor;if(_4f){_4f.destroy();this._vertexEditor=null;}},_disableBoxEditing:function(){var box=this._boxEditor;if(box){box.destroy();this._boxEditor=null;}},_clear:function(){this._disableMove();this._disableVertexEditing();this._disableBoxEditing();this._tool=0;this._modified=false;},_mapPanEndHandler:function(){this._refreshMoveables();},_mapExtentChangeHandler:function(e,d,_50){if(_50){this._refreshMoveables();}},_refreshMoveables:function(_51){var _52=_4.filter([this._graphicMover,this._vertexEditor,this._boxEditor],esri._isDefined);_4.forEach(_52,function(mov){mov.refresh(_51);});},_beginOperation:function(_53){_4.forEach(this._getAffectedTools(_53),function(_54){_54.suspend();});},_endOperation:function(_55){_4.forEach(this._getAffectedTools(_55),function(_56){_56.resume();});},_getAffectedTools:function(_57){var _58=[];switch(_57){case "MOVE":_58=[this._vertexEditor,this._boxEditor];break;case "VERTICES":_58=[this._boxEditor];break;case "BOX":_58=[this._vertexEditor];break;}_58=_4.filter(_58,esri._isDefined);return _58;}});_4.mixin(esri.toolbars.Edit,{MOVE:1,EDIT_VERTICES:2,SCALE:4,ROTATE:8});}}};});