/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../chunks/_rollupPluginBabelHelpers","../../../core/maybe","../../../core/unitUtils","../../../chunks/mat4","../../../chunks/vec3","../../../geometry/projection","../../../geometry/SpatialReference","../../../geometry/support/Axis","../../../geometry/support/coordinateSystem","../../../geometry/support/plane","../../../geometry/support/vectorStacks","../../../layers/graphics/dehydratedFeatureUtils","../../ViewingMode","../../support/spatialReferenceSupport"],(function(e,t,o,i,n,r,s,a,c,l,d,u,f,p,h){"use strict";let y=function(){function e(e,t,o,i){this.viewingMode=e,this.spatialReference=t,this.unitInMeters=o,this.coordinateSystem=i,this._coordinateSystem=l.create(i)}var h=e.prototype;return h.getAltitude=function(e){return l.altitudeAt(this.coordinateSystem,e)},h.setAltitude=function(e,t,o=e){return l.setAltitudeAt(this.coordinateSystem,o,t,e)},h.setAltitudeOfTransformation=function(e,t){l.setAltitudeOfTransformation(this.coordinateSystem,t,e,t)},h.worldUpAtPosition=function(e,t){return l.normalAt(this.coordinateSystem,e,t)},h.worldBasisAtPosition=function(e,t,o){return l.axisAt(this.coordinateSystem,e,t,o)},h.basisMatrixAtPosition=function(e,t){const o=this.worldBasisAtPosition(e,c.Axis.X,u.sv3d.get()),i=this.worldBasisAtPosition(e,c.Axis.Y,u.sv3d.get()),r=this.worldBasisAtPosition(e,c.Axis.Z,u.sv3d.get());return n.set(t,o[0],o[1],o[2],0,i[0],i[1],i[2],0,r[0],r[1],r[2],0,0,0,0,1),t},h.intersectManifoldClosestSilhouette=function(e,t,o){return l.elevate(this.coordinateSystem,t,this._coordinateSystem),l.intersectRayClosestSilhouette(this._coordinateSystem,e,o),o},h.intersectManifold=function(e,t,o){l.elevate(this.coordinateSystem,t,this._coordinateSystem);const i=u.sv3d.get();return l.intersectRay(this._coordinateSystem,e,i)?r.copy(o,i):null},h.intersectInfiniteManifold=function(e,t,o){if(this.viewingMode===p.ViewingMode.Global)return this.intersectManifold(e,t,o);l.elevate(this.coordinateSystem,t,this._coordinateSystem);const i=this._coordinateSystem.value,n=u.sv3d.get();return d.intersectRay(i.plane,e,n)?r.copy(o,n):null},h.toRenderCoords=function(e,t,o){return f.isDehydratedPoint(e)?s.projectPointToVector(e,t,this.spatialReference):s.projectVectorToVector(e,t,o,this.spatialReference)},h.fromRenderCoords=function(e,t,i=null){return f.isDehydratedPoint(t)?(o.isSome(i)&&(t.spatialReference=i),s.projectVectorToDehydratedPoint(e,this.spatialReference,t)):t instanceof a?s.projectVectorToPoint(e,this.spatialReference,t):s.projectVectorToVector(e,this.spatialReference,t,i)?t:null},e.create=function(t,o){switch(t){case p.ViewingMode.Local:return new e(p.ViewingMode.Local,o,i.getMetersPerUnitForSR(o),l.createLocal());case p.ViewingMode.Global:return new e(p.ViewingMode.Global,o,1,l.createGlobal(o))}},e.renderUnitScaleFactor=function(e,t){return m(e)/m(t)},t._createClass(e,[{key:"extent",set:function(e){e&&l.setExtent(this.coordinateSystem,e,this.coordinateSystem)}}]),e}();function m(e){if(h.isSpatialReferenceSupported(e,p.ViewingMode.Global))return 1;const t=l.renderSRFromViewSR(!1,e);return i.getMetersPerUnitForSR(t)}e.RenderCoordsHelper=y,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
