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