vue-openlayers-plugin 1.1.16 → 1.2.1

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 (36) hide show
  1. package/README.md +341 -0
  2. package/lib/{BasemapPanel-d1332546.mjs → BasemapPanel-aa284bf3.mjs} +1 -1
  3. package/lib/{CoordinateLocationDialog-c2d89c1e.mjs → CoordinateLocationDialog-6c0a6b23.mjs} +1 -1
  4. package/lib/{MapPrintDialog-eea9e39e.mjs → FilterPanel-b91325ac.mjs} +1 -1
  5. package/lib/{FilterPanel-d7cb1c79.mjs → LayerPanel-88983648.mjs} +1 -1
  6. package/lib/{LayerPanel-f411a32b.mjs → MapPrintDialog-2e5a22e7.mjs} +1 -1
  7. package/lib/{MeasurementDialog-9914f4e9.mjs → MeasurementDialog-ebda57e6.mjs} +1 -1
  8. package/lib/{MyMarkersDialog-ef717e8c.mjs → MyMarkersDialog-1f851036.mjs} +1 -1
  9. package/lib/{QuadCompareDialog-3d6eaf0c.mjs → QuadCompareDialog-8f624242.mjs} +1 -1
  10. package/lib/{RegionNavigationDialog-2843eedd.mjs → RegionNavigationDialog-549597e1.mjs} +1 -1
  11. package/lib/{SplitCompareDialog-1e678e69.mjs → SplitCompareDialog-9bcce145.mjs} +1 -1
  12. package/lib/{SwipeCompareDialog-547de7ee.mjs → SwipeCompareDialog-374b9865.mjs} +1 -1
  13. package/lib/{ViewBookmarksDialog-d3e38c53.mjs → ViewBookmarksDialog-10b5fe14.mjs} +1 -1
  14. package/lib/{index-92020358.mjs → index-b9d6884a.mjs} +1 -1
  15. package/lib/{index-198a96d2.mjs → index-e8d5fc75.mjs} +652 -90
  16. package/lib/{index.es-dd926512.mjs → index.es-ff0f4147.mjs} +1 -1
  17. package/lib/index.esm.js +1 -1
  18. package/lib/index.umd.js +638 -76
  19. package/lib/style.css +74 -23
  20. package/package.json +1 -1
  21. package/types/components/OlControlPanel.vue.d.ts +7 -3
  22. package/types/components/OlControlPanel.vue.d.ts.map +1 -1
  23. package/types/components/OlMap.vue.d.ts +3 -1
  24. package/types/components/OlMap.vue.d.ts.map +1 -1
  25. package/types/components/OlMapSearch.vue.d.ts +20 -1
  26. package/types/components/OlMapSearch.vue.d.ts.map +1 -1
  27. package/types/core/tiandituSearchApi.d.ts.map +1 -1
  28. package/types/lowcode-entry.d.ts +5 -0
  29. package/types/lowcode-entry.d.ts.map +1 -1
  30. package/types/plugins/index.d.ts +90 -0
  31. package/types/plugins/index.d.ts.map +1 -0
  32. package/types/services/searchService.d.ts +21 -1
  33. package/types/services/searchService.d.ts.map +1 -1
  34. package/types/tsconfig.tsbuildinfo +1 -1
  35. package/types/types/map.d.ts +56 -0
  36. package/types/types/map.d.ts.map +1 -1
package/lib/index.umd.js CHANGED
@@ -4187,7 +4187,6 @@ var __publicField = (obj, key, value) => {
4187
4187
  dest
4188
4188
  );
4189
4189
  }
4190
- const SimpleGeometry$1 = SimpleGeometry;
4191
4190
  function linearRing(flatCoordinates, offset2, end2, stride) {
4192
4191
  let twiceArea = 0;
4193
4192
  const x0 = flatCoordinates[end2 - stride];
@@ -4640,7 +4639,7 @@ var __publicField = (obj, key, value) => {
4640
4639
  }
4641
4640
  return simplifiedOffset;
4642
4641
  }
4643
- let LinearRing$1 = class LinearRing2 extends SimpleGeometry$1 {
4642
+ let LinearRing$1 = class LinearRing2 extends SimpleGeometry {
4644
4643
  /**
4645
4644
  * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
4646
4645
  * For internal use, flat coordinates in combination with `layout` are also accepted.
@@ -4797,7 +4796,7 @@ var __publicField = (obj, key, value) => {
4797
4796
  }
4798
4797
  };
4799
4798
  const LinearRing$2 = LinearRing$1;
4800
- let Point$6 = class Point2 extends SimpleGeometry$1 {
4799
+ let Point$6 = class Point2 extends SimpleGeometry {
4801
4800
  /**
4802
4801
  * @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
4803
4802
  * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
@@ -5282,7 +5281,7 @@ var __publicField = (obj, key, value) => {
5282
5281
  }
5283
5282
  return endss;
5284
5283
  }
5285
- let Polygon$6 = class Polygon2 extends SimpleGeometry$1 {
5284
+ let Polygon$6 = class Polygon2 extends SimpleGeometry {
5286
5285
  /**
5287
5286
  * @param {!Array<Array<import("../coordinate.js").Coordinate>>|!Array<number>} coordinates
5288
5287
  * Array of linear rings that define the polygon. The first linear ring of the
@@ -18182,7 +18181,7 @@ var __publicField = (obj, key, value) => {
18182
18181
  }
18183
18182
  return length2;
18184
18183
  }
18185
- let LineString$1 = class LineString2 extends SimpleGeometry$1 {
18184
+ let LineString$1 = class LineString2 extends SimpleGeometry {
18186
18185
  /**
18187
18186
  * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
18188
18187
  * For internal use, flat coordinates in combination with `layout` are also accepted.
@@ -19780,7 +19779,7 @@ var __publicField = (obj, key, value) => {
19780
19779
  }
19781
19780
  return flatCenters;
19782
19781
  }
19783
- let Circle$6 = class Circle2 extends SimpleGeometry$1 {
19782
+ let Circle$6 = class Circle2 extends SimpleGeometry {
19784
19783
  /**
19785
19784
  * @param {!import("../coordinate.js").Coordinate} center Center.
19786
19785
  * For internal use, flat coordinates in combination with `layout` and no
@@ -20292,7 +20291,7 @@ var __publicField = (obj, key, value) => {
20292
20291
  return geometries.map((geometry) => geometry.clone());
20293
20292
  }
20294
20293
  const GeometryCollection$1 = GeometryCollection;
20295
- let MultiLineString$1 = class MultiLineString2 extends SimpleGeometry$1 {
20294
+ let MultiLineString$1 = class MultiLineString2 extends SimpleGeometry {
20296
20295
  /**
20297
20296
  * @param {Array<Array<import("../coordinate.js").Coordinate>|LineString>|Array<number>} coordinates
20298
20297
  * Coordinates or LineString geometries. (For internal use, flat coordinates in
@@ -20608,7 +20607,7 @@ var __publicField = (obj, key, value) => {
20608
20607
  }
20609
20608
  };
20610
20609
  const MultiLineString$2 = MultiLineString$1;
20611
- let MultiPoint$1 = class MultiPoint2 extends SimpleGeometry$1 {
20610
+ let MultiPoint$1 = class MultiPoint2 extends SimpleGeometry {
20612
20611
  /**
20613
20612
  * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
20614
20613
  * For internal use, flat coordinates in combination with `layout` are also accepted.
@@ -20783,7 +20782,7 @@ var __publicField = (obj, key, value) => {
20783
20782
  }
20784
20783
  };
20785
20784
  const MultiPoint$2 = MultiPoint$1;
20786
- let MultiPolygon$1 = class MultiPolygon2 extends SimpleGeometry$1 {
20785
+ let MultiPolygon$1 = class MultiPolygon2 extends SimpleGeometry {
20787
20786
  /**
20788
20787
  * @param {Array<Array<Array<import("../coordinate.js").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.
20789
20788
  * For internal use, flat coordinates in combination with `layout` and `endss` are also accepted.
@@ -55186,7 +55185,6 @@ ${this.attributes_.map(
55186
55185
  return abstract();
55187
55186
  }
55188
55187
  }
55189
- const FeatureFormat$1 = FeatureFormat;
55190
55188
  function transformGeometryWithOptions(geometry, write2, options) {
55191
55189
  const featureProjection = options ? get$6(options.featureProjection) : null;
55192
55190
  const dataProjection = options ? get$6(options.dataProjection) : null;
@@ -55299,7 +55297,7 @@ ${this.attributes_.map(
55299
55297
  options
55300
55298
  );
55301
55299
  }
55302
- class JSONFeature extends FeatureFormat$1 {
55300
+ class JSONFeature extends FeatureFormat {
55303
55301
  constructor() {
55304
55302
  super();
55305
55303
  }
@@ -56236,7 +56234,7 @@ ${this.attributes_.map(
56236
56234
  }
56237
56235
  return document_;
56238
56236
  }
56239
- class XMLFeature extends FeatureFormat$1 {
56237
+ class XMLFeature extends FeatureFormat {
56240
56238
  constructor() {
56241
56239
  super();
56242
56240
  this.xmlSerializer_ = getXMLSerializer();
@@ -58742,7 +58740,7 @@ ${this.attributes_.map(
58742
58740
  GML.prototype.writeFeatures;
58743
58741
  GML.prototype.writeFeaturesNode;
58744
58742
  const GML$1 = GML;
58745
- class TextFeature extends FeatureFormat$1 {
58743
+ class TextFeature extends FeatureFormat {
58746
58744
  constructor() {
58747
58745
  super();
58748
58746
  }
@@ -62053,7 +62051,7 @@ ${this.attributes_.map(
62053
62051
  }
62054
62052
  return pos;
62055
62053
  }
62056
- class MVT extends FeatureFormat$1 {
62054
+ class MVT extends FeatureFormat {
62057
62055
  /**
62058
62056
  * @param {Options<FeatureType>} [options] Options.
62059
62057
  */
@@ -335067,24 +335065,24 @@ ${indentData}`);
335067
335065
  key: 0,
335068
335066
  class: "image-loading"
335069
335067
  };
335070
- const _hoisted_8$f = {
335068
+ const _hoisted_8$g = {
335071
335069
  key: 1,
335072
335070
  class: "image-error"
335073
335071
  };
335074
- const _hoisted_9$e = {
335072
+ const _hoisted_9$f = {
335075
335073
  key: 2,
335076
335074
  class: "image-navigation"
335077
335075
  };
335078
- const _hoisted_10$e = {
335076
+ const _hoisted_10$f = {
335079
335077
  key: 3,
335080
335078
  class: "image-counter"
335081
335079
  };
335082
- const _hoisted_11$c = {
335080
+ const _hoisted_11$d = {
335083
335081
  key: 2,
335084
335082
  class: "image-thumbnails"
335085
335083
  };
335086
- const _hoisted_12$a = ["onClick"];
335087
- const _hoisted_13$9 = ["src", "alt"];
335084
+ const _hoisted_12$b = ["onClick"];
335085
+ const _hoisted_13$a = ["src", "alt"];
335088
335086
  const _hoisted_14$7 = {
335089
335087
  key: 3,
335090
335088
  class: "slideshow-controls"
@@ -335255,10 +335253,10 @@ ${indentData}`);
335255
335253
  vue.createElementVNode("div", { class: "loading-spinner" }, null, -1),
335256
335254
  vue.createElementVNode("span", null, "加载中...", -1)
335257
335255
  ])])) : vue.createCommentVNode("", true),
335258
- imageError.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$f, [..._cache[5] || (_cache[5] = [
335256
+ imageError.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$g, [..._cache[5] || (_cache[5] = [
335259
335257
  vue.createElementVNode("span", null, "图片加载失败", -1)
335260
335258
  ])])) : vue.createCommentVNode("", true),
335261
- imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$e, [
335259
+ imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$f, [
335262
335260
  vue.createVNode(vue.unref(elementPlus.ElButton), {
335263
335261
  class: "nav-btn prev-btn",
335264
335262
  disabled: currentIndex.value === 0,
@@ -335284,10 +335282,10 @@ ${indentData}`);
335284
335282
  _: 1
335285
335283
  }, 8, ["disabled"])
335286
335284
  ])) : vue.createCommentVNode("", true),
335287
- imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$e, vue.toDisplayString(currentIndex.value + 1) + " / " + vue.toDisplayString(imageList.value.length), 1)) : vue.createCommentVNode("", true)
335285
+ imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$f, vue.toDisplayString(currentIndex.value + 1) + " / " + vue.toDisplayString(imageList.value.length), 1)) : vue.createCommentVNode("", true)
335288
335286
  ])
335289
335287
  ]),
335290
- _ctx.config.showThumbnails && imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$c, [
335288
+ _ctx.config.showThumbnails && imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$d, [
335291
335289
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(imageList.value, (image2, index2) => {
335292
335290
  return vue.openBlock(), vue.createElementBlock("div", {
335293
335291
  key: index2,
@@ -335297,8 +335295,8 @@ ${indentData}`);
335297
335295
  vue.createElementVNode("img", {
335298
335296
  src: image2,
335299
335297
  alt: `缩略图 ${index2 + 1}`
335300
- }, null, 8, _hoisted_13$9)
335301
- ], 10, _hoisted_12$a);
335298
+ }, null, 8, _hoisted_13$a)
335299
+ ], 10, _hoisted_12$b);
335302
335300
  }), 128))
335303
335301
  ])) : vue.createCommentVNode("", true),
335304
335302
  _ctx.config.slideshow && imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$7, [
@@ -335371,24 +335369,24 @@ ${indentData}`);
335371
335369
  class: "data-stats"
335372
335370
  };
335373
335371
  const _hoisted_7$i = { key: 0 };
335374
- const _hoisted_8$e = {
335372
+ const _hoisted_8$f = {
335375
335373
  key: 5,
335376
335374
  class: "table-view"
335377
335375
  };
335378
- const _hoisted_9$d = { class: "table-container" };
335379
- const _hoisted_10$d = { class: "data-table" };
335380
- const _hoisted_11$b = ["onClick"];
335381
- const _hoisted_12$9 = {
335376
+ const _hoisted_9$e = { class: "table-container" };
335377
+ const _hoisted_10$e = { class: "data-table" };
335378
+ const _hoisted_11$c = ["onClick"];
335379
+ const _hoisted_12$a = {
335382
335380
  key: 0,
335383
335381
  class: "sort-indicator"
335384
335382
  };
335385
- const _hoisted_13$8 = ["onClick"];
335383
+ const _hoisted_13$9 = ["onClick"];
335386
335384
  const _hoisted_14$6 = { key: 0 };
335387
335385
  const _hoisted_15$5 = ["src", "alt"];
335388
335386
  const _hoisted_16$5 = { key: 1 };
335389
335387
  const _hoisted_17$5 = ["href"];
335390
335388
  const _hoisted_18$5 = { key: 2 };
335391
- const _hoisted_19$4 = { key: 3 };
335389
+ const _hoisted_19$5 = { key: 3 };
335392
335390
  const _hoisted_20$3 = { key: 4 };
335393
335391
  const _hoisted_21$2 = {
335394
335392
  key: 6,
@@ -335639,9 +335637,9 @@ ${indentData}`);
335639
335637
  vue.createElementVNode("span", null, "共 " + vue.toDisplayString(filteredData.value.length) + " 条记录", 1),
335640
335638
  searchQuery.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7$i, "(已过滤 " + vue.toDisplayString(arrayData.value.length - filteredData.value.length) + " 条)", 1)) : vue.createCommentVNode("", true)
335641
335639
  ])) : vue.createCommentVNode("", true),
335642
- currentView.value === "table" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$e, [
335643
- vue.createElementVNode("div", _hoisted_9$d, [
335644
- vue.createElementVNode("table", _hoisted_10$d, [
335640
+ currentView.value === "table" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$f, [
335641
+ vue.createElementVNode("div", _hoisted_9$e, [
335642
+ vue.createElementVNode("table", _hoisted_10$e, [
335645
335643
  vue.createElementVNode("thead", null, [
335646
335644
  vue.createElementVNode("tr", null, [
335647
335645
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayFields.value, (field) => {
@@ -335651,8 +335649,8 @@ ${indentData}`);
335651
335649
  onClick: ($event) => handleSort(field.key)
335652
335650
  }, [
335653
335651
  vue.createTextVNode(vue.toDisplayString(field.label) + " ", 1),
335654
- field.sortable && sortField.value === field.key ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_12$9, vue.toDisplayString(sortOrder.value === "asc" ? "↑" : "↓"), 1)) : vue.createCommentVNode("", true)
335655
- ], 10, _hoisted_11$b);
335652
+ field.sortable && sortField.value === field.key ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_12$a, vue.toDisplayString(sortOrder.value === "asc" ? "↑" : "↓"), 1)) : vue.createCommentVNode("", true)
335653
+ ], 10, _hoisted_11$c);
335656
335654
  }), 128))
335657
335655
  ])
335658
335656
  ]),
@@ -335678,10 +335676,10 @@ ${indentData}`);
335678
335676
  target: "_blank",
335679
335677
  class: "table-link"
335680
335678
  }, vue.toDisplayString(getFieldValue(item, field.key || field.name)), 9, _hoisted_17$5)
335681
- ])) : field.type === "date" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_18$5, vue.toDisplayString(formatDate(getFieldValue(item, field.key || field.name))), 1)) : field.type === "number" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_19$4, vue.toDisplayString(formatNumber2(getFieldValue(item, field.key || field.name))), 1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_20$3, vue.toDisplayString(getFieldValue(item, field.key || field.name)), 1))
335679
+ ])) : field.type === "date" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_18$5, vue.toDisplayString(formatDate(getFieldValue(item, field.key || field.name))), 1)) : field.type === "number" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_19$5, vue.toDisplayString(formatNumber2(getFieldValue(item, field.key || field.name))), 1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_20$3, vue.toDisplayString(getFieldValue(item, field.key || field.name)), 1))
335682
335680
  ]);
335683
335681
  }), 128))
335684
- ], 8, _hoisted_13$8);
335682
+ ], 8, _hoisted_13$9);
335685
335683
  }), 128))
335686
335684
  ])
335687
335685
  ])
@@ -338282,6 +338280,7 @@ ${indentData}`);
338282
338280
  * @param options 搜索选项
338283
338281
  */
338284
338282
  async search(query, options = {}) {
338283
+ var _a2;
338285
338284
  try {
338286
338285
  const {
338287
338286
  maxResults = 10,
@@ -338309,8 +338308,10 @@ ${indentData}`);
338309
338308
  throw new Error(`天地图API请求失败: ${response.status}`);
338310
338309
  }
338311
338310
  const data2 = await response.json();
338312
- if (data2.status !== "200" && data2.status !== "0") {
338313
- throw new Error(`天地图API返回错误: ${data2.status}`);
338311
+ const isSuccess = data2.status === "200" || data2.status === "0" || typeof data2.status === "object" && ((_a2 = data2.status) == null ? void 0 : _a2.infocode) === 1e3;
338312
+ if (!isSuccess) {
338313
+ const errorMessage = typeof data2.status === "object" ? `${data2.status.cndesc || "未知错误"} (${data2.status.infocode ?? "unknown"})` : data2.status;
338314
+ throw new Error(`天地图API返回错误: ${errorMessage}`);
338314
338315
  }
338315
338316
  return this.transformResults(data2, type);
338316
338317
  } catch (error2) {
@@ -338477,6 +338478,20 @@ ${indentData}`);
338477
338478
  }
338478
338479
  }
338479
338480
  const tiandituSearchApi = new TiandituSearchApi();
338481
+ class MapSearchError extends Error {
338482
+ constructor(options) {
338483
+ super(options.message);
338484
+ __publicField(this, "code");
338485
+ __publicField(this, "userMessage");
338486
+ __publicField(this, "provider");
338487
+ __publicField(this, "cause");
338488
+ this.name = "MapSearchError";
338489
+ this.code = options.code;
338490
+ this.userMessage = options.userMessage;
338491
+ this.provider = options.provider;
338492
+ this.cause = options.cause;
338493
+ }
338494
+ }
338480
338495
  class MapSearchService {
338481
338496
  constructor(config, deps) {
338482
338497
  __publicField(this, "config");
@@ -338530,7 +338545,7 @@ ${indentData}`);
338530
338545
  return results;
338531
338546
  } catch (error2) {
338532
338547
  console.error("搜索失败:", error2);
338533
- return [];
338548
+ throw this.createSearchError(query, error2);
338534
338549
  }
338535
338550
  }
338536
338551
  /**
@@ -338645,7 +338660,7 @@ ${indentData}`);
338645
338660
  async searchTianditu(query) {
338646
338661
  try {
338647
338662
  const results = await tiandituSearchApi.search(query, {
338648
- ...this.config,
338663
+ ...this.getTiandituSearchOptions(),
338649
338664
  maxResults: this.config.maxResults || 10,
338650
338665
  type: this.config.type || "all"
338651
338666
  });
@@ -338655,6 +338670,111 @@ ${indentData}`);
338655
338670
  throw error2;
338656
338671
  }
338657
338672
  }
338673
+ getTiandituSearchOptions() {
338674
+ const {
338675
+ enabled: _enabled,
338676
+ position: _position,
338677
+ placeholder: _placeholder,
338678
+ provider: _provider,
338679
+ apiKey: _apiKey,
338680
+ customApi: _customApi,
338681
+ layerSearch: _layerSearch,
338682
+ maxResults: _maxResults,
338683
+ showHistory: _showHistory,
338684
+ enableStorage: _enableStorage,
338685
+ searchDelay: _searchDelay,
338686
+ minSearchLength: _minSearchLength,
338687
+ messages: _messages,
338688
+ resultStyle: _resultStyle,
338689
+ onSearch: _onSearch,
338690
+ onSelect: _onSelect,
338691
+ customSearchFn: _customSearchFn,
338692
+ ...tiandituOptions
338693
+ } = this.config;
338694
+ return tiandituOptions;
338695
+ }
338696
+ createSearchError(query, error2) {
338697
+ var _a2;
338698
+ if (error2 instanceof MapSearchError) {
338699
+ return error2;
338700
+ }
338701
+ const provider = this.getResolvedProvider();
338702
+ const code = this.inferSearchErrorCode(error2);
338703
+ const technicalMessage = error2 instanceof Error ? error2.message : "搜索服务发生未知错误";
338704
+ const userMessage = this.resolveMessage((_a2 = this.config.messages) == null ? void 0 : _a2.searchFailed, {
338705
+ query,
338706
+ provider,
338707
+ error: error2,
338708
+ code
338709
+ }) || this.getDefaultSearchFailedMessage(provider, code);
338710
+ return new MapSearchError({
338711
+ code,
338712
+ message: technicalMessage,
338713
+ userMessage,
338714
+ provider,
338715
+ cause: error2
338716
+ });
338717
+ }
338718
+ inferSearchErrorCode(error2) {
338719
+ if (error2 instanceof MapSearchError) {
338720
+ return error2.code;
338721
+ }
338722
+ if (error2 instanceof TypeError) {
338723
+ return "network_error";
338724
+ }
338725
+ if (!(error2 instanceof Error)) {
338726
+ return "unknown_error";
338727
+ }
338728
+ const message = error2.message.toLowerCase();
338729
+ if (message.includes("未配置") || message.includes("not configured")) {
338730
+ return "config_error";
338731
+ }
338732
+ if (message.includes("failed to fetch") || message.includes("networkerror") || message.includes("网络")) {
338733
+ return "network_error";
338734
+ }
338735
+ if (message.includes("http error") || message.includes("请求失败") || /^http\s\d+/.test(message)) {
338736
+ return "http_error";
338737
+ }
338738
+ if (message.includes("api错误") || message.includes("返回错误") || message.includes("业务错误")) {
338739
+ return "api_error";
338740
+ }
338741
+ return "unknown_error";
338742
+ }
338743
+ getResolvedProvider() {
338744
+ return this.config.provider || "tianditu";
338745
+ }
338746
+ getDefaultSearchFailedMessage(provider, code) {
338747
+ const providerLabel = this.getProviderLabel(provider);
338748
+ switch (code) {
338749
+ case "config_error":
338750
+ return `${providerLabel}未完成配置,请联系管理员`;
338751
+ case "http_error":
338752
+ return `${providerLabel}服务连接失败,请稍后重试`;
338753
+ case "api_error":
338754
+ return `${providerLabel}返回业务错误,请调整关键词后重试`;
338755
+ case "network_error":
338756
+ return `网络连接异常,无法访问${providerLabel}`;
338757
+ default:
338758
+ return `${providerLabel}搜索暂不可用,请稍后重试`;
338759
+ }
338760
+ }
338761
+ getProviderLabel(provider) {
338762
+ const labelMap = {
338763
+ baidu: "百度地图搜索服务",
338764
+ amap: "高德地图搜索服务",
338765
+ google: "Google 地图搜索服务",
338766
+ tianditu: "天地图搜索服务",
338767
+ custom: "自定义搜索服务",
338768
+ layer: "图层搜索服务"
338769
+ };
338770
+ return labelMap[provider];
338771
+ }
338772
+ resolveMessage(resolver, context) {
338773
+ if (!resolver) {
338774
+ return void 0;
338775
+ }
338776
+ return typeof resolver === "function" ? resolver(context) : resolver;
338777
+ }
338658
338778
  /**
338659
338779
  * 自定义API搜索
338660
338780
  */
@@ -338999,6 +339119,11 @@ ${indentData}`);
338999
339119
  showHistory: true,
339000
339120
  searchDelay: 300,
339001
339121
  minSearchLength: 2,
339122
+ messages: {
339123
+ historyTitle: "搜索历史",
339124
+ clearHistory: "清除",
339125
+ resultsTitle: "搜索结果"
339126
+ },
339002
339127
  resultStyle: {
339003
339128
  markerColor: "#409eff",
339004
339129
  markerSize: 20,
@@ -339008,6 +339133,7 @@ ${indentData}`);
339008
339133
  };
339009
339134
  const searchService = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
339010
339135
  __proto__: null,
339136
+ MapSearchError,
339011
339137
  MapSearchService,
339012
339138
  defaultSearchConfig
339013
339139
  }, Symbol.toStringTag, { value: "Module" }));
@@ -339021,18 +339147,18 @@ ${indentData}`);
339021
339147
  const _hoisted_5$q = ["onClick"];
339022
339148
  const _hoisted_6$k = { class: "item-content" };
339023
339149
  const _hoisted_7$h = { class: "item-name" };
339024
- const _hoisted_8$d = { class: "item-address" };
339025
- const _hoisted_9$c = {
339150
+ const _hoisted_8$e = { class: "item-address" };
339151
+ const _hoisted_9$d = {
339026
339152
  key: 1,
339027
339153
  class: "search-section"
339028
339154
  };
339029
- const _hoisted_10$c = {
339155
+ const _hoisted_10$d = {
339030
339156
  key: 0,
339031
339157
  class: "section-title"
339032
339158
  };
339033
- const _hoisted_11$a = { class: "result-count" };
339034
- const _hoisted_12$8 = ["onClick"];
339035
- const _hoisted_13$7 = { class: "item-content" };
339159
+ const _hoisted_11$b = { class: "result-count" };
339160
+ const _hoisted_12$9 = ["onClick"];
339161
+ const _hoisted_13$8 = { class: "item-content" };
339036
339162
  const _hoisted_14$5 = ["innerHTML"];
339037
339163
  const _hoisted_15$4 = ["innerHTML"];
339038
339164
  const _hoisted_16$4 = {
@@ -339044,6 +339170,10 @@ ${indentData}`);
339044
339170
  class: "item-confidence"
339045
339171
  };
339046
339172
  const _hoisted_18$4 = {
339173
+ key: 0,
339174
+ class: "search-error"
339175
+ };
339176
+ const _hoisted_19$4 = {
339047
339177
  key: 0,
339048
339178
  class: "no-results"
339049
339179
  };
@@ -339060,10 +339190,15 @@ ${indentData}`);
339060
339190
  enableStorage: false,
339061
339191
  // 默认禁用存储
339062
339192
  searchDelay: 300,
339063
- minSearchLength: 2
339193
+ minSearchLength: 2,
339194
+ messages: {
339195
+ historyTitle: "搜索历史",
339196
+ clearHistory: "清除",
339197
+ resultsTitle: "搜索结果"
339198
+ }
339064
339199
  }) }
339065
339200
  },
339066
- emits: ["search", "select", "clear"],
339201
+ emits: ["search", "select", "clear", "search-error"],
339067
339202
  setup(__props, { expose: __expose, emit: __emit }) {
339068
339203
  const props = __props;
339069
339204
  const emit = __emit;
@@ -339079,12 +339214,52 @@ ${indentData}`);
339079
339214
  const showResults = vue.ref(false);
339080
339215
  const selectedIndex = vue.ref(-1);
339081
339216
  const searchTimer = vue.ref(null);
339217
+ const searchErrorMessage = vue.ref("");
339218
+ const searchErrorCode = vue.ref("");
339082
339219
  const position2 = vue.computed(() => props.config.position || "top-left");
339083
339220
  const placeholder = vue.computed(() => props.config.placeholder || "搜索地点...");
339084
339221
  const maxResults = vue.computed(() => props.config.maxResults || 10);
339085
339222
  const showHistory = vue.computed(() => props.config.showHistory !== false);
339086
339223
  const searchDelay = vue.computed(() => props.config.searchDelay || 300);
339087
339224
  const minSearchLength = vue.computed(() => props.config.minSearchLength || 2);
339225
+ const historyTitleText = vue.computed(
339226
+ () => {
339227
+ var _a2;
339228
+ return resolveMessage((_a2 = props.config.messages) == null ? void 0 : _a2.historyTitle, {}, "搜索历史");
339229
+ }
339230
+ );
339231
+ const clearHistoryText = vue.computed(
339232
+ () => {
339233
+ var _a2;
339234
+ return resolveMessage((_a2 = props.config.messages) == null ? void 0 : _a2.clearHistory, {}, "清除");
339235
+ }
339236
+ );
339237
+ const resultsTitleText = vue.computed(
339238
+ () => {
339239
+ var _a2;
339240
+ return resolveMessage(
339241
+ (_a2 = props.config.messages) == null ? void 0 : _a2.resultsTitle,
339242
+ {
339243
+ query: searchQuery.value,
339244
+ count: searchResults.value.length
339245
+ },
339246
+ "搜索结果"
339247
+ );
339248
+ }
339249
+ );
339250
+ const noResultsText = vue.computed(
339251
+ () => {
339252
+ var _a2;
339253
+ return resolveMessage(
339254
+ (_a2 = props.config.messages) == null ? void 0 : _a2.noResults,
339255
+ {
339256
+ query: searchQuery.value,
339257
+ provider: props.config.provider
339258
+ },
339259
+ getDefaultNoResultsMessage(props.config.provider || "tianditu")
339260
+ );
339261
+ }
339262
+ );
339088
339263
  const displayResults = vue.computed(() => {
339089
339264
  return searchResults.value.slice(0, maxResults.value);
339090
339265
  });
@@ -339098,15 +339273,65 @@ ${indentData}`);
339098
339273
  }
339099
339274
  return count2;
339100
339275
  });
339276
+ const resolveMessage = (resolver, context, fallback) => {
339277
+ if (!resolver) {
339278
+ return fallback;
339279
+ }
339280
+ return typeof resolver === "function" ? resolver(context) : resolver;
339281
+ };
339282
+ const getProviderLabel = (provider) => {
339283
+ const labelMap = {
339284
+ baidu: "百度地图",
339285
+ amap: "高德地图",
339286
+ google: "Google 地图",
339287
+ tianditu: "天地图",
339288
+ custom: "自定义搜索服务",
339289
+ layer: "图层搜索"
339290
+ };
339291
+ return labelMap[provider];
339292
+ };
339293
+ const getDefaultNoResultsMessage = (provider) => {
339294
+ switch (provider) {
339295
+ case "baidu":
339296
+ return "百度地图未找到相关地点,请尝试更换关键词";
339297
+ case "amap":
339298
+ return "高德地图未找到相关地点,请尝试更换关键词";
339299
+ case "google":
339300
+ return "Google 地图未找到相关地点,请尝试更换关键词";
339301
+ case "custom":
339302
+ return "自定义搜索服务未返回结果";
339303
+ case "layer":
339304
+ return "当前图层中未找到匹配结果";
339305
+ default:
339306
+ return "天地图未找到相关地点,请尝试补充行政区或 POI 名称";
339307
+ }
339308
+ };
339309
+ const normalizeSearchError = (error2) => {
339310
+ if (error2 instanceof MapSearchError) {
339311
+ return error2;
339312
+ }
339313
+ const provider = props.config.provider || "tianditu";
339314
+ return new MapSearchError({
339315
+ code: "unknown_error",
339316
+ message: error2 instanceof Error ? error2.message : "搜索服务发生未知错误",
339317
+ userMessage: `${getProviderLabel(provider)}搜索暂不可用,请稍后重试`,
339318
+ provider,
339319
+ cause: error2
339320
+ });
339321
+ };
339101
339322
  const handleSearchInput = (value) => {
339102
339323
  if (searchTimer.value) {
339103
339324
  clearTimeout(searchTimer.value);
339104
339325
  }
339105
339326
  if (value.length >= minSearchLength.value) {
339327
+ searchErrorMessage.value = "";
339328
+ searchErrorCode.value = "";
339106
339329
  searchTimer.value = setTimeout(() => {
339107
339330
  performSearch(value);
339108
339331
  }, searchDelay.value);
339109
339332
  } else {
339333
+ searchErrorMessage.value = "";
339334
+ searchErrorCode.value = "";
339110
339335
  searchResults.value = [];
339111
339336
  showResults.value = value.length === 0 && showHistory.value;
339112
339337
  }
@@ -339154,6 +339379,8 @@ ${indentData}`);
339154
339379
  selectedIndex.value = -1;
339155
339380
  searchQuery.value = "";
339156
339381
  searchResults.value = [];
339382
+ searchErrorMessage.value = "";
339383
+ searchErrorCode.value = "";
339157
339384
  };
339158
339385
  const getSelectableItems = () => {
339159
339386
  const items = [];
@@ -339166,11 +339393,14 @@ ${indentData}`);
339166
339393
  return items;
339167
339394
  };
339168
339395
  const performSearch = async (query) => {
339396
+ var _a2;
339169
339397
  if (!query || query.length < minSearchLength.value) {
339170
339398
  return;
339171
339399
  }
339172
339400
  isLoading.value = true;
339173
339401
  showResults.value = true;
339402
+ searchErrorMessage.value = "";
339403
+ searchErrorCode.value = "";
339174
339404
  try {
339175
339405
  const results = await searchService2.search(query);
339176
339406
  searchResults.value = results;
@@ -339178,6 +339408,19 @@ ${indentData}`);
339178
339408
  } catch (error2) {
339179
339409
  console.error("搜索失败:", error2);
339180
339410
  searchResults.value = [];
339411
+ const normalizedError = normalizeSearchError(error2);
339412
+ searchErrorCode.value = normalizedError.code;
339413
+ searchErrorMessage.value = error2 instanceof MapSearchError ? normalizedError.userMessage : resolveMessage(
339414
+ (_a2 = props.config.messages) == null ? void 0 : _a2.searchFailed,
339415
+ {
339416
+ query,
339417
+ provider: normalizedError.provider,
339418
+ error: error2,
339419
+ code: normalizedError.code
339420
+ },
339421
+ normalizedError.userMessage
339422
+ );
339423
+ emit("search-error", normalizedError);
339181
339424
  } finally {
339182
339425
  isLoading.value = false;
339183
339426
  }
@@ -339187,7 +339430,6 @@ ${indentData}`);
339187
339430
  showResults.value = false;
339188
339431
  selectedIndex.value = -1;
339189
339432
  addToHistory(result);
339190
- debugger;
339191
339433
  emit("select", result);
339192
339434
  };
339193
339435
  const selectHistoryItem = (item) => {
@@ -339250,12 +339492,16 @@ ${indentData}`);
339250
339492
  const updateResults = (results) => {
339251
339493
  searchResults.value = results;
339252
339494
  isLoading.value = false;
339495
+ searchErrorMessage.value = "";
339496
+ searchErrorCode.value = "";
339253
339497
  };
339254
339498
  const clearResults = () => {
339255
339499
  searchResults.value = [];
339256
339500
  searchQuery.value = "";
339257
339501
  showResults.value = false;
339258
339502
  selectedIndex.value = -1;
339503
+ searchErrorMessage.value = "";
339504
+ searchErrorCode.value = "";
339259
339505
  emit("clear");
339260
339506
  };
339261
339507
  vue.onMounted(() => {
@@ -339273,6 +339519,8 @@ ${indentData}`);
339273
339519
  (newConfig) => {
339274
339520
  searchService2.updateConfig(newConfig);
339275
339521
  searchResults.value = [];
339522
+ searchErrorMessage.value = "";
339523
+ searchErrorCode.value = "";
339276
339524
  selectedIndex.value = -1;
339277
339525
  console.log("MapSearch配置已更新:", newConfig);
339278
339526
  },
@@ -339367,15 +339615,15 @@ ${indentData}`);
339367
339615
  showHistory.value && searchHistory.value.length > 0 && !searchQuery.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$v, [
339368
339616
  vue.renderSlot(_ctx.$slots, "history-title", { clearHistory }, () => [
339369
339617
  vue.createElementVNode("div", _hoisted_4$t, [
339370
- _cache[2] || (_cache[2] = vue.createElementVNode("span", null, "搜索历史", -1)),
339618
+ vue.createElementVNode("span", null, vue.toDisplayString(historyTitleText.value), 1),
339371
339619
  vue.createVNode(vue.unref(elementPlus.ElButton), {
339372
339620
  link: "",
339373
339621
  size: "small",
339374
339622
  onClick: clearHistory
339375
339623
  }, {
339376
- default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
339377
- vue.createTextVNode(" 清除 ", -1)
339378
- ])]),
339624
+ default: vue.withCtx(() => [
339625
+ vue.createTextVNode(vue.toDisplayString(clearHistoryText.value), 1)
339626
+ ]),
339379
339627
  _: 1
339380
339628
  })
339381
339629
  ])
@@ -339400,20 +339648,20 @@ ${indentData}`);
339400
339648
  }),
339401
339649
  vue.createElementVNode("div", _hoisted_6$k, [
339402
339650
  vue.createElementVNode("div", _hoisted_7$h, vue.toDisplayString(item.name), 1),
339403
- vue.createElementVNode("div", _hoisted_8$d, vue.toDisplayString(item.address), 1)
339651
+ vue.createElementVNode("div", _hoisted_8$e, vue.toDisplayString(item.address), 1)
339404
339652
  ])
339405
339653
  ], 10, _hoisted_5$q)
339406
339654
  ]);
339407
339655
  }), 128))
339408
339656
  ])) : vue.createCommentVNode("", true),
339409
- searchResults.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$c, [
339657
+ searchResults.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$d, [
339410
339658
  vue.renderSlot(_ctx.$slots, "results-title", {
339411
339659
  searchQuery: searchQuery.value,
339412
339660
  resultsCount: searchResults.value.length
339413
339661
  }, () => [
339414
- searchQuery.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$c, [
339415
- _cache[3] || (_cache[3] = vue.createElementVNode("span", null, "搜索结果", -1)),
339416
- vue.createElementVNode("span", _hoisted_11$a, "(" + vue.toDisplayString(searchResults.value.length) + ")", 1)
339662
+ searchQuery.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$d, [
339663
+ vue.createElementVNode("span", null, vue.toDisplayString(resultsTitleText.value), 1),
339664
+ vue.createElementVNode("span", _hoisted_11$b, "(" + vue.toDisplayString(searchResults.value.length) + ")", 1)
339417
339665
  ])) : vue.createCommentVNode("", true)
339418
339666
  ]),
339419
339667
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayResults.value, (result, index2) => {
@@ -339438,7 +339686,7 @@ ${indentData}`);
339438
339686
  ]),
339439
339687
  _: 1
339440
339688
  }),
339441
- vue.createElementVNode("div", _hoisted_13$7, [
339689
+ vue.createElementVNode("div", _hoisted_13$8, [
339442
339690
  vue.createElementVNode("div", {
339443
339691
  class: "item-name",
339444
339692
  innerHTML: highlightText(result.name, searchQuery.value)
@@ -339450,23 +339698,39 @@ ${indentData}`);
339450
339698
  result.type ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16$4, vue.toDisplayString(result.type), 1)) : vue.createCommentVNode("", true)
339451
339699
  ]),
339452
339700
  result.confidence ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$4, vue.toDisplayString(Math.round(result.confidence * 100)) + "% ", 1)) : vue.createCommentVNode("", true)
339453
- ], 10, _hoisted_12$8)
339701
+ ], 10, _hoisted_12$9)
339454
339702
  ]);
339455
339703
  }), 128))
339456
339704
  ])) : vue.createCommentVNode("", true),
339705
+ vue.renderSlot(_ctx.$slots, "search-error", {
339706
+ searchQuery: searchQuery.value,
339707
+ errorMessage: searchErrorMessage.value,
339708
+ errorCode: searchErrorCode.value,
339709
+ isLoading: isLoading.value
339710
+ }, () => [
339711
+ searchErrorMessage.value && !isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$4, [
339712
+ vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
339713
+ default: vue.withCtx(() => [
339714
+ vue.createVNode(vue.unref(iconsVue.InfoFilled))
339715
+ ]),
339716
+ _: 1
339717
+ }),
339718
+ vue.createElementVNode("span", null, vue.toDisplayString(searchErrorMessage.value), 1)
339719
+ ])) : vue.createCommentVNode("", true)
339720
+ ]),
339457
339721
  vue.renderSlot(_ctx.$slots, "no-results", {
339458
339722
  searchQuery: searchQuery.value,
339459
339723
  searchResults: searchResults.value,
339460
339724
  isLoading: isLoading.value
339461
339725
  }, () => [
339462
- searchQuery.value && searchResults.value.length === 0 && !isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$4, [
339726
+ searchQuery.value && searchResults.value.length === 0 && !isLoading.value && !searchErrorMessage.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_19$4, [
339463
339727
  vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
339464
339728
  default: vue.withCtx(() => [
339465
339729
  vue.createVNode(vue.unref(iconsVue.InfoFilled))
339466
339730
  ]),
339467
339731
  _: 1
339468
339732
  }),
339469
- _cache[4] || (_cache[4] = vue.createElementVNode("span", null, "未找到相关结果", -1))
339733
+ vue.createElementVNode("span", null, vue.toDisplayString(noResultsText.value), 1)
339470
339734
  ])) : vue.createCommentVNode("", true)
339471
339735
  ])
339472
339736
  ])
@@ -339611,6 +339875,24 @@ ${indentData}`);
339611
339875
  key: 6,
339612
339876
  class: "control-section"
339613
339877
  };
339878
+ const _hoisted_8$d = { class: "drawing-menu-panel-content" };
339879
+ const _hoisted_9$c = { class: "drawing-tool-list" };
339880
+ const _hoisted_10$c = {
339881
+ key: 0,
339882
+ class: "drawing-menu-divider"
339883
+ };
339884
+ const _hoisted_11$a = {
339885
+ key: 1,
339886
+ class: "drawing-toggle-row"
339887
+ };
339888
+ const _hoisted_12$8 = {
339889
+ key: 7,
339890
+ class: "control-divider"
339891
+ };
339892
+ const _hoisted_13$7 = {
339893
+ key: 8,
339894
+ class: "control-section"
339895
+ };
339614
339896
  const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
339615
339897
  __name: "OlControlPanel",
339616
339898
  props: {
@@ -339623,8 +339905,10 @@ ${indentData}`);
339623
339905
  bottomOffset: {},
339624
339906
  viewBookmarks: {}
339625
339907
  },
339626
- setup(__props, { expose: __expose }) {
339908
+ emits: ["drawing-complete"],
339909
+ setup(__props, { expose: __expose, emit: __emit }) {
339627
339910
  const props = __props;
339911
+ const emit = __emit;
339628
339912
  const map2 = vue.inject("map");
339629
339913
  const mapManager = vue.inject("mapManager");
339630
339914
  const overviewMapUtil = createOverviewMapUtil();
@@ -339634,7 +339918,37 @@ ${indentData}`);
339634
339918
  const currentZoom = vue.ref(10);
339635
339919
  const minZoom = vue.ref(3);
339636
339920
  const maxZoom = vue.ref(18);
339921
+ const isDrawingMenuOpen = vue.ref(false);
339922
+ const continuousDrawing = vue.ref(false);
339923
+ const activeDrawingMode = vue.ref("none");
339924
+ const DEFAULT_DRAWING_TOOLS = [
339925
+ "rectangle",
339926
+ "polygon",
339927
+ "circle",
339928
+ "line",
339929
+ "point"
339930
+ ];
339931
+ const drawingToolLabels = {
339932
+ point: "绘制点",
339933
+ line: "绘制线",
339934
+ polygon: "绘制多边形",
339935
+ circle: "绘制圆形",
339936
+ rectangle: "绘制矩形"
339937
+ };
339938
+ const geoJsonFormat = new GeoJSON$2();
339939
+ let boundDrawingManager = null;
339940
+ let boundDrawingEndHandler = null;
339941
+ let boundModeChangeHandler = null;
339637
339942
  const currentMap = vue.computed(() => map2 == null ? void 0 : map2.value);
339943
+ const popoverPlacement = vue.computed(() => {
339944
+ const isRight = props.position.includes("right");
339945
+ const isBottom = props.position.includes("bottom");
339946
+ if (props.direction === "vertical") {
339947
+ return isRight ? "left" : "right";
339948
+ } else {
339949
+ return isBottom ? "top" : "bottom";
339950
+ }
339951
+ });
339638
339952
  const positionClasses = vue.computed(() => {
339639
339953
  const basePositions = {
339640
339954
  "top-left": "top-4 left-4",
@@ -339718,10 +340032,55 @@ ${indentData}`);
339718
340032
  const tools = props.config.tools;
339719
340033
  return !!((tools == null ? void 0 : tools.viewBookmarks) || props.config.viewBookmarks);
339720
340034
  });
340035
+ const drawingControlConfig = vue.computed(() => {
340036
+ var _a2;
340037
+ const rawConfig = ((_a2 = props.config.tools) == null ? void 0 : _a2.drawing) ?? props.config.drawing;
340038
+ if (rawConfig === false) {
340039
+ return {
340040
+ enabled: false,
340041
+ trigger: "hover",
340042
+ continuous: false,
340043
+ showContinuousToggle: true,
340044
+ tools: DEFAULT_DRAWING_TOOLS,
340045
+ onDrawEnd: void 0
340046
+ };
340047
+ }
340048
+ if (rawConfig === true || rawConfig === void 0) {
340049
+ return {
340050
+ enabled: rawConfig === true,
340051
+ trigger: "hover",
340052
+ continuous: false,
340053
+ showContinuousToggle: true,
340054
+ tools: DEFAULT_DRAWING_TOOLS,
340055
+ onDrawEnd: void 0
340056
+ };
340057
+ }
340058
+ const config = rawConfig;
340059
+ const tools = (config.tools || DEFAULT_DRAWING_TOOLS).filter(
340060
+ (tool) => DEFAULT_DRAWING_TOOLS.includes(tool)
340061
+ );
340062
+ return {
340063
+ enabled: config.enabled !== false,
340064
+ trigger: config.trigger || "hover",
340065
+ continuous: config.continuous ?? false,
340066
+ showContinuousToggle: config.showContinuousToggle !== false,
340067
+ tools: tools.length > 0 ? Array.from(new Set(tools)) : DEFAULT_DRAWING_TOOLS,
340068
+ onDrawEnd: config.onDrawEnd
340069
+ };
340070
+ });
340071
+ const isDrawingEnabled = vue.computed(() => drawingControlConfig.value.enabled);
340072
+ const isDrawingActive = vue.computed(() => activeDrawingMode.value !== "none");
339721
340073
  const hasOtherTools = vue.computed(() => {
339722
340074
  const tools = props.config.tools;
339723
340075
  return !!((tools == null ? void 0 : tools.fullScreen) || props.config.fullScreen || (tools == null ? void 0 : tools.location) || props.config.location || isLayerPanelEnabled.value || isViewBookmarksEnabled.value || (tools == null ? void 0 : tools.overviewMap) || props.config.overviewMap || (tools == null ? void 0 : tools.zoomToExtent) || props.config.zoomToExtent);
339724
340076
  });
340077
+ vue.watch(
340078
+ drawingControlConfig,
340079
+ (config) => {
340080
+ continuousDrawing.value = config.continuous;
340081
+ },
340082
+ { immediate: true }
340083
+ );
339725
340084
  const initOverviewMap = () => {
339726
340085
  const tools = props.config.tools || {};
339727
340086
  const rawConfig = tools.overviewMap ?? props.config.overviewMap;
@@ -339891,6 +340250,83 @@ ${indentData}`);
339891
340250
  mapManager.value.clearAll();
339892
340251
  }
339893
340252
  };
340253
+ const buildDrawingResult = (drawing) => {
340254
+ const drawingJson = drawing.toJSON();
340255
+ const feature = drawing.getFeature();
340256
+ let geojson = null;
340257
+ if (feature && currentMap.value) {
340258
+ try {
340259
+ geojson = geoJsonFormat.writeFeatureObject(feature, {
340260
+ featureProjection: currentMap.value.getView().getProjection(),
340261
+ dataProjection: "EPSG:4326"
340262
+ });
340263
+ } catch (error2) {
340264
+ console.warn("绘制结果转 GeoJSON 失败:", error2);
340265
+ }
340266
+ }
340267
+ return {
340268
+ id: drawing.getId(),
340269
+ type: drawing.getType(),
340270
+ name: drawing.getName(),
340271
+ coordinates: drawingJson.coordinates,
340272
+ properties: drawingJson.properties || {},
340273
+ style: drawingJson.style || {},
340274
+ config: drawingJson.config || {},
340275
+ geojson,
340276
+ drawing,
340277
+ feature,
340278
+ source: "controls"
340279
+ };
340280
+ };
340281
+ const cleanupDrawingListeners = () => {
340282
+ if (boundDrawingManager && boundDrawingEndHandler && boundModeChangeHandler) {
340283
+ boundDrawingManager.off("drawing-end", boundDrawingEndHandler);
340284
+ boundDrawingManager.off("mode-change", boundModeChangeHandler);
340285
+ }
340286
+ boundDrawingManager = null;
340287
+ boundDrawingEndHandler = null;
340288
+ boundModeChangeHandler = null;
340289
+ activeDrawingMode.value = "none";
340290
+ };
340291
+ const bindDrawingListeners = (drawingManager) => {
340292
+ cleanupDrawingListeners();
340293
+ if (!drawingManager)
340294
+ return;
340295
+ boundDrawingManager = drawingManager;
340296
+ activeDrawingMode.value = drawingManager.getMode();
340297
+ boundDrawingEndHandler = (drawing) => {
340298
+ var _a2, _b2;
340299
+ const result = buildDrawingResult(drawing);
340300
+ (_b2 = (_a2 = drawingControlConfig.value).onDrawEnd) == null ? void 0 : _b2.call(_a2, result);
340301
+ emit("drawing-complete", result);
340302
+ };
340303
+ boundModeChangeHandler = (mode) => {
340304
+ activeDrawingMode.value = mode;
340305
+ };
340306
+ drawingManager.on("drawing-end", boundDrawingEndHandler);
340307
+ drawingManager.on("mode-change", boundModeChangeHandler);
340308
+ };
340309
+ const startQuickDrawing = (tool) => {
340310
+ var _a2;
340311
+ const drawingManager = (_a2 = mapManager == null ? void 0 : mapManager.value) == null ? void 0 : _a2.getDrawingManager();
340312
+ if (!drawingManager) {
340313
+ console.warn("DrawingManager not found");
340314
+ return;
340315
+ }
340316
+ drawingManager.setContinuousDrawing(continuousDrawing.value);
340317
+ drawingManager.setMode(tool, {
340318
+ allowContinuousDrawing: continuousDrawing.value
340319
+ });
340320
+ isDrawingMenuOpen.value = false;
340321
+ };
340322
+ const stopQuickDrawing = () => {
340323
+ var _a2;
340324
+ const drawingManager = (_a2 = mapManager == null ? void 0 : mapManager.value) == null ? void 0 : _a2.getDrawingManager();
340325
+ if (!drawingManager)
340326
+ return;
340327
+ drawingManager.setMode("none");
340328
+ isDrawingMenuOpen.value = false;
340329
+ };
339894
340330
  const zoomToExtent = () => {
339895
340331
  var _a2;
339896
340332
  if (currentMap.value) {
@@ -339934,6 +340370,16 @@ ${indentData}`);
339934
340370
  },
339935
340371
  { immediate: true }
339936
340372
  );
340373
+ vue.watch(
340374
+ () => {
340375
+ var _a2;
340376
+ return ((_a2 = mapManager == null ? void 0 : mapManager.value) == null ? void 0 : _a2.getDrawingManager()) || null;
340377
+ },
340378
+ (drawingManager) => {
340379
+ bindDrawingListeners(drawingManager);
340380
+ },
340381
+ { immediate: true }
340382
+ );
339937
340383
  const handleFullscreenChange = () => {
339938
340384
  isFullscreen.value = !!document.fullscreenElement;
339939
340385
  };
@@ -339945,6 +340391,7 @@ ${indentData}`);
339945
340391
  var _a2;
339946
340392
  document.removeEventListener("fullscreenchange", handleFullscreenChange);
339947
340393
  overviewMapUtil.destroy();
340394
+ cleanupDrawingListeners();
339948
340395
  if (currentMap.value) {
339949
340396
  currentMap.value.un("moveend", updateScale);
339950
340397
  (_a2 = currentMap.value.getTargetElement()) == null ? void 0 : _a2.removeEventListener("mousemove", updateMousePosition);
@@ -339975,7 +340422,7 @@ ${indentData}`);
339975
340422
  isMinZoom
339976
340423
  });
339977
340424
  return (_ctx, _cache) => {
339978
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p;
340425
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2;
339979
340426
  const _component_el_slider = vue.resolveComponent("el-slider");
339980
340427
  return vue.openBlock(), vue.createElementBlock("div", {
339981
340428
  class: vue.normalizeClass(["mapcontrols absolute z-1 pointer-events-none select-none animate-fade-in", positionClasses.value]),
@@ -340214,8 +340661,119 @@ ${indentData}`);
340214
340661
  _: 1
340215
340662
  }, 8, ["title"])) : vue.createCommentVNode("", true)
340216
340663
  ])) : vue.createCommentVNode("", true),
340217
- (((_m = _ctx.config.tools) == null ? void 0 : _m.clearAll) || _ctx.config.clearAll) && (hasOtherTools.value || ((_n2 = _ctx.config.tools) == null ? void 0 : _n2.zoom) || _ctx.config.zoom || ((_o2 = _ctx.config.tools) == null ? void 0 : _o2.rotate) || _ctx.config.rotate) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$j)) : vue.createCommentVNode("", true),
340218
- ((_p = _ctx.config.tools) == null ? void 0 : _p.clearAll) || _ctx.config.clearAll ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$g, [
340664
+ isDrawingEnabled.value && (hasOtherTools.value || ((_m = _ctx.config.tools) == null ? void 0 : _m.zoom) || _ctx.config.zoom || ((_n2 = _ctx.config.tools) == null ? void 0 : _n2.rotate) || _ctx.config.rotate) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$j)) : vue.createCommentVNode("", true),
340665
+ isDrawingEnabled.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$g, [
340666
+ vue.createVNode(vue.unref(elementPlus.ElPopover), {
340667
+ placement: popoverPlacement.value,
340668
+ trigger: drawingControlConfig.value.trigger === "hover" ? "hover" : "click",
340669
+ visible: isDrawingMenuOpen.value,
340670
+ "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => isDrawingMenuOpen.value = $event),
340671
+ width: 180,
340672
+ "popper-class": "drawing-menu-popover",
340673
+ disabled: !isDrawingEnabled.value
340674
+ }, {
340675
+ reference: vue.withCtx(() => [
340676
+ vue.createVNode(vue.unref(elementPlus.ElButton), {
340677
+ class: vue.normalizeClass(["control-btn", { "is-active": isDrawingMenuOpen.value || isDrawingActive.value }]),
340678
+ title: "快捷绘制",
340679
+ size: "small",
340680
+ text: ""
340681
+ }, {
340682
+ default: vue.withCtx(() => [
340683
+ vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
340684
+ default: vue.withCtx(() => [
340685
+ vue.createVNode(vue.unref(iconsVue.EditPen))
340686
+ ]),
340687
+ _: 1
340688
+ })
340689
+ ]),
340690
+ _: 1
340691
+ }, 8, ["class"])
340692
+ ]),
340693
+ default: vue.withCtx(() => [
340694
+ vue.createElementVNode("div", _hoisted_8$d, [
340695
+ _cache[5] || (_cache[5] = vue.createElementVNode("div", { class: "drawing-menu-title" }, "快捷绘制", -1)),
340696
+ vue.createElementVNode("div", _hoisted_9$c, [
340697
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(drawingControlConfig.value.tools, (tool) => {
340698
+ return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
340699
+ key: tool,
340700
+ content: drawingToolLabels[tool],
340701
+ placement: "top",
340702
+ "show-after": 200
340703
+ }, {
340704
+ default: vue.withCtx(() => [
340705
+ vue.createVNode(vue.unref(elementPlus.ElButton), {
340706
+ size: "small",
340707
+ text: "",
340708
+ class: vue.normalizeClass(["drawing-tool-btn", { "is-active": activeDrawingMode.value === tool }]),
340709
+ onClick: ($event) => startQuickDrawing(tool)
340710
+ }, {
340711
+ default: vue.withCtx(() => [
340712
+ tool === "point" ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElIcon), { key: 0 }, {
340713
+ default: vue.withCtx(() => [
340714
+ vue.createVNode(vue.unref(iconsVue.Location))
340715
+ ]),
340716
+ _: 1
340717
+ })) : tool === "line" ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElIcon), { key: 1 }, {
340718
+ default: vue.withCtx(() => [
340719
+ vue.createVNode(vue.unref(iconsVue.Minus))
340720
+ ]),
340721
+ _: 1
340722
+ })) : tool === "polygon" ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElIcon), { key: 2 }, {
340723
+ default: vue.withCtx(() => [
340724
+ vue.createVNode(vue.unref(iconsVue.Share))
340725
+ ]),
340726
+ _: 1
340727
+ })) : tool === "circle" ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElIcon), { key: 3 }, {
340728
+ default: vue.withCtx(() => [
340729
+ vue.createVNode(vue.unref(iconsVue.CircleCheck))
340730
+ ]),
340731
+ _: 1
340732
+ })) : tool === "rectangle" ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElIcon), { key: 4 }, {
340733
+ default: vue.withCtx(() => [
340734
+ vue.createVNode(vue.unref(iconsVue.FullScreen))
340735
+ ]),
340736
+ _: 1
340737
+ })) : vue.createCommentVNode("", true)
340738
+ ]),
340739
+ _: 2
340740
+ }, 1032, ["class", "onClick"])
340741
+ ]),
340742
+ _: 2
340743
+ }, 1032, ["content"]);
340744
+ }), 128))
340745
+ ]),
340746
+ drawingControlConfig.value.showContinuousToggle || isDrawingActive.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$c)) : vue.createCommentVNode("", true),
340747
+ drawingControlConfig.value.showContinuousToggle ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$a, [
340748
+ vue.createVNode(vue.unref(elementPlus.ElCheckbox), {
340749
+ modelValue: continuousDrawing.value,
340750
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => continuousDrawing.value = $event)
340751
+ }, {
340752
+ default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
340753
+ vue.createTextVNode(" 是否连续绘制 ", -1)
340754
+ ])]),
340755
+ _: 1
340756
+ }, 8, ["modelValue"])
340757
+ ])) : vue.createCommentVNode("", true),
340758
+ isDrawingActive.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
340759
+ key: 2,
340760
+ size: "small",
340761
+ text: "",
340762
+ class: "drawing-stop-btn",
340763
+ onClick: stopQuickDrawing
340764
+ }, {
340765
+ default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
340766
+ vue.createTextVNode(" 停止绘制 ", -1)
340767
+ ])]),
340768
+ _: 1
340769
+ })) : vue.createCommentVNode("", true)
340770
+ ])
340771
+ ]),
340772
+ _: 1
340773
+ }, 8, ["placement", "trigger", "visible", "disabled"])
340774
+ ])) : vue.createCommentVNode("", true),
340775
+ (((_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) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$8)) : vue.createCommentVNode("", true),
340776
+ ((_r2 = _ctx.config.tools) == null ? void 0 : _r2.clearAll) || _ctx.config.clearAll ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$7, [
340219
340777
  vue.createVNode(vue.unref(elementPlus.ElButton), {
340220
340778
  class: "control-btn",
340221
340779
  title: "清空绘制内容",
@@ -340239,8 +340797,8 @@ ${indentData}`);
340239
340797
  };
340240
340798
  }
340241
340799
  });
340242
- const OlControlPanel_vue_vue_type_style_index_0_scoped_fdbbb5b4_lang = "";
340243
- const OlControlPanel = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-fdbbb5b4"]]);
340800
+ const OlControlPanel_vue_vue_type_style_index_0_scoped_13e7a909_lang = "";
340801
+ const OlControlPanel = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-13e7a909"]]);
340244
340802
  const _hoisted_1$u = {
340245
340803
  key: 0,
340246
340804
  class: "ol-legend-header"
@@ -365477,7 +366035,7 @@ ${indentData}`);
365477
366035
  popupConfig: {},
365478
366036
  enableGeolocation: { type: Boolean, default: true }
365479
366037
  },
365480
- 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", "search", "search-select", "search-clear", "popup-show", "popup-hide", "popup-close"],
366038
+ 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", "search", "search-select", "search-clear", "popup-show", "popup-hide", "popup-close"],
365481
366039
  setup(__props, { expose: __expose, emit: __emit }) {
365482
366040
  const currentLegends = vue.ref([]);
365483
366041
  const currentLayers = vue.ref([]);
@@ -366339,6 +366897,9 @@ ${indentData}`);
366339
366897
  break;
366340
366898
  }
366341
366899
  };
366900
+ const onDrawingComplete = (result) => {
366901
+ emit("drawing-complete", result);
366902
+ };
366342
366903
  const onPrintAction = (data2) => {
366343
366904
  console.log("打印操作:", data2);
366344
366905
  switch (data2.action) {
@@ -367025,7 +367586,8 @@ ${indentData}`);
367025
367586
  "right-offset": finalControlsConfig.value.rightOffset,
367026
367587
  "top-offset": finalControlsConfig.value.topOffset,
367027
367588
  "bottom-offset": finalControlsConfig.value.bottomOffset,
367028
- "view-bookmarks": props.viewBookmarks
367589
+ "view-bookmarks": props.viewBookmarks,
367590
+ onDrawingComplete
367029
367591
  }, {
367030
367592
  custom: vue.withCtx(({ controls }) => [
367031
367593
  vue.renderSlot(_ctx.$slots, "controls", {
@@ -367162,8 +367724,8 @@ ${indentData}`);
367162
367724
  };
367163
367725
  }
367164
367726
  });
367165
- const OlMap_vue_vue_type_style_index_0_scoped_888f37cb_lang = "";
367166
- const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-888f37cb"]]);
367727
+ const OlMap_vue_vue_type_style_index_0_scoped_847d5f65_lang = "";
367728
+ const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-847d5f65"]]);
367167
367729
  const ol = "";
367168
367730
  const Property$1 = {
367169
367731
  ACCURACY: "accuracy",