vue-openlayers-plugin 1.0.82 → 1.0.84
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.
- package/lib/BasemapPanel-1145a7ed.mjs +280 -0
- package/lib/CoordinateLocationDialog-be972ee5.mjs +263 -0
- package/lib/FilterPanel-9d55d20c.mjs +6 -0
- package/lib/LayerPanel-0272f4a3.mjs +6 -0
- package/lib/MapPrintDialog-3d0a2891.mjs +6 -0
- package/lib/MeasurementDialog-37a0bbb3.mjs +369 -0
- package/lib/MyMarkersDialog-61d5c30d.mjs +584 -0
- package/lib/RegionNavigationDialog-0808549f.mjs +1320 -0
- package/lib/ViewBookmarksDialog-107a29d1.mjs +723 -0
- package/lib/index-3d1e1ad0.mjs +839 -0
- package/lib/{index-61901e1f.mjs → index-6f94a7fa.mjs} +50494 -53897
- package/lib/index-91e9a4e6.mjs +756 -0
- package/lib/{index.es-c17b5917.mjs → index.es-03fbdea2.mjs} +1 -1
- package/lib/index.esm.js +65 -56
- package/lib/index.umd.js +73175 -71501
- package/lib/style.css +1705 -1704
- package/package.json +8 -4
- package/types/src/assets/index.d.ts +9 -0
- package/types/src/assets/index.d.ts.map +1 -0
- package/types/src/components/CustomDialog/CustomDialog.vue.d.ts +16 -16
- package/types/src/components/CustomDialog/icons/index.d.ts +14 -0
- package/types/src/components/CustomDialog/icons/index.d.ts.map +1 -0
- package/types/src/components/OlBaseLayerSwitcher.vue.d.ts +19 -0
- package/types/src/components/OlBaseLayerSwitcher.vue.d.ts.map +1 -0
- package/types/src/components/OlControlPanel.vue.d.ts +63 -0
- package/types/src/components/OlControlPanel.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/BasemapPanel.vue.d.ts +20 -0
- package/types/src/components/OlDialogs/BasemapPanel.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/CoordinateLocationDialog.vue.d.ts +21 -0
- package/types/src/components/OlDialogs/CoordinateLocationDialog.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/DialogManager.d.ts +58 -0
- package/types/src/components/OlDialogs/DialogManager.d.ts.map +1 -0
- package/types/src/components/OlDialogs/FilterPanel.vue.d.ts +33 -0
- package/types/src/components/OlDialogs/FilterPanel.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/LayerPanel.vue.d.ts +1345 -0
- package/types/src/components/OlDialogs/LayerPanel.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/LayerStyleConfig.vue.d.ts +23 -0
- package/types/src/components/OlDialogs/LayerStyleConfig.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/LayerTreeNode.vue.d.ts +28 -0
- package/types/src/components/OlDialogs/LayerTreeNode.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/MapDrawingDialog/components/ListTab.vue.d.ts +3 -0
- package/types/src/components/OlDialogs/MapDrawingDialog/components/ListTab.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/MapDrawingDialog/components/MarkTab.vue.d.ts +3 -0
- package/types/src/components/OlDialogs/MapDrawingDialog/components/MarkTab.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/MapDrawingDialog/index.vue.d.ts +3 -0
- package/types/src/components/OlDialogs/MapDrawingDialog/index.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/MapPrintDialog.vue.d.ts +24 -0
- package/types/src/components/OlDialogs/MapPrintDialog.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/MeasurementDialog.vue.d.ts +41 -0
- package/types/src/components/OlDialogs/MeasurementDialog.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/MyMarkersDialog.vue.d.ts +21 -0
- package/types/src/components/OlDialogs/MyMarkersDialog.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/RegionNavigationDialog.vue.d.ts +25 -0
- package/types/src/components/OlDialogs/RegionNavigationDialog.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/ViewBookmarksDialog.vue.d.ts +21 -0
- package/types/src/components/OlDialogs/ViewBookmarksDialog.vue.d.ts.map +1 -0
- package/types/src/components/OlDialogs/registry.d.ts +39 -0
- package/types/src/components/OlDialogs/registry.d.ts.map +1 -0
- package/types/src/components/OlDrawToolbar.vue.d.ts +61 -0
- package/types/src/components/OlDrawToolbar.vue.d.ts.map +1 -0
- package/types/src/components/OlLegendPanel.vue.d.ts +69 -0
- package/types/src/components/OlLegendPanel.vue.d.ts.map +1 -0
- package/types/src/components/OlMapContainer.vue.d.ts +112 -0
- package/types/src/components/OlMapContainer.vue.d.ts.map +1 -0
- package/types/src/components/OlMapPopup/ArrayPopup.vue.d.ts +47 -0
- package/types/src/components/OlMapPopup/ArrayPopup.vue.d.ts.map +1 -0
- package/types/src/components/OlMapPopup/BasePopup.vue.d.ts +63 -0
- package/types/src/components/OlMapPopup/BasePopup.vue.d.ts.map +1 -0
- package/types/src/components/OlMapPopup/HtmlPopup.vue.d.ts +45 -0
- package/types/src/components/OlMapPopup/HtmlPopup.vue.d.ts.map +1 -0
- package/types/src/components/OlMapPopup/ImagePopup.vue.d.ts +45 -0
- package/types/src/components/OlMapPopup/ImagePopup.vue.d.ts.map +1 -0
- package/types/src/components/OlMapPopup/index.d.ts +9 -0
- package/types/src/components/OlMapPopup/index.d.ts.map +1 -0
- package/types/src/components/OlMapPopup/types.d.ts +118 -0
- package/types/src/components/OlMapPopup/types.d.ts.map +1 -0
- package/types/src/components/OlMapSearch.vue.d.ts +126 -0
- package/types/src/components/OlMapSearch.vue.d.ts.map +1 -0
- package/types/src/components/OlMapTooltip.vue.d.ts +70 -0
- package/types/src/components/OlMapTooltip.vue.d.ts.map +1 -0
- package/types/src/core/EventBus.d.ts +66 -0
- package/types/src/core/EventBus.d.ts.map +1 -0
- package/types/src/core/EventManager.d.ts +147 -0
- package/types/src/core/EventManager.d.ts.map +1 -0
- package/types/src/core/FeatureHighlightManager.d.ts +103 -0
- package/types/src/core/FeatureHighlightManager.d.ts.map +1 -0
- package/types/src/core/GlobalStyleManager.d.ts +76 -0
- package/types/src/core/GlobalStyleManager.d.ts.map +1 -0
- package/types/src/core/LayerConfigManager.d.ts +66 -0
- package/types/src/core/LayerConfigManager.d.ts.map +1 -0
- package/types/src/core/LayerManager.d.ts +198 -0
- package/types/src/core/LayerManager.d.ts.map +1 -0
- package/types/src/core/LayerTreeManager.d.ts +125 -0
- package/types/src/core/LayerTreeManager.d.ts.map +1 -0
- package/types/src/core/MapManager.d.ts +203 -0
- package/types/src/core/MapManager.d.ts.map +1 -0
- package/types/src/core/MarkerDrawingAdapter.d.ts +125 -0
- package/types/src/core/MarkerDrawingAdapter.d.ts.map +1 -0
- package/types/src/core/PluginManager.d.ts +158 -0
- package/types/src/core/PluginManager.d.ts.map +1 -0
- package/types/src/core/PopupManager.d.ts +110 -0
- package/types/src/core/PopupManager.d.ts.map +1 -0
- package/types/src/core/SearchMarkerManager.d.ts +96 -0
- package/types/src/core/SearchMarkerManager.d.ts.map +1 -0
- package/types/src/core/TooltipHelper.d.ts +134 -0
- package/types/src/core/TooltipHelper.d.ts.map +1 -0
- package/types/src/core/amapSearchApi.d.ts +57 -0
- package/types/src/core/amapSearchApi.d.ts.map +1 -0
- package/types/src/core/basemapManager.d.ts +63 -0
- package/types/src/core/basemapManager.d.ts.map +1 -0
- package/types/src/core/configLoader.d.ts +159 -0
- package/types/src/core/configLoader.d.ts.map +1 -0
- package/types/src/core/drawing/BaseDrawing.d.ts +255 -0
- package/types/src/core/drawing/BaseDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/DrawingManager.d.ts +394 -0
- package/types/src/core/drawing/DrawingManager.d.ts.map +1 -0
- package/types/src/core/drawing/IconDrawing.d.ts +188 -0
- package/types/src/core/drawing/IconDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/ImageDrawing.d.ts +193 -0
- package/types/src/core/drawing/ImageDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/LineDrawing.d.ts +193 -0
- package/types/src/core/drawing/LineDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/MilitaryDrawing.d.ts +175 -0
- package/types/src/core/drawing/MilitaryDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/MultiLineStringDrawing.d.ts +294 -0
- package/types/src/core/drawing/MultiLineStringDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/MultiPointDrawing.d.ts +244 -0
- package/types/src/core/drawing/MultiPointDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/MultiPolygonDrawing.d.ts +206 -0
- package/types/src/core/drawing/MultiPolygonDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/PointDrawing.d.ts +175 -0
- package/types/src/core/drawing/PointDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/PointWithTextDrawing.d.ts +183 -0
- package/types/src/core/drawing/PointWithTextDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/PolygonDrawing.d.ts +240 -0
- package/types/src/core/drawing/PolygonDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/TextDrawing.d.ts +164 -0
- package/types/src/core/drawing/TextDrawing.d.ts.map +1 -0
- package/types/src/core/drawing/index.d.ts +525 -0
- package/types/src/core/drawing/index.d.ts.map +1 -0
- package/types/src/core/geoJsonLocationTool.d.ts +116 -0
- package/types/src/core/geoJsonLocationTool.d.ts.map +1 -0
- package/types/src/core/layers/BaseLayer.d.ts +162 -0
- package/types/src/core/layers/BaseLayer.d.ts.map +1 -0
- package/types/src/core/layers/CanvasLayerHandler.d.ts +65 -0
- package/types/src/core/layers/CanvasLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/ClusterLayerHandler.d.ts +122 -0
- package/types/src/core/layers/ClusterLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/GMLLayerHandler.d.ts +107 -0
- package/types/src/core/layers/GMLLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/GeoJSONLayerHandler.d.ts +125 -0
- package/types/src/core/layers/GeoJSONLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/HeatmapLayerHandler.d.ts +86 -0
- package/types/src/core/layers/HeatmapLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/ImageVectorLayerHandler.d.ts +77 -0
- package/types/src/core/layers/ImageVectorLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/KMLLayerHandler.d.ts +95 -0
- package/types/src/core/layers/KMLLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/LayerFactory.d.ts +63 -0
- package/types/src/core/layers/LayerFactory.d.ts.map +1 -0
- package/types/src/core/layers/SuperMapServiceTester.d.ts +54 -0
- package/types/src/core/layers/SuperMapServiceTester.d.ts.map +1 -0
- package/types/src/core/layers/SuperMapTiledMapServiceHandler.d.ts +35 -0
- package/types/src/core/layers/SuperMapTiledMapServiceHandler.d.ts.map +1 -0
- package/types/src/core/layers/TiandituConfigHelper.d.ts +120 -0
- package/types/src/core/layers/TiandituConfigHelper.d.ts.map +1 -0
- package/types/src/core/layers/TiandituLayerHandler.d.ts +75 -0
- package/types/src/core/layers/TiandituLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/TileLayerHandler.d.ts +42 -0
- package/types/src/core/layers/TileLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/TileSuperMapRestHandler.d.ts +161 -0
- package/types/src/core/layers/TileSuperMapRestHandler.d.ts.map +1 -0
- package/types/src/core/layers/VectorTileLayerHandler.d.ts +126 -0
- package/types/src/core/layers/VectorTileLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/WFSLayerHandler.d.ts +80 -0
- package/types/src/core/layers/WFSLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/WKTLayerHandler.d.ts +123 -0
- package/types/src/core/layers/WKTLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/WMSLayerHandler.d.ts +78 -0
- package/types/src/core/layers/WMSLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/WMTSLayerHandler.d.ts +44 -0
- package/types/src/core/layers/WMTSLayerHandler.d.ts.map +1 -0
- package/types/src/core/layers/index.d.ts +20 -0
- package/types/src/core/layers/index.d.ts.map +1 -0
- package/types/src/core/layers/interfaces.d.ts +95 -0
- package/types/src/core/layers/interfaces.d.ts.map +1 -0
- package/types/src/core/mapOperationTool.d.ts +145 -0
- package/types/src/core/mapOperationTool.d.ts.map +1 -0
- package/types/src/core/measurementTool.d.ts +136 -0
- package/types/src/core/measurementTool.d.ts.map +1 -0
- package/types/src/core/overviewMapUtil.d.ts +62 -0
- package/types/src/core/overviewMapUtil.d.ts.map +1 -0
- package/types/src/core/proxyHelper.d.ts +66 -0
- package/types/src/core/proxyHelper.d.ts.map +1 -0
- package/types/src/core/storage.d.ts +139 -0
- package/types/src/core/storage.d.ts.map +1 -0
- package/types/src/core/styles/StyleFactory.d.ts +74 -0
- package/types/src/core/styles/StyleFactory.d.ts.map +1 -0
- package/types/src/core/styles/StyleManager.d.ts +77 -0
- package/types/src/core/styles/StyleManager.d.ts.map +1 -0
- package/types/src/core/styles/index.d.ts +67 -0
- package/types/src/core/styles/index.d.ts.map +1 -0
- package/types/src/core/styles/interfaces.d.ts +221 -0
- package/types/src/core/styles/interfaces.d.ts.map +1 -0
- package/types/src/core/tiandituSearchApi.d.ts +51 -0
- package/types/src/core/tiandituSearchApi.d.ts.map +1 -0
- package/types/src/data-old/testLayers.d.ts +84 -0
- package/types/src/data-old/testLayers.d.ts.map +1 -0
- package/types/src/examples-old/FilterExamples.d.ts +104 -0
- package/types/src/examples-old/FilterExamples.d.ts.map +1 -0
- package/types/src/hooks/useMap.d.ts +5 -0
- package/types/src/hooks/useMap.d.ts.map +1 -0
- package/types/src/services/searchService.d.ts +106 -0
- package/types/src/services/searchService.d.ts.map +1 -0
- package/types/src/test-old/FilterSystemTest.d.ts +57 -0
- package/types/src/test-old/FilterSystemTest.d.ts.map +1 -0
- package/types/src/types/index.d.ts +2 -11
- package/types/src/types/index.d.ts.map +1 -1
- package/types/src/types/map.d.ts +819 -0
- package/types/src/types/map.d.ts.map +1 -0
- package/types/src/types/plugin.d.ts +202 -0
- package/types/src/types/plugin.d.ts.map +1 -0
- package/types/src/utils/DiffusionAnimationHelper.d.ts +60 -0
- package/types/src/utils/DiffusionAnimationHelper.d.ts.map +1 -0
- package/types/src/utils/GifAnimationHelper.d.ts +31 -0
- package/types/src/utils/GifAnimationHelper.d.ts.map +1 -0
- package/types/src/utils/coordinateTransform.d.ts +28 -0
- package/types/src/utils/coordinateTransform.d.ts.map +1 -0
- package/types/src/utils/index.d.ts +8 -8
- package/types/src/utils/index.d.ts.map +1 -1
- package/types/src/utils/unitConverter.d.ts +36 -0
- package/types/src/utils/unitConverter.d.ts.map +1 -0
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { defineComponent, inject, computed, ref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, Fragment, renderList, normalizeClass } from "vue";
|
|
2
|
+
import { f as formatMeasurementResult, g as getUnitByType, d as _export_sfc } from "./index-6f94a7fa.mjs";
|
|
3
|
+
import "ol";
|
|
4
|
+
const getIconPath = (name) => {
|
|
5
|
+
return `/icons/${name}.svg`;
|
|
6
|
+
};
|
|
7
|
+
const icons = {
|
|
8
|
+
distance: getIconPath("distance"),
|
|
9
|
+
area: getIconPath("area"),
|
|
10
|
+
coordinate: getIconPath("coordinate"),
|
|
11
|
+
angle: getIconPath("angle"),
|
|
12
|
+
location: getIconPath("location"),
|
|
13
|
+
// 添加其他需要的图标
|
|
14
|
+
marker: getIconPath("marker"),
|
|
15
|
+
clear: getIconPath("clear"),
|
|
16
|
+
close: getIconPath("close"),
|
|
17
|
+
fullscreen: getIconPath("fullscreen"),
|
|
18
|
+
exitFullscreen: getIconPath("exit-fullscreen")
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_1 = { class: "measurement-content h-full flex flex-col" };
|
|
21
|
+
const _hoisted_2 = { class: "measurement-header flex justify-between items-center px-6 py-4" };
|
|
22
|
+
const _hoisted_3 = { class: "measurement-result py-8 text-center" };
|
|
23
|
+
const _hoisted_4 = { class: "result-value" };
|
|
24
|
+
const _hoisted_5 = { class: "tool-grid flex-1 py-5" };
|
|
25
|
+
const _hoisted_6 = ["onClick"];
|
|
26
|
+
const _hoisted_7 = ["src", "alt"];
|
|
27
|
+
const _hoisted_8 = { class: "tool-label" };
|
|
28
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
29
|
+
__name: "MeasurementDialog",
|
|
30
|
+
props: {
|
|
31
|
+
modelValue: { type: Boolean }
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:modelValue"],
|
|
34
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
35
|
+
const props = __props;
|
|
36
|
+
const emit = __emit;
|
|
37
|
+
const measurementToolRef = inject("measurementTool");
|
|
38
|
+
const measurementTool = computed(() => measurementToolRef == null ? void 0 : measurementToolRef.value);
|
|
39
|
+
const dialogVisible = computed({
|
|
40
|
+
get: () => props.modelValue,
|
|
41
|
+
set: (value) => emit("update:modelValue", value)
|
|
42
|
+
});
|
|
43
|
+
const activeTool = ref(null);
|
|
44
|
+
const measurementResult = ref(null);
|
|
45
|
+
const measurementTools = [
|
|
46
|
+
{ type: "distance", icon: icons.distance, label: "空间距离" },
|
|
47
|
+
{ type: "area", icon: icons.area, label: "水平面积" },
|
|
48
|
+
{ type: "coordinate", icon: icons.coordinate, label: "坐标测量" },
|
|
49
|
+
{ type: "angle", icon: icons.angle, label: "角度" }
|
|
50
|
+
];
|
|
51
|
+
const selectedUnit = ref("auto");
|
|
52
|
+
const onUnitChange = () => {
|
|
53
|
+
console.log("单位变化:", selectedUnit.value);
|
|
54
|
+
if (!measurementResult.value)
|
|
55
|
+
return;
|
|
56
|
+
const resultType = measurementResult.value.type || activeTool.value;
|
|
57
|
+
if (resultType === "distance" && measurementResult.value.value !== void 0) {
|
|
58
|
+
const result = formatMeasurementResult(measurementResult.value.value, "length", selectedUnit.value);
|
|
59
|
+
measurementResult.value = {
|
|
60
|
+
...measurementResult.value,
|
|
61
|
+
distance: result.formatted
|
|
62
|
+
};
|
|
63
|
+
} else if (resultType === "area" && measurementResult.value.value !== void 0) {
|
|
64
|
+
const result = formatMeasurementResult(measurementResult.value.value, "area", selectedUnit.value);
|
|
65
|
+
measurementResult.value = {
|
|
66
|
+
...measurementResult.value,
|
|
67
|
+
area: result.formatted
|
|
68
|
+
};
|
|
69
|
+
} else if (resultType === "angle" && measurementResult.value.value !== void 0) {
|
|
70
|
+
const result = formatMeasurementResult(measurementResult.value.value, "angle", selectedUnit.value);
|
|
71
|
+
measurementResult.value = {
|
|
72
|
+
...measurementResult.value,
|
|
73
|
+
angle: result.formatted
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const checkUnitCompatibility = (tool, unit) => {
|
|
78
|
+
const distanceUnits = ["m", "km"];
|
|
79
|
+
const areaUnits = ["m²", "km²"];
|
|
80
|
+
const angleUnits = ["°", "rad"];
|
|
81
|
+
if (tool === "distance" && distanceUnits.includes(unit))
|
|
82
|
+
return true;
|
|
83
|
+
if (tool === "area" && areaUnits.includes(unit))
|
|
84
|
+
return true;
|
|
85
|
+
if (tool === "angle" && angleUnits.includes(unit))
|
|
86
|
+
return true;
|
|
87
|
+
return false;
|
|
88
|
+
};
|
|
89
|
+
const isMouseActive = ref(false);
|
|
90
|
+
const mouseTooltip = ref("");
|
|
91
|
+
const setActiveTool = (tool, unitConfig) => {
|
|
92
|
+
if (!measurementTool.value) {
|
|
93
|
+
console.warn("measurementTool未初始化");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
measurementResult.value = null;
|
|
97
|
+
if (measurementTool.value) {
|
|
98
|
+
measurementTool.value.stopMeasurement();
|
|
99
|
+
}
|
|
100
|
+
activeTool.value = tool;
|
|
101
|
+
const toolType = tool;
|
|
102
|
+
if (unitConfig) {
|
|
103
|
+
selectedUnit.value = getUnitByType(toolType);
|
|
104
|
+
} else {
|
|
105
|
+
if (selectedUnit.value !== "auto" && !checkUnitCompatibility(tool, selectedUnit.value)) {
|
|
106
|
+
selectedUnit.value = "auto";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
isMouseActive.value = true;
|
|
110
|
+
switch (tool) {
|
|
111
|
+
case "distance":
|
|
112
|
+
mouseTooltip.value = "点击地图上两点或多点测量距离";
|
|
113
|
+
measurementTool.value.startDistanceMeasurement((result) => {
|
|
114
|
+
handleMeasurementResult(result);
|
|
115
|
+
}, selectedUnit.value);
|
|
116
|
+
break;
|
|
117
|
+
case "area":
|
|
118
|
+
mouseTooltip.value = "点击地图绘制多边形测量面积";
|
|
119
|
+
measurementTool.value.startAreaMeasurement((result) => {
|
|
120
|
+
handleMeasurementResult(result);
|
|
121
|
+
}, selectedUnit.value);
|
|
122
|
+
break;
|
|
123
|
+
case "coordinate":
|
|
124
|
+
mouseTooltip.value = "点击地图获取坐标信息";
|
|
125
|
+
measurementTool.value.startCoordinateMeasurement((result) => {
|
|
126
|
+
handleMeasurementResult(result);
|
|
127
|
+
});
|
|
128
|
+
break;
|
|
129
|
+
case "angle":
|
|
130
|
+
mouseTooltip.value = "点击地图测量角度";
|
|
131
|
+
measurementTool.value.startAngleMeasurement((result) => {
|
|
132
|
+
handleMeasurementResult(result);
|
|
133
|
+
}, selectedUnit.value);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const getDisplayValue = () => {
|
|
138
|
+
if (!measurementResult.value)
|
|
139
|
+
return "0";
|
|
140
|
+
const resultType = measurementResult.value.type || activeTool.value;
|
|
141
|
+
if (resultType === "distance" && measurementResult.value.distance) {
|
|
142
|
+
return measurementResult.value.distance;
|
|
143
|
+
} else if (resultType === "area" && measurementResult.value.area) {
|
|
144
|
+
return measurementResult.value.area;
|
|
145
|
+
} else if (resultType === "angle" && measurementResult.value.angle) {
|
|
146
|
+
return measurementResult.value.angle;
|
|
147
|
+
} else if (resultType === "coordinate" && measurementResult.value.longitude) {
|
|
148
|
+
return `${measurementResult.value.longitude}°, ${measurementResult.value.latitude}°`;
|
|
149
|
+
}
|
|
150
|
+
return "0";
|
|
151
|
+
};
|
|
152
|
+
const handleMeasurementResult = (result) => {
|
|
153
|
+
var _a, _b, _c;
|
|
154
|
+
console.log("接收到测量结果:", result);
|
|
155
|
+
activeTool.value = null;
|
|
156
|
+
if (result.type === "length") {
|
|
157
|
+
measurementResult.value = {
|
|
158
|
+
type: "distance",
|
|
159
|
+
value: result.value,
|
|
160
|
+
// 保存原始数值用于单位转换
|
|
161
|
+
unit: result.unit,
|
|
162
|
+
distance: result.distance || ((_a = result.value) == null ? void 0 : _a.toString()) || "0",
|
|
163
|
+
area: null
|
|
164
|
+
};
|
|
165
|
+
} else if (result.type === "area") {
|
|
166
|
+
measurementResult.value = {
|
|
167
|
+
type: "area",
|
|
168
|
+
value: result.value,
|
|
169
|
+
// 保存原始数值用于单位转换
|
|
170
|
+
unit: result.unit,
|
|
171
|
+
distance: null,
|
|
172
|
+
area: result.area || ((_b = result.value) == null ? void 0 : _b.toString()) || "0"
|
|
173
|
+
};
|
|
174
|
+
} else if (result.type === "angle") {
|
|
175
|
+
measurementResult.value = {
|
|
176
|
+
type: "angle",
|
|
177
|
+
value: result.value,
|
|
178
|
+
// 保存原始数值用于单位转换
|
|
179
|
+
unit: result.unit,
|
|
180
|
+
angle: result.angle || ((_c = result.value) == null ? void 0 : _c.toString()) || "0"
|
|
181
|
+
};
|
|
182
|
+
} else if (result.type === "coordinate") {
|
|
183
|
+
measurementResult.value = {
|
|
184
|
+
type: "coordinate",
|
|
185
|
+
longitude: result.longitude,
|
|
186
|
+
latitude: result.latitude
|
|
187
|
+
};
|
|
188
|
+
} else {
|
|
189
|
+
measurementResult.value = result;
|
|
190
|
+
}
|
|
191
|
+
isMouseActive.value = false;
|
|
192
|
+
};
|
|
193
|
+
const handleMapMeasurementResult = (result) => {
|
|
194
|
+
console.log("接收到地图测量结果:", result);
|
|
195
|
+
if (result.type === "distance") {
|
|
196
|
+
measurementResult.value = {
|
|
197
|
+
type: "distance",
|
|
198
|
+
distance: result.value,
|
|
199
|
+
area: null
|
|
200
|
+
};
|
|
201
|
+
} else if (result.type === "area") {
|
|
202
|
+
measurementResult.value = {
|
|
203
|
+
type: "area",
|
|
204
|
+
distance: null,
|
|
205
|
+
area: result.value
|
|
206
|
+
};
|
|
207
|
+
} else if (result.type === "angle") {
|
|
208
|
+
measurementResult.value = {
|
|
209
|
+
type: "angle",
|
|
210
|
+
angle: result.value
|
|
211
|
+
};
|
|
212
|
+
} else if (result.type === "coordinate") {
|
|
213
|
+
measurementResult.value = {
|
|
214
|
+
type: "coordinate",
|
|
215
|
+
longitude: result.longitude,
|
|
216
|
+
latitude: result.latitude,
|
|
217
|
+
elevation: result.elevation
|
|
218
|
+
};
|
|
219
|
+
} else {
|
|
220
|
+
measurementResult.value = result;
|
|
221
|
+
}
|
|
222
|
+
isMouseActive.value = false;
|
|
223
|
+
};
|
|
224
|
+
__expose({
|
|
225
|
+
handleMapMeasurementResult
|
|
226
|
+
});
|
|
227
|
+
const clearMeasurement = () => {
|
|
228
|
+
measurementResult.value = null;
|
|
229
|
+
if (measurementTool.value) {
|
|
230
|
+
measurementTool.value.clearMeasurements();
|
|
231
|
+
}
|
|
232
|
+
activeTool.value = null;
|
|
233
|
+
isMouseActive.value = false;
|
|
234
|
+
mouseTooltip.value = "";
|
|
235
|
+
};
|
|
236
|
+
const stopAllMeasurement = () => {
|
|
237
|
+
measurementResult.value = null;
|
|
238
|
+
if (measurementTool.value) {
|
|
239
|
+
measurementTool.value.clearMeasurements();
|
|
240
|
+
}
|
|
241
|
+
activeTool.value = null;
|
|
242
|
+
isMouseActive.value = false;
|
|
243
|
+
mouseTooltip.value = "";
|
|
244
|
+
};
|
|
245
|
+
const handleClose = () => {
|
|
246
|
+
dialogVisible.value = false;
|
|
247
|
+
stopAllMeasurement();
|
|
248
|
+
mouseTooltip.value = "";
|
|
249
|
+
};
|
|
250
|
+
watch(dialogVisible, (newVal) => {
|
|
251
|
+
if (!newVal) {
|
|
252
|
+
handleClose();
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
return (_ctx, _cache) => {
|
|
256
|
+
const _component_el_option = resolveComponent("el-option");
|
|
257
|
+
const _component_el_option_group = resolveComponent("el-option-group");
|
|
258
|
+
const _component_el_select = resolveComponent("el-select");
|
|
259
|
+
const _component_el_button = resolveComponent("el-button");
|
|
260
|
+
const _component_EPlusDialog = resolveComponent("EPlusDialog");
|
|
261
|
+
return openBlock(), createBlock(_component_EPlusDialog, {
|
|
262
|
+
modelValue: dialogVisible.value,
|
|
263
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dialogVisible.value = $event),
|
|
264
|
+
title: "图上量算",
|
|
265
|
+
width: "400px",
|
|
266
|
+
"before-close": handleClose,
|
|
267
|
+
"show-modal": false,
|
|
268
|
+
cacheId: "measurement-dialog"
|
|
269
|
+
}, {
|
|
270
|
+
default: withCtx(() => [
|
|
271
|
+
createElementVNode("div", _hoisted_1, [
|
|
272
|
+
createElementVNode("div", _hoisted_2, [
|
|
273
|
+
createVNode(_component_el_select, {
|
|
274
|
+
modelValue: selectedUnit.value,
|
|
275
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedUnit.value = $event),
|
|
276
|
+
placeholder: "自动",
|
|
277
|
+
size: "small",
|
|
278
|
+
style: { "width": "120px" },
|
|
279
|
+
onChange: onUnitChange
|
|
280
|
+
}, {
|
|
281
|
+
default: withCtx(() => [
|
|
282
|
+
createVNode(_component_el_option, {
|
|
283
|
+
label: "自动",
|
|
284
|
+
value: "auto"
|
|
285
|
+
}),
|
|
286
|
+
createVNode(_component_el_option_group, { label: "距离单位" }, {
|
|
287
|
+
default: withCtx(() => [
|
|
288
|
+
createVNode(_component_el_option, {
|
|
289
|
+
label: "米",
|
|
290
|
+
value: "m"
|
|
291
|
+
}),
|
|
292
|
+
createVNode(_component_el_option, {
|
|
293
|
+
label: "千米",
|
|
294
|
+
value: "km"
|
|
295
|
+
})
|
|
296
|
+
]),
|
|
297
|
+
_: 1
|
|
298
|
+
}),
|
|
299
|
+
createVNode(_component_el_option_group, { label: "面积单位" }, {
|
|
300
|
+
default: withCtx(() => [
|
|
301
|
+
createVNode(_component_el_option, {
|
|
302
|
+
label: "平方米",
|
|
303
|
+
value: "m²"
|
|
304
|
+
}),
|
|
305
|
+
createVNode(_component_el_option, {
|
|
306
|
+
label: "平方千米",
|
|
307
|
+
value: "km²"
|
|
308
|
+
})
|
|
309
|
+
]),
|
|
310
|
+
_: 1
|
|
311
|
+
}),
|
|
312
|
+
createVNode(_component_el_option_group, { label: "角度单位" }, {
|
|
313
|
+
default: withCtx(() => [
|
|
314
|
+
createVNode(_component_el_option, {
|
|
315
|
+
label: "度",
|
|
316
|
+
value: "°"
|
|
317
|
+
}),
|
|
318
|
+
createVNode(_component_el_option, {
|
|
319
|
+
label: "弧度",
|
|
320
|
+
value: "rad"
|
|
321
|
+
})
|
|
322
|
+
]),
|
|
323
|
+
_: 1
|
|
324
|
+
})
|
|
325
|
+
]),
|
|
326
|
+
_: 1
|
|
327
|
+
}, 8, ["modelValue"]),
|
|
328
|
+
createVNode(_component_el_button, {
|
|
329
|
+
type: "text",
|
|
330
|
+
size: "small",
|
|
331
|
+
onClick: clearMeasurement,
|
|
332
|
+
style: { "color": "#ff4757" }
|
|
333
|
+
}, {
|
|
334
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
335
|
+
createTextVNode(" 清除 ", -1)
|
|
336
|
+
])]),
|
|
337
|
+
_: 1
|
|
338
|
+
})
|
|
339
|
+
]),
|
|
340
|
+
createElementVNode("div", _hoisted_3, [
|
|
341
|
+
createElementVNode("div", _hoisted_4, toDisplayString(getDisplayValue()), 1)
|
|
342
|
+
]),
|
|
343
|
+
createElementVNode("div", _hoisted_5, [
|
|
344
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(measurementTools, (tool) => {
|
|
345
|
+
return createElementVNode("div", {
|
|
346
|
+
key: tool.type,
|
|
347
|
+
class: normalizeClass(["tool-item", { active: activeTool.value === tool.type }]),
|
|
348
|
+
onClick: ($event) => setActiveTool(tool.type)
|
|
349
|
+
}, [
|
|
350
|
+
createElementVNode("img", {
|
|
351
|
+
src: tool.icon,
|
|
352
|
+
alt: tool.label,
|
|
353
|
+
class: "tool-icon"
|
|
354
|
+
}, null, 8, _hoisted_7),
|
|
355
|
+
createElementVNode("span", _hoisted_8, toDisplayString(tool.label), 1)
|
|
356
|
+
], 10, _hoisted_6);
|
|
357
|
+
}), 64))
|
|
358
|
+
])
|
|
359
|
+
])
|
|
360
|
+
]),
|
|
361
|
+
_: 1
|
|
362
|
+
}, 8, ["modelValue"]);
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
const MeasurementDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ac238457"]]);
|
|
367
|
+
export {
|
|
368
|
+
MeasurementDialog as default
|
|
369
|
+
};
|