chunk-e7725ec6.993241a7.js 35 KB

12345678910111213141516171819202122232425262728293031323334
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-e7725ec6"],{"2ab3":function(e,t,i){"use strict";i.d(t,"a",(function(){return o})),i.d(t,"b",(function(){return r}));var a=i("3886"),s=i("690a"),n=i("b7bd");function r(){const e=new s["a"];e.vertex.uniforms.add("proj","mat4").add("view","mat4").add("width","float"),e.attributes.add(n["a"].POSITION,"vec3"),e.attributes.add(n["a"].NORMAL,"vec3"),e.attributes.add(n["a"].UV0,"vec2"),e.attributes.add(n["a"].AUXPOS1,"float"),e.varyings.add("vtc","vec2"),e.varyings.add("vlength","float"),e.varyings.add("vradius","float"),e.vertex.code.add(a["a"]`void main(void) {
  2. vec3 bitangent = normal;
  3. vtc = uv0;
  4. vlength = auxpos1;
  5. vradius = 0.5 * width;
  6. vec4 pos = view * vec4(position + vradius * bitangent * uv0.y, 1.0);
  7. gl_Position = proj * pos;
  8. }`),e.fragment.uniforms.add("outlineSize","float").add("outlineColor","vec4").add("stripeLength","float").add("stripeEvenColor","vec4").add("stripeOddColor","vec4");const t=1/Math.sqrt(2);return e.fragment.code.add(a["a"]`
  9. const float INV_SQRT2 = ${a["a"].float(t)};
  10. vec4 arrowColor(vec2 tc, float len) {
  11. float d = INV_SQRT2 * (tc.x - abs(tc.y));
  12. d = min(d, INV_SQRT2 * (len - tc.x - abs(tc.y)));
  13. d = min(d, 1.0 - abs(tc.y));
  14. if (d < 0.0) {
  15. return vec4(0.0);
  16. } else if (d < outlineSize) {
  17. return outlineColor;
  18. } else {
  19. return fract(0.5 / stripeLength * tc.x * vradius) >= 0.5 ? stripeOddColor : stripeEvenColor;
  20. }
  21. }
  22. void main(void) {
  23. vec2 ntc = vec2(vtc.x / vradius, vtc.y);
  24. vec4 color = arrowColor(ntc, vlength / vradius);
  25. if (color.a == 0.0) {
  26. discard;
  27. }
  28. gl_FragColor = color;
  29. }
  30. `),e}const o=Object.freeze({__proto__:null,build:r})},"6d28":function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return Xe}));var a=i("a4ee"),s=i("fc29"),n=i("b2b2"),r=i("59b2"),o=(i("b50f"),i("c120"),i("cea0"),i("d386")),l=i("caf1e"),c=i("1bd2"),d=i("aa0f"),h=i("af40"),u=i("e92d"),b=i("f315"),O=i("477c"),p=i("3795"),g=i("e431"),_=i("0b2d"),m=i("ea51"),j=i("521c"),v=i("8188"),y=i("f694"),w=i("40b6"),f=i("6f8b"),P=i("29a2");const L=u["a"].getLogger("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementController"),S=1e5;let z=class extends s["a"]{constructor(e){super(e),this._unitNormalizer=new f["a"],this._handles=new h["a"],this._tempStartPosition=Object(_["f"])(),this._tempEndPosition=Object(_["f"])(),this._tempCornerPosition=Object(_["f"])()}initialize(){this._handles.add(Object(p["j"])(this.view,"ready",()=>this._initialize(),!0))}destroy(){this._handles=Object(n["d"])(this._handles)}_initialize(){const e=this.view.spatialReference,t=Object(y["g"])(e),i=t===y["a"]?y["d"]:t;this._sphericalPCPF=i;const a=Object(v["b"])(e,i);this._unitNormalizer.spatialReference=a?i:e,this._handles.add([Object(O["e"])(()=>({viewData:this.viewData,startPoint:this.analysis.startPoint}),({viewData:e,startPoint:t})=>{e.elevationAlignedStartPoint=this._applyProjectionAndElevationAlignment(t)},O["d"]),Object(O["e"])(()=>({viewData:this.viewData,endPoint:this.analysis.endPoint}),({viewData:e,endPoint:t})=>{e.elevationAlignedEndPoint=this._applyProjectionAndElevationAlignment(t)},O["d"]),Object(O["e"])(()=>({result:this._computedResult,viewData:this.viewData}),({result:e,viewData:t})=>{t.result=e},O["d"])])}_applyProjectionAndElevationAlignment(e){if(Object(n["j"])(e))return e;const t=Object(P["a"])(e,this.view.spatialReference,this.view.elevationProvider);return Object(n["j"])(t)?(Object(P["b"])(this.analysis,e.spatialReference,L),null):t}get _computedResult(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,measurementMode:i}=this.viewData;if(Object(n["j"])(e)||Object(n["j"])(t))return null;const a=this._euclideanDistances(e,t),s=this._geodesicDistance(e,t,a.horizontal.value),r=i===d["a"].Geodesic||i===d["a"].Auto&&a.horizontal.value>S?"geodesic":"euclidean";return{mode:r,distance:"euclidean"===r?a.direct:s,directDistance:a.direct,horizontalDistance:a.horizontal,verticalDistance:a.vertical,geodesicDistance:s}}_euclideanDistances(e,t){const i=e.clone();i.z=t.z;const a=this._tempStartPosition,s=this._tempEndPosition,n=this._tempCornerPosition,r=this.view.spatialReference,o=this._sphericalPCPF,l=Object(v["b"])(r,o)?o:r;Object(v["t"])(e,a,l),Object(v["t"])(t,s,l),Object(v["t"])(i,n,l);const c=Object(g["o"])(a,s),d=Object(g["o"])(n,s),h=Math.abs(t.z-e.z),u=e=>this._unitNormalizer.normalizeDistance(e),O=u(c),p=u(d),_=u(h);return{direct:Object(b["c"])(O,"meters"),horizontal:Object(b["c"])(p,"meters"),vertical:Object(b["c"])(_,"meters")}}_geodesicDistance(e,t,i){const a=e.spatialReference,s=new j["a"]({spatialReference:a});s.addPath([e,t]);const r=a.isGeographic&&Object(w["c"])(a)?Object(w["a"])([s],"meters")[0]:a.isWebMercator?Object(m["geodesicLength"])(s,"meters"):null,o=Object(n["k"])(r)?r:this._fallbackGeodesicDistance(e,t,i);return Object(b["c"])(o,"meters")}_fallbackGeodesicDistance(e,t,i){if(Object(v["u"])(e,C)&&Object(v["u"])(t,E)){const e={distance:0};return Object(w["b"])(e,C,E),e.distance}return i}};Object(a["a"])([Object(r["b"])()],z.prototype,"view",void 0),Object(a["a"])([Object(r["b"])()],z.prototype,"analysis",void 0),Object(a["a"])([Object(r["b"])()],z.prototype,"viewData",void 0),Object(a["a"])([Object(r["b"])()],z.prototype,"_computedResult",null),z=Object(a["a"])([Object(o["a"])("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementController")],z);const C=Object(_["f"])(),E=Object(_["f"])();i("1b8f");var M,A,V=i("38a4"),D=i("7617"),T=i("a915"),x=i("8048"),R=i("3349"),G=i("5ef2");!function(e){e[e.None=0]="None",e[e.Direct=1]="Direct",e[e.Triangle=2]="Triangle",e[e.ProjectedGeodesic=3]="ProjectedGeodesic"}(M||(M={})),function(e){e[e.Auto=0]="Auto",e[e.AboveSegment=1]="AboveSegment",e[e.BelowSegment=2]="BelowSegment"}(A||(A={}));var N=i("52b7"),q=i("27ea"),k=i("94e6"),I=i("afe1"),H=i("0fc4"),U=i("7361"),W=i("5fae"),Q=i("caf7"),F=i("35b3"),B=i("fc00"),J=i("a05b"),X=i("b7c2"),$=i("d7f7"),K=i("badc"),Y=i("b7bd"),Z=i("8e97"),ee=i("c3a4"),te=i("ca98"),ie=i("da35"),ae=i("fa1e"),se=i("7438"),ne=i("c829"),re=i("2ab3"),oe=i("d17d"),le=i("189c");class ce extends te["a"]{constructor(e,t,i){super(e,t,i)}initializeProgram(e){const t=ce.shader.get().build();return new ne["a"](e.rctx,t,ae["a"])}bindPass(e,t){Object(Z["b"])(this.program,t.camera.projectionMatrix),this.program.setUniform1f("width",e.width),this.program.setUniform1f("outlineSize",e.outlineSize),this.program.setUniform4fv("outlineColor",e.outlineColor),this.program.setUniform1f("stripeLength",e.stripeLength),this.program.setUniform4fv("stripeEvenColor",e.stripeEvenColor),this.program.setUniform4fv("stripeOddColor",e.stripeOddColor)}bindDraw(e){Object(Z["c"])(this.program,e),this.program.rebindTextures()}_setPipelineState(e){const t=e===X["l"].NONE,i=this.configuration;return Object(le["g"])({blending:i.transparent?t?se["d"]:Object(se["f"])(e):null,polygonOffset:this.configuration.polygonOffsetEnabled&&{factor:0,units:-4},depthTest:{func:oe["h"].LESS},depthWrite:le["e"],colorWrite:le["d"]})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}get primitiveType(){return oe["r"].TRIANGLE_STRIP}}ce.shader=new ee["a"](re["a"],()=>i.e("chunk-2d213e8d").then(i.bind(null,"af4f")));class de extends ie["a"]{constructor(){super(...arguments),this.polygonOffsetEnabled=!1,this.transparent=!1,this.transparencyPassType=X["l"].NONE}}Object(a["a"])([Object(ie["b"])()],de.prototype,"polygonOffsetEnabled",void 0),Object(a["a"])([Object(ie["b"])()],de.prototype,"transparent",void 0),Object(a["a"])([Object(ie["b"])({count:X["l"].COUNT})],de.prototype,"transparencyPassType",void 0);class he extends F["b"]{constructor(e){super(e,be),this.techniqueConfig=new de}getTechniqueConfig(e,t){var i;return this.techniqueConfig.polygonOffsetEnabled=this.parameters.polygonOffset,this.techniqueConfig.transparent=this.parameters.stripeEvenColor[3]<1||this.parameters.stripeOddColor[3]<1||this.parameters.outlineColor[3]<1,this.techniqueConfig.transparencyPassType=null!=(i=null==t?void 0:t.transparencyPassType)?i:X["l"].NONE,this.techniqueConfig}dispose(){}getPassParameters(){return this.parameters}intersect(){}requiresSlot(e){return e===K["a"].OPAQUE_MATERIAL}createGLMaterial(e){return e.output===J["a"].Color?new ue(e):null}createBufferWriter(){return new ve}}class ue extends $["a"]{updateParameters(e){return this.ensureTechnique(ce,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const be={width:32,outlineSize:.2,outlineColor:[1,.5,0,1],stripeLength:1,stripeEvenColor:[1,1,1,1],stripeOddColor:[1,.5,0,1],polygonOffset:!1,...F["a"]},Oe=Object(B["a"])().vec3f(Y["a"].POSITION).vec3f(Y["a"].NORMAL).vec2f(Y["a"].UV0).f32(Y["a"].AUXPOS1),pe=Object(_["f"])(),ge=Object(_["f"])(),_e=Object(_["f"])(),me=Object(_["f"])(),je=Object(_["f"])();class ve{constructor(){this.vertexBufferLayout=Oe}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 2*(e.indices.get(Y["a"].POSITION).length/2+1)}write(e,t,i,a){const s=t.vertexAttributes.get(Y["a"].POSITION).data,n=t.vertexAttributes.get(Y["a"].NORMAL).data,r=s.length/3,o=t&&t.indices&&t.indices.get(Y["a"].POSITION);o&&o.length!==2*(r-1)&&console.warn("MeasurementArrowMaterial does not support indices");const l=pe,c=ge,d=_e,h=me,u=je,b=e.transformation,O=e.invTranspTransformation,p=i.position,_=i.normal,m=i.uv0;let j=0;for(let y=0;y<r;++y){const e=3*y;if(Object(g["y"])(l,s[e],s[e+1],s[e+2]),y<r-1){const e=3*(y+1);Object(g["y"])(c,s[e],s[e+1],s[e+2]),Object(g["y"])(u,n[e],n[e+1],n[e+2]),Object(g["t"])(u,u),Object(g["l"])(d,c,l),Object(g["t"])(d,d),Object(g["i"])(h,u,d),Object(g["t"])(h,h)}const t=Object(g["o"])(l,c);b&&O&&(Object(g["s"])(l,l,b),Object(g["s"])(c,c,b),Object(g["s"])(h,h,O));const i=a+2*y,o=i+1;p.setVec(i,l),p.setVec(o,l),_.setVec(i,h),_.setVec(o,h),m.set(i,0,j),m.set(i,1,-1),m.set(o,0,j),m.set(o,1,1),y<r-1&&(j+=t)}const v=i.auxpos1;for(let g=0;g<2*r;++g)v.set(a+g,j)}}class ye extends W["a"]{constructor(e){super(e),this._parameters=we,this._handles=null,this._origin=Object(_["f"])(),this._originTransform=Object(I["d"])(),this._arrowCenter=Object(_["f"])(),this._renderOccluded=F["c"].OccludeAndTransparent,this._geometry=null,this._stripeLength=1,this._stripesEnabled=!0,this._opacity=1,this.applyProps(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._arrowMaterial&&this._arrowMaterial.setParameters({renderOccluded:e}))}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this._geometryChanged()}get stripeLength(){return this._stripeLength}set stripeLength(e){this._stripeLength=e,this.attached&&this._arrowMaterial.setParameters({stripeLength:this._stripeLength})}get stripesEnabled(){return this._stripesEnabled}set stripesEnabled(e){if(this._stripesEnabled=e,this.attached){const e=this.opacity,{arrowStripeEvenColor:t,arrowStripeOddColor:i}=this._parameters,a=Object(V["c"])(fe,this._stripesEnabled?t:i,e);this._arrowMaterial.setParameters({stripeEvenColor:a})}}get opacity(){return this._opacity}set opacity(e){e!==this._opacity&&(this._opacity=e,this._updateArrowOpacity())}createExternalResources(){const{arrowStripeEvenColor:e,arrowStripeOddColor:t,arrowOutlineColor:i}=this._parameters,a=this._stripesEnabled?e:t;this._arrowMaterial=new he({outlineColor:i,stripeEvenColor:a,stripeOddColor:t,renderOccluded:this.renderOccluded,polygonOffset:!0}),this._handles=new h["a"],this._handles.add(this.view.state.watch("camera",()=>{this._viewChanged()}))}destroyExternalResources(){this._arrowMaterial=null,this._handles.destroy(),this._handles=null}forEachExternalMaterial(e){e(this._arrowMaterial)}createGeometries(e){if(Object(n["j"])(this._geometry)||Object(n["j"])(this._geometry.startRenderSpace)||Object(n["j"])(this._geometry.endRenderSpace))return;const t=this._createArrowGeometry(this._geometry.startRenderSpace,this._geometry.endRenderSpace,this._origin,this._geometry);e.addGeometry(t,this._arrowMaterial,this._originTransform),this._viewChanged()}_createArrowGeometry(e,t,i,a){const s=this.view.renderCoordsHelper,n=[],r=[],o=(e,t)=>{const a=U["d"].get();Object(g["l"])(a,e,i),n.push(a),r.push(t)};if("euclidean"===a.type){a.eval(.5,this._arrowCenter);const i=U["d"].get();s.worldUpAtPosition(this._arrowCenter,i),o(e,i),o(t,i)}else{a.eval(.5,this._arrowCenter);const e=this._parameters.arrowSubdivisions+1&-2;for(let t=0;t<e;++t){const i=t/(e-1),n=U["d"].get(),r=U["d"].get();a.eval(i,n),s.worldUpAtPosition(n,r),o(n,r)}}return Q["a"].createPolylineGeometry(n,r)}_geometryChanged(){this.recreateGeometry()}_viewChanged(){if(this.view.ready&&this.attached&&Object(n["k"])(this._geometry)){const e=this.view.state.camera.computeScreenPixelSizeAt(this._arrowCenter);this._arrowMaterial.setParameters({width:this._parameters.arrowWidth*e})}}_updateArrowOpacity(){const e=this.opacity,{arrowStripeEvenColor:t,arrowStripeOddColor:i,arrowOutlineColor:a}=this._parameters,s=Object(V["c"])(fe,this._stripesEnabled?t:i,e),n=Object(V["c"])(Pe,a,e),r=Object(V["c"])(Le,i,e);this._arrowMaterial.setParameters({stripeEvenColor:s,outlineColor:n,stripeOddColor:r})}}const we={arrowWidth:16,arrowOutlineColor:[1,.5,0,1],arrowOutlineWidth:.2,arrowStripeEvenColor:[1,1,1,1],arrowStripeOddColor:[1,.5,0,1],arrowStripeLength:16,arrowSubdivisions:128},fe=Object(H["e"])(),Pe=Object(H["e"])(),Le=Object(H["e"])();var Se=i("d791"),ze=i("7577"),Ce=i("0278"),Ee=i("d36e"),Me=i("86ba");class Ae extends W["a"]{constructor(e){super(e),this._handles=new h["a"],this._quadMaterial=null,this._outlineMaterial=null,this._maxSize=0,this._position=Object(_["f"])(),this._up=Object(_["f"])(),this._right=Object(_["f"])(),this._renderOccluded=F["c"].OccludeAndTransparent,this._color=Object(G["c"])(1,0,0,1),this._outlineColor=Object(G["c"])(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=F["c"].Opaque,this.applyProps(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get color(){return this._color}set color(e){Object(ze["c"])(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){Object(ze["c"])(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:i}){this._maxSize=Math.min(Object(g["o"])(t,e),Object(g["o"])(t,i))/3,Object(g["t"])(this._up,Object(g["l"])(this._up,e,t)),Object(g["t"])(this._right,Object(g["l"])(this._right,i,t)),Object(g["m"])(this._position,t),this.recreateGeometry()}createExternalResources(){this._quadMaterial=new Ee["a"](this.quadMaterialParameters),this._outlineMaterial=new Me["a"](this.outlineMaterialParameters),this._handles.add(this.view.state.watch("camera",()=>this._updateTransform()))}destroyExternalResources(){this._quadMaterial=null,this._outlineMaterial=null,this._handles.removeAll()}forEachExternalMaterial(e){e(this._quadMaterial),e(this._outlineMaterial)}createGeometries(e){this._createQuadGeometry(e),this._createOutlineGeometry(e),this._updateTransform(e)}_createQuadGeometry(e){const t=this._quadGeometryData(this._up,this._right);e.addGeometry(t,this._quadMaterial)}_createOutlineGeometry(e){if(0===this._outlineSize)return;const t=Object(g["h"])(U["d"].get(),this._up,this._right),i=Q["a"].createPolylineGeometry([this._up,t,this._right]);e.addGeometry(i,this._outlineMaterial)}_updateTransform(e=this.object){const t=this.view.state.camera,i=this._size*t.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);Object(Se["g"])(Ve,this._position),Object(Se["i"])(Ve,Ve,[a,a,a]),Object(n["k"])(e)&&(e.transformation=Ve)}_quadGeometryData(e,t){const i=Object(g["h"])(U["d"].get(),e,t);return new Ce["a"]([[Y["a"].POSITION,{size:3,data:[0,0,0,...t,...e,...i],exclusive:!0}]],[[Y["a"].POSITION,new Uint16Array([0,1,2,1,2,3])]])}get quadMaterialParameters(){return{color:this._color,transparent:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded}}_updateQuadMaterial(){this._quadMaterial&&this._quadMaterial.setParameters(this.quadMaterialParameters)}get outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded}}_updateOutlineMaterial(){this._outlineMaterial&&this._outlineMaterial.setParameters(this.outlineMaterialParameters)}}const Ve=Object(I["d"])();var De,Te=i("5c1c"),xe=i("3544"),Re=i("2035"),Ge=i("6323");!function(e){e[e.Pending=0]="Pending",e[e.Ready=1]="Ready",e[e.Destroyed=2]="Destroyed"}(De||(De={}));let Ne=class extends s["a"]{constructor(e){super(e),this._params={...Ie},this._handles=new h["a"],this._segmentVisualElement=null,this._triangleVisualElement=null,this._rightAngleQuad=null,this._projectedGeodesicLine=null,this._geodesicStartHint=null,this._geodesicEndHint=null,this._segmentLabel=null,this._verticalLabel=null,this._horizontalLabel=null,this._startPosition=Object(_["f"])(),this._endPosition=Object(_["f"])(),this._cornerPosition=Object(_["f"])(),this._startPositionAtSeaLevel=Object(_["f"])(),this._endPositionAtSeaLevel=Object(_["f"])(),this._state=De.Pending,this._triangleOrientationOverride=null,this.messages=null,this.loadingMessages=!0,this.visualElementOrientation=A.Auto,this.triangleCollapseRatioThreshold=.03}get ready(){return this._state===De.Ready}get visible(){return this.analysisView.visible}get viewMode(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView;if(Object(n["j"])(e)||Object(n["j"])(t)||e.equals(t))return M.None;const i=this.analysisView.result;if(Object(n["j"])(i))return M.Direct;if("geodesic"===i.mode)return this._requiresGeodesicGuideAt(this._startPosition)||this._requiresGeodesicGuideAt(this._endPosition)?M.ProjectedGeodesic:M.Direct;const{verticalDistance:a,horizontalDistance:s}=i,r=a.value,o=s.value;return Math.min(r/o,o/r)<this.triangleCollapseRatioThreshold?M.Direct:M.Triangle}get actualVisualizedMeasurement(){if(Object(n["j"])(this.analysisView.result))switch(this.analysisView.measurementMode){case d["a"].Auto:case d["a"].Euclidean:default:return"euclidean";case d["a"].Geodesic:return"geodesic"}return this.analysisView.result.mode}get allowVisualElementsOrientationChange(){return Object(n["j"])(this._triangleOrientationOverride)}set allowVisualElementsOrientationChange(e){Object(n["j"])(this._triangleOrientationOverride)!==e&&(Object(n["j"])(this._triangleOrientationOverride)?this._triangleOrientationOverride=this._actualVisualElementsOrientation:this._triangleOrientationOverride=null)}get labels(){const e="geodesic"===this.actualVisualizedMeasurement;return{direct:this._segmentLabel,horizontal:e?this._segmentLabel:this._horizontalLabel,vertical:this._verticalLabel}}get testData(){var e;return{labels:this.labels,stripeLength:null==(e=this._segmentVisualElement)?void 0:e.stripeLength}}initialize(){this._handles.add(Object(p["j"])(this.view,"ready",()=>this._initialize(),!0))}_initialize(){switch(this._state){case De.Ready:throw new Error("invalid state");case De.Destroyed:return}const e=this._params,t={attached:!0,view:this.view};this._segmentVisualElement=new ye({...t,geometry:null,renderOccluded:F["c"].OccludeAndTransparent}),this._triangleVisualElement=new k["a"]({...t,width:e.triangleLineWidth,color:e.triangleColor,renderOccluded:F["c"].OccludeAndTransparent}),this._rightAngleQuad=new Ae({...t,color:ke,renderOccluded:F["c"].OccludeAndTransparent});const i={...t,polygonOffset:!0,renderOccluded:F["c"].OccludeAndTransparent};this._projectedGeodesicLine=new k["a"]({...i,width:e.geodesicProjectionLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:Object(xe["a"])(e.guideStippleLengthPixels)}),this._geodesicStartHint=new k["a"]({...i,width:e.guideLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:Object(xe["a"])(e.guideStippleLengthPixels)}),this._geodesicEndHint=new k["a"]({...i,width:e.guideLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:Object(xe["a"])(e.guideStippleLengthPixels)}),this._segmentLabel=new q["a"]({...t,fontSize:e.direcLabelFontSize}),this._verticalLabel=new q["a"]({...t,fontSize:e.verticalLabelFontSize}),this._horizontalLabel=new q["a"]({...t,fontSize:e.horizontalLabelFontSize}),this._handles.add([Object(O["e"])(()=>{const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView,i=this.view;return{view:i,camera:i.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}},e=>this._updateGeometryAndViewMode(e),O["d"]),Object(O["e"])(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateVisualElementVisibility(e),O["d"]),Object(O["e"])(()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement}),e=>this._updateLabelText(e),O["d"]),Object(O["e"])(()=>({visible:this.visible,viewMode:this.viewMode,state:this._state}),e=>this._updateLabelVisibility(e),O["d"]),Object(O["e"])(()=>this._measurementArrowStripeLength,e=>this._updateSegmentStripeLength(e),O["d"]),Object(Re["c"])(async()=>this._updateMessageBundle())]),this._state=De.Ready,this._updateMessageBundle()}destroy(){this._state!==De.Destroyed&&(this._handles=Object(n["d"])(this._handles),this._segmentVisualElement=Object(n["d"])(this._segmentVisualElement),this._triangleVisualElement=Object(n["d"])(this._triangleVisualElement),this._rightAngleQuad=Object(n["d"])(this._rightAngleQuad),this._projectedGeodesicLine=Object(n["d"])(this._projectedGeodesicLine),this._geodesicStartHint=Object(n["d"])(this._geodesicStartHint),this._geodesicEndHint=Object(n["d"])(this._geodesicEndHint),this._segmentLabel=Object(n["d"])(this._segmentLabel),this._verticalLabel=Object(n["d"])(this._verticalLabel),this._horizontalLabel=Object(n["d"])(this._horizontalLabel),this.set("view",null),this._state=De.Destroyed)}async whenReady(){await Object(p["j"])(this,"ready")}_updateVisualElementVisibility({visible:e,viewMode:t}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,e)switch(t){case M.None:break;case M.Direct:this._segmentVisualElement.visible=!0;break;case M.Triangle:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case M.ProjectedGeodesic:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:e,camera:t,viewMode:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:s,orientation:r,visualizedMeasurement:o,stripeLength:l}){const c=e.renderCoordsHelper;if(Object(n["j"])(a)||Object(n["j"])(s)||a.equals(s))return;let d=this._startPosition,h=this._endPosition;c.toRenderCoords(a,d),c.toRenderCoords(s,h);const u=r===A.AboveSegment?1:-1,b=u*(c.getAltitude(h)-c.getAltitude(d));b<0&&(d=this._endPosition,h=this._startPosition);const O="geodesic"===o?new Te["b"](this._startPosition,this._endPosition,c.spatialReference):new Te["a"](this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=O,this._updateSegmentStripeLength(l),i){case M.Direct:this._updateSegment(O,r);break;case M.Triangle:this._updateSegmentAndTriangle({view:e,camera:t,segment:O,orientation:r,startPosition:d,endPosition:h,deltaSign:u,altitudeDelta:b});break;case M.ProjectedGeodesic:this._updateSegmentAndProjection({view:e,orientation:r,startPosition:d,endPosition:h})}}_updateSegment(e,t){this._segmentLabel.anchor=t===A.AboveSegment?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:e,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:e},camera:t,segment:i,orientation:a,startPosition:s,endPosition:n,deltaSign:r,altitudeDelta:o}){const l=this._cornerPosition;e.worldUpAtPosition(s,l),Object(g["g"])(l,l,r*Math.abs(o)),Object(g["h"])(l,l,s),this._triangleVisualElement.geometry=[[[s[0],s[1],s[2]],[l[0],l[1],l[2]],[n[0],n[1],n[2]]]],this._rightAngleQuad.geometry={previous:s,center:l,next:n};const c=new Te["a"](s,l),d=new Te["a"](l,n),h=qe(s,n,l,a,t);this._segmentLabel.anchor=h.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:c,sampleLocation:"center"},this._verticalLabel.anchor=h.vertical,this._horizontalLabel.geometry={type:"segment",segment:d,sampleLocation:"center"},this._horizontalLabel.anchor=h.horizontal}_updateSegmentAndProjection({view:{renderCoordsHelper:e},orientation:t,startPosition:i,endPosition:a}){e.setAltitude(this._startPositionAtSeaLevel,0,i),e.setAltitude(this._endPositionAtSeaLevel,0,a);const s=new Te["b"](this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,e.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(s),this._geodesicStartHint.setGeometryFromSegment(new Te["a"](this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new Te["a"](this._endPositionAtSeaLevel,a)),this._segmentLabel.geometry={type:"segment",segment:s,sampleLocation:"center"},this._segmentLabel.anchor=t===A.AboveSegment?"top":"bottom"}_updateLabelText({text:e,visualizedMeasurement:t}){Object(n["k"])(e)?(this._segmentLabel.text="euclidean"===t?e.euclideanDistance:e.geodesicDistance,this._horizontalLabel.text=e.horizontalDistance,this._verticalLabel.text=e.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({state:e,visible:t,viewMode:i}){if(e!==De.Ready)return;const a=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(a.visible=!1,s.visible=!1,n.visible=!1,t)switch(i){case M.Direct:a.visible=!0;break;case M.Triangle:a.visible=!0,s.visible=!0,n.visible=!0;break;case M.ProjectedGeodesic:a.visible=!0;case M.None:}}get _labelsText(){if(this._state!==De.Ready)return null;const e=this.messages,t=this.analysisView.result;if(Object(n["j"])(t)||Object(n["j"])(e))return null;const{directDistance:i,horizontalDistance:a,verticalDistance:s,geodesicDistance:r}=t,o=this.analysisView.unit,l=e=>({euclideanDistance:"",geodesicDistance:"",horizontalDistance:"",verticalDistance:"",...e});switch(o){case"metric":return l({euclideanDistance:i&&Object(D["d"])(e,i),geodesicDistance:r&&Object(D["d"])(e,r),horizontalDistance:a&&Object(D["d"])(e,a),verticalDistance:s&&Object(D["e"])(e,s)});case"imperial":return l({euclideanDistance:i&&Object(D["b"])(e,i),geodesicDistance:r&&Object(D["b"])(e,r),horizontalDistance:a&&Object(D["b"])(e,a),verticalDistance:s&&Object(D["c"])(e,s)});default:return l({euclideanDistance:i&&Object(D["a"])(e,i,o),geodesicDistance:r&&Object(D["a"])(e,r,o),horizontalDistance:a&&Object(D["a"])(e,a,o),verticalDistance:s&&Object(D["a"])(e,s,o)})}}_updateSegmentStripeLength(e){const t=this._segmentVisualElement;Object(n["k"])(e)?(t.stripeLength=e,t.stripesEnabled=!0):t.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(Object(n["k"])(this._triangleOrientationOverride))return this._triangleOrientationOverride;const e=this.visualElementOrientation;return e===A.Auto?this.view.state.camera.aboveGround?A.AboveSegment:A.BelowSegment:e}_requiresGeodesicGuideAt(e){const t=this.view;if(null==t||!t.state)return!1;const i=t.state.camera,a=t.renderCoordsHelper,s=i.computeScreenPixelSizeAt(e);return a.getAltitude(e)/s>=10}get _measurementArrowStripeLength(){const{result:e,unit:t}=this.analysisView;if(Object(n["j"])(e))return null;let i=null;const a=e.directDistance;switch(t){case"metric":i=a&&Object(b["d"])(a,"meters");break;case"imperial":i=a&&Object(b["d"])(a,Object(x["o"])(a.value,a.unit));break;default:i=a&&Object(b["d"])(a,t)}return Object(n["j"])(i)?null:Object(V["m"])(i.value/30)*Object(x["c"])(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,Object(Ge["a"])("esri/core/t9n/Units").then(e=>{this.messages=e}).finally(()=>{this.loadingMessages=!1})}};function qe(e,t,i,a,s){const n=Ue,r=We;s.projectToRenderScreen(i,n),s.projectToRenderScreen(t,r);const o={segment:"bottom",horizontal:"top",vertical:n[0]<r[0]?"left":"right"};{const a=Qe,n=Fe;if(Object(N["b"])(e,i,a,s),Object(N["b"])(e,t,n,s),Object(R["k"])(a,n)>=He){const e=Math.sign(a[1])===Math.sign(n[1]);o.segment=e?Object(q["b"])(o.vertical):o.vertical}else{const e=Be;Object(N["b"])(i,t,e,s),Object(R["k"])(e,n)>=He&&(o.segment=Math.sign(e[0])===Math.sign(n[0])?Object(q["b"])(o.horizontal):o.horizontal)}}if(a===A.BelowSegment){const e=e=>"top"===e?"bottom":"top";o.segment=e(o.segment),o.horizontal=e(o.horizontal),o.vertical=e(o.vertical)}return o}Object(a["a"])([Object(r["b"])()],Ne.prototype,"_state",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"_triangleOrientationOverride",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"messages",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"view",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"analysis",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"analysisView",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"ready",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"loadingMessages",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"visible",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"viewMode",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"actualVisualizedMeasurement",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"visualElementOrientation",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"triangleCollapseRatioThreshold",void 0),Object(a["a"])([Object(r["b"])()],Ne.prototype,"allowVisualElementsOrientationChange",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"labels",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"testData",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"_labelsText",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"_actualVisualElementsOrientation",null),Object(a["a"])([Object(r["b"])()],Ne.prototype,"_measurementArrowStripeLength",null),Ne=Object(a["a"])([Object(o["a"])("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],Ne);const ke=Object(G["c"])(1,.5,0,.75),Ie={laserLineGlowColor:[1,.5,0],laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:[1,1,1],laserLineInnerWidth:.75,laserLineGlobalAlpha:.75,laserLineEnabled:!0,handleColor:[1,.5,0],handleOpacity:.5,handleRadius:5,triangleColor:ke,triangleLineWidth:3,triangleCornerSize:32,triangleSubdivisions:128,arrowWidth:16,arrowOutlineColor:[1,.5,0,1],arrowOutlineWidth:.2,arrowStripeEvenColor:[1,1,1,1],arrowStripeOddColor:[1,.5,0,1],arrowStripeLength:16,arrowSubdivisions:128,geodesicProjectionLineWidth:2,geodesicProjectionLineColor:ke,guideLineWidth:2,guideLineColor:ke,guideStippleLengthPixels:6,labelDistance:25,direcLabelFontSize:16,horizontalLabelFontSize:12,verticalLabelFontSize:12},He=Math.cos(Object(V["h"])(12)),Ue=Object(T["d"])(),We=Object(T["d"])(),Qe=Object(T["c"])(),Fe=Object(T["c"])(),Be=Object(T["c"])();let Je=class extends(Object(c["a"])(s["a"])){constructor(e){super(e),this.type="direct-line-measurement-view-3d",this.result=null,this.measurementMode=d["a"].Auto,this.elevationAlignedStartPoint=null,this.elevationAlignedEndPoint=null}initialize(){const e=this.view,t=this.analysis;this._analysisVisualization=new Ne({view:e,analysis:t,analysisView:this}),this._analysisController=new z({view:e,analysis:t,viewData:this})}destroy(){this._analysisController=Object(n["d"])(this._analysisController),this._analysisVisualization=Object(n["d"])(this._analysisVisualization)}whenReady(){return this._analysisVisualization.whenReady()}get updating(){var e;return!(null==(e=this._analysisVisualization)||!e.loadingMessages)}get viewMode(){return this._analysisVisualization.viewMode}get actualVisualizedMeasurement(){return this._analysisVisualization.actualVisualizedMeasurement}get visualElementOrientation(){return this._analysisVisualization.visualElementOrientation}set visualElementOrientation(e){this._analysisVisualization.visualElementOrientation=e}get allowVisualElementsOrientationChange(){return this._analysisVisualization.allowVisualElementsOrientationChange}set allowVisualElementsOrientationChange(e){this._analysisVisualization.allowVisualElementsOrientationChange=e}get triangleCollapseRatioThreshold(){return this._analysisVisualization.triangleCollapseRatioThreshold}set triangleCollapseRatioThreshold(e){this._analysisVisualization.triangleCollapseRatioThreshold=e}get directLabelText(){return this._analysisVisualization.labels.direct.text}get horizontalLabelText(){return this._analysisVisualization.labels.horizontal.text}get verticalLabelText(){return this._analysisVisualization.labels.vertical.text}get testData(){var e;return this.destroyed?{labels:null,stripeLength:null,visualization:null,controller:null}:{...null==(e=this._analysisVisualization)?void 0:e.testData,visualization:this._analysisVisualization,controller:this._analysisController}}get unit(){return Object(n["u"])(this.analysis.unit,this._defaultUnit)}};Object(a["a"])([Object(r["b"])()],Je.prototype,"updating",null),Object(a["a"])([Object(r["b"])()],Je.prototype,"type",void 0),Object(a["a"])([Object(r["b"])()],Je.prototype,"analysis",void 0),Object(a["a"])([Object(r["b"])()],Je.prototype,"result",void 0),Object(a["a"])([Object(r["b"])()],Je.prototype,"measurementMode",void 0),Object(a["a"])([Object(r["b"])()],Je.prototype,"elevationAlignedStartPoint",void 0),Object(a["a"])([Object(r["b"])()],Je.prototype,"elevationAlignedEndPoint",void 0),Object(a["a"])([Object(r["b"])({readOnly:!0})],Je.prototype,"viewMode",null),Object(a["a"])([Object(r["b"])({readOnly:!0})],Je.prototype,"actualVisualizedMeasurement",null),Object(a["a"])([Object(r["b"])()],Je.prototype,"visualElementOrientation",null),Object(a["a"])([Object(r["b"])()],Je.prototype,"allowVisualElementsOrientationChange",null),Object(a["a"])([Object(r["b"])()],Je.prototype,"triangleCollapseRatioThreshold",null),Object(a["a"])([Object(r["b"])({readOnly:!0})],Je.prototype,"directLabelText",null),Object(a["a"])([Object(r["b"])({readOnly:!0})],Je.prototype,"horizontalLabelText",null),Object(a["a"])([Object(r["b"])({readOnly:!0})],Je.prototype,"verticalLabelText",null),Object(a["a"])([Object(r["b"])()],Je.prototype,"testData",null),Object(a["a"])([Object(r["b"])()],Je.prototype,"_analysisVisualization",void 0),Object(a["a"])([Object(r["b"])()],Je.prototype,"_analysisController",void 0),Object(a["a"])([Object(r["b"])()],Je.prototype,"unit",null),Object(a["a"])([Object(r["b"])(l["a"])],Je.prototype,"_defaultUnit",void 0),Je=Object(a["a"])([Object(o["a"])("esri.views.3d.analysis.DirectLineMeasurementAnalysisView3D")],Je);const Xe=Je}}]);
  31. //# sourceMappingURL=chunk-e7725ec6.993241a7.js.map