hy-dispatch-ui-v3 0.2.83 → 0.2.85
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/dist/tailwind.css +54 -0
- package/es/bussiness/hyDeviceTree/deviceTree.vue.mjs +5 -0
- package/es/bussiness/hyDeviceTree/js/index.mjs +15 -5
- package/es/bussiness/hySelectDeviceTree/cpns/deviceItem.install.mjs +6 -0
- package/es/bussiness/hySelectDeviceTree/cpns/deviceItem.vue.mjs +113 -0
- package/es/bussiness/hySelectDeviceTree/index.mjs +7 -0
- package/es/bussiness/hySelectDeviceTree/js/index.mjs +35 -0
- package/es/bussiness/hySelectDeviceTree/selectDeviceTree.install.mjs +6 -0
- package/es/bussiness/hySelectDeviceTree/selectDeviceTree.vue.mjs +163 -0
- package/es/bussiness/hySelectDeviceTree/style/selectDeviceTree.scss +0 -0
- package/es/bussiness/index.mjs +1 -0
- package/es/components/hyForm/cpns/formItem.vue.mjs +493 -426
- package/es/components/hyForm/form.vue.mjs +12 -0
- package/es/components/hyIcon/icon.vue.mjs +10 -4
- package/es/components/hyMap/js/index.mjs +1 -0
- package/es/components-map.mjs +1 -0
- package/es/index.mjs +2 -0
- package/es/utils/device.mjs +42 -0
- package/es/utils/index.mjs +1 -0
- package/es/utils/map/hook/bigMap.mjs +103 -124
- package/es/utils/map/hook/gaode.mjs +3 -0
- package/es/utils/map/hook/leafletjs.mjs +78 -113
- package/es/utils/map/index.mjs +4 -4
- package/es/utils/map/js/mapProxy.mjs +24 -5
- package/es/version.mjs +1 -1
- package/lib/bussiness/hyDeviceTree/deviceTree.vue.js +5 -0
- package/lib/bussiness/hyDeviceTree/js/index.js +15 -5
- package/lib/bussiness/hySelectDeviceTree/cpns/deviceItem.install.js +6 -0
- package/lib/bussiness/hySelectDeviceTree/cpns/deviceItem.vue.js +117 -0
- package/lib/bussiness/hySelectDeviceTree/index.js +12 -0
- package/lib/bussiness/hySelectDeviceTree/js/index.js +37 -0
- package/lib/bussiness/hySelectDeviceTree/selectDeviceTree.install.js +6 -0
- package/lib/bussiness/hySelectDeviceTree/selectDeviceTree.vue.js +167 -0
- package/lib/bussiness/hySelectDeviceTree/style/selectDeviceTree.scss +0 -0
- package/lib/bussiness/index.js +4 -2
- package/lib/components/hyForm/cpns/formItem.vue.js +492 -425
- package/lib/components/hyForm/form.vue.js +12 -0
- package/lib/components/hyIcon/icon.vue.js +10 -4
- package/lib/components/hyMap/js/index.js +1 -0
- package/lib/components-map.js +1 -0
- package/lib/index.js +24 -20
- package/lib/utils/device.js +44 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/map/hook/bigMap.js +102 -123
- package/lib/utils/map/hook/gaode.js +3 -0
- package/lib/utils/map/hook/leafletjs.js +77 -112
- package/lib/utils/map/index.js +4 -4
- package/lib/utils/map/js/mapProxy.js +24 -4
- package/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -59,6 +59,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
59
59
|
type: String,
|
|
60
60
|
default: "default"
|
|
61
61
|
// default-默认 tableForm-表格表单
|
|
62
|
+
},
|
|
63
|
+
labelPosition: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "top"
|
|
66
|
+
},
|
|
67
|
+
labelWidth: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: ""
|
|
62
70
|
}
|
|
63
71
|
},
|
|
64
72
|
emits: ["on-allMapSelect", "complete", "optionsStatus"],
|
|
@@ -86,6 +94,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
86
94
|
const isTableForm = computed(() => props.business === "tableForm");
|
|
87
95
|
const locationSelectRef = useTemplateRef("locationSelectRef");
|
|
88
96
|
const allMapSelect = ref(false);
|
|
97
|
+
const labelPosition = computed(() => {
|
|
98
|
+
return ["left", "right", "top"].includes(props.labelPosition) ? props.labelPosition : "top";
|
|
99
|
+
});
|
|
89
100
|
function setMapSize() {
|
|
90
101
|
allMapSelect.value = !allMapSelect.value;
|
|
91
102
|
emits("on-allMapSelect", allMapSelect.value);
|
|
@@ -131,6 +142,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
131
142
|
formContextKey,
|
|
132
143
|
reactive({
|
|
133
144
|
...toRefs(props),
|
|
145
|
+
labelPosition,
|
|
134
146
|
emits,
|
|
135
147
|
addField,
|
|
136
148
|
removeField,
|
|
@@ -21,14 +21,20 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
21
21
|
className: {
|
|
22
22
|
type: String,
|
|
23
23
|
default: ""
|
|
24
|
+
},
|
|
25
|
+
ensureHyIcon: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default: () => {
|
|
28
|
+
const { ensureHyIcon } = useEnsureHyIcon();
|
|
29
|
+
return ensureHyIcon;
|
|
30
|
+
}
|
|
24
31
|
}
|
|
25
32
|
},
|
|
26
33
|
setup(__props) {
|
|
27
34
|
const props = __props;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
watch(() => props.svgName, ensureHyIcon);
|
|
35
|
+
if (props.ensureHyIcon) {
|
|
36
|
+
onMounted(() => props.ensureHyIcon(props.svgName));
|
|
37
|
+
watch(() => props.svgName, props.ensureHyIcon);
|
|
32
38
|
}
|
|
33
39
|
const iconName = computed(() => `#${props.prefix}${props.svgName}`);
|
|
34
40
|
const svgClass = computed(() => {
|
|
@@ -143,6 +143,7 @@ const useAppMapWrapper = (hy) => {
|
|
|
143
143
|
maxZoom: mapConfig.maxZoom || 18,
|
|
144
144
|
center: { lat: userInfo?.lat || 22.553681, lng: userInfo?.lng || 113.931936 },
|
|
145
145
|
zoom: mapConfig.zoom || 14,
|
|
146
|
+
satelliteMap: mapConfig.satelliteMap,
|
|
146
147
|
completeCallbacks: () => {
|
|
147
148
|
nextTick(() => {
|
|
148
149
|
emits("complete", hy.hyMap.value, hy.map.value);
|
package/es/components-map.mjs
CHANGED
|
@@ -17,5 +17,6 @@ export default {
|
|
|
17
17
|
HyRuleFenceDialog: () => import('hy-dispatch-ui-v3/es/bussiness/hyRuleSetting/cpns/ruleFenceDialog/ruleFenceDialog'),
|
|
18
18
|
HyRuleSettingDialog: () => import('hy-dispatch-ui-v3/es/bussiness/hyRuleSetting/cpns/ruleSettingDialog/ruleSettingDialog'),
|
|
19
19
|
HySetRuleAggregationAlarmDialog: () => import('hy-dispatch-ui-v3/es/bussiness/hyRuleSetting/cpns/setRuleAggregationAlarmDialog/setRuleAggregationAlarmDialog'),
|
|
20
|
+
HySelectDeviceTree: () => import('hy-dispatch-ui-v3/es/bussiness/hySelectDeviceTree/selectDeviceTree'),
|
|
20
21
|
HyUserTree: () => import('hy-dispatch-ui-v3/es/bussiness/hyUserTree/userTree'),
|
|
21
22
|
}
|
package/es/index.mjs
CHANGED
|
@@ -41,6 +41,7 @@ export { HyPlanGroupDeviceTree } from './bussiness/hyPlanGroupDeviceTree/index.m
|
|
|
41
41
|
export { HyRadioGroup } from './components/hyRadioGroup/index.mjs';
|
|
42
42
|
export { HyRuleAssignDialog, HyRuleFenceDialog, HyRuleSetting, HyRuleSettingDialog, HySetRuleAggregationAlarmDialog } from './bussiness/hyRuleSetting/index.mjs';
|
|
43
43
|
export { HySearch } from './components/hySearch/index.mjs';
|
|
44
|
+
export { HySelectDeviceTree } from './bussiness/hySelectDeviceTree/index.mjs';
|
|
44
45
|
export { HyStatus } from './components/hyStatus/index.mjs';
|
|
45
46
|
export { HyTable } from './components/hyTable/index.mjs';
|
|
46
47
|
export { HyTableActionButton } from './components/hyTableActionButton/index.mjs';
|
|
@@ -62,6 +63,7 @@ export { defaultAxios, localApiKey, useApi } from './hooks/useApi.mjs';
|
|
|
62
63
|
export { enterNumbersRrLetters, enterTheMumber, filterSpaces, formatTimeFn, getPublicFileSize, inputForbidden, keepTwoDecimalPlaces, onlyNumber } from './utils/input.mjs';
|
|
63
64
|
export { formatDay, formatHoursToHM, formatSeconds, formatTime, getBeforeDays, getCurDtm, getNextDays, getToday } from './utils/timeUtils.mjs';
|
|
64
65
|
export { formatDuration, getDefaultValueFormatByType } from './utils/date.mjs';
|
|
66
|
+
export { getDeviceTypeIcon } from './utils/device.mjs';
|
|
65
67
|
export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isObject, isOverflowing, isPermission, isString, isSupportH265, isSymbol, isUndefined, isVueProxy } from './utils/is.mjs';
|
|
66
68
|
export { loadingSvg } from './utils/sharedContent.mjs';
|
|
67
69
|
export { localAudioPlayerConfigKey, useAudioPlayerConfig } from './hooks/useAudioPlayerConfig.mjs';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import '../hooks/index.mjs';
|
|
2
|
+
import { useBaseMainStore } from '../hooks/useBaseMainStore.mjs';
|
|
3
|
+
|
|
4
|
+
function getDeviceTypeIcon(device = {}, onlineState) {
|
|
5
|
+
const { baseMainStore } = useBaseMainStore();
|
|
6
|
+
const key = baseMainStore.value.getters.getDeviceTypeIcon(device, onlineState);
|
|
7
|
+
const deviceTypeV3Json = {
|
|
8
|
+
"tree-icon-law-enforcement-2": "dispatch-share-v3-sip-law-enforcement",
|
|
9
|
+
"tree-icon-dispatching-desk-2": "map-tree-dispatching-desk",
|
|
10
|
+
"tree-icon-duty-desk-2": "map-tree-duty-desk",
|
|
11
|
+
"tree-icon-phone-2": "map-tree-phone",
|
|
12
|
+
"tree-icon-control-the-ball-2": "map-tree-control-the-ball",
|
|
13
|
+
"tree-icon-ipc-2": "map-tree-ipc",
|
|
14
|
+
"tree-icon-safety-hat-2": "map-tree-safety-hat",
|
|
15
|
+
"tree-icon-flashlight-2": "map-tree-flashlight",
|
|
16
|
+
"tree-icon-work-card-2": "map-marker-marker-device-v2",
|
|
17
|
+
"tree-icon-vehicle-2": "map-tree-vehicle",
|
|
18
|
+
"tree-icon-uav-2": "map-tree-uav",
|
|
19
|
+
"tree-icon-obd-2": "map-tree-obd",
|
|
20
|
+
"tree-icon-walkie-talkie-2": "map-tree-walkie-talkie",
|
|
21
|
+
"tree-icon-law-enforcement-3": "map-tree-law-enforcement-v2",
|
|
22
|
+
"tree-icon-smartwatch": "map-tree-smartwatch",
|
|
23
|
+
"tree-icon-law-enforcement-off-line-2": "lawEnforcement_offLine",
|
|
24
|
+
"tree-icon-dispatching-desk-off-line-2": "dispatchingDesk_offLine",
|
|
25
|
+
"tree-icon-duty-desk-offline": "dutyDesk_offLine",
|
|
26
|
+
"tree-icon-phone-off-line-2": "phone_offLine",
|
|
27
|
+
"tree-icon-control-the-ball-off-line-2": "controlTheBall_offLine",
|
|
28
|
+
"tree-icon-safety-hat-off-line-2": "safetyHat_offLine",
|
|
29
|
+
"tree-icon-flashlight-off-line-2": "flashlight_offLine",
|
|
30
|
+
"tree-icon-work-card-off-line-2": "workCard_offLine",
|
|
31
|
+
"tree-icon-vehicle-off-line-2": "vehicle_offLine",
|
|
32
|
+
"tree-icon-uav-off-line-2": "uav_offLine",
|
|
33
|
+
"tree-icon-ipc-off-line-2": "ipc_offLine",
|
|
34
|
+
"tree-icon-obd-off-line-2": "obd_offLine",
|
|
35
|
+
"tree-icon-law-enforcement-3-off-line": "lawEnforcementV2_offLine",
|
|
36
|
+
"tree-icon-smartwatch-off-line": "smartwatch_offLine",
|
|
37
|
+
"tree-icon-walkie-talkie-off-line-2": "walkieTalkie_offLine"
|
|
38
|
+
};
|
|
39
|
+
return deviceTypeV3Json[`${key}`] || key;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { getDeviceTypeIcon };
|
package/es/utils/index.mjs
CHANGED
|
@@ -11,4 +11,5 @@ export { InitMap, setMapServer, setPoiServer } from './map/index.mjs';
|
|
|
11
11
|
import './tree.mjs';
|
|
12
12
|
export { loadingSvg } from './sharedContent.mjs';
|
|
13
13
|
export { formatDay, formatHoursToHM, formatSeconds, formatTime, getBeforeDays, getCurDtm, getNextDays, getToday } from './timeUtils.mjs';
|
|
14
|
+
export { getDeviceTypeIcon } from './device.mjs';
|
|
14
15
|
export { setGlobalTreeConfig } from 'hy-virtual-tree';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import L from 'leaflet';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { importCoordinate, exportCoordinate } from '../js/webgis.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { createWrappedHandlerStore, createNativeMapProxy } from '../js/mapProxy.mjs';
|
|
5
5
|
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -49,53 +49,17 @@ function circleToPolygonPoints(center, radius, asObject = false) {
|
|
|
49
49
|
}
|
|
50
50
|
const generalMapMethods = {
|
|
51
51
|
// 导入到地图里面
|
|
52
|
-
getBounds: function(target) {
|
|
53
|
-
const bounds = target.getBounds();
|
|
54
|
-
|
|
55
|
-
let northEast = bounds.getNorthEast();
|
|
56
|
-
let center = bounds.getCenter();
|
|
57
|
-
bounds.getSouthWest = function() {
|
|
58
|
-
const { lat, lng } = latAndLngCheck(southWest);
|
|
59
|
-
return { lat, lng };
|
|
60
|
-
};
|
|
61
|
-
bounds.getNorthEast = function() {
|
|
62
|
-
const { lat, lng } = latAndLngCheck(northEast);
|
|
63
|
-
return { lat, lng };
|
|
64
|
-
};
|
|
65
|
-
bounds.getCenter = function() {
|
|
66
|
-
const { lat, lng } = latAndLngCheck(center);
|
|
67
|
-
return { lat, lng };
|
|
68
|
-
};
|
|
69
|
-
return bounds;
|
|
52
|
+
getBounds: function(target, BM2) {
|
|
53
|
+
const bounds = target.getBounds ? target.getBounds() : target;
|
|
54
|
+
return BM2.latLngBounds(latAndLngCheck(bounds.getSouthWest()), latAndLngCheck(bounds.getNorthEast()));
|
|
70
55
|
},
|
|
71
56
|
getMap: function(map) {
|
|
72
|
-
return
|
|
73
|
-
getCenter: function(target) {
|
|
74
|
-
const center = target.getCenter();
|
|
75
|
-
const { lng, lat } = latAndLngCheck(center);
|
|
76
|
-
return { lat, lng };
|
|
77
|
-
}
|
|
78
|
-
});
|
|
57
|
+
return map.getRawMap ? map.getRawMap() : map;
|
|
79
58
|
},
|
|
80
59
|
// 导出到外面
|
|
81
|
-
getBoundsExport: function(target) {
|
|
60
|
+
getBoundsExport: function(target, BM2) {
|
|
82
61
|
const bounds = target.getBounds();
|
|
83
|
-
|
|
84
|
-
let northEast = bounds.getNorthEast();
|
|
85
|
-
let center = bounds.getCenter();
|
|
86
|
-
bounds.getSouthWest = function() {
|
|
87
|
-
const { lat, lng } = latAndLngCheckExport(southWest);
|
|
88
|
-
return { lat, lng };
|
|
89
|
-
};
|
|
90
|
-
bounds.getNorthEast = function() {
|
|
91
|
-
const { lat, lng } = latAndLngCheckExport(northEast);
|
|
92
|
-
return { lat, lng };
|
|
93
|
-
};
|
|
94
|
-
bounds.getCenter = function() {
|
|
95
|
-
const { lat, lng } = latAndLngCheckExport(center);
|
|
96
|
-
return { lat, lng };
|
|
97
|
-
};
|
|
98
|
-
return bounds;
|
|
62
|
+
return BM2.latLngBounds(latAndLngCheckExport(bounds.getSouthWest()), latAndLngCheckExport(bounds.getNorthEast()));
|
|
99
63
|
}
|
|
100
64
|
};
|
|
101
65
|
function latAndLngCheck(item) {
|
|
@@ -131,6 +95,10 @@ function latLngListCheck(dataList = []) {
|
|
|
131
95
|
for (let i = 0; i < dataList.length; i++) {
|
|
132
96
|
const item = dataList[i];
|
|
133
97
|
const type = Array.isArray(item);
|
|
98
|
+
if (type && (item.length === 0 || typeof item[0] === "object")) {
|
|
99
|
+
newDataList.push(latLngListCheck(item));
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
134
102
|
let { lat, lng } = latAndLngCheck(item);
|
|
135
103
|
if (type) {
|
|
136
104
|
newDataList.push([lat, lng]);
|
|
@@ -149,6 +117,10 @@ function latLngListCheckExport(dataList = []) {
|
|
|
149
117
|
for (let i = 0; i < dataList.length; i++) {
|
|
150
118
|
const item = dataList[i];
|
|
151
119
|
const type = Array.isArray(item);
|
|
120
|
+
if (type && (item.length === 0 || typeof item[0] === "object")) {
|
|
121
|
+
newDataList.push(latLngListCheckExport(item));
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
152
124
|
let { lat, lng } = latAndLngCheckExport(item);
|
|
153
125
|
if (type) {
|
|
154
126
|
newDataList.push([lat, lng]);
|
|
@@ -167,10 +139,11 @@ class bigMap extends EventEmitter {
|
|
|
167
139
|
super();
|
|
168
140
|
// 绘画多边形覆盖物
|
|
169
141
|
__publicField(this, "Polygon", (pathList = [], option) => {
|
|
142
|
+
const BM2 = this.BM;
|
|
170
143
|
if (pathList && pathList.length !== 0) {
|
|
171
144
|
pathList = latLngListCheck(pathList);
|
|
172
145
|
}
|
|
173
|
-
const polygon = new this.BM.Polygon(
|
|
146
|
+
const polygon = new this.BM.Polygon(pathList, option);
|
|
174
147
|
const wrappedHandlers = createWrappedHandlerStore();
|
|
175
148
|
const handlers = {
|
|
176
149
|
addTo: function(target, map) {
|
|
@@ -178,12 +151,16 @@ class bigMap extends EventEmitter {
|
|
|
178
151
|
},
|
|
179
152
|
// 修改位置
|
|
180
153
|
getBounds: function(target) {
|
|
181
|
-
return generalMapMethods.getBoundsExport(target);
|
|
154
|
+
return generalMapMethods.getBoundsExport(target, BM2);
|
|
182
155
|
},
|
|
183
156
|
getLatLngs: function(target) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
157
|
+
return latLngListCheckExport(target.getLatLngs());
|
|
158
|
+
},
|
|
159
|
+
setLatLngs: function(target, points) {
|
|
160
|
+
return target.setLatLngs(latLngListCheck(points));
|
|
161
|
+
},
|
|
162
|
+
addLatLng: function(target, point) {
|
|
163
|
+
return target.addLatLng(latAndLngCheck(point));
|
|
187
164
|
},
|
|
188
165
|
on: function(target, types, fn, context) {
|
|
189
166
|
if (types === "click") {
|
|
@@ -203,13 +180,14 @@ class bigMap extends EventEmitter {
|
|
|
203
180
|
return target.off(types, wrappedFn || fn, context);
|
|
204
181
|
}
|
|
205
182
|
};
|
|
206
|
-
return
|
|
183
|
+
return createNativeMapProxy(polygon, handlers);
|
|
207
184
|
});
|
|
208
185
|
this.initParams = request;
|
|
209
186
|
}
|
|
210
187
|
// 初始化地图
|
|
211
188
|
InitMap(domId, option) {
|
|
212
189
|
this.BM = this.initParams.BM;
|
|
190
|
+
const BM2 = this.BM;
|
|
213
191
|
this.BM.Config.HTTP_URL = this.initParams.bmHttpsUrl;
|
|
214
192
|
this.BM.Config.HTTPS_URL = this.initParams.bmHttpsUrl;
|
|
215
193
|
const { center } = option;
|
|
@@ -246,16 +224,22 @@ class bigMap extends EventEmitter {
|
|
|
246
224
|
target.off();
|
|
247
225
|
}
|
|
248
226
|
},
|
|
249
|
-
fitBounds: function(target, params) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
227
|
+
fitBounds: function(target, params, options) {
|
|
228
|
+
const bounds = BM2.latLngBounds();
|
|
229
|
+
const extend = (item) => {
|
|
230
|
+
if (item?.getBounds) {
|
|
231
|
+
const layer = item.getInitLayer ? item.getInitLayer() : item;
|
|
232
|
+
bounds.extend(layer.getBounds());
|
|
233
|
+
} else if (item?.getSouthWest) {
|
|
234
|
+
bounds.extend(generalMapMethods.getBounds(item, BM2));
|
|
235
|
+
} else if (Array.isArray(item) && (item.length === 0 || typeof item[0] === "object")) {
|
|
236
|
+
item.forEach(extend);
|
|
237
|
+
} else {
|
|
238
|
+
bounds.extend(latAndLngCheck(item));
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
extend(params);
|
|
242
|
+
return target.fitBounds(bounds, options);
|
|
259
243
|
},
|
|
260
244
|
// 获取中心点
|
|
261
245
|
getCenter: function(target) {
|
|
@@ -268,16 +252,7 @@ class bigMap extends EventEmitter {
|
|
|
268
252
|
},
|
|
269
253
|
// 四个角
|
|
270
254
|
getBounds: function(target) {
|
|
271
|
-
|
|
272
|
-
let southWest = bounds.getSouthWest();
|
|
273
|
-
let northEast = bounds.getNorthEast();
|
|
274
|
-
bounds.getSouthWest = function() {
|
|
275
|
-
return latAndLngCheckExport(southWest);
|
|
276
|
-
};
|
|
277
|
-
bounds.getNorthEast = function() {
|
|
278
|
-
return latAndLngCheckExport(northEast);
|
|
279
|
-
};
|
|
280
|
-
return bounds;
|
|
255
|
+
return generalMapMethods.getBoundsExport(target, BM2);
|
|
281
256
|
},
|
|
282
257
|
// 移动至目标位置
|
|
283
258
|
panTo: function(target, center2, options) {
|
|
@@ -302,31 +277,12 @@ class bigMap extends EventEmitter {
|
|
|
302
277
|
} else if (types === "pm:create") {
|
|
303
278
|
const customClickHandler = (e) => {
|
|
304
279
|
const newEvent = { ...e };
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
};
|
|
312
|
-
} else {
|
|
313
|
-
const latLngList = newEvent.layer.getLatLngs();
|
|
314
|
-
newEvent.layer.getLatLngs = () => {
|
|
315
|
-
const item = JSON.parse(JSON.stringify(latLngList[0]));
|
|
316
|
-
return [latLngListCheckExport([...item])];
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
newEvent.layer.getBounds = () => {
|
|
320
|
-
let southWest = bounds.getSouthWest();
|
|
321
|
-
let northEast = bounds.getNorthEast();
|
|
322
|
-
bounds.getSouthWest = function() {
|
|
323
|
-
return latAndLngCheckExport(southWest);
|
|
324
|
-
};
|
|
325
|
-
bounds.getNorthEast = function() {
|
|
326
|
-
return latAndLngCheckExport(northEast);
|
|
327
|
-
};
|
|
328
|
-
return bounds;
|
|
329
|
-
};
|
|
280
|
+
newEvent.layer = createNativeMapProxy(e.layer, {
|
|
281
|
+
getLatLngs: (layer) => latLngListCheckExport(
|
|
282
|
+
layer.getLatLngs ? layer.getLatLngs() : [circleToPolygonPoints(layer.getLatLng(), layer.getRadius() / 1e3, true)]
|
|
283
|
+
),
|
|
284
|
+
getBounds: (layer) => generalMapMethods.getBoundsExport(layer, BM2)
|
|
285
|
+
});
|
|
330
286
|
fn.call(context || target, newEvent);
|
|
331
287
|
};
|
|
332
288
|
wrappedHandlers.remember(types, fn, customClickHandler);
|
|
@@ -341,21 +297,23 @@ class bigMap extends EventEmitter {
|
|
|
341
297
|
satelliteMapFn: function() {
|
|
342
298
|
}
|
|
343
299
|
};
|
|
344
|
-
return
|
|
300
|
+
return createNativeMapProxy(newMap, handlers);
|
|
345
301
|
}
|
|
346
302
|
// 地图图层
|
|
347
303
|
layerGroup(map, markers = []) {
|
|
348
|
-
const layerGroup = this.BM.layerGroup(
|
|
349
|
-
|
|
304
|
+
const layerGroup = this.BM.layerGroup(
|
|
305
|
+
markers.map((marker) => marker.getInitLayer ? marker.getInitLayer() : marker)
|
|
306
|
+
);
|
|
307
|
+
layerGroup.addTo(generalMapMethods.getMap(map));
|
|
350
308
|
const handlers = {
|
|
351
309
|
addLayer: function(target, addItem) {
|
|
352
|
-
return target.addLayer(addItem);
|
|
310
|
+
return target.addLayer(addItem.getInitLayer ? addItem.getInitLayer() : addItem);
|
|
353
311
|
},
|
|
354
312
|
clearLayers: function(target) {
|
|
355
313
|
return target.clearLayers();
|
|
356
314
|
}
|
|
357
315
|
};
|
|
358
|
-
return
|
|
316
|
+
return createNativeMapProxy(layerGroup, handlers);
|
|
359
317
|
}
|
|
360
318
|
// 自定义图标
|
|
361
319
|
DivIcon(option) {
|
|
@@ -396,7 +354,7 @@ class bigMap extends EventEmitter {
|
|
|
396
354
|
// 更改标记位置。
|
|
397
355
|
setLatLng: function(target, lngAndLat) {
|
|
398
356
|
const { lat, lng } = latAndLngCheck(lngAndLat);
|
|
399
|
-
target.setLatLng([lat, lng]);
|
|
357
|
+
return target.setLatLng([lat, lng]);
|
|
400
358
|
},
|
|
401
359
|
// 更改标记图标。
|
|
402
360
|
setIcon: function(target, iconParams) {
|
|
@@ -420,7 +378,7 @@ class bigMap extends EventEmitter {
|
|
|
420
378
|
return target.off(types, wrappedFn || fn, context);
|
|
421
379
|
}
|
|
422
380
|
};
|
|
423
|
-
return
|
|
381
|
+
return createNativeMapProxy(marker, handlers);
|
|
424
382
|
}
|
|
425
383
|
// 生成 聚合点
|
|
426
384
|
MarkerClusterGroup(map, markerList, option) {
|
|
@@ -436,7 +394,7 @@ class bigMap extends EventEmitter {
|
|
|
436
394
|
maxClusterRadius: option.maxClusterRadius
|
|
437
395
|
};
|
|
438
396
|
const displayCluster = new this.BM.MarkerClusterGroup(option);
|
|
439
|
-
map.addLayer(displayCluster);
|
|
397
|
+
generalMapMethods.getMap(map).addLayer(displayCluster);
|
|
440
398
|
const toNativeMarkers = (list = []) => {
|
|
441
399
|
const markers = Array.isArray(list) ? list : [list];
|
|
442
400
|
return markers.map((marker) => marker?.getInitMarker ? marker.getInitMarker() : marker).filter(Boolean);
|
|
@@ -448,16 +406,20 @@ class bigMap extends EventEmitter {
|
|
|
448
406
|
removeLayers: function(target, markerList2 = []) {
|
|
449
407
|
target.removeLayers(toNativeMarkers(markerList2));
|
|
450
408
|
},
|
|
409
|
+
clearLayers: function(target) {
|
|
410
|
+
target.clearLayers();
|
|
411
|
+
},
|
|
451
412
|
addLayers: function(target, markerList2 = []) {
|
|
452
413
|
target.addLayers(toNativeMarkers(markerList2));
|
|
453
414
|
}
|
|
454
415
|
};
|
|
455
|
-
const newDisplayCluster =
|
|
416
|
+
const newDisplayCluster = createNativeMapProxy(displayCluster, handlers);
|
|
456
417
|
newDisplayCluster.addLayers(markerList);
|
|
457
418
|
return newDisplayCluster;
|
|
458
419
|
}
|
|
459
420
|
// 绘画圆
|
|
460
421
|
Circle(latLngList = {}, option = {}) {
|
|
422
|
+
const BM2 = this.BM;
|
|
461
423
|
option = {
|
|
462
424
|
...option,
|
|
463
425
|
radius: option.radius,
|
|
@@ -471,13 +433,19 @@ class bigMap extends EventEmitter {
|
|
|
471
433
|
latLngList = [lat, lng];
|
|
472
434
|
const circle = new this.BM.Circle(latLngList, option);
|
|
473
435
|
const handlers = {
|
|
436
|
+
getLatLng: function(target) {
|
|
437
|
+
return latAndLngCheckExport(target.getLatLng());
|
|
438
|
+
},
|
|
439
|
+
setLatLng: function(target, center) {
|
|
440
|
+
return target.setLatLng(latAndLngCheck(center));
|
|
441
|
+
},
|
|
474
442
|
// 添加到地图
|
|
475
443
|
addTo: function(target, map) {
|
|
476
444
|
return target.addTo(generalMapMethods.getMap(map));
|
|
477
445
|
},
|
|
478
446
|
// 修改位置
|
|
479
447
|
getBounds: function(target) {
|
|
480
|
-
return generalMapMethods.getBoundsExport(target);
|
|
448
|
+
return generalMapMethods.getBoundsExport(target, BM2);
|
|
481
449
|
},
|
|
482
450
|
// 圆形转多边形坐标
|
|
483
451
|
getLatLngs: function(target) {
|
|
@@ -485,22 +453,27 @@ class bigMap extends EventEmitter {
|
|
|
485
453
|
return [latLngListCheckExport(points)];
|
|
486
454
|
}
|
|
487
455
|
};
|
|
488
|
-
return
|
|
456
|
+
return createNativeMapProxy(circle, handlers);
|
|
489
457
|
}
|
|
490
458
|
// 自定义 popup
|
|
491
459
|
Popup(option) {
|
|
460
|
+
const BM2 = this.BM;
|
|
492
461
|
option = {
|
|
493
462
|
closeButton: false,
|
|
494
463
|
...option
|
|
495
464
|
};
|
|
496
465
|
const popup = new this.BM.Popup(option);
|
|
497
466
|
const handlers = {
|
|
467
|
+
getLatLng: function(target) {
|
|
468
|
+
const point = target.getLatLng();
|
|
469
|
+
return point ? latAndLngCheckExport(point) : point;
|
|
470
|
+
},
|
|
498
471
|
addTo: function(target, map) {
|
|
499
472
|
return target.addTo(generalMapMethods.getMap(map));
|
|
500
473
|
},
|
|
501
474
|
// 修改位置
|
|
502
475
|
getBounds: function(target) {
|
|
503
|
-
return generalMapMethods.getBoundsExport(target);
|
|
476
|
+
return generalMapMethods.getBoundsExport(target, BM2);
|
|
504
477
|
},
|
|
505
478
|
// 修改位置
|
|
506
479
|
setLatLng: function(target, latLngList) {
|
|
@@ -510,22 +483,32 @@ class bigMap extends EventEmitter {
|
|
|
510
483
|
return target.setLatLng(latLngList);
|
|
511
484
|
}
|
|
512
485
|
};
|
|
513
|
-
return
|
|
486
|
+
return createNativeMapProxy(popup, handlers);
|
|
514
487
|
}
|
|
515
488
|
// 自定义 线条
|
|
516
489
|
Polyline(latLngList = [], option = {}) {
|
|
490
|
+
const BM2 = this.BM;
|
|
517
491
|
if (latLngList && latLngList.length !== 0) {
|
|
518
492
|
latLngList = latLngListCheck(latLngList);
|
|
519
493
|
}
|
|
520
494
|
const polyline = this.BM.polyline(latLngList, option);
|
|
521
495
|
const wrappedHandlers = createWrappedHandlerStore();
|
|
522
496
|
const handlers = {
|
|
497
|
+
getLatLngs: function(target) {
|
|
498
|
+
return latLngListCheckExport(target.getLatLngs());
|
|
499
|
+
},
|
|
500
|
+
setLatLngs: function(target, points) {
|
|
501
|
+
return target.setLatLngs(latLngListCheck(points));
|
|
502
|
+
},
|
|
503
|
+
addLatLng: function(target, point) {
|
|
504
|
+
return target.addLatLng(latAndLngCheck(point));
|
|
505
|
+
},
|
|
523
506
|
addTo: function(target, map) {
|
|
524
507
|
return target.addTo(generalMapMethods.getMap(map));
|
|
525
508
|
},
|
|
526
509
|
// 修改位置
|
|
527
510
|
getBounds: function(target) {
|
|
528
|
-
return generalMapMethods.getBoundsExport(target);
|
|
511
|
+
return generalMapMethods.getBoundsExport(target, BM2);
|
|
529
512
|
},
|
|
530
513
|
on: function(target, types, fn, context) {
|
|
531
514
|
if (types === "click") {
|
|
@@ -545,12 +528,13 @@ class bigMap extends EventEmitter {
|
|
|
545
528
|
return target.off(types, wrappedFn || fn, context);
|
|
546
529
|
}
|
|
547
530
|
};
|
|
548
|
-
return
|
|
531
|
+
return createNativeMapProxy(polyline, handlers);
|
|
549
532
|
}
|
|
550
533
|
// 轨迹回放
|
|
551
534
|
TrackPlayer(latLngList = [], option = {}, map = null) {
|
|
552
535
|
let monitorTrack = null;
|
|
553
536
|
let speed = option.speed;
|
|
537
|
+
const nativePath = latLngListCheck(latLngList);
|
|
554
538
|
let polyline = this.Polyline(latLngList, {
|
|
555
539
|
color: option.notPassedLineColor || "#FF1875",
|
|
556
540
|
// 线颜色
|
|
@@ -571,7 +555,7 @@ class bigMap extends EventEmitter {
|
|
|
571
555
|
})
|
|
572
556
|
}).addTo(map);
|
|
573
557
|
marker.on("update_position", (e) => {
|
|
574
|
-
passedPolyline.setLatLngs(e.path);
|
|
558
|
+
passedPolyline.getInitLayer().setLatLngs(e.path);
|
|
575
559
|
if (monitorTrack) {
|
|
576
560
|
clearTimeout(monitorTrack);
|
|
577
561
|
}
|
|
@@ -582,7 +566,7 @@ class bigMap extends EventEmitter {
|
|
|
582
566
|
map.setView(latLngList[0], 18);
|
|
583
567
|
const moveAlong = () => {
|
|
584
568
|
if (!marker) return;
|
|
585
|
-
marker.moveAlong(
|
|
569
|
+
marker.moveAlong(nativePath, speed / 3.6, {
|
|
586
570
|
replay: false
|
|
587
571
|
});
|
|
588
572
|
};
|
|
@@ -625,7 +609,7 @@ class bigMap extends EventEmitter {
|
|
|
625
609
|
}
|
|
626
610
|
}
|
|
627
611
|
};
|
|
628
|
-
return
|
|
612
|
+
return createNativeMapProxy(marker, handlers);
|
|
629
613
|
}
|
|
630
614
|
/**
|
|
631
615
|
*
|
|
@@ -650,15 +634,10 @@ class bigMap extends EventEmitter {
|
|
|
650
634
|
rawMap.on(this.BM.Draw.Event.CREATED, (e) => {
|
|
651
635
|
isEnd = true;
|
|
652
636
|
layer = e.layer;
|
|
653
|
-
|
|
654
|
-
const center = latAndLngCheckExport(layer.getLatLng());
|
|
655
|
-
layer._latlngs = [circleToPolygonPoints(center, layer.getRadius() / 1e3, true)];
|
|
656
|
-
} else {
|
|
657
|
-
layer._latlngs[0] = latLngListCheckExport(layer._latlngs[0]);
|
|
658
|
-
}
|
|
637
|
+
const points = layer.getLatLngs ? layer.getLatLngs()[0] : circleToPolygonPoints(layer.getLatLng(), layer.getRadius() / 1e3, true);
|
|
659
638
|
layer.addTo(rawMap);
|
|
660
639
|
if (options.onChange) {
|
|
661
|
-
options.onChange(
|
|
640
|
+
options.onChange(latLngListCheckExport(points));
|
|
662
641
|
}
|
|
663
642
|
});
|
|
664
643
|
const mapClick = () => {
|
|
@@ -704,7 +683,7 @@ class bigMap extends EventEmitter {
|
|
|
704
683
|
});
|
|
705
684
|
}
|
|
706
685
|
};
|
|
707
|
-
return
|
|
686
|
+
return createNativeMapProxy({}, handlers);
|
|
708
687
|
}
|
|
709
688
|
// 电子围栏
|
|
710
689
|
CreateFence(pmType = "rectangle", options = {}, map) {
|
|
@@ -733,7 +712,7 @@ class bigMap extends EventEmitter {
|
|
|
733
712
|
pm.close();
|
|
734
713
|
};
|
|
735
714
|
const onChange = (pointList) => {
|
|
736
|
-
setPolygon(
|
|
715
|
+
setPolygon(pointList);
|
|
737
716
|
};
|
|
738
717
|
const pm = this.CreatePm(
|
|
739
718
|
pmType,
|
|
@@ -754,7 +733,7 @@ class bigMap extends EventEmitter {
|
|
|
754
733
|
setPolygon(circleToPolygonPoints(lnglat, radius / 2e3));
|
|
755
734
|
},
|
|
756
735
|
setPolygon: function(target, pointList) {
|
|
757
|
-
setPolygon(
|
|
736
|
+
setPolygon(pointList);
|
|
758
737
|
},
|
|
759
738
|
startDraw: function(target, toolType = "rectangle") {
|
|
760
739
|
clearPolygon();
|
|
@@ -775,7 +754,7 @@ class bigMap extends EventEmitter {
|
|
|
775
754
|
target.setMouseTool(toolType);
|
|
776
755
|
}
|
|
777
756
|
};
|
|
778
|
-
return
|
|
757
|
+
return createNativeMapProxy(pm, handlers);
|
|
779
758
|
}
|
|
780
759
|
// 测距工具 labelColor labelFillColor lineColor
|
|
781
760
|
RangingTool(options = {}, map) {
|
|
@@ -1105,7 +1084,7 @@ class bigMap extends EventEmitter {
|
|
|
1105
1084
|
rangingPointsEnd = null;
|
|
1106
1085
|
}
|
|
1107
1086
|
};
|
|
1108
|
-
return
|
|
1087
|
+
return createNativeMapProxy({}, handlers);
|
|
1109
1088
|
}
|
|
1110
1089
|
}
|
|
1111
1090
|
|
|
@@ -325,6 +325,9 @@ class Google extends EventEmitter {
|
|
|
325
325
|
// 添加多个个 【marker】
|
|
326
326
|
addLayers: function(target, markerArray = []) {
|
|
327
327
|
target.addMarkers(markerArray);
|
|
328
|
+
},
|
|
329
|
+
clearLayers: function(target) {
|
|
330
|
+
target.clearMarkers();
|
|
328
331
|
}
|
|
329
332
|
};
|
|
330
333
|
return createMapProxy(displayCluster, handlers);
|