@vesium/shared 1.0.1-beta.44 → 1.0.1-beta.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{defined as w,Ellipsoid as g,Cartesian3 as h,Math as d,Cartographic as y,Material as A,CallbackProperty as O,ConstantProperty as W}from"cesium";import{promiseTimeout as k}from"@vueuse/shared";const M=Object.prototype.toString;function R(e){return typeof e<"u"}function N(e){return typeof e=="boolean"}function m(e){return typeof e=="function"}function G(e){return typeof e=="number"}function _(e){return typeof e=="string"}function q(e){return M.call(e)==="[object Object]"}function L(e){return typeof window<"u"&&M.call(e)==="[object Window]"}function p(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function z(e){return!!(e&&e.nodeName&&e.nodeType===1)}const B=Array.isArray;function F(e){return/^\s*data:([a-z]+\/[\d+.a-z-]+(;[a-z-]+=[\da-z-]+)?)?(;base64)?,([\s\w!$%&'()*+,./:;=?@~-]*?)\s*$/i.test(e)}function K(e,t){if(e)throw new Error(t)}function V(e,t){return e===t||m(e?.equals)&&e.equals(t)||m(t?.equals)&&t.equals(e)}function H(e){return!w(e)||!!e.isConstant}function I(e,t,o="auto"){if(o==="pickPosition")return t.pickPosition(e);if(o==="globePick"){const r=t.camera.getPickRay(e);return r&&t.globe.pick(r,t)}else{if(t.globe.depthTestAgainstTerrain)return t.pickPosition(e);const r=t.pickPosition(e),n=t.camera.getPickRay(e),i=n&&t.globe.pick(n,t);if(!r)return i;const a=(r&&g.WGS84.cartesianToCartographic(r).height)??0,c=(i&&g.WGS84.cartesianToCartographic(i).height)??0;return a<c?r:i}}function J(e,t){return t.cartesianToCanvasCoordinates(e)}function x(e,t={}){if(!e)return;const{type:o="Array",alt:r=!1}=t;let n,i,a;if(e instanceof h){const c=g.WGS84.cartesianToCartographic(e);n=d.toDegrees(c.longitude),i=d.toDegrees(c.latitude),a=c.height}else if(e instanceof y){const c=e;n=d.toDegrees(c.longitude),i=d.toDegrees(c.latitude),a=c.height}else Array.isArray(e)?(n=d.toDegrees(e[0]),i=d.toDegrees(e[1]),a=e[2]):(n=e.longitude,i=e.latitude,a=e.height);return o==="Array"?r?[n,i,a]:[n,i]:r?{longitude:n,latitude:i,height:a}:{longitude:n,latitude:i}}function S(e,t=3){const o=`${e}`;let r=o.indexOf(".");const n=r<0?o:o.slice(0,Math.max(0,r));let i="0",a="0";return r>0&&(i=`0${o.slice(Math.max(0,r))}`,i=`${+i*60}`,r=i.indexOf("."),r>0&&(a=`0${i.slice(Math.max(0,r))}`,i=i.slice(0,Math.max(0,r)),a=`${+a*60}`,r=a.indexOf("."),a=a.slice(0,Math.max(0,r+4)),a=(+a).toFixed(t))),`${Math.abs(+n)}\xB0${+i}\u2032${+a}\u2033`}function $(e){const[t,o]=e.split("\xB0")??[],[r,n]=o?.split("\u2032")??[],i=n?.split("\u2033")[0],a=Number(t)||0,c=(Number(r)||0)/60,s=(Number(i)||0)/60/60,l=a+c+s;if(l===0)return 0;{let f=l;return["W","w","S","s"].includes(e[e.length-1])&&(f=-f),f}}function Q(e,t=3){const o=x(e,{alt:!0});if(!o)return;const[r,n,i]=o,a=S(r,t),c=S(n,t);return[`${a}${r>0?"E":"W"}`,`${c}${n>0?"N":"S"}`,i]}function U(e){const[t,o,r]=e,n=$(t),i=$(o);return[n,i,Number(r)||0]}class X extends A{constructor(t){super(t)}}function Y(e){return A._materialCache.getMaterial(e)}function Z(e,t){return A._materialCache.addMaterial(e,t)}function v(e={}){const{primitive:t,id:o,primitiveCollection:r,collection:n}=e,i=o&&o.entityCollection||null,a=i&&i.owner||null;return[...Array.isArray(o)?o:[o].filter(Boolean),t,r,n,i,a].filter(s=>!!s)}function ee(e,t){if(!Array.isArray(t)||!t.length)return!1;const o=v(e);return o.length?o.some(r=>t.includes(r)):!1}function C(e){return e&&m(e.getValue)}function te(e,t){return C(e)?e.getValue(t):e}function E(e,t=!1){return C(e)?e:m(e)?new O(e,t):new W(e)}function re(e,t,o,r){let n;const i=s=>{var l;n?.(),w(s?.definitionChanged)&&(n=(l=s?.definitionChanged)==null?void 0:l.addEventListener(()=>{e.definitionChanged.raiseEvent(e,t,s,s)}))},a=`_${t}`,c=E(o);e[a]=c,i(c),r?Object.defineProperty(e,t,{get(){return e[a]}}):Object.defineProperty(e,t,{get(){return e[a]},set(s){const l=e[a];e[a]!==s&&(e[a]=s,i(s),w(e.definitionChanged)&&e.definitionChanged.raiseEvent(e,t,s,l))}})}function j(e,t,o,r={}){const n=!!r.toProperty,i=!!r.shallowClone,a=r.changedEventKey||"definitionChanged",c=Reflect.get(e,a),s=`_${String(t)}`,l=n?E(o):o;Reflect.set(e,s,l);const f={get(){const u=Reflect.get(e,s);return i?Array.isArray(u)?[...u]:{...u}:u}};let P;const T=(u,b)=>{var D;P?.(),P=(D=u?.definitionChanged)==null?void 0:D.addEventListener(()=>{c?.raiseEvent.bind(c)(e,t,u,b)})};r.readonly||(n&&C(o)&&T(o),f.set=u=>{if(n&&!C(u))throw new Error(`The value of ${String(t)} must be a Cesium.Property object`);const b=Reflect.get(e,s);b!==u&&(Reflect.set(e,s,u),c?.raiseEvent.bind(c)(e,t,u,b),n&&T(u))}),Object.defineProperty(e,t,f)}function ne(e,t,o,r={}){return j(e,t,o,{...r,toProperty:!0})}function ie(e,t=100,o=!0,r=!1){const n=[];let i=!1;const a=async()=>{if(await k(t),i=!1,r)try{e(...n[0])}catch(c){console.error(c)}if(o&&(!r||n.length>1))try{e(...n[n.length-1])}catch(c){console.error(c)}n.length=0};return(...c)=>{n.length<2?n.push(c):n[1]=c,i||(i=!0,a())}}function oe(e){if(e)return e instanceof h?e.clone():e instanceof y?g.WGS84.cartographicToCartesian(e):Array.isArray(e)?h.fromDegrees(e[0],e[1],e[2]):h.fromDegrees(e.longitude,e.latitude,e.height)}function ae(e){if(e)return e instanceof h?g.WGS84.cartesianToCartographic(e):e instanceof y?e.clone():Array.isArray(e)?y.fromDegrees(e[0],e[1],e[2]):y.fromDegrees(e.longitude,e.latitude,e.height)}function ce(e){return(...t)=>{try{return e?.(...t)}catch(o){console.error(o)}}}function se(e,t){const o=new Set(t),r=e.filter(a=>!o.has(a)),n=new Set(e),i=t?.filter(a=>!n.has(a))??[];return{added:r,removed:i}}export{X as CesiumMaterial,Z as addMaterialCache,se as arrayDiff,K as assertError,I as canvasCoordToCartesian,J as cartesianToCanvasCoord,V as cesiumEquals,j as createCesiumAttribute,ne as createCesiumProperty,re as createPropertyField,Q as degreesToDms,$ as dmsDecode,S as dmsEncode,U as dmsToDegrees,Y as getMaterialCache,B as isArray,F as isBase64,N as isBoolean,H as isCesiumConstant,R as isDef,z as isElement,m as isFunction,G as isNumber,q as isObject,p as isPromise,C as isProperty,_ as isString,L as isWindow,ee as pickHitGraphic,v as resolvePick,ie as throttle,oe as toCartesian3,ae as toCartographic,x as toCoord,E as toProperty,te as toPropertyValue,ce as tryRun};
2
- //# sourceMappingURL=index.min.mjs.map
1
+ import{CallbackProperty as e,Cartesian3 as t,Cartographic as n,ConstantProperty as r,Ellipsoid as i,Material as a,Math as o,defined as s}from"cesium";Object.create,Object.defineProperty,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.prototype.hasOwnProperty;function c(e,t){let n=new Set(t),r=e.filter(e=>!n.has(e)),i=new Set(e);return{added:r,removed:t?.filter(e=>!i.has(e))??[]}}function l(e,t,n=`auto`){if(n===`pickPosition`)return t.pickPosition(e);if(n===`globePick`){let n=t.camera.getPickRay(e);return n&&t.globe.pick(n,t)}else{if(t.globe.depthTestAgainstTerrain)return t.pickPosition(e);let n=t.pickPosition(e),r=t.camera.getPickRay(e),a=r&&t.globe.pick(r,t);return n&&((n&&i.WGS84.cartesianToCartographic(n).height)??0)<((a&&i.WGS84.cartesianToCartographic(a).height)??0)?n:a}}function u(e,t){return t.cartesianToCanvasCoordinates(e)}const d=Object.prototype.toString;function f(e){return e!==void 0}function p(e){return typeof e==`boolean`}function m(e){return typeof e==`function`}function h(e){return typeof e==`number`}function g(e){return typeof e==`string`}function _(e){return d.call(e)===`[object Object]`}function v(e){return typeof window<`u`&&d.call(e)===`[object Window]`}function y(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}function b(e){return!!(e&&e.nodeName&&e.nodeType===1)}const x=Array.isArray;function S(e){return/^\s*data:([a-z]+\/[\d+.a-z-]+(;[a-z-]+=[\da-z-]+)?)?(;base64)?,([\s\w!$%&'()*+,./:;=?@~-]*?)\s*$/i.test(e)}function C(e,t){if(e)throw Error(t)}function w(e,t){return e===t||m(e?.equals)&&e.equals(t)||m(t?.equals)&&t.equals(e)}function T(e,r={}){if(!e)return;let{type:a=`Array`,alt:s=!1}=r,c,l,u;if(e instanceof t){let t=i.WGS84.cartesianToCartographic(e);c=o.toDegrees(t.longitude),l=o.toDegrees(t.latitude),u=t.height}else if(e instanceof n){let t=e;c=o.toDegrees(t.longitude),l=o.toDegrees(t.latitude),u=t.height}else Array.isArray(e)?(c=o.toDegrees(e[0]),l=o.toDegrees(e[1]),u=e[2]):(c=e.longitude,l=e.latitude,u=e.height);return a===`Array`?s?[c,l,u]:[c,l]:s?{longitude:c,latitude:l,height:u}:{longitude:c,latitude:l}}function E(e,t=3){let n=`${e}`,r=n.indexOf(`.`),i=r<0?n:n.slice(0,Math.max(0,r)),a=`0`,o=`0`;return r>0&&(a=`0${n.slice(Math.max(0,r))}`,a=`${a*60}`,r=a.indexOf(`.`),r>0&&(o=`0${a.slice(Math.max(0,r))}`,a=a.slice(0,Math.max(0,r)),o=`${o*60}`,r=o.indexOf(`.`),o=o.slice(0,Math.max(0,r+4)),o=(+o).toFixed(t))),`${Math.abs(+i)}°${+a}′${+o}″`}function D(e){let[t,n]=e.split(`°`)??[],[r,i]=n?.split(`′`)??[],a=i?.split(`″`)[0],o=Number(t)||0,s=(Number(r)||0)/60,c=(Number(a)||0)/60/60,l=o+s+c;if(l===0)return 0;{let t=l;return[`W`,`w`,`S`,`s`].includes(e[e.length-1])&&(t=-t),t}}function O(e,t=3){let n=T(e,{alt:!0});if(!n)return;let[r,i,a]=n,o=E(r,t),s=E(i,t);return[`${o}${r>0?`E`:`W`}`,`${s}${i>0?`N`:`S`}`,a]}function k(e){let[t,n,r]=e;return[D(t),D(n),Number(r)||0]}function A(e){return!s(e)||!!e.isConstant}var j=class extends a{constructor(e){super(e)}};function M(e){return a._materialCache.getMaterial(e)}function N(e,t){return a._materialCache.addMaterial(e,t)}function P(e={}){let{primitive:t,id:n,primitiveCollection:r,collection:i}=e,a=n&&n.entityCollection||null,o=a&&a.owner||null;return[...Array.isArray(n)?n:[n].filter(Boolean),t,r,i,a,o].filter(e=>!!e)}function F(e,t){if(!Array.isArray(t)||!t.length)return!1;let n=P(e);return n.length?n.some(e=>t.includes(e)):!1}function I(e){return e&&m(e.getValue)}function L(e,t){return I(e)?e.getValue(t):e}function R(t,n=!1){return I(t)?t:m(t)?new e(t,n):new r(t)}function z(e,t,n,r){let i,a=n=>{i?.(),s(n?.definitionChanged)&&(i=n?.definitionChanged?.addEventListener(()=>{e.definitionChanged.raiseEvent(e,t,n,n)}))},o=`_${t}`,c=R(n);e[o]=c,a(c),r?Object.defineProperty(e,t,{get(){return e[o]}}):Object.defineProperty(e,t,{get(){return e[o]},set(n){let r=e[o];e[o]!==n&&(e[o]=n,a(n),s(e.definitionChanged)&&e.definitionChanged.raiseEvent(e,t,n,r))}})}function B(e,t,n,r={}){let i=!!r.toProperty,a=!!r.shallowClone,o=r.changedEventKey||`definitionChanged`,s=Reflect.get(e,o),c=`_${String(t)}`,l=i?R(n):n;Reflect.set(e,c,l);let u={get(){let t=Reflect.get(e,c);return a?Array.isArray(t)?[...t]:{...t}:t}},d,f=(n,r)=>{d?.(),d=n?.definitionChanged?.addEventListener(()=>{s?.raiseEvent.bind(s)(e,t,n,r)})};r.readonly||(i&&I(n)&&f(n),u.set=n=>{if(i&&!I(n))throw Error(`The value of ${String(t)} must be a Cesium.Property object`);let r=Reflect.get(e,c);r!==n&&(Reflect.set(e,c,n),s?.raiseEvent.bind(s)(e,t,n,r),i&&f(n))}),Object.defineProperty(e,t,u)}function V(e,t,n,r={}){return B(e,t,n,{...r,toProperty:!0})}typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;function H(e,t=!1,n=`Timeout`){return new Promise((r,i)=>{t?setTimeout(()=>i(n),e):setTimeout(r,e)})}function U(e,t=100,n=!0,r=!1){let i=[],a=!1,o=async()=>{if(await H(t),a=!1,r)try{e(...i[0])}catch(e){console.error(e)}if(n&&(!r||i.length>1))try{e(...i[i.length-1])}catch(e){console.error(e)}i.length=0};return(...e)=>{i.length<2?i.push(e):i[1]=e,a||(a=!0,o())}}function W(e){if(e)return e instanceof t?e.clone():e instanceof n?i.WGS84.cartographicToCartesian(e):Array.isArray(e)?t.fromDegrees(e[0],e[1],e[2]):t.fromDegrees(e.longitude,e.latitude,e.height)}function G(e){if(e)return e instanceof t?i.WGS84.cartesianToCartographic(e):e instanceof n?e.clone():Array.isArray(e)?n.fromDegrees(e[0],e[1],e[2]):n.fromDegrees(e.longitude,e.latitude,e.height)}function K(e){return((...t)=>{try{return e?.(...t)}catch(e){console.error(e)}})}export{j as CesiumMaterial,N as addMaterialCache,c as arrayDiff,C as assertError,l as canvasCoordToCartesian,u as cartesianToCanvasCoord,w as cesiumEquals,B as createCesiumAttribute,V as createCesiumProperty,z as createPropertyField,O as degreesToDms,D as dmsDecode,E as dmsEncode,k as dmsToDegrees,M as getMaterialCache,x as isArray,S as isBase64,p as isBoolean,A as isCesiumConstant,f as isDef,b as isElement,m as isFunction,h as isNumber,_ as isObject,y as isPromise,I as isProperty,g as isString,v as isWindow,F as pickHitGraphic,P as resolvePick,U as throttle,W as toCartesian3,G as toCartographic,T as toCoord,R as toProperty,L as toPropertyValue,K as tryRun};
2
+ //# sourceMappingURL=index.min.mjs.map