@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.32 kB
JavaScript
import{initializeProjection as e,project as t}from"../../geometry/projection.js";import r from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as n}from"../../geometry/support/webMercatorUtils.js";async function o(o){const i=o.spatialReference;if(i.isWGS84)return o.clone();if(i.isWebMercator)return n(o);const s=r.WGS84;return await e(i,s),t(o,s)}function i(e,t){if(!s(e,t)){const r=e.typeKeywords;r?r.push(t):e.typeKeywords=[t]}}function s(e,t){return!!e.typeKeywords?.includes(t)}function c(e,t){const r=e.typeKeywords;if(r){const e=r.indexOf(t);e>-1&&r.splice(e,1)}}async function a(e){const t=e.clone().normalize();let r;if(t.length>1)for(const n of t)r?n.width>r.width&&(r=n):r=n;else r=t[0];return o(r)}const u={DEVELOPER_BASEMAP:"DeveloperBasemap",JSAPI:"ArcGIS API for JavaScript",METADATA:"Metadata",MULTI_LAYER:"Multilayer",SINGLE_LAYER:"Singlelayer",TABLE:"Table"};function l(e){const{portal:t,isOrgItem:r,itemControl:n}=e,o=t.user?.privileges;let i=!o||o.includes("features:user:edit"),s=!!r&&!!o?.includes("features:user:fullEdit");const c="update"===n||"admin"===n;return c?s=i=!0:s&&(i=!0),{features:{edit:i,fullEdit:s},content:{updateItem:c}}}export{u as TypeKeyword,i as addTypeKeyword,l as getUserPrivileges,a as getWGS84ExtentForItem,s as hasTypeKeyword,c as removeTypeKeyword};