UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 3.37 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{JSONMap as e}from"../../../core/jsonMap.js";import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import{geographicToWebMercator as r}from"../../../geometry/support/webMercatorUtils.js";import n from"./cameraOrientationRegistry.js";import{isConstantElevation as i,ConstantElevation as o,ElevationSource as s}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as l}from"../enums/CameraOrientationType.js";function a(e,t,r){return t&&(e=`${t}${e}`),r&&(e+=`${r}`),e}function u(e,t,r){let{url:n}=e;return n?(n=a(n,t,r),new s({...e,url:n})):null}function c(e,t,r){return e?i(e)?new o(e):u(e,t,r):e}const f=new e({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),p=new e({Feet:"feet",Meter:"meter"}),m=new e({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique",Terrestrial360Video:"terrestrial-360-video",TerrestrialFrameVideo:"terrestrial-frame-video",Aerial360Video:"aerial-360-video",AerialFrameVideo:"aerial-frame-video","":null}),h=new Map;function g(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,v,w,D,$,z,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,omega:s,phi:l,kappa:a,...y([u,c,f,p,m,h],[d,v],[w,D,$],[z,j],g)}}h.set(`${l.HPR}`,v),h.set(`${l.YPR}`,w),h.set(`${l.OPK}`,g),h.set(`${l.LTP}`,D);const d=e=>{const t=e.map((e=>parseFloat(e))).filter((e=>!isNaN(e)));if(t.length===e.length)return t};function y(e,t,r,n,i){const o=d(e),s=d(t),l=d(r),a=d(n);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function v(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,v,w,D,$,z,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,heading:s,pitch:l,roll:a,...y([u,c,f,p,m,h],[d,v],[w,D,$],[z,j],g)}}function w(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,v,w,D,$,z,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,yaw:s,pitch:l,roll:a,...y([u,c,f,p,m,h],[d,v],[w,D,$],[z,j],g)}}function D(e){const[t,r,i,o,s,...l]=e.slice(1),a=h.get(s),u=n.get(s)?.constructor;if(!a||!u)return null;return{latitude:t,longitude:r,ellipsoidRadius:i,squaredEccentricity:o,properties:new u(a([s,"",...l]))}}function $(e){if(!e)return null;const t=`${e}`.split("|");if(0===t.length)return null;const r=n.get(t[0]);if(!r)return null;const i=h.get(t[0]);if(!i)return null;return new(0,r.constructor)(i(t))}function z(e){return Array.isArray(e)&&e?.length>5&&!e.some(isNaN)}function j(e){for(e=e.slice(0,8);e.length<8;)e.push(0);return e}function I(e){return e.spatialReference.isGeographic?r(e):e.clone()}function K(e){return e.isGeographic?1:t(e)}function W(e){const t=e.match(/^(.*)\/rest\/services\/(.*)$/);return t?t[1]:null}export{a as appendPrefixAndSuffix,I as convertGeographicToWebMercator,$ as createCameraOrientation,W as getArcGISServerUrl,c as getEffectiveElevationSource,K as getMetersPerUnitOfSR,z as isOrientationAccuracy,m as orientedImageryTypeMap,j as padAccuracyArray,u as processElevationSource,f as timeIntervalUnitTypeMap,h as transformersRegistry,p as verticalMeasurementTypeMap};