@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.28 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{createScreenPoint as e,pt2px as t,toPt as n}from"../../../core/screenUtils.js";import{defaultBasemapGroups as r,getBasemapId as i}from"../../support/utils.js";const o=r.light,c=r.dark,s=[...o,...c];function l(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b}function u(e,t){let n=0;if(e.length===t.length){let r=e.every(((e,n)=>l(e,t[n])));if(r)n=1;else{r=e.slice().reverse().every(((e,n)=>l(e,t[n]))),r&&(n=-1)}}return n}function a(t){const n=t.width,r=t.height;let i=t.pixelSizeAt(t.toMap(e(.5*n,.5*r),{exclude:[]}));if(i<=0&&(i=t.pixelSizeAt(t.toMap(e(.5*n,.95*r),{exclude:[]})),i<=0&&"camera"in t)){const e=t.camera.position.clone();e.z=0,i=2*t.pixelSizeAt(e)}return i}function f(e,r){return Math.ceil(a(r)*t(n(e)))}function h(e){const t=i(e,s,!1);return t?o.includes(t)?"light":c.includes(t)?"dark":void 0:null}function p(e){if(!e)return[];const t=new Set,n=[e.primaryScheme];e.secondarySchemes&&n.push(...e.secondarySchemes);for(const r of n)r&&"tags"in r&&r.tags&&r.tags.forEach((e=>t.add(e)));return[...t]}export{h as getBasemapTheme,a as getPixelSize,p as getTagsFromSchemes,u as hasIdenticalColors,f as toWorldScale};