@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.2 kB
JavaScript
class t{constructor(t,e,i){this._editGeometry=t,this._vertices=e,this.operation=i,this._undone=!1}apply(){this._vertices.forEach((t=>this.operation.apply(t))),this._editGeometry.components.forEach((t=>t.unnormalizeVertexPositions())),this._editGeometry.notifyChanges({operation:this._undone?"redo":"apply",updatedVertices:this._vertices})}undo(){this._vertices.forEach((t=>this.operation.undo(t))),this._editGeometry.notifyChanges({operation:"undo",updatedVertices:this._vertices}),this._undone=!0}canAccumulate(t){if(this._undone||t._vertices.length!==this._vertices.length)return!1;for(let e=0;e<t._vertices.length;++e)if(t._vertices[e]!==this._vertices[e])return!1;return this.operation.canAccumulate(t.operation)}accumulate(e){return!!(e instanceof t&&this.canAccumulate(e))&&(this._vertices.forEach((t=>this.operation.accumulate(t,e.operation))),this.operation.accumulateParams(e.operation),this._editGeometry.components.forEach((t=>t.unnormalizeVertexPositions())),this._editGeometry.notifyChanges({operation:"apply",updatedVertices:this._vertices}),!0)}}var e;!function(t){t[t.CUMULATIVE=0]="CUMULATIVE",t[t.REPLACE=1]="REPLACE"}(e||(e={}));export{e as AccumulationType,t as UpdateVertices};