sctj-components 1.1.36 → 1.1.38
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/sctj-components.es.js +248 -552
- package/lib/sctj-components.umd.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ if (typeof window !== "undefined") {
|
|
|
30
30
|
loadSvg();
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const index_vue_vue_type_style_index_0_scoped_d535ba4f_lang = "";
|
|
34
34
|
const _export_sfc = (sfc, props) => {
|
|
35
35
|
const target = sfc.__vccOpts || sfc;
|
|
36
36
|
for (const [key, val] of props) {
|
|
@@ -53,7 +53,11 @@ const _sfc_main$y = {
|
|
|
53
53
|
const props = __props;
|
|
54
54
|
const values = computed$1(() => {
|
|
55
55
|
if (props.value !== null && typeof props.value !== "undefined") {
|
|
56
|
-
|
|
56
|
+
if (Array.isArray(props.value))
|
|
57
|
+
return props.value;
|
|
58
|
+
if (typeof props.value === "string")
|
|
59
|
+
return props.value.split(",").filter((item) => item);
|
|
60
|
+
return [props.value];
|
|
57
61
|
} else {
|
|
58
62
|
return [];
|
|
59
63
|
}
|
|
@@ -87,7 +91,7 @@ const _sfc_main$y = {
|
|
|
87
91
|
};
|
|
88
92
|
}
|
|
89
93
|
};
|
|
90
|
-
const SCTJDictTag = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-
|
|
94
|
+
const SCTJDictTag = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-d535ba4f"]]);
|
|
91
95
|
const index_vue_vue_type_style_index_0_scope_true_lang = "";
|
|
92
96
|
const _hoisted_1$p = ["xlink:href", "fill"];
|
|
93
97
|
const _sfc_main$x = {
|
|
@@ -10198,8 +10202,8 @@ const _sfc_main$5 = {
|
|
|
10198
10202
|
}
|
|
10199
10203
|
};
|
|
10200
10204
|
const SCTJTrackPlayback = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-87a3abe5"]]);
|
|
10201
|
-
const
|
|
10202
|
-
const _withScopeId$3 = (n) => (pushScopeId("data-v-
|
|
10205
|
+
const index_vue_vue_type_style_index_0_scoped_a7875dcf_lang = "";
|
|
10206
|
+
const _withScopeId$3 = (n) => (pushScopeId("data-v-a7875dcf"), n = n(), popScopeId(), n);
|
|
10203
10207
|
const _hoisted_1$3 = {
|
|
10204
10208
|
key: 0,
|
|
10205
10209
|
class: "btn-container"
|
|
@@ -10380,6 +10384,20 @@ const _sfc_main$4 = {
|
|
|
10380
10384
|
renderInitialData();
|
|
10381
10385
|
});
|
|
10382
10386
|
const { isMobile } = useMobile();
|
|
10387
|
+
const normalizePathProp = (propValue) => {
|
|
10388
|
+
if (!propValue)
|
|
10389
|
+
return [];
|
|
10390
|
+
let value = isJSONString(propValue) ? JSON.parse(propValue) : propValue;
|
|
10391
|
+
if (Array.isArray(value) && value.some((item) => isJSONString(item))) {
|
|
10392
|
+
value = value.map((item) => isJSONString(item) ? JSON.parse(item) : item);
|
|
10393
|
+
}
|
|
10394
|
+
if (Array.isArray(value) && getArrayLevel(value) === 1) {
|
|
10395
|
+
return value.length ? [value] : [];
|
|
10396
|
+
}
|
|
10397
|
+
if (Array.isArray(value) && getArrayLevel(value) > 1)
|
|
10398
|
+
return value;
|
|
10399
|
+
return [];
|
|
10400
|
+
};
|
|
10383
10401
|
const realMarkers = computed$1({
|
|
10384
10402
|
get() {
|
|
10385
10403
|
if (Array.isArray(props.markers))
|
|
@@ -10391,105 +10409,49 @@ const _sfc_main$4 = {
|
|
|
10391
10409
|
return [];
|
|
10392
10410
|
},
|
|
10393
10411
|
set(value) {
|
|
10394
|
-
console.log("update:markers", value);
|
|
10395
10412
|
emit("update:markers", value);
|
|
10396
10413
|
}
|
|
10397
10414
|
});
|
|
10398
10415
|
const realPolylines = computed$1({
|
|
10399
10416
|
get() {
|
|
10400
|
-
|
|
10401
|
-
let value = isJSONString(props.polylines) ? JSON.parse(props.polylines) : props.polylines;
|
|
10402
|
-
if (Array.isArray(value) && value.some((item) => isJSONString(item))) {
|
|
10403
|
-
value = value.map((item) => {
|
|
10404
|
-
return isJSONString(item) ? JSON.parse(item) : item;
|
|
10405
|
-
});
|
|
10406
|
-
}
|
|
10407
|
-
if (Array.isArray(value) && getArrayLevel(value) === 1) {
|
|
10408
|
-
if (!value.length)
|
|
10409
|
-
return [];
|
|
10410
|
-
return [value];
|
|
10411
|
-
}
|
|
10412
|
-
if (Array.isArray(value) && getArrayLevel(value) > 1)
|
|
10413
|
-
return value;
|
|
10414
|
-
return [];
|
|
10415
|
-
}
|
|
10416
|
-
return [];
|
|
10417
|
+
return normalizePathProp(props.polylines);
|
|
10417
10418
|
},
|
|
10418
10419
|
set(value) {
|
|
10419
|
-
console.log("update:polylines", value);
|
|
10420
10420
|
emit("update:polylines", value);
|
|
10421
10421
|
}
|
|
10422
10422
|
});
|
|
10423
10423
|
const realPolygons = computed$1({
|
|
10424
10424
|
get() {
|
|
10425
|
-
|
|
10426
|
-
let value = isJSONString(props.polygons) ? JSON.parse(props.polygons) : props.polygons;
|
|
10427
|
-
if (Array.isArray(value) && value.some((item) => isJSONString(item))) {
|
|
10428
|
-
value = value.map((item) => {
|
|
10429
|
-
return isJSONString(item) ? JSON.parse(item) : item;
|
|
10430
|
-
});
|
|
10431
|
-
}
|
|
10432
|
-
if (Array.isArray(value) && getArrayLevel(value) === 1) {
|
|
10433
|
-
if (!value.length)
|
|
10434
|
-
return [];
|
|
10435
|
-
return [value];
|
|
10436
|
-
}
|
|
10437
|
-
if (Array.isArray(value) && getArrayLevel(value) > 1)
|
|
10438
|
-
return value;
|
|
10439
|
-
return [];
|
|
10440
|
-
}
|
|
10441
|
-
return [];
|
|
10425
|
+
return normalizePathProp(props.polygons);
|
|
10442
10426
|
},
|
|
10443
10427
|
set(value) {
|
|
10444
|
-
console.log("update:polygons", value);
|
|
10445
10428
|
emit("update:polygons", value);
|
|
10446
10429
|
}
|
|
10447
10430
|
});
|
|
10448
10431
|
const realBezierCurves = computed$1({
|
|
10449
10432
|
get() {
|
|
10450
|
-
|
|
10451
|
-
let value = isJSONString(props.bezierCurves) ? JSON.parse(props.polbezierCurvesylines) : props.bezierCurves;
|
|
10452
|
-
if (Array.isArray(value) && value.some((item) => isJSONString(item))) {
|
|
10453
|
-
value = value.map((item) => {
|
|
10454
|
-
return isJSONString(item) ? JSON.parse(item) : item;
|
|
10455
|
-
});
|
|
10456
|
-
}
|
|
10457
|
-
if (Array.isArray(value) && getArrayLevel(value) === 1) {
|
|
10458
|
-
if (!value.length)
|
|
10459
|
-
return [];
|
|
10460
|
-
return [value];
|
|
10461
|
-
}
|
|
10462
|
-
if (Array.isArray(value) && getArrayLevel(value) > 1)
|
|
10463
|
-
return value;
|
|
10464
|
-
return [];
|
|
10465
|
-
}
|
|
10466
|
-
return [];
|
|
10433
|
+
return normalizePathProp(props.bezierCurves);
|
|
10467
10434
|
},
|
|
10468
10435
|
set(value) {
|
|
10469
|
-
console.log("update:bezierCurves", value);
|
|
10470
10436
|
emit("update:bezierCurves", value);
|
|
10471
10437
|
}
|
|
10472
10438
|
});
|
|
10473
10439
|
const realCircles = computed$1({
|
|
10474
10440
|
get() {
|
|
10475
|
-
if (props.circles)
|
|
10476
|
-
let value = isJSONString(props.circles) ? JSON.parse(props.circles) : props.circles;
|
|
10477
|
-
if (Array.isArray(value) && value.some((item) => isJSONString(item))) {
|
|
10478
|
-
value = value.map((item) => {
|
|
10479
|
-
return isJSONString(item) ? JSON.parse(item) : item;
|
|
10480
|
-
});
|
|
10481
|
-
}
|
|
10482
|
-
if (Array.isArray(value))
|
|
10483
|
-
return value;
|
|
10484
|
-
if (Object.prototype.toString.call(value) === "[object Object]") {
|
|
10485
|
-
return [value];
|
|
10486
|
-
}
|
|
10441
|
+
if (!props.circles)
|
|
10487
10442
|
return [];
|
|
10443
|
+
let value = isJSONString(props.circles) ? JSON.parse(props.circles) : props.circles;
|
|
10444
|
+
if (Array.isArray(value) && value.some((item) => isJSONString(item))) {
|
|
10445
|
+
value = value.map((item) => isJSONString(item) ? JSON.parse(item) : item);
|
|
10446
|
+
}
|
|
10447
|
+
if (Array.isArray(value))
|
|
10448
|
+
return value;
|
|
10449
|
+
if (Object.prototype.toString.call(value) === "[object Object]") {
|
|
10450
|
+
return [value];
|
|
10488
10451
|
}
|
|
10489
10452
|
return [];
|
|
10490
10453
|
},
|
|
10491
10454
|
set(value) {
|
|
10492
|
-
console.log("update:circle", value);
|
|
10493
10455
|
emit("update:circles", value);
|
|
10494
10456
|
}
|
|
10495
10457
|
});
|
|
@@ -10501,34 +10463,52 @@ const _sfc_main$4 = {
|
|
|
10501
10463
|
const showHelpDialog = ref$1(false);
|
|
10502
10464
|
const map = shallowRef(null);
|
|
10503
10465
|
const mouseTool = shallowRef(null);
|
|
10504
|
-
const
|
|
10505
|
-
const localPolylines = ref$1([]);
|
|
10506
|
-
const localPolygons = ref$1([]);
|
|
10507
|
-
const localBezierCurves = ref$1([]);
|
|
10508
|
-
const localCircles = ref$1([]);
|
|
10509
|
-
const polyEditor = ref$1(null);
|
|
10510
|
-
const polygonEditor = ref$1(null);
|
|
10511
|
-
const bezierCurveEditor = ref$1(null);
|
|
10512
|
-
const circleEditor = ref$1(null);
|
|
10466
|
+
const editor = shallowRef(null);
|
|
10513
10467
|
const currentEditingObj = ref$1(null);
|
|
10514
10468
|
const placeSearch = ref$1(null);
|
|
10515
10469
|
const searchKeyword = ref$1("");
|
|
10516
10470
|
const searchLngLat = ref$1("");
|
|
10517
10471
|
const mapContainer = ref$1(null);
|
|
10472
|
+
const localMarkers = ref$1([]);
|
|
10473
|
+
const localPolylines = ref$1([]);
|
|
10474
|
+
const localPolygons = ref$1([]);
|
|
10475
|
+
const localBezierCurves = ref$1([]);
|
|
10476
|
+
const localCircles = ref$1([]);
|
|
10477
|
+
const LOCAL_ARRAYS = {
|
|
10478
|
+
marker: localMarkers,
|
|
10479
|
+
polyline: localPolylines,
|
|
10480
|
+
polygon: localPolygons,
|
|
10481
|
+
bezierCurve: localBezierCurves,
|
|
10482
|
+
circle: localCircles
|
|
10483
|
+
};
|
|
10484
|
+
const BUTTON_TO_INSTANCE = {
|
|
10485
|
+
point: "marker",
|
|
10486
|
+
polyline: "polyline",
|
|
10487
|
+
polygon: "polygon",
|
|
10488
|
+
bezierCurve: "bezierCurve",
|
|
10489
|
+
circle: "circle"
|
|
10490
|
+
};
|
|
10491
|
+
const TYPE_NAMES = {
|
|
10492
|
+
marker: "\u70B9",
|
|
10493
|
+
polyline: "\u6298\u7EBF",
|
|
10494
|
+
polygon: "\u591A\u8FB9\u5F62",
|
|
10495
|
+
bezierCurve: "\u66F2\u7EBF",
|
|
10496
|
+
circle: "\u5706\u5F62"
|
|
10497
|
+
};
|
|
10518
10498
|
watch(() => props.center, () => {
|
|
10519
10499
|
var _a;
|
|
10520
10500
|
if (props.center && map.value && !allOverlays.value.length) {
|
|
10521
10501
|
(_a = map.value) == null ? void 0 : _a.setCenter(parsePosition(props.center));
|
|
10522
10502
|
}
|
|
10523
10503
|
});
|
|
10524
|
-
const markerDefaultConfig =
|
|
10504
|
+
const markerDefaultConfig = {
|
|
10525
10505
|
icon: "https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
|
|
10526
10506
|
size: {
|
|
10527
10507
|
width: 26,
|
|
10528
10508
|
height: 32
|
|
10529
10509
|
}
|
|
10530
|
-
}
|
|
10531
|
-
const polylineDefaultConfig =
|
|
10510
|
+
};
|
|
10511
|
+
const polylineDefaultConfig = {
|
|
10532
10512
|
isOutline: true,
|
|
10533
10513
|
outlineColor: "#ffffff",
|
|
10534
10514
|
borderWeight: 2,
|
|
@@ -10541,22 +10521,12 @@ const _sfc_main$4 = {
|
|
|
10541
10521
|
showDir: true,
|
|
10542
10522
|
dirColor: "white",
|
|
10543
10523
|
dirIconSize: 20
|
|
10544
|
-
}
|
|
10545
|
-
const bezierCurveDefaultConfig =
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
strokeOpacity: 1,
|
|
10551
|
-
strokeWeight: 3,
|
|
10552
|
-
strokeStyle: "solid",
|
|
10553
|
-
lineJoin: "round",
|
|
10554
|
-
lineCap: "round",
|
|
10555
|
-
showDir: true,
|
|
10556
|
-
dirColor: "white",
|
|
10557
|
-
dirIconSize: 20
|
|
10558
|
-
});
|
|
10559
|
-
const polygonDefaultConfig = reactive({
|
|
10524
|
+
};
|
|
10525
|
+
const bezierCurveDefaultConfig = {
|
|
10526
|
+
...polylineDefaultConfig,
|
|
10527
|
+
strokeWeight: 3
|
|
10528
|
+
};
|
|
10529
|
+
const polygonDefaultConfig = {
|
|
10560
10530
|
fillColor: "#1890ff",
|
|
10561
10531
|
strokeColor: "#1890ff",
|
|
10562
10532
|
fillOpacity: 0.1,
|
|
@@ -10565,8 +10535,8 @@ const _sfc_main$4 = {
|
|
|
10565
10535
|
strokeStyle: "dashed",
|
|
10566
10536
|
strokeDasharray: [10, 5],
|
|
10567
10537
|
draggable: false
|
|
10568
|
-
}
|
|
10569
|
-
const circleDefaultConfig =
|
|
10538
|
+
};
|
|
10539
|
+
const circleDefaultConfig = {
|
|
10570
10540
|
strokeColor: "#1890ff",
|
|
10571
10541
|
strokeOpacity: 1,
|
|
10572
10542
|
strokeWeight: 3,
|
|
@@ -10574,13 +10544,7 @@ const _sfc_main$4 = {
|
|
|
10574
10544
|
fillOpacity: 0.1,
|
|
10575
10545
|
zIndex: 10,
|
|
10576
10546
|
draggable: false
|
|
10577
|
-
}
|
|
10578
|
-
onBeforeUnmount(() => {
|
|
10579
|
-
if (map.value) {
|
|
10580
|
-
map.value.destroy();
|
|
10581
|
-
map.value = null;
|
|
10582
|
-
}
|
|
10583
|
-
});
|
|
10547
|
+
};
|
|
10584
10548
|
const isMultipleAllowed = (type) => {
|
|
10585
10549
|
if (typeof props.multiple === "boolean") {
|
|
10586
10550
|
return props.multiple;
|
|
@@ -10596,6 +10560,37 @@ const _sfc_main$4 = {
|
|
|
10596
10560
|
}
|
|
10597
10561
|
return position;
|
|
10598
10562
|
};
|
|
10563
|
+
const preventContextMenu = (e) => e.preventDefault();
|
|
10564
|
+
const getInstanceType = (instance) => {
|
|
10565
|
+
if (instance instanceof AMap.Marker)
|
|
10566
|
+
return "marker";
|
|
10567
|
+
if (instance instanceof AMap.Polyline)
|
|
10568
|
+
return "polyline";
|
|
10569
|
+
if (instance instanceof AMap.Polygon)
|
|
10570
|
+
return "polygon";
|
|
10571
|
+
if (instance instanceof AMap.BezierCurve)
|
|
10572
|
+
return "bezierCurve";
|
|
10573
|
+
if (instance instanceof AMap.Circle)
|
|
10574
|
+
return "circle";
|
|
10575
|
+
return null;
|
|
10576
|
+
};
|
|
10577
|
+
const parseLngLat = (str) => {
|
|
10578
|
+
const [lng, lat] = str.split(",").map(Number);
|
|
10579
|
+
return new AMap.LngLat(lng, lat);
|
|
10580
|
+
};
|
|
10581
|
+
const buildMarkerOptions = () => {
|
|
10582
|
+
const { size, icon } = props.markerConfig;
|
|
10583
|
+
const useSize = size || markerDefaultConfig.size;
|
|
10584
|
+
const useIcon = icon || markerDefaultConfig.icon;
|
|
10585
|
+
return {
|
|
10586
|
+
icon: new AMap.Icon({
|
|
10587
|
+
image: useIcon,
|
|
10588
|
+
imageSize: new AMap.Size(useSize.width, useSize.height)
|
|
10589
|
+
}),
|
|
10590
|
+
offset: new AMap.Pixel(-(useSize.width / 2), -useSize.height),
|
|
10591
|
+
size: new AMap.Size(useSize.width, useSize.height)
|
|
10592
|
+
};
|
|
10593
|
+
};
|
|
10599
10594
|
const initMap = async () => {
|
|
10600
10595
|
try {
|
|
10601
10596
|
loading.value = true;
|
|
@@ -10624,9 +10619,7 @@ const _sfc_main$4 = {
|
|
|
10624
10619
|
mouseTool.value = new AMap2.MouseTool(map.value);
|
|
10625
10620
|
mouseTool.value.on("draw", handleDrawComplete);
|
|
10626
10621
|
map.value.on("rightclick", handleRightClick);
|
|
10627
|
-
document.addEventListener("contextmenu",
|
|
10628
|
-
e.preventDefault();
|
|
10629
|
-
});
|
|
10622
|
+
document.addEventListener("contextmenu", preventContextMenu);
|
|
10630
10623
|
placeSearch.value = new AMap2.PlaceSearch({
|
|
10631
10624
|
pageSize: 10,
|
|
10632
10625
|
pageIndex: 1,
|
|
@@ -10657,22 +10650,22 @@ const _sfc_main$4 = {
|
|
|
10657
10650
|
const setInstanceEvent = (type, instance) => {
|
|
10658
10651
|
if (type !== "circle") {
|
|
10659
10652
|
instance.setDraggable(true);
|
|
10660
|
-
instance.on("mousedown", (
|
|
10653
|
+
instance.on("mousedown", () => {
|
|
10661
10654
|
if (drawingType.value === "circle")
|
|
10662
10655
|
instance.setDraggable(false);
|
|
10663
10656
|
});
|
|
10664
|
-
instance.on("mouseup", (
|
|
10657
|
+
instance.on("mouseup", () => {
|
|
10665
10658
|
instance.setDraggable(true);
|
|
10666
10659
|
});
|
|
10667
|
-
instance.on("dragend", (
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
updatePolylineData
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10660
|
+
instance.on("dragend", () => {
|
|
10661
|
+
var _a;
|
|
10662
|
+
const updaters = {
|
|
10663
|
+
marker: updateMarkerData,
|
|
10664
|
+
polyline: updatePolylineData,
|
|
10665
|
+
polygon: updatePolygonData,
|
|
10666
|
+
bezierCurve: updateBezierCurveData
|
|
10667
|
+
};
|
|
10668
|
+
(_a = updaters[type]) == null ? void 0 : _a.call(updaters, instance);
|
|
10676
10669
|
props.immediateComplete && handleConfirm();
|
|
10677
10670
|
});
|
|
10678
10671
|
}
|
|
@@ -10680,7 +10673,7 @@ const _sfc_main$4 = {
|
|
|
10680
10673
|
handleRightClick(instance);
|
|
10681
10674
|
});
|
|
10682
10675
|
if (type !== "marker") {
|
|
10683
|
-
instance.on("dblclick", (
|
|
10676
|
+
instance.on("dblclick", () => {
|
|
10684
10677
|
setTimeout(() => {
|
|
10685
10678
|
mouseTool.value && mouseTool.value.close();
|
|
10686
10679
|
});
|
|
@@ -10688,13 +10681,22 @@ const _sfc_main$4 = {
|
|
|
10688
10681
|
});
|
|
10689
10682
|
}
|
|
10690
10683
|
};
|
|
10691
|
-
const allOverlays = computed$1(
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10684
|
+
const allOverlays = computed$1(
|
|
10685
|
+
() => Object.values(LOCAL_ARRAYS).flatMap((arr) => arr.value.map((item) => item.obj).filter(Boolean))
|
|
10686
|
+
);
|
|
10687
|
+
const renderPathOverlay = (dataList, OverlayClass, defaultConfig, propConfig, type, localArr) => {
|
|
10688
|
+
dataList.forEach((data) => {
|
|
10689
|
+
const path = data.map((point) => parseLngLat(point));
|
|
10690
|
+
const obj = new OverlayClass({
|
|
10691
|
+
path,
|
|
10692
|
+
map: map.value,
|
|
10693
|
+
...defaultConfig,
|
|
10694
|
+
...propConfig
|
|
10695
|
+
});
|
|
10696
|
+
setInstanceEvent(type, obj);
|
|
10697
|
+
localArr.value.push({ obj, path: data, type });
|
|
10698
|
+
});
|
|
10699
|
+
};
|
|
10698
10700
|
const renderInitialData = () => {
|
|
10699
10701
|
if (!map.value)
|
|
10700
10702
|
return;
|
|
@@ -10707,56 +10709,18 @@ const _sfc_main$4 = {
|
|
|
10707
10709
|
map.value.clearMap();
|
|
10708
10710
|
realMarkers.value.forEach((marker) => {
|
|
10709
10711
|
const [lng, lat] = marker.split(",").map(Number);
|
|
10710
|
-
const { size, icon } = props.markerConfig;
|
|
10711
10712
|
const markerObj = new AMap2.Marker({
|
|
10712
10713
|
position: [lng, lat],
|
|
10713
|
-
|
|
10714
|
-
image: icon || markerDefaultConfig.icon,
|
|
10715
|
-
imageSize: size ? new AMap2.Size(size.width, size.height) : new AMap2.Size(markerDefaultConfig.size.width, markerDefaultConfig.size.height)
|
|
10716
|
-
}),
|
|
10717
|
-
offset: size ? new AMap2.Pixel(-(size.width / 2), -size.height) : new AMap2.Pixel(-(markerDefaultConfig.size.width / 2), -markerDefaultConfig.size.height),
|
|
10718
|
-
size: size ? new AMap2.Size(size.width, size.height) : new AMap2.Size(markerDefaultConfig.size.width, markerDefaultConfig.size.height),
|
|
10714
|
+
...buildMarkerOptions(),
|
|
10719
10715
|
map: map.value
|
|
10720
10716
|
});
|
|
10721
10717
|
setInstanceEvent("marker", markerObj);
|
|
10722
10718
|
localMarkers.value.push({ obj: markerObj, position: marker, type: "marker" });
|
|
10723
10719
|
});
|
|
10724
|
-
realPolylines.value.
|
|
10725
|
-
|
|
10726
|
-
const path = polyline.map((point) => {
|
|
10727
|
-
const [lng, lat] = point.split(",").map(Number);
|
|
10728
|
-
return new AMap2.LngLat(lng, lat);
|
|
10729
|
-
});
|
|
10730
|
-
const polylineObj = new AMap2.Polyline({
|
|
10731
|
-
path,
|
|
10732
|
-
map: map.value,
|
|
10733
|
-
...polylineDefaultConfig,
|
|
10734
|
-
...props.polylineConfig
|
|
10735
|
-
});
|
|
10736
|
-
setInstanceEvent("polyline", polylineObj);
|
|
10737
|
-
localPolylines.value.push({ obj: polylineObj, path: polyline, type: "polyline" });
|
|
10738
|
-
});
|
|
10739
|
-
realPolygons.value.forEach((polygon) => {
|
|
10740
|
-
console.log("polygon", polygon);
|
|
10741
|
-
const path = polygon.map((point) => {
|
|
10742
|
-
const [lng, lat] = point.split(",").map(Number);
|
|
10743
|
-
return new AMap2.LngLat(lng, lat);
|
|
10744
|
-
});
|
|
10745
|
-
const polygonObj = new AMap2.Polygon({
|
|
10746
|
-
path,
|
|
10747
|
-
map: map.value,
|
|
10748
|
-
...polygonDefaultConfig,
|
|
10749
|
-
...props.polygonConfig
|
|
10750
|
-
});
|
|
10751
|
-
setInstanceEvent("polygon", polygonObj);
|
|
10752
|
-
localPolygons.value.push({ obj: polygonObj, path: polygon, type: "polygon" });
|
|
10753
|
-
});
|
|
10720
|
+
renderPathOverlay(realPolylines.value, AMap2.Polyline, polylineDefaultConfig, props.polylineConfig, "polyline", localPolylines);
|
|
10721
|
+
renderPathOverlay(realPolygons.value, AMap2.Polygon, polygonDefaultConfig, props.polygonConfig, "polygon", localPolygons);
|
|
10754
10722
|
realBezierCurves.value.forEach((bezierCurve) => {
|
|
10755
|
-
const path = bezierCurve.map((point) =>
|
|
10756
|
-
return point.map((item) => {
|
|
10757
|
-
return Number(item);
|
|
10758
|
-
});
|
|
10759
|
-
});
|
|
10723
|
+
const path = bezierCurve.map((point) => point.map(Number));
|
|
10760
10724
|
const bezierCurveObj = new AMap2.BezierCurve({
|
|
10761
10725
|
path,
|
|
10762
10726
|
map: map.value,
|
|
@@ -10784,7 +10748,6 @@ const _sfc_main$4 = {
|
|
|
10784
10748
|
}
|
|
10785
10749
|
};
|
|
10786
10750
|
const drawTypClick = (type) => {
|
|
10787
|
-
console.log("type------", type);
|
|
10788
10751
|
type === drawingType.value ? drawingType.value = "" : drawingType.value = type;
|
|
10789
10752
|
if (drawingType.value) {
|
|
10790
10753
|
startDrawing(drawingType.value);
|
|
@@ -10800,22 +10763,9 @@ const _sfc_main$4 = {
|
|
|
10800
10763
|
}
|
|
10801
10764
|
switch (type) {
|
|
10802
10765
|
case "point":
|
|
10803
|
-
|
|
10804
|
-
mouseTool.value.marker({
|
|
10805
|
-
icon: new AMap.Icon({
|
|
10806
|
-
image: icon || markerDefaultConfig.icon,
|
|
10807
|
-
imageSize: size ? new AMap.Size(size.width, size.height) : new AMap.Size(markerDefaultConfig.size.width, markerDefaultConfig.size.height)
|
|
10808
|
-
}),
|
|
10809
|
-
offset: size ? new AMap.Pixel(-(size.width / 2), -size.height) : new AMap.Pixel(-(markerDefaultConfig.size.width / 2), -markerDefaultConfig.size.height),
|
|
10810
|
-
size: size ? new AMap.Size(size.width, size.height) : new AMap.Size(markerDefaultConfig.size.width, markerDefaultConfig.size.height)
|
|
10811
|
-
});
|
|
10766
|
+
mouseTool.value.marker(buildMarkerOptions());
|
|
10812
10767
|
break;
|
|
10813
10768
|
case "polyline":
|
|
10814
|
-
mouseTool.value.polyline({
|
|
10815
|
-
...polylineDefaultConfig,
|
|
10816
|
-
...props.polylineConfig
|
|
10817
|
-
});
|
|
10818
|
-
break;
|
|
10819
10769
|
case "bezierCurve":
|
|
10820
10770
|
mouseTool.value.polyline({
|
|
10821
10771
|
...polylineDefaultConfig,
|
|
@@ -10844,15 +10794,15 @@ const _sfc_main$4 = {
|
|
|
10844
10794
|
return;
|
|
10845
10795
|
const { obj } = event;
|
|
10846
10796
|
if (obj instanceof AMap.Marker && !isMultipleAllowed("point")) {
|
|
10847
|
-
|
|
10797
|
+
clearLocalByType("marker");
|
|
10848
10798
|
} else if (obj instanceof AMap.Polyline && drawingType.value !== "bezierCurve" && !isMultipleAllowed("polyline")) {
|
|
10849
|
-
|
|
10799
|
+
clearLocalByType("polyline");
|
|
10850
10800
|
} else if (obj instanceof AMap.Polygon && !isMultipleAllowed("polygon")) {
|
|
10851
|
-
|
|
10801
|
+
clearLocalByType("polygon");
|
|
10852
10802
|
} else if ((obj instanceof AMap.BezierCurve || obj instanceof AMap.Polyline && drawingType.value === "bezierCurve") && !isMultipleAllowed("bezierCurve")) {
|
|
10853
|
-
|
|
10803
|
+
clearLocalByType("bezierCurve");
|
|
10854
10804
|
} else if (obj instanceof AMap.Circle && !isMultipleAllowed("circle")) {
|
|
10855
|
-
obj._opts.radius &&
|
|
10805
|
+
obj._opts.radius && clearLocalByType("circle");
|
|
10856
10806
|
}
|
|
10857
10807
|
if (obj instanceof AMap.Marker) {
|
|
10858
10808
|
const position = obj.getPosition();
|
|
@@ -10934,8 +10884,8 @@ const _sfc_main$4 = {
|
|
|
10934
10884
|
...props.bezierCurveConfig,
|
|
10935
10885
|
map: map.value
|
|
10936
10886
|
});
|
|
10937
|
-
|
|
10938
|
-
localBezierCurves.value.push({ obj: bezierCurve, path: bezierPath });
|
|
10887
|
+
enableEditor("bezierCurve", bezierCurve);
|
|
10888
|
+
localBezierCurves.value.push({ obj: bezierCurve, path: bezierPath, type: "bezierCurve" });
|
|
10939
10889
|
setInstanceEvent("bezierCurve", bezierCurve);
|
|
10940
10890
|
};
|
|
10941
10891
|
const updateMarkerData = (marker) => {
|
|
@@ -10947,61 +10897,38 @@ const _sfc_main$4 = {
|
|
|
10947
10897
|
localMarkers.value[index2].position = `${position.lng},${position.lat}`;
|
|
10948
10898
|
}
|
|
10949
10899
|
};
|
|
10950
|
-
const
|
|
10951
|
-
if (
|
|
10952
|
-
|
|
10953
|
-
if (
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
};
|
|
10960
|
-
const enablePolygonEditor = (polygon) => {
|
|
10961
|
-
if (props.disabled)
|
|
10962
|
-
return;
|
|
10963
|
-
if (polygonEditor.value) {
|
|
10964
|
-
polygonEditor.value.close();
|
|
10965
|
-
}
|
|
10966
|
-
polygonEditor.value = new AMap.PolygonEditor(map.value, polygon);
|
|
10967
|
-
polygonEditor.value.open();
|
|
10968
|
-
currentEditingObj.value = polygon;
|
|
10969
|
-
};
|
|
10970
|
-
const enableCircleEditor = (circle) => {
|
|
10971
|
-
if (props.disabled)
|
|
10972
|
-
return;
|
|
10973
|
-
if (circleEditor.value) {
|
|
10974
|
-
circleEditor.value.close();
|
|
10975
|
-
}
|
|
10976
|
-
circleEditor.value = new AMap.CircleEditor(map.value, circle);
|
|
10977
|
-
circleEditor.value.open();
|
|
10978
|
-
currentEditingObj.value = circle;
|
|
10900
|
+
const updateDataByInstance = (instance) => {
|
|
10901
|
+
if (instance instanceof AMap.Polyline)
|
|
10902
|
+
updatePolylineData(instance);
|
|
10903
|
+
else if (instance instanceof AMap.Polygon)
|
|
10904
|
+
updatePolygonData(instance);
|
|
10905
|
+
else if (instance instanceof AMap.BezierCurve)
|
|
10906
|
+
updateBezierCurveData(instance);
|
|
10907
|
+
else if (instance instanceof AMap.Circle)
|
|
10908
|
+
updateCircleData(instance);
|
|
10979
10909
|
};
|
|
10980
|
-
const
|
|
10910
|
+
const enableEditor = (type, instance) => {
|
|
10981
10911
|
if (props.disabled)
|
|
10982
10912
|
return;
|
|
10983
|
-
if (
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10913
|
+
if (editor.value)
|
|
10914
|
+
editor.value.close();
|
|
10915
|
+
const EditorClass = {
|
|
10916
|
+
polyline: AMap.PolyEditor,
|
|
10917
|
+
polygon: AMap.PolygonEditor,
|
|
10918
|
+
circle: AMap.CircleEditor,
|
|
10919
|
+
bezierCurve: AMap.BezierCurveEditor
|
|
10920
|
+
}[type];
|
|
10921
|
+
editor.value = new EditorClass(map.value, instance);
|
|
10922
|
+
editor.value.open();
|
|
10923
|
+
currentEditingObj.value = instance;
|
|
10989
10924
|
};
|
|
10990
10925
|
const handleRightClick = (target) => {
|
|
10991
10926
|
setTimeout(() => {
|
|
10992
10927
|
if (props.disabled || drawing.value)
|
|
10993
10928
|
return;
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
deletePolyline(target);
|
|
10998
|
-
} else if (target instanceof AMap.Polygon) {
|
|
10999
|
-
console.log("target", target);
|
|
11000
|
-
deletePolygon(target);
|
|
11001
|
-
} else if (target instanceof AMap.BezierCurve) {
|
|
11002
|
-
deleteBezierCurve(target);
|
|
11003
|
-
} else if (target instanceof AMap.Circle) {
|
|
11004
|
-
deleteCircle(target);
|
|
10929
|
+
const type = getInstanceType(target);
|
|
10930
|
+
if (type) {
|
|
10931
|
+
confirmDelete("single", { type, instance: target });
|
|
11005
10932
|
} else {
|
|
11006
10933
|
if (props.immediateComplete && currentEditingObj.value) {
|
|
11007
10934
|
handleConfirm();
|
|
@@ -11021,121 +10948,38 @@ const _sfc_main$4 = {
|
|
|
11021
10948
|
return;
|
|
11022
10949
|
}
|
|
11023
10950
|
if (currentEditingObj.value) {
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
enablePolylineEditor(target);
|
|
11029
|
-
} else if (target instanceof AMap.Polygon) {
|
|
11030
|
-
enablePolygonEditor(target);
|
|
11031
|
-
} else if (target instanceof AMap.BezierCurve) {
|
|
11032
|
-
enableBezierCurveEditor(target);
|
|
11033
|
-
} else if (target instanceof AMap.Circle) {
|
|
11034
|
-
enableCircleEditor(target);
|
|
11035
|
-
}
|
|
11036
|
-
};
|
|
11037
|
-
const deleteMarker = (marker) => {
|
|
11038
|
-
if (props.disabled)
|
|
11039
|
-
return;
|
|
11040
|
-
confirmDelete("single", {
|
|
11041
|
-
type: "marker",
|
|
11042
|
-
instance: marker
|
|
11043
|
-
});
|
|
11044
|
-
};
|
|
11045
|
-
const executeDeleteMarker = (marker) => {
|
|
11046
|
-
marker.setMap(null);
|
|
11047
|
-
const index2 = localMarkers.value.findIndex((item) => item.obj._amap_id === marker._amap_id);
|
|
11048
|
-
if (index2 !== -1) {
|
|
11049
|
-
localMarkers.value.splice(index2, 1);
|
|
11050
|
-
}
|
|
11051
|
-
};
|
|
11052
|
-
const deletePolyline = (polyline) => {
|
|
11053
|
-
if (props.disabled)
|
|
11054
|
-
return;
|
|
11055
|
-
confirmDelete("single", {
|
|
11056
|
-
type: "polyline",
|
|
11057
|
-
instance: polyline
|
|
11058
|
-
});
|
|
11059
|
-
};
|
|
11060
|
-
const executeDeletePolyline = (polyline) => {
|
|
11061
|
-
polyline.setMap(null);
|
|
11062
|
-
const index2 = localPolylines.value.findIndex((item) => item.obj._amap_id === polyline._amap_id);
|
|
11063
|
-
console.log("index---------", index2);
|
|
11064
|
-
if (index2 !== -1) {
|
|
11065
|
-
localPolylines.value.splice(index2, 1);
|
|
10951
|
+
if (props.immediateComplete)
|
|
10952
|
+
handleConfirm();
|
|
10953
|
+
else
|
|
10954
|
+
closeEditor();
|
|
11066
10955
|
}
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
return;
|
|
11071
|
-
confirmDelete("single", {
|
|
11072
|
-
type: "polygon",
|
|
11073
|
-
instance: polygon
|
|
11074
|
-
});
|
|
11075
|
-
};
|
|
11076
|
-
const executeDeletePolygon = (polygon) => {
|
|
11077
|
-
polygon.setMap(null);
|
|
11078
|
-
console.log("localPolygons.value", localPolygons.value);
|
|
11079
|
-
const index2 = localPolygons.value.findIndex((item) => item.obj._amap_id === polygon._amap_id);
|
|
11080
|
-
console.log("index---------", index2);
|
|
11081
|
-
if (index2 !== -1) {
|
|
11082
|
-
localPolygons.value.splice(index2, 1);
|
|
11083
|
-
console.log("localPolygons.value", localPolygons.value);
|
|
10956
|
+
const type = getInstanceType(target);
|
|
10957
|
+
if (type && type !== "marker") {
|
|
10958
|
+
enableEditor(type, target);
|
|
11084
10959
|
}
|
|
11085
10960
|
};
|
|
11086
|
-
const
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
type: "bezierCurve",
|
|
11091
|
-
instance: bezierCurve
|
|
11092
|
-
});
|
|
11093
|
-
};
|
|
11094
|
-
const executeDeleteBezierCurve = (bezierCurve) => {
|
|
11095
|
-
bezierCurve.setMap(null);
|
|
11096
|
-
const index2 = localBezierCurves.value.findIndex((item) => item.obj._amap_id === bezierCurve._amap_id);
|
|
10961
|
+
const executeDeleteSingle = (type, instance) => {
|
|
10962
|
+
instance.setMap(null);
|
|
10963
|
+
const arr = LOCAL_ARRAYS[type];
|
|
10964
|
+
const index2 = arr.value.findIndex((item) => item.obj._amap_id === instance._amap_id);
|
|
11097
10965
|
if (index2 !== -1) {
|
|
11098
|
-
|
|
11099
|
-
}
|
|
11100
|
-
};
|
|
11101
|
-
const deleteCircle = (circle) => {
|
|
11102
|
-
if (props.disabled)
|
|
11103
|
-
return;
|
|
11104
|
-
confirmDelete("single", {
|
|
11105
|
-
type: "circle",
|
|
11106
|
-
instance: circle
|
|
11107
|
-
});
|
|
11108
|
-
};
|
|
11109
|
-
const executeDeleteCircle = (circle) => {
|
|
11110
|
-
circle.setMap(null);
|
|
11111
|
-
const index2 = localCircles.value.findIndex((item) => item.obj._amap_id === circle._amap_id);
|
|
11112
|
-
if (index2 !== -1) {
|
|
11113
|
-
localCircles.value.splice(index2, 1);
|
|
10966
|
+
arr.value.splice(index2, 1);
|
|
11114
10967
|
}
|
|
11115
10968
|
};
|
|
11116
10969
|
const closeEditor = () => {
|
|
11117
10970
|
if (props.disabled)
|
|
11118
10971
|
return;
|
|
11119
|
-
if (
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
}
|
|
11123
|
-
if (polygonEditor.value && currentEditingObj.value instanceof AMap.Polygon) {
|
|
11124
|
-
updatePolygonData();
|
|
11125
|
-
polygonEditor.value.close();
|
|
11126
|
-
}
|
|
11127
|
-
if (bezierCurveEditor.value && currentEditingObj.value instanceof AMap.BezierCurve) {
|
|
11128
|
-
updateBezierCurveData();
|
|
11129
|
-
bezierCurveEditor.value.close();
|
|
11130
|
-
}
|
|
11131
|
-
if (circleEditor.value && currentEditingObj.value instanceof AMap.Circle) {
|
|
11132
|
-
updateCircleData();
|
|
11133
|
-
circleEditor.value.close();
|
|
10972
|
+
if (editor.value && currentEditingObj.value) {
|
|
10973
|
+
updateDataByInstance(currentEditingObj.value);
|
|
10974
|
+
editor.value.close();
|
|
11134
10975
|
}
|
|
11135
10976
|
currentEditingObj.value = null;
|
|
11136
10977
|
};
|
|
11137
10978
|
const updatePolylineData = (instance = null) => {
|
|
11138
|
-
|
|
10979
|
+
var _a;
|
|
10980
|
+
const polyline = instance != null ? instance : (_a = editor.value) == null ? void 0 : _a.getTarget();
|
|
10981
|
+
if (!polyline)
|
|
10982
|
+
return;
|
|
11139
10983
|
let InstancePath = polyline.getPath();
|
|
11140
10984
|
if (getArrayLevel(InstancePath) > 1) {
|
|
11141
10985
|
InstancePath = InstancePath[0];
|
|
@@ -11143,13 +10987,15 @@ const _sfc_main$4 = {
|
|
|
11143
10987
|
}
|
|
11144
10988
|
const path = InstancePath.map((point) => `${point.lng},${point.lat}`);
|
|
11145
10989
|
const index2 = localPolylines.value.findIndex((item) => item.obj._amap_id === polyline._amap_id);
|
|
11146
|
-
console.log("index", index2);
|
|
11147
10990
|
if (index2 !== -1) {
|
|
11148
10991
|
localPolylines.value[index2].path = path;
|
|
11149
10992
|
}
|
|
11150
10993
|
};
|
|
11151
10994
|
const updatePolygonData = (instance = null) => {
|
|
11152
|
-
|
|
10995
|
+
var _a;
|
|
10996
|
+
const polygon = instance != null ? instance : (_a = editor.value) == null ? void 0 : _a.getTarget();
|
|
10997
|
+
if (!polygon)
|
|
10998
|
+
return;
|
|
11153
10999
|
const path = polygon.getPath().map((point) => `${point.lng},${point.lat}`);
|
|
11154
11000
|
const index2 = localPolygons.value.findIndex((item) => item.obj._amap_id === polygon._amap_id);
|
|
11155
11001
|
if (index2 !== -1) {
|
|
@@ -11157,7 +11003,10 @@ const _sfc_main$4 = {
|
|
|
11157
11003
|
}
|
|
11158
11004
|
};
|
|
11159
11005
|
const updateBezierCurveData = (instance = null) => {
|
|
11160
|
-
|
|
11006
|
+
var _a;
|
|
11007
|
+
const bezierCurve = instance != null ? instance : (_a = editor.value) == null ? void 0 : _a.getTarget();
|
|
11008
|
+
if (!bezierCurve)
|
|
11009
|
+
return;
|
|
11161
11010
|
const rawPath = bezierCurve.getPath();
|
|
11162
11011
|
const path = [];
|
|
11163
11012
|
try {
|
|
@@ -11193,7 +11042,6 @@ const _sfc_main$4 = {
|
|
|
11193
11042
|
}
|
|
11194
11043
|
}
|
|
11195
11044
|
}
|
|
11196
|
-
console.log("\u5904\u7406\u540E\u7684\u8D1D\u585E\u5C14\u66F2\u7EBF\u8DEF\u5F84:", path);
|
|
11197
11045
|
const index2 = localBezierCurves.value.findIndex((item) => item.obj._amap_id === bezierCurve._amap_id);
|
|
11198
11046
|
if (index2 !== -1) {
|
|
11199
11047
|
localBezierCurves.value[index2].path = path;
|
|
@@ -11203,7 +11051,10 @@ const _sfc_main$4 = {
|
|
|
11203
11051
|
}
|
|
11204
11052
|
};
|
|
11205
11053
|
const updateCircleData = (instance = null) => {
|
|
11206
|
-
|
|
11054
|
+
var _a;
|
|
11055
|
+
const circle = instance != null ? instance : (_a = editor.value) == null ? void 0 : _a.getTarget();
|
|
11056
|
+
if (!circle)
|
|
11057
|
+
return;
|
|
11207
11058
|
const center = circle.getCenter();
|
|
11208
11059
|
const radius = circle.getRadius();
|
|
11209
11060
|
const index2 = localCircles.value.findIndex((item) => item.obj._amap_id === circle._amap_id);
|
|
@@ -11212,80 +11063,38 @@ const _sfc_main$4 = {
|
|
|
11212
11063
|
localCircles.value[index2].radius = radius;
|
|
11213
11064
|
}
|
|
11214
11065
|
};
|
|
11066
|
+
const CONFIRM_MAPPING = [
|
|
11067
|
+
{ checkType: "point", instanceType: "marker", local: localMarkers, real: realMarkers },
|
|
11068
|
+
{ checkType: "polyline", instanceType: "polyline", local: localPolylines, real: realPolylines },
|
|
11069
|
+
{ checkType: "polygon", instanceType: "polygon", local: localPolygons, real: realPolygons },
|
|
11070
|
+
{ checkType: "bezierCurve", instanceType: "bezierCurve", local: localBezierCurves, real: realBezierCurves },
|
|
11071
|
+
{ checkType: "circle", instanceType: "circle", local: localCircles, real: realCircles }
|
|
11072
|
+
];
|
|
11073
|
+
const buildOutputItem = (item, instanceType) => {
|
|
11074
|
+
let path;
|
|
11075
|
+
if (instanceType === "marker") {
|
|
11076
|
+
path = typeof item.position === "string" ? item.position : props.formatJson ? JSON.stringify(item.position) : item.position;
|
|
11077
|
+
} else if (instanceType === "circle") {
|
|
11078
|
+
const data = { center: item.center, radius: item.radius };
|
|
11079
|
+
path = props.formatJson ? JSON.stringify(data) : data;
|
|
11080
|
+
} else {
|
|
11081
|
+
path = props.formatJson ? JSON.stringify(item.path) : item.path;
|
|
11082
|
+
}
|
|
11083
|
+
return { path, type: item.type };
|
|
11084
|
+
};
|
|
11215
11085
|
const handleConfirm = () => {
|
|
11216
|
-
var _a, _b, _c, _d, _e;
|
|
11217
11086
|
if (props.disabled)
|
|
11218
11087
|
return;
|
|
11219
11088
|
closeEditor();
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
}))[0]) != null ? _a : "";
|
|
11230
|
-
}
|
|
11231
|
-
if (isMultipleAllowed("polyline")) {
|
|
11232
|
-
realPolylines.value = localPolylines.value.map((item) => ({
|
|
11233
|
-
path: props.formatJson ? JSON.stringify(item.path) : item.path,
|
|
11234
|
-
type: item.type
|
|
11235
|
-
}));
|
|
11236
|
-
} else {
|
|
11237
|
-
realPolylines.value = (_b = localPolylines.value.map((item) => ({
|
|
11238
|
-
path: props.formatJson ? JSON.stringify(item.path) : item.path,
|
|
11239
|
-
type: item.type
|
|
11240
|
-
}))[0]) != null ? _b : "";
|
|
11241
|
-
}
|
|
11242
|
-
if (isMultipleAllowed("polygon")) {
|
|
11243
|
-
realPolygons.value = localPolygons.value.map((item) => ({
|
|
11244
|
-
path: props.formatJson ? JSON.stringify(item.path) : item.path,
|
|
11245
|
-
type: item.type
|
|
11246
|
-
}));
|
|
11247
|
-
} else {
|
|
11248
|
-
realPolygons.value = (_c = localPolygons.value.map((item) => ({
|
|
11249
|
-
path: props.formatJson ? JSON.stringify(item.path) : item.path,
|
|
11250
|
-
type: item.type
|
|
11251
|
-
}))[0]) != null ? _c : "";
|
|
11252
|
-
}
|
|
11253
|
-
if (isMultipleAllowed("bezierCurve")) {
|
|
11254
|
-
realBezierCurves.value = localBezierCurves.value.map((item) => {
|
|
11255
|
-
return {
|
|
11256
|
-
path: props.formatJson ? JSON.stringify(item.path) : item.path,
|
|
11257
|
-
type: item.type
|
|
11258
|
-
};
|
|
11259
|
-
});
|
|
11260
|
-
} else {
|
|
11261
|
-
realBezierCurves.value = (_d = localBezierCurves.value.map((item) => ({
|
|
11262
|
-
path: props.formatJson ? JSON.stringify(item.path) : item.path,
|
|
11263
|
-
type: item.type
|
|
11264
|
-
}))[0]) != null ? _d : "";
|
|
11265
|
-
}
|
|
11266
|
-
if (isMultipleAllowed("circle")) {
|
|
11267
|
-
realCircles.value = localCircles.value.map((item) => ({
|
|
11268
|
-
path: props.formatJson ? JSON.stringify({
|
|
11269
|
-
center: item.center,
|
|
11270
|
-
radius: item.radius
|
|
11271
|
-
}) : {
|
|
11272
|
-
center: item.center,
|
|
11273
|
-
radius: item.radius
|
|
11274
|
-
},
|
|
11275
|
-
type: item.type
|
|
11276
|
-
}));
|
|
11277
|
-
} else {
|
|
11278
|
-
realCircles.value = (_e = localCircles.value.map((item) => ({
|
|
11279
|
-
path: props.formatJson ? JSON.stringify({
|
|
11280
|
-
center: item.center,
|
|
11281
|
-
radius: item.radius
|
|
11282
|
-
}) : {
|
|
11283
|
-
center: item.center,
|
|
11284
|
-
radius: item.radius
|
|
11285
|
-
},
|
|
11286
|
-
type: item.type
|
|
11287
|
-
}))[0]) != null ? _e : "";
|
|
11288
|
-
}
|
|
11089
|
+
CONFIRM_MAPPING.forEach(({ checkType, instanceType, local, real }) => {
|
|
11090
|
+
var _a;
|
|
11091
|
+
const items = local.value.map((item) => buildOutputItem(item, instanceType));
|
|
11092
|
+
if (isMultipleAllowed(checkType)) {
|
|
11093
|
+
real.value = items;
|
|
11094
|
+
} else {
|
|
11095
|
+
real.value = (_a = items[0]) != null ? _a : "";
|
|
11096
|
+
}
|
|
11097
|
+
});
|
|
11289
11098
|
emit("change");
|
|
11290
11099
|
emit("confirm");
|
|
11291
11100
|
};
|
|
@@ -11303,18 +11112,10 @@ const _sfc_main$4 = {
|
|
|
11303
11112
|
mouseTool.value.off("draw", handleDrawComplete);
|
|
11304
11113
|
mouseTool.value.close();
|
|
11305
11114
|
}
|
|
11306
|
-
if (
|
|
11307
|
-
|
|
11308
|
-
}
|
|
11309
|
-
if (polygonEditor.value) {
|
|
11310
|
-
polygonEditor.value.close();
|
|
11311
|
-
}
|
|
11312
|
-
if (bezierCurveEditor.value) {
|
|
11313
|
-
bezierCurveEditor.value.close();
|
|
11314
|
-
}
|
|
11315
|
-
if (circleEditor.value) {
|
|
11316
|
-
circleEditor.value.close();
|
|
11115
|
+
if (editor.value) {
|
|
11116
|
+
editor.value.close();
|
|
11317
11117
|
}
|
|
11118
|
+
document.removeEventListener("contextmenu", preventContextMenu);
|
|
11318
11119
|
if (map.value) {
|
|
11319
11120
|
map.value.clearMap();
|
|
11320
11121
|
map.value.off("rightclick", handleRightClick);
|
|
@@ -11332,25 +11133,11 @@ const _sfc_main$4 = {
|
|
|
11332
11133
|
};
|
|
11333
11134
|
return labels[type] || type;
|
|
11334
11135
|
};
|
|
11335
|
-
const getCountByType = (
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
return localMarkers.value.length;
|
|
11339
|
-
case "polyline":
|
|
11340
|
-
return localPolylines.value.length;
|
|
11341
|
-
case "polygon":
|
|
11342
|
-
return localPolygons.value.length;
|
|
11343
|
-
case "bezierCurve":
|
|
11344
|
-
return localBezierCurves.value.length;
|
|
11345
|
-
case "circle":
|
|
11346
|
-
return localCircles.value.length;
|
|
11347
|
-
default:
|
|
11348
|
-
return 0;
|
|
11349
|
-
}
|
|
11350
|
-
};
|
|
11351
|
-
const getTotalCount = () => {
|
|
11352
|
-
return localMarkers.value.length + localPolylines.value.length + localPolygons.value.length + localBezierCurves.value.length + localCircles.value.length;
|
|
11136
|
+
const getCountByType = (buttonType) => {
|
|
11137
|
+
const instanceType = BUTTON_TO_INSTANCE[buttonType];
|
|
11138
|
+
return instanceType ? LOCAL_ARRAYS[instanceType].value.length : 0;
|
|
11353
11139
|
};
|
|
11140
|
+
const getTotalCount = () => Object.values(LOCAL_ARRAYS).reduce((sum, arr) => sum + arr.value.length, 0);
|
|
11354
11141
|
const confirmDelete = async (type, target) => {
|
|
11355
11142
|
try {
|
|
11356
11143
|
let message = "";
|
|
@@ -11360,25 +11147,7 @@ const _sfc_main$4 = {
|
|
|
11360
11147
|
const typeName = getButtonLabel(target).replace("\u7ED8\u5236", "");
|
|
11361
11148
|
message = `\u786E\u5B9A\u8981\u5220\u9664\u6240\u6709${typeName}\u5417\uFF1F\u8FD9\u5C06\u6E05\u9664\u5730\u56FE\u4E0A\u7684\u6240\u6709 ${getCountByType(target)} \u4E2A${typeName}\u3002`;
|
|
11362
11149
|
} else if (type === "single") {
|
|
11363
|
-
|
|
11364
|
-
switch (target.type) {
|
|
11365
|
-
case "marker":
|
|
11366
|
-
typeName = "\u70B9";
|
|
11367
|
-
break;
|
|
11368
|
-
case "polyline":
|
|
11369
|
-
typeName = "\u6298\u7EBF";
|
|
11370
|
-
break;
|
|
11371
|
-
case "polygon":
|
|
11372
|
-
typeName = "\u591A\u8FB9\u5F62";
|
|
11373
|
-
break;
|
|
11374
|
-
case "bezierCurve":
|
|
11375
|
-
typeName = "\u66F2\u7EBF";
|
|
11376
|
-
break;
|
|
11377
|
-
case "circle":
|
|
11378
|
-
typeName = "\u5706\u5F62";
|
|
11379
|
-
break;
|
|
11380
|
-
}
|
|
11381
|
-
message = `\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u4E2A${typeName}\u5417\uFF1F`;
|
|
11150
|
+
message = `\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u4E2A${TYPE_NAMES[target.type]}\u5417\uFF1F`;
|
|
11382
11151
|
}
|
|
11383
11152
|
await ElMessageBox.confirm(message, "\u5220\u9664\u786E\u8BA4");
|
|
11384
11153
|
if (type === "all") {
|
|
@@ -11386,102 +11155,31 @@ const _sfc_main$4 = {
|
|
|
11386
11155
|
} else if (type === "type") {
|
|
11387
11156
|
deleteAllByType(target);
|
|
11388
11157
|
} else if (type === "single") {
|
|
11389
|
-
|
|
11390
|
-
case "marker":
|
|
11391
|
-
executeDeleteMarker(target.instance);
|
|
11392
|
-
break;
|
|
11393
|
-
case "polyline":
|
|
11394
|
-
executeDeletePolyline(target.instance);
|
|
11395
|
-
break;
|
|
11396
|
-
case "polygon":
|
|
11397
|
-
executeDeletePolygon(target.instance);
|
|
11398
|
-
break;
|
|
11399
|
-
case "bezierCurve":
|
|
11400
|
-
executeDeleteBezierCurve(target.instance);
|
|
11401
|
-
break;
|
|
11402
|
-
case "circle":
|
|
11403
|
-
executeDeleteCircle(target.instance);
|
|
11404
|
-
break;
|
|
11405
|
-
}
|
|
11158
|
+
executeDeleteSingle(target.type, target.instance);
|
|
11406
11159
|
}
|
|
11407
11160
|
props.immediateComplete && handleConfirm();
|
|
11408
11161
|
} catch (error) {
|
|
11409
11162
|
}
|
|
11410
11163
|
};
|
|
11164
|
+
const clearLocalByType = (instanceType) => {
|
|
11165
|
+
const arr = LOCAL_ARRAYS[instanceType];
|
|
11166
|
+
arr.value.forEach((item) => item.obj && item.obj.setMap(null));
|
|
11167
|
+
arr.value = [];
|
|
11168
|
+
};
|
|
11411
11169
|
const deleteAllOverlays = () => {
|
|
11412
11170
|
if (props.disabled)
|
|
11413
11171
|
return;
|
|
11414
11172
|
closeEditor();
|
|
11415
|
-
|
|
11416
|
-
deleteAllPolylines();
|
|
11417
|
-
deleteAllPolygons();
|
|
11418
|
-
deleteAllBezierCurves();
|
|
11419
|
-
deleteAllCircles();
|
|
11173
|
+
Object.keys(LOCAL_ARRAYS).forEach(clearLocalByType);
|
|
11420
11174
|
startDrawing(drawingType.value);
|
|
11421
11175
|
};
|
|
11422
|
-
const deleteAllByType = (
|
|
11176
|
+
const deleteAllByType = (buttonType) => {
|
|
11423
11177
|
if (props.disabled)
|
|
11424
11178
|
return;
|
|
11425
11179
|
closeEditor();
|
|
11426
|
-
|
|
11427
|
-
case "point":
|
|
11428
|
-
deleteAllMarkers();
|
|
11429
|
-
break;
|
|
11430
|
-
case "polyline":
|
|
11431
|
-
deleteAllPolylines();
|
|
11432
|
-
break;
|
|
11433
|
-
case "polygon":
|
|
11434
|
-
deleteAllPolygons();
|
|
11435
|
-
break;
|
|
11436
|
-
case "bezierCurve":
|
|
11437
|
-
deleteAllBezierCurves();
|
|
11438
|
-
break;
|
|
11439
|
-
case "circle":
|
|
11440
|
-
deleteAllCircles();
|
|
11441
|
-
break;
|
|
11442
|
-
}
|
|
11180
|
+
clearLocalByType(BUTTON_TO_INSTANCE[buttonType]);
|
|
11443
11181
|
startDrawing(drawingType.value);
|
|
11444
11182
|
};
|
|
11445
|
-
const deleteAllMarkers = () => {
|
|
11446
|
-
if (props.disabled)
|
|
11447
|
-
return;
|
|
11448
|
-
localMarkers.value.forEach((marker) => {
|
|
11449
|
-
marker.obj.setMap(null);
|
|
11450
|
-
});
|
|
11451
|
-
localMarkers.value = [];
|
|
11452
|
-
};
|
|
11453
|
-
const deleteAllPolylines = () => {
|
|
11454
|
-
if (props.disabled)
|
|
11455
|
-
return;
|
|
11456
|
-
localPolylines.value.forEach((polyline) => {
|
|
11457
|
-
polyline.obj.setMap(null);
|
|
11458
|
-
});
|
|
11459
|
-
localPolylines.value = [];
|
|
11460
|
-
};
|
|
11461
|
-
const deleteAllPolygons = () => {
|
|
11462
|
-
if (props.disabled)
|
|
11463
|
-
return;
|
|
11464
|
-
localPolygons.value.forEach((polygon) => {
|
|
11465
|
-
polygon.obj.setMap(null);
|
|
11466
|
-
});
|
|
11467
|
-
localPolygons.value = [];
|
|
11468
|
-
};
|
|
11469
|
-
const deleteAllBezierCurves = () => {
|
|
11470
|
-
if (props.disabled)
|
|
11471
|
-
return;
|
|
11472
|
-
localBezierCurves.value.forEach((bezierCurve) => {
|
|
11473
|
-
bezierCurve.obj.setMap(null);
|
|
11474
|
-
});
|
|
11475
|
-
localBezierCurves.value = [];
|
|
11476
|
-
};
|
|
11477
|
-
const deleteAllCircles = () => {
|
|
11478
|
-
if (props.disabled)
|
|
11479
|
-
return;
|
|
11480
|
-
localCircles.value.forEach((circle) => {
|
|
11481
|
-
circle.obj.setMap(null);
|
|
11482
|
-
});
|
|
11483
|
-
localCircles.value = [];
|
|
11484
|
-
};
|
|
11485
11183
|
const searchPlace = (queryString, callback) => {
|
|
11486
11184
|
if (queryString.length === 0) {
|
|
11487
11185
|
callback([]);
|
|
@@ -11510,9 +11208,7 @@ const _sfc_main$4 = {
|
|
|
11510
11208
|
return validateCoordinates(arr[0], arr[1]);
|
|
11511
11209
|
};
|
|
11512
11210
|
const handleLngLatSelect = (lngLat) => {
|
|
11513
|
-
|
|
11514
|
-
console.log("res---------", res);
|
|
11515
|
-
if (!res) {
|
|
11211
|
+
if (!checkLngLat(lngLat)) {
|
|
11516
11212
|
ElMessage.error("\u7ECF\u7EAC\u5EA6\u683C\u5F0F\u9519\u8BEF,\u8BF7\u8F93\u5165\u5982\uFF1A103.98673,30.584973 \u683C\u5F0F,\u5C0F\u6570\u4F4D\u6570\u4E0D\u8D85\u8FC715\u4F4D");
|
|
11517
11213
|
return;
|
|
11518
11214
|
}
|
|
@@ -11777,7 +11473,7 @@ const _sfc_main$4 = {
|
|
|
11777
11473
|
};
|
|
11778
11474
|
}
|
|
11779
11475
|
};
|
|
11780
|
-
const SCTJMapDrawing = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
11476
|
+
const SCTJMapDrawing = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a7875dcf"]]);
|
|
11781
11477
|
const BimViewer_vue_vue_type_style_index_0_scoped_5d1b1a03_lang = "";
|
|
11782
11478
|
const _withScopeId$2 = (n) => (pushScopeId("data-v-5d1b1a03"), n = n(), popScopeId(), n);
|
|
11783
11479
|
const _hoisted_1$2 = {
|