// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/editing/tools/Reshape","dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/connect dojo/has ../../../graphic ../../../layers/FeatureLayer ../../../tasks/query ../../../toolbars/draw ./ToggleToolBase ../../../kernel".split(" "),function(a,e,g,b,k,l,m,n,p,q,r){a=a([q],{declaredClass:"esri.dijit.editing.tools.Reshape",id:"btnFeatureReshape",_enabledIcon:"toolbarIcon reshapeIcon",_disabledIcon:"toolbarIcon reshapeIcon",_drawType:p.POLYLINE,_enabled:!0,_label:"NLS_reshapeLbl",
activate:function(){b.disconnect(this._rConnect);this._rConnect=b.connect(this._toolbar,"onDrawEnd",this,"_onDrawEnd");this.inherited(arguments)},deactivate:function(){this.inherited(arguments);b.disconnect(this._rConnect);delete this._rConnect},_onDrawEnd:function(c){var a=this._settings.layers,d=new n;d.geometry=c;c=this._reshapeLayers=g.filter(a,function(a){return"esriGeometryPolygon"===a.geometryType||"esriGeometryPolyline"});this._settings.editor._selectionHelper.selectFeatures(c,d,m.SELECTION_NEW,
e.hitch(this,"_reshape",d))},_reshape:function(a,b){if(1===b.length){var d=[],c=[],h=[],f=b[0],g=f.getLayer();this._settings.geometryService.reshape(f.geometry,a.geometry,e.hitch(this,function(a){"polyline"===a.type&&a.paths&&0===a.paths.length?(this._settings.editor._selectionHelper.clearSelection(!1),this.onFinished()):"polygon"===a.type&&a.rings&&0===a.rings.length?(this._settings.editor._selectionHelper.clearSelection(!1),this.onFinished()):(h.push(new l(f.toJson())),c.push(f.setGeometry(a)),
d.push({layer:g,updates:c,preUpdates:h}),this.onApplyEdits(d,e.hitch(this,function(){this._settings.editor._selectionHelper.clearSelection(!1);this.onFinished()})))}))}}});k("extend-esri")&&e.setObject("dijit.editing.tools.Reshape",a,r);return a});