vue-openlayers-plugin 1.2.5 → 1.2.7

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.
Files changed (29) hide show
  1. package/lib/{BasemapPanel-c74c3819.mjs → BasemapPanel-ebe413da.mjs} +1 -1
  2. package/lib/{CoordinateLocationDialog-4e8ce1ff.mjs → CoordinateLocationDialog-ba72d9ea.mjs} +1 -1
  3. package/lib/{MapPrintDialog-d472ac5b.mjs → FilterPanel-22070c3b.mjs} +1 -1
  4. package/lib/{FilterPanel-af354b93.mjs → LayerPanel-1398051d.mjs} +1 -1
  5. package/lib/{LayerPanel-bc36c426.mjs → MapPrintDialog-d071ff8b.mjs} +1 -1
  6. package/lib/{MeasurementDialog-aab00e44.mjs → MeasurementDialog-e078d1c1.mjs} +1 -1
  7. package/lib/{MyMarkersDialog-73bbc54e.mjs → MyMarkersDialog-e0441cb0.mjs} +1 -1
  8. package/lib/{QuadCompareDialog-07ae0711.mjs → QuadCompareDialog-b6315ab1.mjs} +1 -1
  9. package/lib/{RegionNavigationDialog-095d3280.mjs → RegionNavigationDialog-d533c521.mjs} +1 -1
  10. package/lib/{SplitCompareDialog-5cff9362.mjs → SplitCompareDialog-2d49fbc6.mjs} +1 -1
  11. package/lib/{SwipeCompareDialog-1d9a0af3.mjs → SwipeCompareDialog-50dfd6b1.mjs} +1 -1
  12. package/lib/{ViewBookmarksDialog-17a8ba20.mjs → ViewBookmarksDialog-8c3f5a5b.mjs} +1 -1
  13. package/lib/{index-9a3b8ffa.mjs → index-b7a615a7.mjs} +232 -42
  14. package/lib/{index-37fe6cc1.mjs → index-ee2fa791.mjs} +1 -1
  15. package/lib/{index.es-eff5b793.mjs → index.es-dcd9031f.mjs} +1 -1
  16. package/lib/index.esm.js +1 -1
  17. package/lib/index.umd.js +218 -28
  18. package/lib/style.css +33 -26
  19. package/package.json +1 -1
  20. package/types/components/OlControlPanel.vue.d.ts +3 -1
  21. package/types/components/OlControlPanel.vue.d.ts.map +1 -1
  22. package/types/components/OlMap.vue.d.ts +3 -1
  23. package/types/components/OlMap.vue.d.ts.map +1 -1
  24. package/types/core/drawing/DrawingManager.d.ts +4 -0
  25. package/types/core/drawing/DrawingManager.d.ts.map +1 -1
  26. package/types/lowcode-entry.d.ts +5 -0
  27. package/types/lowcode-entry.d.ts.map +1 -1
  28. package/types/types/map.d.ts +20 -0
  29. package/types/types/map.d.ts.map +1 -1
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, computed, ref, watch, onMounted, onUnmounted, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString } from "vue";
2
- import { r as resolveBasemapThumbnail, l as layerEventBus, X, b as _export_sfc } from "./index-9a3b8ffa.mjs";
2
+ import { r as resolveBasemapThumbnail, l as layerEventBus, X, b as _export_sfc } from "./index-b7a615a7.mjs";
3
3
  import "@element-plus/icons-vue";
4
4
  import "ol";
5
5
  import "proj4";
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, computed, ref, reactive, resolveComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode } from "vue";
2
2
  import { Aim } from "@element-plus/icons-vue";
3
- import { X, T as TooltipHelper, b as _export_sfc } from "./index-9a3b8ffa.mjs";
3
+ import { X, T as TooltipHelper, b as _export_sfc } from "./index-b7a615a7.mjs";
4
4
  import "ol";
5
5
  import "proj4";
6
6
  import "@supermapgis/iclient-ol";
@@ -1,4 +1,4 @@
1
- import { d as _sfc_main } from "./index-9a3b8ffa.mjs";
1
+ import { j as _sfc_main } from "./index-b7a615a7.mjs";
2
2
  import "vue";
3
3
  import "@element-plus/icons-vue";
4
4
  import "ol";
@@ -1,4 +1,4 @@
1
- import { j as _sfc_main } from "./index-9a3b8ffa.mjs";
1
+ import { e as _sfc_main } from "./index-b7a615a7.mjs";
2
2
  import "vue";
3
3
  import "@element-plus/icons-vue";
4
4
  import "ol";
@@ -1,4 +1,4 @@
1
- import { e as _sfc_main } from "./index-9a3b8ffa.mjs";
1
+ import { d as _sfc_main } from "./index-b7a615a7.mjs";
2
2
  import "vue";
3
3
  import "@element-plus/icons-vue";
4
4
  import "ol";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, computed, ref, watch, resolveComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, Fragment, renderList, normalizeClass } from "vue";
2
- import { X, f as formatMeasurementResult, b as _export_sfc } from "./index-9a3b8ffa.mjs";
2
+ import { X, f as formatMeasurementResult, b as _export_sfc } from "./index-b7a615a7.mjs";
3
3
  import "@element-plus/icons-vue";
4
4
  import "ol";
5
5
  import "proj4";
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, inject, computed, ref, reactive, onUnmounted, watch, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, unref, withCtx, createElementVNode, normalizeClass, createTextVNode, toDisplayString, renderList, createBlock, withModifiers, mergeProps } from "vue";
2
2
  import { Plus, FolderOpened, Download, Delete, Search, LocationFilled, Edit } from "@element-plus/icons-vue";
3
3
  import { ElMessageBox } from "element-plus";
4
- import { X, M as MarkerDrawingAdapter, h as fromLonLat, t as toLonLat } from "./index-9a3b8ffa.mjs";
4
+ import { X, M as MarkerDrawingAdapter, h as fromLonLat, t as toLonLat } from "./index-b7a615a7.mjs";
5
5
  import "ol";
6
6
  import "proj4";
7
7
  import "@supermapgis/iclient-ol";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, inject, computed, shallowRef, reactive, watch, nextTick, onMounted, onUnmounted, resolveComponent, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, createCommentVNode } from "vue";
2
- import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-9a3b8ffa.mjs";
2
+ import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-b7a615a7.mjs";
3
3
  import { u as useMap } from "./useMap-8e3a2de5.mjs";
4
4
  import { View, Map } from "ol";
5
5
  import "@element-plus/icons-vue";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, ref, reactive, resolveComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, normalizeClass } from "vue";
2
- import { X } from "./index-9a3b8ffa.mjs";
2
+ import { X } from "./index-b7a615a7.mjs";
3
3
  import "@element-plus/icons-vue";
4
4
  import "ol";
5
5
  import "proj4";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, inject, computed, shallowRef, watch, nextTick, onMounted, onUnmounted, resolveComponent, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, createCommentVNode } from "vue";
2
- import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-9a3b8ffa.mjs";
2
+ import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-b7a615a7.mjs";
3
3
  import { u as useMap } from "./useMap-8e3a2de5.mjs";
4
4
  import { View, Map } from "ol";
5
5
  import "@element-plus/icons-vue";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, inject, computed, shallowRef, watch, nextTick, onMounted, onUnmounted, resolveComponent, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeClass, normalizeStyle, Fragment, renderList, createBlock, createCommentVNode } from "vue";
2
- import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-9a3b8ffa.mjs";
2
+ import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-b7a615a7.mjs";
3
3
  import { u as useMap } from "./useMap-8e3a2de5.mjs";
4
4
  import { View, Map } from "ol";
5
5
  import { DCaret } from "@element-plus/icons-vue";
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, inject, computed, ref, watch, reactive, resolveComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, createElementBlock, Fragment, renderList, withModifiers, toDisplayString, createCommentVNode } from "vue";
2
2
  import { Plus, Delete, Search, Camera, View, Edit, Location, ZoomIn } from "@element-plus/icons-vue";
3
3
  import { ElMessage, ElMessageBox } from "element-plus";
4
- import { X, t as toLonLat, h as fromLonLat, i as getUid } from "./index-9a3b8ffa.mjs";
4
+ import { X, t as toLonLat, h as fromLonLat, i as getUid } from "./index-b7a615a7.mjs";
5
5
  import "ol";
6
6
  import "proj4";
7
7
  import "@supermapgis/iclient-ol";
@@ -5,11 +5,11 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, normalizeClass, normalizeStyle as normalizeStyle$1, withModifiers, createElementVNode, createBlock, unref, withCtx, createTextVNode, createCommentVNode, renderSlot, nextTick, toDisplayString, onUnmounted, createVNode as createVNode$1, Fragment, renderList, h as h$3, createApp, inject, provide, isRef, resolveDirective, withDirectives, vShow, defineAsyncComponent, reactive, shallowRef, resolveComponent, resolveDynamicComponent, withKeys, useAttrs, useSlots, mergeProps, createSlots, normalizeProps, guardReactiveProps, watchEffect, Teleport } from "vue";
8
- import { MapLocation, Grid as Grid$6, Tools, Location, Guide, Flag, Printer, EditPen, Delete, Switch, DocumentCopy, Search, Loading, Clock, InfoFilled, Plus, Minus, RefreshLeft, RefreshRight, Right, FullScreen, Aim, Menu as Menu$2, View as View$4, Expand, Share, CircleCheck, FolderOpened, DataBoard, Setting, Download, Refresh, ZoomIn, ZoomOut, Document as Document$1, Position, Close } from "@element-plus/icons-vue";
8
+ import { MapLocation, Grid as Grid$6, Tools, Location, Guide, Flag, Printer, EditPen, Delete, Switch, DocumentCopy, Search, Loading, Clock, InfoFilled, Plus, Minus, RefreshLeft, RefreshRight, Right, FullScreen, Aim, Menu as Menu$2, View as View$4, Expand, Share, CircleCheck, Upload, FolderOpened, DataBoard, Setting, Download, Refresh, ZoomIn, ZoomOut, Document as Document$1, Position, Close } from "@element-plus/icons-vue";
9
9
  import { Feature as Feature$3, Map as Map$4 } from "ol";
10
10
  import proj4 from "proj4";
11
11
  import { TileSuperMapRest, Util as Util$3, GetFeaturesByGeometryParameters as GetFeaturesByGeometryParameters$1, FeatureService } from "@supermapgis/iclient-ol";
12
- import { ElButton, ElInput, ElIcon, ElPopover, ElTooltip, ElCheckbox, ElDialog } from "element-plus";
12
+ import { ElButton, ElInput, ElIcon, ElPopover, ElTooltip, ElCheckbox, ElMessage, ElDialog } from "element-plus";
13
13
  function _mergeNamespaces(n2, m2) {
14
14
  for (var i = 0; i < m2.length; i++) {
15
15
  const e8 = m2[i];
@@ -50979,6 +50979,12 @@ class DrawingManager {
50979
50979
  if (interaction === this._drawInteraction || interaction === this._selectInteraction || interaction === this._modifyInteraction || interaction === this._snapInteraction) {
50980
50980
  return;
50981
50981
  }
50982
+ if (!enable && this.shouldKeepInteractionActiveDuringDrawing(interaction)) {
50983
+ if (interaction.setActive) {
50984
+ interaction.setActive(true);
50985
+ }
50986
+ return;
50987
+ }
50982
50988
  if (interaction.setActive) {
50983
50989
  interaction.setActive(enable);
50984
50990
  }
@@ -50986,6 +50992,12 @@ class DrawingManager {
50986
50992
  this.toggleMapEventListeners(enable);
50987
50993
  console.log(`地图其他交互已${enable ? "启用" : "禁用"}`);
50988
50994
  }
50995
+ /**
50996
+ * 判断绘制期间是否需要保留地图交互
50997
+ */
50998
+ shouldKeepInteractionActiveDuringDrawing(interaction) {
50999
+ return interaction instanceof MouseWheelZoom$1 || interaction instanceof PinchZoom$1;
51000
+ }
50989
51001
  /**
50990
51002
  * 控制地图事件监听器的启用/禁用
50991
51003
  */
@@ -334685,7 +334697,7 @@ const _hoisted_11$a = {
334685
334697
  };
334686
334698
  const _hoisted_12$8 = ["onClick"];
334687
334699
  const _hoisted_13$8 = ["src", "alt"];
334688
- const _hoisted_14$5 = {
334700
+ const _hoisted_14$6 = {
334689
334701
  key: 3,
334690
334702
  class: "slideshow-controls"
334691
334703
  };
@@ -334901,7 +334913,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
334901
334913
  ], 10, _hoisted_12$8);
334902
334914
  }), 128))
334903
334915
  ])) : createCommentVNode("", true),
334904
- _ctx.config.slideshow && imageList.value.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_14$5, [
334916
+ _ctx.config.slideshow && imageList.value.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_14$6, [
334905
334917
  createVNode$1(unref(ElButton), {
334906
334918
  class: normalizeClass(["slideshow-btn", { active: isSlideshow.value }]),
334907
334919
  type: isSlideshow.value ? "primary" : "default",
@@ -334982,7 +334994,7 @@ const _hoisted_12$7 = {
334982
334994
  class: "sort-indicator"
334983
334995
  };
334984
334996
  const _hoisted_13$7 = ["onClick"];
334985
- const _hoisted_14$4 = { key: 0 };
334997
+ const _hoisted_14$5 = { key: 0 };
334986
334998
  const _hoisted_15$3 = ["src", "alt"];
334987
334999
  const _hoisted_16$3 = { key: 1 };
334988
335000
  const _hoisted_17$3 = ["href"];
@@ -335265,7 +335277,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
335265
335277
  return openBlock(), createElementBlock("td", {
335266
335278
  key: field.key
335267
335279
  }, [
335268
- field.type === "image" ? (openBlock(), createElementBlock("span", _hoisted_14$4, [
335280
+ field.type === "image" ? (openBlock(), createElementBlock("span", _hoisted_14$5, [
335269
335281
  createElementVNode("img", {
335270
335282
  src: getFieldValue(item, field.key || field.name),
335271
335283
  alt: field.label,
@@ -337425,19 +337437,19 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
337425
337437
  }
337426
337438
  });
337427
337439
  const defaultComponents = {
337428
- measurement: () => import("./MeasurementDialog-aab00e44.mjs"),
337429
- basemap: () => import("./BasemapPanel-c74c3819.mjs"),
337430
- print: () => import("./MapPrintDialog-d472ac5b.mjs"),
337431
- "layer-panel": () => import("./LayerPanel-bc36c426.mjs"),
337432
- coordinate: () => import("./CoordinateLocationDialog-4e8ce1ff.mjs"),
337433
- "region-navigation": () => import("./RegionNavigationDialog-095d3280.mjs"),
337434
- "my-markers": () => import("./MyMarkersDialog-73bbc54e.mjs"),
337435
- "view-bookmarks": () => import("./ViewBookmarksDialog-17a8ba20.mjs"),
337436
- "map-drawing": () => import("./index-37fe6cc1.mjs"),
337437
- "filter-panel": () => import("./FilterPanel-af354b93.mjs"),
337438
- "swipe-compare": () => import("./SwipeCompareDialog-1d9a0af3.mjs"),
337439
- "split-compare": () => import("./SplitCompareDialog-5cff9362.mjs"),
337440
- "quad-compare": () => import("./QuadCompareDialog-07ae0711.mjs")
337440
+ measurement: () => import("./MeasurementDialog-e078d1c1.mjs"),
337441
+ basemap: () => import("./BasemapPanel-ebe413da.mjs"),
337442
+ print: () => import("./MapPrintDialog-d071ff8b.mjs"),
337443
+ "layer-panel": () => import("./LayerPanel-1398051d.mjs"),
337444
+ coordinate: () => import("./CoordinateLocationDialog-ba72d9ea.mjs"),
337445
+ "region-navigation": () => import("./RegionNavigationDialog-d533c521.mjs"),
337446
+ "my-markers": () => import("./MyMarkersDialog-e0441cb0.mjs"),
337447
+ "view-bookmarks": () => import("./ViewBookmarksDialog-8c3f5a5b.mjs"),
337448
+ "map-drawing": () => import("./index-ee2fa791.mjs"),
337449
+ "filter-panel": () => import("./FilterPanel-22070c3b.mjs"),
337450
+ "swipe-compare": () => import("./SwipeCompareDialog-50dfd6b1.mjs"),
337451
+ "split-compare": () => import("./SplitCompareDialog-2d49fbc6.mjs"),
337452
+ "quad-compare": () => import("./QuadCompareDialog-b6315ab1.mjs")
337441
337453
  };
337442
337454
  const _DialogRegistry = class _DialogRegistry {
337443
337455
  constructor() {
@@ -338787,7 +338799,7 @@ const _hoisted_10$a = {
338787
338799
  const _hoisted_11$8 = { class: "result-count" };
338788
338800
  const _hoisted_12$6 = ["onClick"];
338789
338801
  const _hoisted_13$6 = { class: "item-content" };
338790
- const _hoisted_14$3 = ["innerHTML"];
338802
+ const _hoisted_14$4 = ["innerHTML"];
338791
338803
  const _hoisted_15$2 = ["innerHTML"];
338792
338804
  const _hoisted_16$2 = {
338793
338805
  key: 0,
@@ -339318,7 +339330,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
339318
339330
  createElementVNode("div", {
339319
339331
  class: "item-name",
339320
339332
  innerHTML: highlightText(result.name, searchQuery.value)
339321
- }, null, 8, _hoisted_14$3),
339333
+ }, null, 8, _hoisted_14$4),
339322
339334
  createElementVNode("div", {
339323
339335
  class: "item-address",
339324
339336
  innerHTML: highlightText(result.address, searchQuery.value)
@@ -339506,17 +339518,21 @@ const _hoisted_8$9 = { class: "drawing-menu-panel-content" };
339506
339518
  const _hoisted_9$9 = { class: "drawing-tool-list" };
339507
339519
  const _hoisted_10$9 = {
339508
339520
  key: 0,
339509
- class: "drawing-menu-divider"
339521
+ class: "drawing-import-row"
339510
339522
  };
339511
339523
  const _hoisted_11$7 = {
339512
339524
  key: 1,
339513
- class: "drawing-toggle-row"
339525
+ class: "drawing-menu-divider"
339514
339526
  };
339515
339527
  const _hoisted_12$5 = {
339528
+ key: 2,
339529
+ class: "drawing-toggle-row"
339530
+ };
339531
+ const _hoisted_13$5 = {
339516
339532
  key: 7,
339517
339533
  class: "control-divider"
339518
339534
  };
339519
- const _hoisted_13$5 = {
339535
+ const _hoisted_14$3 = {
339520
339536
  key: 8,
339521
339537
  class: "control-section"
339522
339538
  };
@@ -339532,7 +339548,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
339532
339548
  bottomOffset: {},
339533
339549
  viewBookmarks: {}
339534
339550
  },
339535
- emits: ["drawing-complete", "drawing-clear"],
339551
+ emits: ["drawing-complete", "drawing-clear", "drawing-import"],
339536
339552
  setup(__props, { expose: __expose, emit: __emit }) {
339537
339553
  const props = __props;
339538
339554
  const emit = __emit;
@@ -339660,7 +339676,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
339660
339676
  return !!((tools == null ? void 0 : tools.viewBookmarks) || props.config.viewBookmarks);
339661
339677
  });
339662
339678
  const drawingControlConfig = computed(() => {
339663
- var _a2;
339679
+ var _a2, _b2, _c2, _d;
339664
339680
  const rawConfig = ((_a2 = props.config.tools) == null ? void 0 : _a2.drawing) ?? props.config.drawing;
339665
339681
  if (rawConfig === false) {
339666
339682
  return {
@@ -339668,8 +339684,15 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
339668
339684
  trigger: "hover",
339669
339685
  continuous: false,
339670
339686
  showContinuousToggle: true,
339687
+ showImportButton: false,
339688
+ importOptions: {
339689
+ clearBeforeImport: false,
339690
+ fitToImported: true,
339691
+ accept: ".json,.geojson"
339692
+ },
339671
339693
  tools: DEFAULT_DRAWING_TOOLS,
339672
- onDrawEnd: void 0
339694
+ onDrawEnd: void 0,
339695
+ onImportEnd: void 0
339673
339696
  };
339674
339697
  }
339675
339698
  if (rawConfig === true || rawConfig === void 0) {
@@ -339678,8 +339701,15 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
339678
339701
  trigger: "hover",
339679
339702
  continuous: false,
339680
339703
  showContinuousToggle: true,
339704
+ showImportButton: false,
339705
+ importOptions: {
339706
+ clearBeforeImport: false,
339707
+ fitToImported: true,
339708
+ accept: ".json,.geojson"
339709
+ },
339681
339710
  tools: DEFAULT_DRAWING_TOOLS,
339682
- onDrawEnd: void 0
339711
+ onDrawEnd: void 0,
339712
+ onImportEnd: void 0
339683
339713
  };
339684
339714
  }
339685
339715
  const config = rawConfig;
@@ -339691,8 +339721,15 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
339691
339721
  trigger: config.trigger || "hover",
339692
339722
  continuous: config.continuous ?? false,
339693
339723
  showContinuousToggle: config.showContinuousToggle !== false,
339724
+ showImportButton: config.showImportButton === true,
339725
+ importOptions: {
339726
+ clearBeforeImport: ((_b2 = config.importOptions) == null ? void 0 : _b2.clearBeforeImport) ?? false,
339727
+ fitToImported: ((_c2 = config.importOptions) == null ? void 0 : _c2.fitToImported) ?? true,
339728
+ accept: ((_d = config.importOptions) == null ? void 0 : _d.accept) || ".json,.geojson"
339729
+ },
339694
339730
  tools: tools.length > 0 ? Array.from(new Set(tools)) : DEFAULT_DRAWING_TOOLS,
339695
- onDrawEnd: config.onDrawEnd
339731
+ onDrawEnd: config.onDrawEnd,
339732
+ onImportEnd: config.onImportEnd
339696
339733
  };
339697
339734
  });
339698
339735
  const isDrawingEnabled = computed(() => drawingControlConfig.value.enabled);
@@ -339910,6 +339947,136 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
339910
339947
  source: "controls"
339911
339948
  };
339912
339949
  };
339950
+ const normalizeImportedGeoJSON = (rawData) => {
339951
+ if (typeof rawData === "string") {
339952
+ const trimmed = rawData.trim();
339953
+ if (!trimmed) {
339954
+ throw new Error("文件内容为空");
339955
+ }
339956
+ return normalizeImportedGeoJSON(
339957
+ JSON.parse(trimmed)
339958
+ );
339959
+ }
339960
+ if (!rawData || typeof rawData !== "object") {
339961
+ throw new Error("仅支持导入 GeoJSON 对象");
339962
+ }
339963
+ const geoJson = rawData;
339964
+ if (geoJson.type === "FeatureCollection" && Array.isArray(geoJson.features)) {
339965
+ return geoJson;
339966
+ }
339967
+ if (geoJson.type === "Feature") {
339968
+ return geoJson;
339969
+ }
339970
+ if ("coordinates" in geoJson && typeof geoJson.type === "string") {
339971
+ return geoJson;
339972
+ }
339973
+ throw new Error("文件不是有效的 GeoJSON 格式");
339974
+ };
339975
+ const collectImportedExtent = (geojson) => {
339976
+ var _a2;
339977
+ if (!currentMap.value)
339978
+ return null;
339979
+ try {
339980
+ const features2 = geoJsonFormat.readFeatures(geojson, {
339981
+ dataProjection: "EPSG:4326",
339982
+ featureProjection: currentMap.value.getView().getProjection()
339983
+ });
339984
+ if (!features2.length) {
339985
+ return null;
339986
+ }
339987
+ let extent3 = (_a2 = features2[0].getGeometry()) == null ? void 0 : _a2.getExtent();
339988
+ if (!extent3) {
339989
+ return null;
339990
+ }
339991
+ for (let i = 1; i < features2.length; i += 1) {
339992
+ const geometry = features2[i].getGeometry();
339993
+ if (!geometry)
339994
+ continue;
339995
+ const currentExtent = geometry.getExtent();
339996
+ extent3 = [
339997
+ Math.min(extent3[0], currentExtent[0]),
339998
+ Math.min(extent3[1], currentExtent[1]),
339999
+ Math.max(extent3[2], currentExtent[2]),
340000
+ Math.max(extent3[3], currentExtent[3])
340001
+ ];
340002
+ }
340003
+ return extent3;
340004
+ } catch (error2) {
340005
+ console.warn("解析导入图形范围失败:", error2);
340006
+ return null;
340007
+ }
340008
+ };
340009
+ const fitToImportedGeoJSON = (geojson) => {
340010
+ if (!currentMap.value)
340011
+ return;
340012
+ const extent3 = collectImportedExtent(geojson);
340013
+ if (!extent3)
340014
+ return;
340015
+ currentMap.value.getView().fit(extent3, {
340016
+ duration: 500,
340017
+ padding: [30, 30, 30, 30],
340018
+ maxZoom: 18
340019
+ });
340020
+ };
340021
+ const importDrawings = () => {
340022
+ var _a2;
340023
+ const drawingManager = (_a2 = mapManager == null ? void 0 : mapManager.value) == null ? void 0 : _a2.getDrawingManager();
340024
+ if (!drawingManager) {
340025
+ ElMessage.warning("绘制管理器未初始化");
340026
+ return;
340027
+ }
340028
+ const input = document.createElement("input");
340029
+ input.type = "file";
340030
+ input.accept = drawingControlConfig.value.importOptions.accept;
340031
+ input.onchange = (event) => {
340032
+ var _a3;
340033
+ const file = (_a3 = event.target.files) == null ? void 0 : _a3[0];
340034
+ if (!file) {
340035
+ return;
340036
+ }
340037
+ const reader = new FileReader();
340038
+ reader.onload = (loadEvent) => {
340039
+ var _a4, _b2, _c2;
340040
+ try {
340041
+ const parsedGeojson = normalizeImportedGeoJSON(
340042
+ ((_a4 = loadEvent.target) == null ? void 0 : _a4.result) ?? ""
340043
+ );
340044
+ if (drawingControlConfig.value.importOptions.clearBeforeImport) {
340045
+ drawingManager.clearAll();
340046
+ }
340047
+ const drawings = drawingManager.addGeoJSONData(parsedGeojson);
340048
+ if (!drawings.length) {
340049
+ ElMessage.warning("未识别到可导入的图形");
340050
+ return;
340051
+ }
340052
+ if (drawingControlConfig.value.importOptions.fitToImported) {
340053
+ fitToImportedGeoJSON(parsedGeojson);
340054
+ }
340055
+ const result = {
340056
+ fileName: file.name,
340057
+ importedCount: drawings.length,
340058
+ geojson: parsedGeojson,
340059
+ drawings: drawings.map((drawing) => buildDrawingResult(drawing)),
340060
+ source: "controls"
340061
+ };
340062
+ (_c2 = (_b2 = drawingControlConfig.value).onImportEnd) == null ? void 0 : _c2.call(_b2, result);
340063
+ emit("drawing-import", result);
340064
+ ElMessage.success(`成功导入 ${drawings.length} 个图形`);
340065
+ isDrawingMenuOpen.value = false;
340066
+ } catch (error2) {
340067
+ console.error("导入图形失败:", error2);
340068
+ ElMessage.error(
340069
+ error2 instanceof Error ? error2.message : "导入图形失败"
340070
+ );
340071
+ }
340072
+ };
340073
+ reader.onerror = () => {
340074
+ ElMessage.error("读取文件失败");
340075
+ };
340076
+ reader.readAsText(file);
340077
+ };
340078
+ input.click();
340079
+ };
339913
340080
  const cleanupDrawingListeners = () => {
339914
340081
  if (boundDrawingManager && boundDrawingEndHandler && boundModeChangeHandler) {
339915
340082
  boundDrawingManager.off("drawing-end", boundDrawingEndHandler);
@@ -340324,7 +340491,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
340324
340491
  ]),
340325
340492
  default: withCtx(() => [
340326
340493
  createElementVNode("div", _hoisted_8$9, [
340327
- _cache[5] || (_cache[5] = createElementVNode("div", { class: "drawing-menu-title" }, "快捷绘制", -1)),
340494
+ _cache[6] || (_cache[6] = createElementVNode("div", { class: "drawing-menu-title" }, "快捷绘制", -1)),
340328
340495
  createElementVNode("div", _hoisted_9$9, [
340329
340496
  (openBlock(true), createElementBlock(Fragment, null, renderList(drawingControlConfig.value.tools, (tool) => {
340330
340497
  return openBlock(), createBlock(unref(ElTooltip), {
@@ -340375,26 +340542,45 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
340375
340542
  }, 1032, ["content"]);
340376
340543
  }), 128))
340377
340544
  ]),
340378
- drawingControlConfig.value.showContinuousToggle || isDrawingActive.value ? (openBlock(), createElementBlock("div", _hoisted_10$9)) : createCommentVNode("", true),
340379
- drawingControlConfig.value.showContinuousToggle ? (openBlock(), createElementBlock("div", _hoisted_11$7, [
340545
+ drawingControlConfig.value.showImportButton ? (openBlock(), createElementBlock("div", _hoisted_10$9, [
340546
+ createVNode$1(unref(ElButton), {
340547
+ size: "small",
340548
+ text: "",
340549
+ class: "drawing-import-btn",
340550
+ onClick: importDrawings
340551
+ }, {
340552
+ default: withCtx(() => [
340553
+ createVNode$1(unref(ElIcon), null, {
340554
+ default: withCtx(() => [
340555
+ createVNode$1(unref(Upload))
340556
+ ]),
340557
+ _: 1
340558
+ }),
340559
+ _cache[3] || (_cache[3] = createElementVNode("span", null, "导入图形", -1))
340560
+ ]),
340561
+ _: 1
340562
+ })
340563
+ ])) : createCommentVNode("", true),
340564
+ drawingControlConfig.value.showContinuousToggle || isDrawingActive.value ? (openBlock(), createElementBlock("div", _hoisted_11$7)) : createCommentVNode("", true),
340565
+ drawingControlConfig.value.showContinuousToggle ? (openBlock(), createElementBlock("div", _hoisted_12$5, [
340380
340566
  createVNode$1(unref(ElCheckbox), {
340381
340567
  modelValue: continuousDrawing.value,
340382
340568
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => continuousDrawing.value = $event)
340383
340569
  }, {
340384
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
340570
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
340385
340571
  createTextVNode(" 是否连续绘制 ", -1)
340386
340572
  ])]),
340387
340573
  _: 1
340388
340574
  }, 8, ["modelValue"])
340389
340575
  ])) : createCommentVNode("", true),
340390
340576
  isDrawingActive.value ? (openBlock(), createBlock(unref(ElButton), {
340391
- key: 2,
340577
+ key: 3,
340392
340578
  size: "small",
340393
340579
  text: "",
340394
340580
  class: "drawing-stop-btn",
340395
340581
  onClick: stopQuickDrawing
340396
340582
  }, {
340397
- default: withCtx(() => [..._cache[4] || (_cache[4] = [
340583
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [
340398
340584
  createTextVNode(" 停止绘制 ", -1)
340399
340585
  ])]),
340400
340586
  _: 1
@@ -340404,8 +340590,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
340404
340590
  _: 1
340405
340591
  }, 8, ["placement", "trigger", "visible", "disabled"])
340406
340592
  ])) : createCommentVNode("", true),
340407
- (((_o2 = _ctx.config.tools) == null ? void 0 : _o2.clearAll) || _ctx.config.clearAll) && (hasOtherTools.value || isDrawingEnabled.value || ((_p = _ctx.config.tools) == null ? void 0 : _p.zoom) || _ctx.config.zoom || ((_q = _ctx.config.tools) == null ? void 0 : _q.rotate) || _ctx.config.rotate) ? (openBlock(), createElementBlock("div", _hoisted_12$5)) : createCommentVNode("", true),
340408
- ((_r2 = _ctx.config.tools) == null ? void 0 : _r2.clearAll) || _ctx.config.clearAll ? (openBlock(), createElementBlock("div", _hoisted_13$5, [
340593
+ (((_o2 = _ctx.config.tools) == null ? void 0 : _o2.clearAll) || _ctx.config.clearAll) && (hasOtherTools.value || isDrawingEnabled.value || ((_p = _ctx.config.tools) == null ? void 0 : _p.zoom) || _ctx.config.zoom || ((_q = _ctx.config.tools) == null ? void 0 : _q.rotate) || _ctx.config.rotate) ? (openBlock(), createElementBlock("div", _hoisted_13$5)) : createCommentVNode("", true),
340594
+ ((_r2 = _ctx.config.tools) == null ? void 0 : _r2.clearAll) || _ctx.config.clearAll ? (openBlock(), createElementBlock("div", _hoisted_14$3, [
340409
340595
  createVNode$1(unref(ElButton), {
340410
340596
  class: "control-btn",
340411
340597
  title: "清空绘制内容",
@@ -340429,7 +340615,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
340429
340615
  };
340430
340616
  }
340431
340617
  });
340432
- const OlControlPanel = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-2ee216d4"]]);
340618
+ const OlControlPanel = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-5317d890"]]);
340433
340619
  const _hoisted_1$i = {
340434
340620
  key: 0,
340435
340621
  class: "ol-legend-header"
@@ -353030,7 +353216,7 @@ function(t3) {
353030
353216
  */
353031
353217
  function(t3) {
353032
353218
  function e8() {
353033
- return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-eff5b793.mjs")).catch(function(t4) {
353219
+ return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-dcd9031f.mjs")).catch(function(t4) {
353034
353220
  return Promise.reject(new Error("Could not load canvg: " + t4));
353035
353221
  }).then(function(t4) {
353036
353222
  return t4.default ? t4.default : t4;
@@ -365767,7 +365953,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
365767
365953
  popupConfig: {},
365768
365954
  enableGeolocation: { type: Boolean, default: true }
365769
365955
  },
365770
- emits: ["map-ready", "map-click", "map-dblclick", "map-contextmenu", "map-move", "zoom-change", "feature-click", "tooltip-show", "tooltip-hide", "layer-change", "measurement-change", "measurement-start", "measurement-end", "measurement-result", "context-menu", "bookmark-action", "marker-action", "tool-action", "drawing-complete", "drawing-clear", "search", "search-select", "search-clear", "popup-show", "popup-hide", "popup-close"],
365956
+ emits: ["map-ready", "map-click", "map-dblclick", "map-contextmenu", "map-move", "zoom-change", "feature-click", "tooltip-show", "tooltip-hide", "layer-change", "measurement-change", "measurement-start", "measurement-end", "measurement-result", "context-menu", "bookmark-action", "marker-action", "tool-action", "drawing-complete", "drawing-clear", "drawing-import", "search", "search-select", "search-clear", "popup-show", "popup-hide", "popup-close"],
365771
365957
  setup(__props, { expose: __expose, emit: __emit }) {
365772
365958
  const currentLegends = ref([]);
365773
365959
  const currentLayers = ref([]);
@@ -366639,6 +366825,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
366639
366825
  const onDrawingClear = (event) => {
366640
366826
  emit("drawing-clear", event);
366641
366827
  };
366828
+ const onDrawingImport = (result) => {
366829
+ emit("drawing-import", result);
366830
+ };
366642
366831
  const onPrintAction = (data) => {
366643
366832
  console.log("打印操作:", data);
366644
366833
  switch (data.action) {
@@ -367327,7 +367516,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
367327
367516
  "bottom-offset": finalControlsConfig.value.bottomOffset,
367328
367517
  "view-bookmarks": props.viewBookmarks,
367329
367518
  onDrawingComplete,
367330
- onDrawingClear
367519
+ onDrawingClear,
367520
+ onDrawingImport
367331
367521
  }, {
367332
367522
  custom: withCtx(({ controls }) => [
367333
367523
  renderSlot(_ctx.$slots, "controls", {
@@ -367464,7 +367654,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
367464
367654
  };
367465
367655
  }
367466
367656
  });
367467
- const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-610dbb17"]]);
367657
+ const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-984651bc"]]);
367468
367658
  const Property = {
367469
367659
  ACCURACY: "accuracy",
367470
367660
  ACCURACY_GEOMETRY: "accuracyGeometry",
@@ -1,6 +1,6 @@
1
1
  import { inject, computed, ref, onMounted, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, Fragment, renderList, createElementVNode, normalizeClass, toDisplayString, unref, createTextVNode, createCommentVNode, createBlock } from "vue";
2
2
  import { Close } from "@element-plus/icons-vue";
3
- import { b as _export_sfc, D as DrawingManager, X } from "./index-9a3b8ffa.mjs";
3
+ import { b as _export_sfc, D as DrawingManager, X } from "./index-b7a615a7.mjs";
4
4
  import "ol";
5
5
  import "proj4";
6
6
  import "@supermapgis/iclient-ol";
@@ -1,4 +1,4 @@
1
- import { c as commonjsGlobal, g as getDefaultExportFromCjs, _ as _asyncToGenerator, a as _defineProperty } from "./index-9a3b8ffa.mjs";
1
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs, _ as _asyncToGenerator, a as _defineProperty } from "./index-b7a615a7.mjs";
2
2
  import "vue";
3
3
  import "@element-plus/icons-vue";
4
4
  import "ol";
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ad, a0, K, O, a4, D, aA, a9, ac, aF, aE, ak, al, aw, ax, Y, am, an, aD, aB, $, Z, ay, az, B, E, F, A, J, y, C, z, G, au, av, as, at, aq, ar, x, s, q, w, O as O2, p, u, v, ae, af, ai, aj, ao, ap, aG, N, ag, ah, U, ab, a1, a5, a8, Q, f, W, aa, a6, a2, a3, aC, P, a7, l, S, r, R } from "./index-9a3b8ffa.mjs";
1
+ import { ad, a0, K, O, a4, D, aA, a9, ac, aF, aE, ak, al, aw, ax, Y, am, an, aD, aB, $, Z, ay, az, B, E, F, A, J, y, C, z, G, au, av, as, at, aq, ar, x, s, q, w, O as O2, p, u, v, ae, af, ai, aj, ao, ap, aG, N, ag, ah, U, ab, a1, a5, a8, Q, f, W, aa, a6, a2, a3, aC, P, a7, l, S, r, R } from "./index-b7a615a7.mjs";
2
2
  import "vue";
3
3
  import "@element-plus/icons-vue";
4
4
  import "ol";