vis-core 0.30.0-beta.2 → 0.30.0-beta.3

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.
@@ -4,7 +4,7 @@ var Yn = Object.getOwnPropertyDescriptors;
4
4
  var In = Object.getOwnPropertySymbols, Hn = Object.getPrototypeOf, Un = Object.prototype.hasOwnProperty, Bn = Object.prototype.propertyIsEnumerable, On = Reflect.get;
5
5
  var Cn = (o, e) => (e = Symbol[o]) ? e : Symbol.for("Symbol." + o), Dn = (o) => {
6
6
  throw TypeError(o);
7
- }, bn = Math.pow, En = (o, e, n) => e in o ? kn(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n, q0 = (o, e) => {
7
+ }, fn = Math.pow, En = (o, e, n) => e in o ? kn(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n, q0 = (o, e) => {
8
8
  for (var n in e || (e = {}))
9
9
  Un.call(e, n) && En(o, n, e[n]);
10
10
  if (In)
@@ -63,7 +63,7 @@ import { continentsCountriesIso2 } from "geojson-cn";
63
63
  Array.prototype.at || (Array.prototype.at = function(o) {
64
64
  return o < 0 && (o = this.length + o), this[o];
65
65
  });
66
- const version = "0.30.0-beta.2", publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t", accessToken = {
66
+ const version = "0.30.0-beta.3", publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t", accessToken = {
67
67
  token: void 0,
68
68
  getInfo() {
69
69
  if (!this.token)
@@ -9120,7 +9120,7 @@ class Mesh extends Object3D {
9120
9120
  */
9121
9121
  raycast(e, n) {
9122
9122
  const r = this.geometry, w = this.material, E = this.matrixWorld;
9123
- w !== void 0 && (r.boundingSphere === null && r.computeBoundingSphere(), _sphere$6.copy(r.boundingSphere), _sphere$6.applyMatrix4(E), _ray$3.copy(e.ray).recast(e.near), !(_sphere$6.containsPoint(_ray$3.origin) === !1 && (_ray$3.intersectSphere(_sphere$6, _sphereHitAt) === null || _ray$3.origin.distanceToSquared(_sphereHitAt) > bn(e.far - e.near, 2))) && (_inverseMatrix$3.copy(E).invert(), _ray$3.copy(e.ray).applyMatrix4(_inverseMatrix$3), !(r.boundingBox !== null && _ray$3.intersectsBox(r.boundingBox) === !1) && this._computeIntersections(e, n, _ray$3)));
9123
+ w !== void 0 && (r.boundingSphere === null && r.computeBoundingSphere(), _sphere$6.copy(r.boundingSphere), _sphere$6.applyMatrix4(E), _ray$3.copy(e.ray).recast(e.near), !(_sphere$6.containsPoint(_ray$3.origin) === !1 && (_ray$3.intersectSphere(_sphere$6, _sphereHitAt) === null || _ray$3.origin.distanceToSquared(_sphereHitAt) > fn(e.far - e.near, 2))) && (_inverseMatrix$3.copy(E).invert(), _ray$3.copy(e.ray).applyMatrix4(_inverseMatrix$3), !(r.boundingBox !== null && _ray$3.intersectsBox(r.boundingBox) === !1) && this._computeIntersections(e, n, _ray$3)));
9124
9124
  }
9125
9125
  _computeIntersections(e, n, r) {
9126
9126
  let w;
@@ -34280,8 +34280,8 @@ class WebGLRenderer {
34280
34280
  if ((cn.position !== void 0 || cn.normal !== void 0 || cn.color !== void 0) && Ai.update(c0, m0, ji), (Ji || Ei.receiveShadow !== c0.receiveShadow) && (Ei.receiveShadow = c0.receiveShadow, Ui.setValue(o0, "receiveShadow", c0.receiveShadow)), a0.isMeshGouraudMaterial && a0.envMap !== null && (on.envMap.value = N0, on.flipEnvMap.value = N0.isCubeTexture && N0.isRenderTargetTexture === !1 ? -1 : 1), a0.isMeshStandardMaterial && a0.envMap === null && l0.environment !== null && (on.envMapIntensity.value = l0.environmentIntensity), on.dfgLUT !== void 0 && (on.dfgLUT.value = getDFGLUT()), Ji && (Ui.setValue(o0, "toneMappingExposure", wt.toneMappingExposure), Ei.needsLights && mn(on, Di), S0 && a0.fog === !0 && Ti.refreshFogUniforms(on, S0), Ti.refreshMaterialUniforms(on, a0, h0, e0, bt.state.transmissionRenderTarget[jt.id]), WebGLUniforms.upload(o0, Ln(Ei), on, F0)), a0.isShaderMaterial && a0.uniformsNeedUpdate === !0 && (WebGLUniforms.upload(o0, Ln(Ei), on, F0), a0.uniformsNeedUpdate = !1), a0.isSpriteMaterial && Ui.setValue(o0, "center", c0.center), Ui.setValue(o0, "modelViewMatrix", c0.modelViewMatrix), Ui.setValue(o0, "normalMatrix", c0.normalMatrix), Ui.setValue(o0, "modelMatrix", c0.matrixWorld), a0.isShaderMaterial || a0.isRawShaderMaterial) {
34281
34281
  const qi = a0.uniformsGroups;
34282
34282
  for (let ln = 0, Pn = qi.length; ln < Pn; ln++) {
34283
- const fn = qi[ln];
34284
- Ri.update(fn, ji), Ri.bind(fn, ji);
34283
+ const bn = qi[ln];
34284
+ Ri.update(bn, ji), Ri.bind(bn, ji);
34285
34285
  }
34286
34286
  }
34287
34287
  return ji;
@@ -34416,8 +34416,8 @@ class WebGLRenderer {
34416
34416
  if (jt.isDepthTexture) {
34417
34417
  const cn = C0.get(jt), qi = C0.get(l0), ln = C0.get(cn.__renderTarget), Pn = C0.get(qi.__renderTarget);
34418
34418
  G0.bindFramebuffer(o0.READ_FRAMEBUFFER, ln.__webglFramebuffer), G0.bindFramebuffer(o0.DRAW_FRAMEBUFFER, Pn.__webglFramebuffer);
34419
- for (let fn = 0; fn < N0; fn++)
34420
- Ui && (o0.framebufferTextureLayer(o0.READ_FRAMEBUFFER, o0.COLOR_ATTACHMENT0, C0.get(jt).__webglTexture, c0, $0 + fn), o0.framebufferTextureLayer(o0.DRAW_FRAMEBUFFER, o0.COLOR_ATTACHMENT0, C0.get(l0).__webglTexture, S0, Pi + fn)), o0.blitFramebuffer(k0, B0, M0, R0, bi, Si, M0, R0, o0.DEPTH_BUFFER_BIT, o0.NEAREST);
34419
+ for (let bn = 0; bn < N0; bn++)
34420
+ Ui && (o0.framebufferTextureLayer(o0.READ_FRAMEBUFFER, o0.COLOR_ATTACHMENT0, C0.get(jt).__webglTexture, c0, $0 + bn), o0.framebufferTextureLayer(o0.DRAW_FRAMEBUFFER, o0.COLOR_ATTACHMENT0, C0.get(l0).__webglTexture, S0, Pi + bn)), o0.blitFramebuffer(k0, B0, M0, R0, bi, Si, M0, R0, o0.DEPTH_BUFFER_BIT, o0.NEAREST);
34421
34421
  G0.bindFramebuffer(o0.READ_FRAMEBUFFER, null), G0.bindFramebuffer(o0.DRAW_FRAMEBUFFER, null);
34422
34422
  } else if (c0 !== 0 || jt.isRenderTargetTexture || C0.has(jt)) {
34423
34423
  const cn = C0.get(jt), qi = C0.get(l0);
@@ -37962,7 +37962,7 @@ function geo_delaunay_from(o) {
37962
37962
  const w = [];
37963
37963
  let E = 1;
37964
37964
  for (let ze = 0, Fe = o.length; ze < Fe; ze++) {
37965
- let ke = bn(o[ze][0], 2) + bn(o[ze][1], 2);
37965
+ let ke = fn(o[ze][0], 2) + fn(o[ze][1], 2);
37966
37966
  !isFinite(ke) || ke > 1e32 ? w.push(ze) : ke > E && (E = ke);
37967
37967
  }
37968
37968
  const O = 1e6 * sqrt(E);
@@ -40411,7 +40411,7 @@ function _populateBuffer(o, e) {
40411
40411
  }
40412
40412
  }
40413
40413
  function generateIndirectBuffer(o, e) {
40414
- const n = (o.index ? o.index.count : o.attributes.position.count) / 3, r = n > bn(2, 16), w = r ? 4 : 2, E = e ? new SharedArrayBuffer(n * w) : new ArrayBuffer(n * w), O = r ? new Uint32Array(E) : new Uint16Array(E);
40414
+ const n = (o.index ? o.index.count : o.attributes.position.count) / 3, r = n > fn(2, 16), w = r ? 4 : 2, E = e ? new SharedArrayBuffer(n * w) : new ArrayBuffer(n * w), O = r ? new Uint32Array(E) : new Uint16Array(E);
40415
40415
  for (let j = 0, le = O.length; j < le; j++)
40416
40416
  O[j] = j;
40417
40417
  return O;
@@ -60056,7 +60056,7 @@ const l = {
60056
60056
  let w = o.clone().add(e);
60057
60057
  w = w.normalize().multiplyScalar(n);
60058
60058
  let E;
60059
- r <= 1 ? E = n / 5 * r : r > 1 && r < 2 ? E = n / 5 * bn(r, 2) : E = n / 5 * bn(r, 1.5);
60059
+ r <= 1 ? E = n / 5 * r : r > 1 && r < 2 ? E = n / 5 * fn(r, 2) : E = n / 5 * fn(r, 1.5);
60060
60060
  const O = o.clone().add(w).normalize().multiplyScalar(n + E), j = e.clone().add(w).normalize().multiplyScalar(n + E);
60061
60061
  return new CubicBezierCurve3(o, O, j, e);
60062
60062
  }, createFlyPath2 = (o, e, n = 40) => {
@@ -144677,15 +144677,28 @@ const objs$1 = Bi(q0({}, objs$3), {
144677
144677
  const le = n();
144678
144678
  if (!le.length) return;
144679
144679
  this.pencil.controls.getPosition(E, !1);
144680
- const fe = w.clone().sub(E), Se = Math.sqrt(
144681
- Math.pow(fe.length(), 2) - Math.pow(O, 2)
144682
- ), ze = le.map((Fe) => Fe.position.clone().sub(E).length() > Se);
144680
+ const fe = w.clone().sub(E), Se = Math.sqrt(fn(fe.length(), 2) - fn(O, 2)), ze = le.map((Fe) => Fe.position.clone().sub(E).length() > Se);
144683
144681
  r(le, ze);
144684
144682
  };
144685
144683
  j(), this.pencil.controls.addEventListener("update", () => {
144686
144684
  j();
144687
144685
  });
144688
144686
  }
144687
+ /**
144688
+ * 设置物体在球面上的位置和旋转,使其垂直于球面
144689
+ * @param object - 要设置的物体
144690
+ * @param location - 经纬度 [经度, 纬度]
144691
+ * @param height - 距离球面的高度,默认为0
144692
+ * @param upAxis - 物体的up轴方向,默认为Y轴 [0, 1, 0]
144693
+ */
144694
+ setObjectOnSphere(n, r, w = 0, E = [0, 1, 0]) {
144695
+ const O = n.rotation.clone(), j = this.getLocationPosition(r, w);
144696
+ n.position.set(...j);
144697
+ const le = new Vector3(...j).normalize(), fe = new Vector3(...E);
144698
+ fe.applyEuler(O);
144699
+ const Se = new Quaternion().setFromUnitVectors(fe, le);
144700
+ n.object3d.applyQuaternion(Se);
144701
+ }
144689
144702
  };
144690
144703
  v0(wn, "VisName", "earth");
144691
144704
  let index$1 = wn;
@@ -145993,6 +146006,16 @@ const getLabelElement = (o) => {
145993
146006
  const [r, w] = n, [E, O] = this.projection([r, w]);
145994
146007
  return [E, -O, this.mapObj ? this.mapObj.z + this.mapObj.depth : 0];
145995
146008
  }
146009
+ /**
146010
+ * 设置物体在平面地图上的位置
146011
+ * @param object - 要设置的物体
146012
+ * @param location - 经纬度 [经度, 纬度]
146013
+ * @param height - 距离地图平面的高度,默认为0
146014
+ */
146015
+ setObjectOnMap(n, r, w = 0) {
146016
+ const E = this.getLocationPosition(r);
146017
+ n.position.set(E[0], E[1], E[2] + w);
146018
+ }
145996
146019
  getAdcodeScreenPosition(n) {
145997
146020
  const r = this.geAdcodePosition(n);
145998
146021
  if (r) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.30.0-beta.2";
1
+ declare const _default: "0.30.0-beta.3";
2
2
  export default _default;
@@ -1,9 +1,9 @@
1
- import Base, { BaseOptions } from "../base";
1
+ import Base, { type BaseOptions } from "../base";
2
2
  import leadObjs from "./objects";
3
- import { BaseObject, Lead } from 'gl-draw';
3
+ import type { BaseObject, Lead } from 'gl-draw';
4
4
  import { MeshLineMaterial } from 'gl-draw/dist/objects';
5
5
  import * as THREE from 'three';
6
- import PlaneMap from '../map/objects/PlaneMap';
6
+ import type PlaneMap from '../map/objects/PlaneMap';
7
7
  interface EarthOptions extends BaseOptions {
8
8
  mapDepth?: number;
9
9
  otherMapDepth?: number;
@@ -74,5 +74,13 @@ export default class extends Base {
74
74
  }): Promise<PlaneMap | undefined>;
75
75
  getRadius(): number;
76
76
  checkBehindEarth(objArr: () => BaseObject[], cb: (obj: BaseObject[], res: boolean[]) => any): void;
77
+ /**
78
+ * 设置物体在球面上的位置和旋转,使其垂直于球面
79
+ * @param object - 要设置的物体
80
+ * @param location - 经纬度 [经度, 纬度]
81
+ * @param height - 距离球面的高度,默认为0
82
+ * @param upAxis - 物体的up轴方向,默认为Y轴 [0, 1, 0]
83
+ */
84
+ setObjectOnSphere(object: BaseObject, location: [number, number], height?: number, upAxis?: [number, number, number]): void;
77
85
  }
78
86
  export {};
@@ -219,6 +219,13 @@ export default class extends Base {
219
219
  eraseLabels(): void;
220
220
  geAdcodePosition(adcode: number): [number, number, number] | undefined;
221
221
  getLocationPosition(location: [number, number]): [number, number, number];
222
+ /**
223
+ * 设置物体在平面地图上的位置
224
+ * @param object - 要设置的物体
225
+ * @param location - 经纬度 [经度, 纬度]
226
+ * @param height - 距离地图平面的高度,默认为0
227
+ */
228
+ setObjectOnMap(object: BaseObject, location: [number, number], height?: number): void;
222
229
  getAdcodeScreenPosition(adcode: number): {
223
230
  x: number;
224
231
  y: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.30.0-beta.2",
3
+ "version": "0.30.0-beta.3",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && PUBLIC_EXCLUDE=true bundler",