/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{GeometryCursor as e}from"../../../../../geometry/GeometryCursor.js";class t{static{this.instance=null}static local(){return null===t.instance&&(t.instance=new t),t.instance}execute(e,t,i){return new n(e,t,i)}}class n{constructor(e,t,n){this._cursor=e,this._effect=t,this._context=n}next(){const t=this._cursor.next();if(t&&t.totalSize>0){const n=t.asJSON(),i=f[this._effect.part](n,{...this._effect,target:this._context.target,scaleFactor:this._context.scaleFactor,matcher:this._context.matcher,tileKey:this._context.tileKey,geomUnitsPerPoint:this._context.geomUnitsPerPoint});return e.fromJSONCIM(i)}return null}}function i(e,t){const n=t.matcher,i=t.target.getObjectId(),s=`${t.tileKey}_${i}`,r=n.getAnalyzedGraphic(s);return r.evaluateWithGeometry(e,t.geomUnitsPerPoint*t.scaleFactor),r}function s(e,t){const n=i(e,t);if(!n||!n.textPoint)return e;return{x:n.textPoint[0],y:n.textPoint[1],spatialReference:e.spatialReference}}function r(e,t){const n=i(e,t);if(!n||!n.dimensionLine)return e;const s=n.dimensionLine[0],r=s[1][0],o=s[1][1],c=s[0][0],a=s[0][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function o(e,t){const n=i(e,t);if(!n||!n.dimensionLine)return e;const s=n.dimensionLine[1],r=s[1][0],o=s[1][1],c=s[0][0],a=s[0][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function c(e,t){const n=i(e,t);if(!n||!n.extensionLines)return e;const s=n.extensionLines[0],r=s[0][0],o=s[0][1],c=s[1][0],a=s[1][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function a(e,t){const n=i(e,t);if(!n||!n.extensionLines)return e;const s=n.extensionLines[1],r=s[0][0],o=s[0][1],c=s[1][0],a=s[1][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}const f={textPoint:s,beginDimensionLine:r,endDimensionLine:o,beginExtensionLine:c,endExtensionLine:a},u="beginMarker",l="endMarker",x="textPoint",h="beginDimensionLine",m="endDimensionLine",p="beginExtensionLine",L="endExtensionLine";export{t as PrivateDimensionEffect,h as beginDimensionLineName,p as beginExtensionLineName,u as beginMarkerName,m as endDimensionLineName,L as endExtensionLineName,l as endMarkerName,i as getDimensionInfo,x as textPointName};
