@shjjs/visual-ui 2.0.6 → 3.0.0

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,8 +1,8 @@
1
- import { defineComponent as $, computed as le, watch as u, createElementBlock as O, unref as B, openBlock as W, normalizeClass as oe, createElementVNode as w, shallowRef as P, ref as h, onMounted as se, onUnmounted as ie } from "vue";
2
- import ne from "@amap/amap-jsapi-loader";
3
- import ce from "axios";
4
- import { nanoid as me } from "nanoid";
5
- import { debounce as x } from "lodash";
1
+ import { defineComponent as N, computed as ie, watch as u, createElementBlock as S, openBlock as L, createElementVNode as E, createCommentVNode as D, normalizeClass as ne, unref as w, toDisplayString as ce, shallowRef as J, ref as h, onMounted as me, onUnmounted as de } from "vue";
2
+ import ue from "@amap/amap-jsapi-loader";
3
+ import ye from "axios";
4
+ import { nanoid as pe } from "nanoid";
5
+ import { debounce as M } from "lodash";
6
6
  /* empty css */
7
7
  /* empty css */
8
8
  import "../../../Interaction/components/Tabs/index.mjs";
@@ -157,14 +157,18 @@ import "../UnityIframe/index.mjs";
157
157
  import "../UnityWebgl/index.mjs";
158
158
  import "../Vr/index.mjs";
159
159
  import "../Earth/index.mjs";
160
- import { SHJDatasourceV2 as de } from "../../../../commons/plugins/datasource/index.mjs";
160
+ import { SHJDatasourceV2 as ge } from "../../../../commons/plugins/datasource/index.mjs";
161
161
  import { SHJParseEvent as p } from "../../../../commons/plugins/event/index.mjs";
162
- import { upgradeAmap3d as ue } from "./version.mjs";
163
- const ye = {
164
- key: 1,
165
- class: "w-full h-full flex flex-col items-center justify-center"
166
- }, pe = $({ name: "ShjAmap3d" }), gr = /* @__PURE__ */ $({
167
- ...pe,
162
+ import { upgradeAmap3d as fe } from "./version.mjs";
163
+ const ve = { class: "relative w-full h-full" }, he = {
164
+ key: 0,
165
+ class: "empty-wrap"
166
+ }, ke = {
167
+ key: 0,
168
+ class: "iconfont shj-gaodeditu",
169
+ style: { "font-size": "48px" }
170
+ }, be = { class: "text-gray-500" }, ze = N({ name: "ShjAmap3d" }), wr = /* @__PURE__ */ N({
171
+ ...ze,
168
172
  props: {
169
173
  option: {},
170
174
  sources: {},
@@ -180,12 +184,12 @@ const ye = {
180
184
  "amap3d-scene-dragend",
181
185
  "amap3d-scene-pulseLinkLayer"
182
186
  ],
183
- setup(m, { expose: J, emit: D }) {
184
- const s = le(() => ue(m.option)), y = D, T = () => {
185
- const o = P(), c = P(), L = h(!1), k = h(), b = h(), z = h(), d = h(), E = (t) => {
186
- I(), window._AMapSecurityConfig = {
187
+ setup(m, { expose: T, emit: F }) {
188
+ const o = ie(() => fe(m.option)), y = F, G = () => {
189
+ const s = J(), c = J(), x = h(!1), k = h(), b = h(), z = h(), d = h(), C = h(""), B = (t) => {
190
+ $(), window._AMapSecurityConfig = {
187
191
  securityJsCode: t.basic.securityJsCode
188
- }, ne.load({
192
+ }, ue.load({
189
193
  key: t.basic.key,
190
194
  // 申请好的Web端开发者Key,首次调用 load 时必填
191
195
  version: "2.0",
@@ -212,7 +216,7 @@ const ye = {
212
216
  zIndex: 0
213
217
  // 叠加层级
214
218
  });
215
- o.value = new e.Map("zerov-amap-3d", {
219
+ s.value = new e.Map("zerov-amap-3d", {
216
220
  rotateEnable: t.config.rotateEnable,
217
221
  // 是否开启地图旋转交互 鼠标右键 + 鼠标画圈移动 或 键盘Ctrl + 鼠标画圈移动
218
222
  pitchEnable: t.config.pitchEnable,
@@ -239,47 +243,47 @@ const ye = {
239
243
  skyColor: t.config.skyColor,
240
244
  layers: [a]
241
245
  }), c.value = new window.Loca.Container({
242
- map: o.value
246
+ map: s.value
243
247
  }), z.value = new d.value.Scale({
244
248
  visible: t.config.plugin.scale.visible,
245
249
  position: {
246
250
  left: t.config.plugin.scale.position.left + "px",
247
251
  bottom: t.config.plugin.scale.position.bottom + "px"
248
252
  }
249
- }), o.value.addControl(z.value), k.value = new e.ControlBar({
253
+ }), s.value.addControl(z.value), k.value = new e.ControlBar({
250
254
  visible: t.config.plugin.controlBar.visible,
251
255
  showControlButton: t.config.plugin.controlBar.showControlButton,
252
256
  position: {
253
257
  right: t.config.plugin.controlBar.position.right + "px",
254
258
  top: t.config.plugin.controlBar.position.top + "px"
255
259
  }
256
- }), o.value.addControl(k.value), b.value = new e.ToolBar({
260
+ }), s.value.addControl(k.value), b.value = new e.ToolBar({
257
261
  visible: t.config.plugin.toolBar.visible,
258
262
  position: {
259
263
  left: t.config.plugin.toolBar.position.left + "px",
260
264
  top: t.config.plugin.toolBar.position.top + "px"
261
265
  }
262
- }), o.value.addControl(b.value), M(e), o.value.on("complete", () => {
266
+ }), s.value.addControl(b.value), W(e), s.value.on("complete", () => {
263
267
  setTimeout(() => {
264
- L.value = !0, y("amap3d-scene-success"), p.parseEvents(m.useEvents, "amap3d-scene-success", null);
268
+ x.value = !0, y("amap3d-scene-success"), p.parseEvents(m.useEvents, "amap3d-scene-success", null), C.value = "";
265
269
  }, 666);
266
- }), o.value.on("zoomstart", () => {
270
+ }), s.value.on("zoomstart", () => {
267
271
  y("amap3d-scene-zoomstart"), p.parseEvents(m.useEvents, "amap3d-scene-zoomstart", null);
268
- }), o.value.on("zoomend", () => {
272
+ }), s.value.on("zoomend", () => {
269
273
  y("amap3d-scene-zoomend"), p.parseEvents(m.useEvents, "amap3d-scene-zoomend", null);
270
- }), o.value.on("click", (r) => {
274
+ }), s.value.on("click", (r) => {
271
275
  y("amap3d-scene-mapclick", r.lnglat), p.parseEvents(
272
276
  m.useEvents,
273
277
  "amap3d-scene-mapclick",
274
278
  r.lnglat
275
279
  );
276
- }), o.value.on("dragstart", (r) => {
280
+ }), s.value.on("dragstart", (r) => {
277
281
  y("amap3d-scene-dragstart", r.lnglat), p.parseEvents(
278
282
  m.useEvents,
279
283
  "amap3d-scene-dragstart",
280
284
  r.lnglat
281
285
  );
282
- }), o.value.on("dragend", (r) => {
286
+ }), s.value.on("dragend", (r) => {
283
287
  y("amap3d-scene-dragend", r.lnglat), p.parseEvents(
284
288
  m.useEvents,
285
289
  "amap3d-scene-dragend",
@@ -287,69 +291,70 @@ const ye = {
287
291
  );
288
292
  });
289
293
  }).catch((e) => {
294
+ x.value = !1, C.value = "缺少必要的Key和密钥,请先在右侧配置面板中进行配置";
290
295
  });
291
- }, M = x((t) => {
292
- m.sources && m.sources.length > 0 ? s.value.widgets.forEach((a, r) => {
293
- de.parse({
296
+ }, W = M((t) => {
297
+ m.sources && m.sources.length > 0 ? o.value.widgets.forEach((a, r) => {
298
+ ge.parse({
294
299
  sources: [m.sources[r]],
295
300
  callback: (l) => {
296
301
  try {
297
- a && a.type === "heatmap" && V(
302
+ a && a.type === "heatmap" && K(
298
303
  window.Loca,
299
304
  a,
300
305
  f(l.data[0].data, "Point")
301
- ), a && a.type === "dotlayers" && U(
306
+ ), a && a.type === "dotlayers" && Q(
302
307
  window.Loca,
303
308
  a,
304
309
  f(l.data[0].data, "Point")
305
- ), a && a.type === "scatter" && q(
310
+ ), a && a.type === "scatter" && X(
306
311
  window.Loca,
307
312
  a,
308
313
  f(l.data[0].data, "Point")
309
- ), a && a.type === "labelsLayer" && K(
314
+ ), a && a.type === "labelsLayer" && Y(
310
315
  window.Loca,
311
316
  a,
312
317
  f(l.data[0].data, "Point")
313
- ), a && a.type === "signagePoints" && Q(
318
+ ), a && a.type === "signagePoints" && _(
314
319
  window.Loca,
315
320
  a,
316
321
  f(l.data[0].data, "Point")
317
- ), a && a.type === "pulseLinkLayer" && X(
322
+ ), a && a.type === "pulseLinkLayer" && ee(
318
323
  window.Loca,
319
324
  a,
320
325
  f(l.data[0].data, "LineString")
321
326
  );
322
327
  } catch {
323
328
  }
324
- s.value.widgets.filter((i) => i.type === "boundary").forEach((i) => {
325
- A(t, i);
329
+ o.value.widgets.filter((i) => i.type === "boundary").forEach((i) => {
330
+ P(t, i);
326
331
  });
327
332
  }
328
333
  });
329
- }) : s.value.widgets.filter((a) => a.type === "boundary").forEach((a) => {
330
- A(t, a);
334
+ }) : o.value.widgets.filter((a) => a.type === "boundary").forEach((a) => {
335
+ P(t, a);
331
336
  });
332
- const e = o.value.getLayers();
337
+ const e = s.value.getLayers();
333
338
  for (let a = 0; a < e.length; a++)
334
- (e[a].type === "sketchTileLayer" || e[a]._opts.type === "sketchImageLayer") && o.value.removeLayer(e[a]);
335
- s.value.widgets.filter((a) => a.type === "sketchTile").forEach((a) => {
336
- const r = j(a);
337
- r && o.value.addLayer(r);
338
- }), s.value.widgets.filter((a) => a.type === "sketchImage").forEach((a) => {
339
- const r = R(a);
340
- o.value.addLayer(r);
339
+ (e[a].type === "sketchTileLayer" || e[a]._opts.type === "sketchImageLayer") && s.value.removeLayer(e[a]);
340
+ o.value.widgets.filter((a) => a.type === "sketchTile").forEach((a) => {
341
+ const r = U(a);
342
+ r && s.value.addLayer(r);
343
+ }), o.value.widgets.filter((a) => a.type === "sketchImage").forEach((a) => {
344
+ const r = q(a);
345
+ s.value.addLayer(r);
341
346
  });
342
- }, 200), Z = (t) => {
347
+ }, 200), V = (t) => {
343
348
  const a = t.slice(
344
349
  t.indexOf("(") + 1,
345
350
  t.lastIndexOf(")")
346
351
  ).split(",").map((l) => l.trim()), r = {};
347
352
  for (let l = 1; l < a.length; l++) {
348
- const i = a[l].split(" "), n = i[0], v = parseFloat(i[1]) / 100, re = Math.round(v * 100) / 100;
349
- r[re] = n;
353
+ const i = a[l].split(" "), n = i[0], v = parseFloat(i[1]) / 100, oe = Math.round(v * 100) / 100;
354
+ r[oe] = n;
350
355
  }
351
356
  return r;
352
- }, j = (t) => {
357
+ }, U = (t) => {
353
358
  try {
354
359
  return new d.value.TileLayer({
355
360
  bounds: new d.value.Bounds(
@@ -371,7 +376,7 @@ const ye = {
371
376
  } catch {
372
377
  }
373
378
  return null;
374
- }, R = (t) => {
379
+ }, q = (t) => {
375
380
  try {
376
381
  return new d.value.ImageLayer({
377
382
  bounds: new d.value.Bounds(
@@ -390,7 +395,7 @@ const ye = {
390
395
  } catch {
391
396
  }
392
397
  return null;
393
- }, V = (t, e, a) => {
398
+ }, K = (t, e, a) => {
394
399
  try {
395
400
  const r = new t.HeatMapLayer({
396
401
  zIndex: 10,
@@ -405,7 +410,7 @@ const ye = {
405
410
  unit: e.style.unit,
406
411
  height: e.style.height,
407
412
  opacity: e.style.opacity,
408
- gradient: Z(e.style.gradient),
413
+ gradient: V(e.style.gradient),
409
414
  value: function(i, n) {
410
415
  return n.coordinates[2] || 0;
411
416
  },
@@ -416,9 +421,9 @@ const ye = {
416
421
  }), c.value.add(r);
417
422
  } catch {
418
423
  }
419
- }, A = async (t, e) => {
424
+ }, P = async (t, e) => {
420
425
  try {
421
- const a = await ce.get(e.geojson);
426
+ const a = await ye.get(e.geojson);
422
427
  if (a.status === 200) {
423
428
  const r = new t.GeoJSON({
424
429
  geoJSON: a.data,
@@ -466,11 +471,11 @@ const ye = {
466
471
  }), n;
467
472
  }
468
473
  });
469
- o.value.add(r);
474
+ s.value.add(r);
470
475
  }
471
476
  } catch {
472
477
  }
473
- }, U = (t, e, a) => {
478
+ }, Q = (t, e, a) => {
474
479
  try {
475
480
  const r = new t.GeoJSONSource({
476
481
  data: a
@@ -500,7 +505,7 @@ const ye = {
500
505
  });
501
506
  } catch {
502
507
  }
503
- }, q = (t, e, a) => {
508
+ }, X = (t, e, a) => {
504
509
  try {
505
510
  const r = new t.GeoJSONSource({
506
511
  data: a
@@ -521,7 +526,7 @@ const ye = {
521
526
  }), c.value.animate.start();
522
527
  } catch {
523
528
  }
524
- }, K = (t, e, a) => {
529
+ }, Y = (t, e, a) => {
525
530
  try {
526
531
  const r = new t.GeoJSONSource({
527
532
  data: a
@@ -571,7 +576,7 @@ const ye = {
571
576
  }), c.value.add(l);
572
577
  } catch {
573
578
  }
574
- }, Q = (t, e, a) => {
579
+ }, _ = (t, e, a) => {
575
580
  try {
576
581
  const r = new t.GeoJSONSource({
577
582
  data: a
@@ -640,7 +645,7 @@ const ye = {
640
645
  }), c.value.add(i), c.value.animate.start();
641
646
  } catch {
642
647
  }
643
- }, X = (t, e, a) => {
648
+ }, ee = (t, e, a) => {
644
649
  const r = new t.PulseLinkLayer({
645
650
  zIndex: e.zIndex,
646
651
  opacity: e.opacity,
@@ -668,7 +673,7 @@ const ye = {
668
673
  // 弧顶位置比例
669
674
  headColor: e.style.headColor,
670
675
  trailColor: e.style.trailColor
671
- }), o.value.on("click", (i) => {
676
+ }), s.value.on("click", (i) => {
672
677
  const n = r.queryFeature(i.pixel.toArray());
673
678
  n && (y("amap3d-scene-pulseLinkLayer", n), p.parseEvents(
674
679
  m.useEvents,
@@ -684,7 +689,7 @@ const ye = {
684
689
  return t.forEach((r) => {
685
690
  const l = {
686
691
  type: "Feature",
687
- id: me(),
692
+ id: pe(),
688
693
  properties: {
689
694
  type: e === "Point" ? e : 0,
690
695
  ...r
@@ -696,123 +701,124 @@ const ye = {
696
701
  };
697
702
  a.features.push(l);
698
703
  }), a;
699
- }, Y = (t) => {
700
- o.value.setFeatures(t.config.features), o.value.setPitch(t.config.pitch), o.value.setRotation(t.config.rotation), o.value.setStatus({
704
+ }, te = (t) => {
705
+ s.value && (s.value.setFeatures(t.config.features), s.value.setPitch(t.config.pitch), s.value.setRotation(t.config.rotation), s.value.setStatus({
701
706
  dragEnable: t.config.dragEnable,
702
707
  zoomEnable: t.config.zoomEnable,
703
708
  rotateEnable: t.config.rotateEnable,
704
709
  pitchEnable: t.config.pitchEnable
705
- }), t.config.plugin.scale.visible ? z.value.show() : z.value.hide(), t.config.plugin.toolBar.visible ? b.value.show() : b.value.hide(), t.config.plugin.controlBar.visible ? k.value.show() : k.value.hide();
706
- }, _ = () => {
707
- o.value && (o.value.clearMap(), c.value.clear(), M(d.value));
708
- }, ee = (t) => {
709
- o.value.setMapStyle(t.config.mapStyle);
710
- }, te = (t) => {
711
- o.value.setZoom(t.config.zoom, !1, 200);
712
- }, ae = (t) => {
713
- o.value.setCenter(t.config.center, !1, 200);
714
- }, I = () => {
715
- o.value && (o.value.clearMap(), o.value.destroy(), o.value = null, c.value && (c.value.clear(), c.value.destroy(), c.value = null));
710
+ }), t.config.plugin.scale.visible ? z.value.show() : z.value.hide(), t.config.plugin.toolBar.visible ? b.value.show() : b.value.hide(), t.config.plugin.controlBar.visible ? k.value.show() : k.value.hide());
711
+ }, ae = () => {
712
+ s.value && (s.value.clearMap(), c.value.clear(), W(d.value));
713
+ }, re = (t) => {
714
+ s.value && s.value.setMapStyle(t.config.mapStyle);
715
+ }, le = (t) => {
716
+ s.value && s.value.setZoom(t.config.zoom, !1, 200);
717
+ }, se = (t) => {
718
+ s.value && s.value.setCenter(t.config.center, !1, 200);
719
+ }, $ = () => {
720
+ s.value && (s.value.clearMap(), s.value.destroy(), s.value = null, c.value && (c.value.clear(), c.value.destroy(), c.value = null));
716
721
  };
717
- return se(() => {
722
+ return me(() => {
718
723
  setTimeout(() => {
719
- E(s.value);
724
+ B(o.value);
720
725
  }, 0);
721
- }), ie(() => I()), {
722
- initAMap3d: E,
723
- updateAMapStyle: ee,
724
- updateAMapConfig: Y,
725
- updateAMapComponents: _,
726
- updateAMapZoom: te,
727
- updateAMapCenter: ae,
728
- amap3d: o,
729
- loading: L,
730
- AMapPrototype: d
726
+ }), de(() => $()), {
727
+ initAMap3d: B,
728
+ updateAMapStyle: re,
729
+ updateAMapConfig: te,
730
+ updateAMapComponents: ae,
731
+ updateAMapZoom: le,
732
+ updateAMapCenter: se,
733
+ amap3d: s,
734
+ loading: x,
735
+ AMapPrototype: d,
736
+ errorMessage: C
731
737
  };
732
738
  }, {
733
739
  initAMap3d: g,
734
- updateAMapStyle: F,
735
- updateAMapConfig: C,
736
- updateAMapComponents: N,
737
- updateAMapZoom: G,
738
- updateAMapCenter: H,
739
- loading: S
740
- } = T();
740
+ updateAMapStyle: H,
741
+ updateAMapConfig: A,
742
+ updateAMapComponents: Z,
743
+ updateAMapZoom: j,
744
+ updateAMapCenter: R,
745
+ loading: I,
746
+ errorMessage: O
747
+ } = G();
741
748
  return u(
742
- () => s.value.config,
749
+ () => o.value.config,
743
750
  () => {
744
- C(s.value);
751
+ A(o.value);
745
752
  },
746
753
  { deep: !0 }
747
754
  ), u(
748
- () => s.value.config.zoom,
755
+ () => o.value.config.zoom,
749
756
  () => {
750
- G(s.value);
757
+ j(o.value);
751
758
  },
752
759
  { deep: !0 }
753
760
  ), u(
754
- () => s.value.config.center,
761
+ () => o.value.config.center,
755
762
  () => {
756
- H(s.value);
763
+ R(o.value);
757
764
  },
758
765
  { deep: !0 }
759
766
  ), u(
760
- () => s.value.config.floors,
761
- x(() => {
762
- g(s.value);
767
+ () => o.value.config.floors,
768
+ M(() => {
769
+ g(o.value);
763
770
  }, 300),
764
771
  { deep: !0 }
765
772
  ), u(
766
- () => s.value.config.skyColor,
767
- x(() => {
768
- g(s.value);
773
+ () => o.value.config.skyColor,
774
+ M(() => {
775
+ g(o.value);
769
776
  }, 300),
770
777
  { deep: !0 }
771
778
  ), u(
772
- () => s.value.widgets,
779
+ () => o.value.widgets,
773
780
  () => {
774
- N();
781
+ Z();
775
782
  },
776
783
  { deep: !0 }
777
784
  ), u(
778
- () => s.value.config.mapStyle,
785
+ () => o.value.config.mapStyle,
779
786
  () => {
780
- F(s.value);
787
+ H(o.value);
781
788
  },
782
789
  { deep: !0 }
783
790
  ), u(
784
- () => s.value.basic,
791
+ () => o.value.basic,
785
792
  () => {
786
- g(s.value);
793
+ g(o.value);
787
794
  },
788
795
  { deep: !0 }
789
796
  ), u(
790
797
  () => m.sources,
791
798
  () => {
792
- g(s.value);
799
+ g(o.value);
793
800
  },
794
801
  { deep: !0 }
795
- ), J({
796
- refresh: () => g(s.value),
797
- refreshView: () => C(s.value),
798
- refreshData: () => g(s.value)
799
- }), (o, c) => B(S) ? (W(), O("div", {
800
- key: 0,
801
- class: oe(["amap-3d-wrap", { show: B(S) }])
802
- }, c[0] || (c[0] = [
803
- w("div", {
804
- id: "zerov-amap-3d",
805
- class: "zerov-amap-container"
806
- }, null, -1)
807
- ]), 2)) : (W(), O("div", ye, c[1] || (c[1] = [
808
- w("i", {
809
- class: "iconfont shj-gaodeditu",
810
- style: { "font-size": "48px" }
811
- }, null, -1),
812
- w("p", { class: "text-gray-500" }, " 缺少必要的Key和密钥,请先在右侧配置面板中进行配置 ", -1)
813
- ])));
802
+ ), T({
803
+ refresh: () => g(o.value),
804
+ refreshView: () => A(o.value),
805
+ refreshData: () => g(o.value)
806
+ }), (s, c) => (L(), S("div", ve, [
807
+ E("div", {
808
+ class: ne(["amap-3d-wrap", { show: w(I) }])
809
+ }, c[0] || (c[0] = [
810
+ E("div", {
811
+ id: "zerov-amap-3d",
812
+ class: "zerov-amap-container"
813
+ }, null, -1)
814
+ ]), 2),
815
+ w(I) ? D("", !0) : (L(), S("div", he, [
816
+ w(O) !== "" ? (L(), S("i", ke)) : D("", !0),
817
+ E("p", be, ce(w(O)), 1)
818
+ ]))
819
+ ]));
814
820
  }
815
821
  });
816
822
  export {
817
- gr as default
823
+ wr as default
818
824
  };
@@ -2,7 +2,7 @@ import o from "./index.vue2.mjs";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import t from "../../../../_virtual/_plugin-vue_export-helper.mjs";
5
- const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d0ab4e88"]]);
5
+ const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-03cb3209"]]);
6
6
  export {
7
- e as default
7
+ _ as default
8
8
  };