@cloud-app-dev/vidc 4.0.20 → 4.0.22
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/es/AppContext/Sync.js +42 -0
- package/es/AppContext/index.js +141 -0
- package/es/AppContext/interface.d.ts +41 -0
- package/es/AppContext/static.js +9 -0
- package/es/Auth/index.js +14 -0
- package/es/AutoExit/index.js +19 -0
- package/es/CheckGroupFixed/demo.js +22 -0
- package/es/CheckGroupFixed/index.js +140 -0
- package/es/CheckGroupFixed/index.less +56 -0
- package/es/Config/index.js +77 -0
- package/es/Config/interface.d.ts +65 -0
- package/es/Config/utils.js +33 -0
- package/es/ConfigContext/index.js +21 -0
- package/es/CustomRenderSelect/index.js +72 -0
- package/es/CustomRenderSelect/index.less +25 -0
- package/es/DBTools/index.js +336 -0
- package/es/DisableMark/index.js +19 -0
- package/es/DisableMark/index.less +9 -0
- package/es/DomMove/demo.js +16 -0
- package/es/DomMove/index.js +139 -0
- package/es/DomMove/utils.js +32 -0
- package/es/Drag/DragAndDropItem.js +133 -0
- package/es/Drag/DropItem.js +50 -0
- package/es/Drag/index.d.ts +9 -0
- package/es/Drag/index.js +7 -0
- package/es/Drag/interface.d.ts +16 -0
- package/es/DynamicGridList/Demo.js +77 -0
- package/es/DynamicGridList/index.js +67 -0
- package/es/DynamicList/demo.js +44 -0
- package/es/DynamicList/index.js +86 -0
- package/es/DynamicList/index.less +17 -0
- package/es/DynamicList/interface.d.ts +19 -0
- package/es/DynamicList/utils.js +6 -0
- package/es/ErrorFallback/index.js +31 -0
- package/es/ErrorFallback/inerface.d.ts +48 -0
- package/es/EventTools/index.js +12 -0
- package/es/FrontendPlayer/index.js +2 -0
- package/es/FullScreen/index.js +33 -0
- package/es/FullScreen/index.less +18 -0
- package/es/GridList/Demo.js +80 -0
- package/es/GridList/data.js +609 -0
- package/es/GridList/hook.js +270 -0
- package/es/GridList/index.js +44 -0
- package/es/GridList/index.less +8 -0
- package/es/GridList/interface.d.ts +59 -0
- package/es/GridList/utils.js +42 -0
- package/es/HightLevel/index.js +18 -0
- package/es/HightLevel/index.less +3 -0
- package/es/IconFont/index.js +54 -0
- package/es/ImageView/index.js +51 -0
- package/es/ImageView/index.less +11 -0
- package/es/InstanceHistory/index.js +7 -0
- package/es/LabelPlayer/111.png +0 -0
- package/es/LabelPlayer/demo.js +115 -0
- package/es/LabelPlayer/index.js +160 -0
- package/es/LabelPlayer/index.less +24 -0
- package/es/LabelValue/index.js +27 -0
- package/es/LabelValue/index.less +23 -0
- package/es/List/demo.js +23 -0
- package/es/List/index.js +28 -0
- package/es/List/index.less +20 -0
- package/es/ListWithSizeAnimate/demo.js +98 -0
- package/es/ListWithSizeAnimate/index.js +85 -0
- package/es/ListWithSizeAnimate/index.less +23 -0
- package/es/LoaderScript/index.js +34 -0
- package/es/LoaderScript/utils.js +179 -0
- package/es/Map/AMap.d.ts +7109 -0
- package/es/Map/BasicMap/AMapInstance.js +98 -0
- package/es/Map/BasicMap/LeafletInstance.js +111 -0
- package/es/Map/BasicMap/index.js +90 -0
- package/es/Map/BasicMap/index.less +29 -0
- package/es/Map/ClusterLayer/demo.js +18 -0
- package/es/Map/ClusterLayer/hook.js +123 -0
- package/es/Map/ClusterLayer/index.js +28 -0
- package/es/Map/ClusterLayer/index.less +29 -0
- package/es/Map/ClusterLayer/props.d.ts +8 -0
- package/es/Map/Config/index.js +48 -0
- package/es/Map/Config/utils.js +65 -0
- package/es/Map/Context/index.js +51 -0
- package/es/Map/FindPio/index.js +13 -0
- package/es/Map/FindPio/index.less +7 -0
- package/es/Map/InfoWindow/MakerLikeWindow.js +108 -0
- package/es/Map/InfoWindow/demo.js +70 -0
- package/es/Map/InfoWindow/index.js +62 -0
- package/es/Map/LevelCenter/DragMarker/index.js +42 -0
- package/es/Map/LevelCenter/demo.js +38 -0
- package/es/Map/LevelCenter/index.js +66 -0
- package/es/Map/LoaderMap/index.js +62 -0
- package/es/Map/MapDrawSelect/demo.js +71 -0
- package/es/Map/MapDrawSelect/index.js +56 -0
- package/es/Map/MouseTool/index.js +40 -0
- package/es/Map/MouseTool/useMouseTools.js +83 -0
- package/es/Map/ResetTools/index.js +57 -0
- package/es/Map/ResetTools/index.less +39 -0
- package/es/Map/SinglePoint/demo.js +14 -0
- package/es/Map/SinglePoint/index.js +52 -0
- package/es/Map/SinglePoint/index.less +41 -0
- package/es/Map/hook/useMapEvent.js +19 -0
- package/es/Map/hook/useMapType.js +12 -0
- package/es/Map/icon.js +10 -0
- package/es/Map/index.js +25 -0
- package/es/Map/interface.d.ts +74 -0
- package/es/Map/points.js +1 -0
- package/es/Map/useMarker/index.js +71 -0
- package/es/Map/withMap/index.js +10 -0
- package/es/Picture/component/DefaultRects/RectInfo.js +80 -0
- package/es/Picture/component/DefaultRects/index.js +52 -0
- package/es/Picture/component/DefaultRects/index.less +211 -0
- package/es/Picture/component/DefaultRects/utils.js +11 -0
- package/es/Picture/component/DrawRect/index.js +46 -0
- package/es/Picture/component/DrawRect/index.less +8 -0
- package/es/Picture/component/RectMenu/index.js +76 -0
- package/es/Picture/component/RectMenu/index.less +36 -0
- package/es/Picture/component/RectMenu/utils.js +19 -0
- package/es/Picture/component/Tools/index.js +73 -0
- package/es/Picture/component/Tools/index.less +49 -0
- package/es/Picture/component/WheelScale/index.js +27 -0
- package/es/Picture/demo.js +105 -0
- package/es/Picture/index.js +341 -0
- package/es/Picture/index.less +20 -0
- package/es/Picture/interface.d.ts +196 -0
- package/es/Picture/loadCaptureRectImage.js +99 -0
- package/es/Picture/useDraw.js +103 -0
- package/es/Picture/utils.js +143 -0
- package/es/Player/api/index.js +309 -0
- package/es/Player/context.js +24 -0
- package/es/Player/contraller_bar/bar.js +20 -0
- package/es/Player/contraller_bar/contraller_event.js +48 -0
- package/es/Player/contraller_bar/index.js +27 -0
- package/es/Player/contraller_bar/left_bar.js +83 -0
- package/es/Player/contraller_bar/right_bar.js +32 -0
- package/es/Player/contraller_bar/time.js +19 -0
- package/es/Player/contraller_bar/useBarStatus.js +43 -0
- package/es/Player/contraller_bar/volume.js +62 -0
- package/es/Player/demo.js +266 -0
- package/es/Player/empty.js +4 -0
- package/es/Player/event/errorEvent.js +88 -0
- package/es/Player/event/eventName.js +29 -0
- package/es/Player/event/index.js +205 -0
- package/es/Player/fps_play.js +83 -0
- package/es/Player/frontend_player.js +64 -0
- package/es/Player/frontend_timeline.js +132 -0
- package/es/Player/iconfont.js +16 -0
- package/es/Player/index.js +2 -0
- package/es/Player/live_heart.js +45 -0
- package/es/Player/message.js +133 -0
- package/es/Player/player.d.ts +233 -0
- package/es/Player/segment_player.js +228 -0
- package/es/Player/segment_timeline.js +173 -0
- package/es/Player/single_player.js +262 -0
- package/es/Player/style/bar.less +43 -0
- package/es/Player/style/iconfont.js +43 -0
- package/es/Player/style/index.less +34 -0
- package/es/Player/style/message.less +56 -0
- package/es/Player/style/slider.less +106 -0
- package/es/Player/style/timeline.less +117 -0
- package/es/Player/style/volume.less +24 -0
- package/es/Player/timeline.js +95 -0
- package/es/Player/util.js +189 -0
- package/es/PlayerExt/demo.js +154 -0
- package/es/PlayerExt/index.js +188 -0
- package/es/PlayerExt/index.less +10 -0
- package/es/Progress/index.d.ts +9 -0
- package/es/Progress/index.js +53 -0
- package/es/Progress/index.less +21 -0
- package/es/ROI/demo.js +16 -0
- package/es/ROI/index.js +54 -0
- package/es/ROI/index.less +33 -0
- package/es/RefDrawer/Footer.js +22 -0
- package/es/RefDrawer/demo.js +18 -0
- package/es/RefDrawer/index.js +71 -0
- package/es/RefModal/demo.js +18 -0
- package/es/RefModal/index.js +70 -0
- package/es/ScreenPlayer/Live.js +212 -0
- package/es/ScreenPlayer/LiveTools.js +151 -0
- package/es/ScreenPlayer/PlayerWithExt.js +231 -0
- package/es/ScreenPlayer/RatePick.js +29 -0
- package/es/ScreenPlayer/Record.js +442 -0
- package/es/ScreenPlayer/RecordTools.js +169 -0
- package/es/ScreenPlayer/ScreenSelect.js +46 -0
- package/es/ScreenPlayer/SegmentTimeLine.js +36 -0
- package/es/ScreenPlayer/TimeMode.js +26 -0
- package/es/ScreenPlayer/TimeSelect.js +88 -0
- package/es/ScreenPlayer/demo.js +21 -0
- package/es/ScreenPlayer/demo2.js +194 -0
- package/es/ScreenPlayer/index.js +9 -0
- package/es/ScreenPlayer/index.less +335 -0
- package/es/ScreenPlayer/interface.d.ts +216 -0
- package/es/ScreenPlayer/useTimeSlider.js +456 -0
- package/es/ScreenPlayer/useVideoFit.js +35 -0
- package/es/ScreenPlayer/utils.js +85 -0
- package/es/SegmentPlayer/index.js +2 -0
- package/es/Service/http.js +133 -0
- package/es/Service/index.js +11 -0
- package/es/Service/interface.d.ts +23 -0
- package/es/Service/middleware.js +22 -0
- package/es/SocketEmitter/eventEmitter.js +88 -0
- package/es/SocketEmitter/index.js +125 -0
- package/es/SocketEmitter/interface.d.ts +4 -0
- package/es/TableLayout/index.js +27 -0
- package/es/TableLayout/index.less +4 -0
- package/es/ThemeAntd/demo.js +81 -0
- package/es/ThemeAntd/demo.less +20 -0
- package/es/ThemeAntd/index.js +21 -0
- package/es/ThemeAntd/index.less +4 -0
- package/es/Timeout/index.js +65 -0
- package/es/bigNumberTransformCN/index.js +58 -0
- package/es/cache/index.js +94 -0
- package/es/copy/index.js +9 -0
- package/es/core.d.ts +0 -0
- package/es/getThemeStyle/index.js +5 -0
- package/es/index.js +62 -0
- package/es/likeGo/index.js +31 -0
- package/es/likeGoSync/index.js +10 -0
- package/es/logger/index.js +30 -0
- package/es/nextTick/index.js +3 -0
- package/es/recorder/demo.js +181 -0
- package/es/recorder/index.js +992 -0
- package/es/submidstr/index.js +14 -0
- package/es/treeHelper/index.js +188 -0
- package/es/typings.d.ts +2 -0
- package/es/useDrawROI/index.js +318 -0
- package/es/useEventEmitterHandle/index.js +17 -0
- package/es/useFullscreen/demo.js +43 -0
- package/es/useFullscreen/index.js +76 -0
- package/es/useHistory/index.js +9 -0
- package/es/useHistory/interface.d.ts +3 -0
- package/es/useInfiniteScroll/index.js +102 -0
- package/es/useRafInterval/index.js +70 -0
- package/es/useSimpleState/index.js +35 -0
- package/es/useVirtualList/index.js +136 -0
- package/es/utils.js +46 -0
- package/es/uuid/index.js +19 -0
- package/package.json +2 -3
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
8
|
+
import deviceList from "../points";
|
|
9
|
+
import MapDrawSelect from "./index";
|
|
10
|
+
var App = function App() {
|
|
11
|
+
var _useState = useState([]),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
points = _useState2[0],
|
|
14
|
+
setPoints = _useState2[1];
|
|
15
|
+
var _useState3 = useState(),
|
|
16
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
17
|
+
type = _useState4[0],
|
|
18
|
+
setType = _useState4[1];
|
|
19
|
+
var _useState5 = useState({
|
|
20
|
+
zoom: null,
|
|
21
|
+
center: null
|
|
22
|
+
}),
|
|
23
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
24
|
+
state = _useState6[0],
|
|
25
|
+
setState = _useState6[1];
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
setTimeout(function () {
|
|
28
|
+
setPoints(deviceList);
|
|
29
|
+
setState({
|
|
30
|
+
center: [116.397392, 39.918206],
|
|
31
|
+
zoom: 13.74
|
|
32
|
+
});
|
|
33
|
+
}, 1000);
|
|
34
|
+
}, []);
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
style: {
|
|
37
|
+
width: '100%',
|
|
38
|
+
height: 800
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/React.createElement(MapDrawSelect, {
|
|
41
|
+
zoom: state.zoom,
|
|
42
|
+
center: state.center,
|
|
43
|
+
points: points,
|
|
44
|
+
drawEnd: console.log,
|
|
45
|
+
drawType: type,
|
|
46
|
+
drawUi: /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
style: {
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
right: 20,
|
|
50
|
+
top: 120
|
|
51
|
+
}
|
|
52
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
onClick: function onClick() {
|
|
54
|
+
return setType(type === 'rect' ? 'close' : 'rect');
|
|
55
|
+
}
|
|
56
|
+
}, "\u77E9\u5F62"), /*#__PURE__*/React.createElement("span", {
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return setType(type === 'polygon' ? 'close' : 'polygon');
|
|
59
|
+
}
|
|
60
|
+
}, "\u591A\u8FB9\u5F62"), /*#__PURE__*/React.createElement("span", {
|
|
61
|
+
onClick: function onClick() {
|
|
62
|
+
return setType(type === 'circle' ? 'close' : 'circle');
|
|
63
|
+
}
|
|
64
|
+
}, "\u5706\u5F27"), /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
onClick: function onClick() {
|
|
66
|
+
return setType('clear');
|
|
67
|
+
}
|
|
68
|
+
}, "\u6E05\u9664"))
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
export default App;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useMount, useUpdateEffect } from 'ahooks';
|
|
2
|
+
import React, { useCallback, useContext, useEffect, useMemo } from 'react';
|
|
3
|
+
import ClusterLayer from "../ClusterLayer";
|
|
4
|
+
import { mapContext } from "../Context";
|
|
5
|
+
import MouseTool from "../MouseTool";
|
|
6
|
+
import ResetTools from "../ResetTools";
|
|
7
|
+
import withMap from "../withMap";
|
|
8
|
+
function MapDrawSelect(_ref) {
|
|
9
|
+
var center = _ref.center,
|
|
10
|
+
zoom = _ref.zoom,
|
|
11
|
+
points = _ref.points,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
drawUi = _ref.drawUi,
|
|
14
|
+
drawType = _ref.drawType,
|
|
15
|
+
selectCenter = _ref.selectCenter,
|
|
16
|
+
drawEnd = _ref.drawEnd,
|
|
17
|
+
onPointClick = _ref.onPointClick;
|
|
18
|
+
var _useContext = useContext(mapContext),
|
|
19
|
+
instance = _useContext.instance;
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
var defaultCenter = useMemo(function () {
|
|
22
|
+
return center || instance.config.center;
|
|
23
|
+
}, [center]);
|
|
24
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
var defaultZoom = useMemo(function () {
|
|
26
|
+
return zoom || instance.config.zoom;
|
|
27
|
+
}, [zoom]);
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
var mapRest = useCallback(function () {
|
|
31
|
+
return instance.setZoomAndCenter(defaultZoom, defaultCenter);
|
|
32
|
+
}, [defaultZoom, defaultCenter]);
|
|
33
|
+
useMount(function () {
|
|
34
|
+
return mapRest();
|
|
35
|
+
});
|
|
36
|
+
useUpdateEffect(function () {
|
|
37
|
+
return instance.setZoomAndCenter(defaultZoom, defaultCenter);
|
|
38
|
+
}, [defaultZoom, defaultCenter]);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
if (selectCenter) {
|
|
41
|
+
instance.setZoomAndCenter(defaultZoom, selectCenter);
|
|
42
|
+
}
|
|
43
|
+
}, [defaultZoom, instance, selectCenter]);
|
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
45
|
+
points: points,
|
|
46
|
+
onPointClick: onPointClick
|
|
47
|
+
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
48
|
+
onMapReset: mapRest
|
|
49
|
+
}), /*#__PURE__*/React.createElement(MouseTool, {
|
|
50
|
+
ui: drawUi,
|
|
51
|
+
drawType: drawType,
|
|
52
|
+
drawEnd: drawEnd,
|
|
53
|
+
points: points
|
|
54
|
+
}), children);
|
|
55
|
+
}
|
|
56
|
+
export default withMap(MapDrawSelect, 'map-draw-select-container');
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useUpdateEffect } from 'ahooks';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import nextTick from "../../nextTick";
|
|
4
|
+
import useMouseTools from "./useMouseTools";
|
|
5
|
+
function MouseTool(_ref) {
|
|
6
|
+
var ui = _ref.ui,
|
|
7
|
+
drawType = _ref.drawType,
|
|
8
|
+
_ref$points = _ref.points,
|
|
9
|
+
points = _ref$points === void 0 ? [] : _ref$points,
|
|
10
|
+
drawEnd = _ref.drawEnd;
|
|
11
|
+
var _useMouseTools = useMouseTools(function (obj) {
|
|
12
|
+
var selectPoints = [];
|
|
13
|
+
for (var i = 0; i < points.length; i++) {
|
|
14
|
+
var item = points[i];
|
|
15
|
+
if (item.longitude && item.latitude && obj.contains([item.longitude, item.latitude])) {
|
|
16
|
+
selectPoints.push(item);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
nextTick(function () {
|
|
20
|
+
return drawEnd === null || drawEnd === void 0 ? void 0 : drawEnd(selectPoints);
|
|
21
|
+
});
|
|
22
|
+
}),
|
|
23
|
+
draw = _useMouseTools.draw,
|
|
24
|
+
close = _useMouseTools.close;
|
|
25
|
+
useUpdateEffect(function () {
|
|
26
|
+
switch (drawType) {
|
|
27
|
+
case 'clear':
|
|
28
|
+
close(true);
|
|
29
|
+
break;
|
|
30
|
+
case 'close':
|
|
31
|
+
close();
|
|
32
|
+
break;
|
|
33
|
+
default:
|
|
34
|
+
draw(drawType);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}, [drawType]);
|
|
38
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, ui);
|
|
39
|
+
}
|
|
40
|
+
export default MouseTool;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useMount } from 'ahooks';
|
|
14
|
+
import { useContext, useEffect, useRef, useState } from 'react';
|
|
15
|
+
import { mapContext } from "../Context";
|
|
16
|
+
function useMouseTools(onDrawEnd) {
|
|
17
|
+
var _useState = useState({
|
|
18
|
+
focusKey: Date.now()
|
|
19
|
+
}),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
state = _useState2[0],
|
|
22
|
+
setState = _useState2[1];
|
|
23
|
+
var _useContext = useContext(mapContext),
|
|
24
|
+
instance = _useContext.instance;
|
|
25
|
+
var overlayersRef = useRef([]);
|
|
26
|
+
var mouseRef = useRef(null);
|
|
27
|
+
useMount(function () {
|
|
28
|
+
var map = instance.map;
|
|
29
|
+
AMap.plugin(['AMap.MouseTool'], function () {
|
|
30
|
+
mouseRef.current = new AMap.MouseTool(map);
|
|
31
|
+
setState(function (old) {
|
|
32
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
33
|
+
focusKey: Date.now()
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
if (!mouseRef.current) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
var fn = function fn(e) {
|
|
43
|
+
overlayersRef.current.push(e.obj);
|
|
44
|
+
onDrawEnd === null || onDrawEnd === void 0 || onDrawEnd(e.obj);
|
|
45
|
+
};
|
|
46
|
+
mouseRef.current.on('draw', fn);
|
|
47
|
+
return function () {
|
|
48
|
+
mouseRef.current.off('draw', fn);
|
|
49
|
+
};
|
|
50
|
+
}, [onDrawEnd, state.focusKey]);
|
|
51
|
+
var draw = function draw(type) {
|
|
52
|
+
if (!mouseRef.current) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
switch (type) {
|
|
56
|
+
case 'rect':
|
|
57
|
+
mouseRef.current.rectangle();
|
|
58
|
+
break;
|
|
59
|
+
case 'polygon':
|
|
60
|
+
mouseRef.current.polygon();
|
|
61
|
+
break;
|
|
62
|
+
case 'circle':
|
|
63
|
+
mouseRef.current.circle();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var clear = function clear(objs) {
|
|
67
|
+
objs.forEach(function (obj) {
|
|
68
|
+
instance.map.remove(obj);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
var close = function close(ifClear) {
|
|
72
|
+
if (!mouseRef.current) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
mouseRef.current.close(ifClear);
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
clear: clear,
|
|
79
|
+
draw: draw,
|
|
80
|
+
close: close
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export default useMouseTools;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useCallback, useContext } from 'react';
|
|
2
|
+
import { mapContext } from "../Context";
|
|
3
|
+
import { Popover } from 'antd';
|
|
4
|
+
import IconFont from "../../IconFont";
|
|
5
|
+
import "../../Player/style/iconfont";
|
|
6
|
+
import "./index.less";
|
|
7
|
+
function ResetTools(_ref) {
|
|
8
|
+
var onMapReset = _ref.onMapReset,
|
|
9
|
+
onMapZoom = _ref.onMapZoom,
|
|
10
|
+
_ref$className = _ref.className,
|
|
11
|
+
className = _ref$className === void 0 ? '' : _ref$className;
|
|
12
|
+
var _useContext = useContext(mapContext),
|
|
13
|
+
instance = _useContext.instance;
|
|
14
|
+
var mapReset = useCallback(function () {
|
|
15
|
+
return onMapReset ? onMapReset() : instance.mapReset();
|
|
16
|
+
}, []);
|
|
17
|
+
var mapZoom = useCallback(function (num) {
|
|
18
|
+
return onMapZoom ? onMapZoom(num) : instance.setZoom(instance.getZoom() + num);
|
|
19
|
+
}, []);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "map-reset-tool-container ".concat(className)
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
23
|
+
placement: "left",
|
|
24
|
+
content: "\u590D\u4F4D",
|
|
25
|
+
overlayClassName: "map-rest-tools-item-popup"
|
|
26
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "map-reset map-tool-icon",
|
|
28
|
+
onClick: mapReset
|
|
29
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
30
|
+
type: "lm-player-S_Bar_Reduction"
|
|
31
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "map-zoom"
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
34
|
+
placement: "left",
|
|
35
|
+
content: "\u653E\u5927",
|
|
36
|
+
overlayClassName: "map-rest-tools-item-popup"
|
|
37
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "map-tool-icon",
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
return mapZoom(1);
|
|
41
|
+
}
|
|
42
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
43
|
+
type: "lm-player-S_Edit_LinePlus"
|
|
44
|
+
}))), /*#__PURE__*/React.createElement(Popover, {
|
|
45
|
+
placement: "left",
|
|
46
|
+
content: "\u7F29\u5C0F",
|
|
47
|
+
overlayClassName: "map-rest-tools-item-popup"
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "map-tool-icon",
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
return mapZoom(-1);
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
54
|
+
type: "lm-player-S_Edit_LineMinus"
|
|
55
|
+
})))));
|
|
56
|
+
}
|
|
57
|
+
export default ResetTools;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.map-reset-tool-container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
right: 10px;
|
|
4
|
+
bottom: 10px;
|
|
5
|
+
z-index: 3;
|
|
6
|
+
padding: 5px 0;
|
|
7
|
+
background: #fff;
|
|
8
|
+
|
|
9
|
+
.map-reset,
|
|
10
|
+
.map-zoom {
|
|
11
|
+
background: #fff;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.map-zoom {
|
|
15
|
+
margin-bottom: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.map-tool-icon {
|
|
19
|
+
display: flex;
|
|
20
|
+
width: 30px;
|
|
21
|
+
height: 25px;
|
|
22
|
+
font-size: 18px;
|
|
23
|
+
color: var(--icon);
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
color: var(--primary);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.map-rest-tools-item-popup {
|
|
35
|
+
.ant-popover-inner-content {
|
|
36
|
+
padding: 4px 8px;
|
|
37
|
+
font-size: var(--fs-small);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SinglePoint from "./index";
|
|
3
|
+
var App = function App() {
|
|
4
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5
|
+
style: {
|
|
6
|
+
width: '100%',
|
|
7
|
+
height: 800
|
|
8
|
+
}
|
|
9
|
+
}, /*#__PURE__*/React.createElement(SinglePoint, {
|
|
10
|
+
center: [112.94477421092171, 38.499347690146514],
|
|
11
|
+
title: "\u8BBE\u7F6E1111"
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
14
|
+
export default App;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useCallback, useContext } from 'react';
|
|
2
|
+
import ClusterLayer from "../ClusterLayer";
|
|
3
|
+
import ResetTools from "../ResetTools";
|
|
4
|
+
import DragMarker from "../LevelCenter/DragMarker";
|
|
5
|
+
import withMap from "../withMap";
|
|
6
|
+
import { mapContext } from "../Context";
|
|
7
|
+
import { useMount } from 'ahooks';
|
|
8
|
+
import useMapEvent from "../hook/useMapEvent";
|
|
9
|
+
import "./index.less";
|
|
10
|
+
function SinglePoint(_ref) {
|
|
11
|
+
var center = _ref.center,
|
|
12
|
+
points = _ref.points,
|
|
13
|
+
onCenterChange = _ref.onCenterChange,
|
|
14
|
+
enableClick = _ref.enableClick,
|
|
15
|
+
title = _ref.title,
|
|
16
|
+
children = _ref.children;
|
|
17
|
+
var _useContext = useContext(mapContext),
|
|
18
|
+
instance = _useContext.instance;
|
|
19
|
+
var mapRest = useCallback(function () {
|
|
20
|
+
return instance.setZoomAndCenter(instance.config.zoom, center !== null && center !== void 0 ? center : instance.config.center);
|
|
21
|
+
}, [center, instance]);
|
|
22
|
+
useMount(function () {
|
|
23
|
+
if (enableClick) {
|
|
24
|
+
instance.setCursor('pointer');
|
|
25
|
+
}
|
|
26
|
+
mapRest();
|
|
27
|
+
});
|
|
28
|
+
useMapEvent('click', function (event) {
|
|
29
|
+
if (enableClick) {
|
|
30
|
+
var _center = [event.lnglat.lng, event.lnglat.lat];
|
|
31
|
+
instance.setCenter(_center);
|
|
32
|
+
onCenterChange === null || onCenterChange === void 0 || onCenterChange({
|
|
33
|
+
center: _center
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
38
|
+
points: points
|
|
39
|
+
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
40
|
+
onMapReset: mapRest
|
|
41
|
+
}), /*#__PURE__*/React.createElement(DragMarker, {
|
|
42
|
+
title: title,
|
|
43
|
+
center: center,
|
|
44
|
+
onChange: function onChange(_ref2) {
|
|
45
|
+
var center = _ref2.center;
|
|
46
|
+
return onCenterChange === null || onCenterChange === void 0 ? void 0 : onCenterChange({
|
|
47
|
+
center: center
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}), children);
|
|
51
|
+
}
|
|
52
|
+
export default withMap(SinglePoint, 'single-point-map-container');
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.single-point-map-container {
|
|
2
|
+
.marker-center-layout {
|
|
3
|
+
width: 32px;
|
|
4
|
+
height: 42px;
|
|
5
|
+
margin-top: -10px;
|
|
6
|
+
text-align: center;
|
|
7
|
+
|
|
8
|
+
> div {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
padding-top: 6px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.onLine {
|
|
15
|
+
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMzJweCIgaGVpZ2h0PSI0MnB4IiB2aWV3Qm94PSIwIDAgMzIgNDIiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUzLjEgKDcyNjMxKSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT5QaW4vUGxhY2VfaWNvbl9PbkxpbmVfTm9ybWFsPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+CiAgICAgICAgPGxpbmVhckdyYWRpZW50IHgxPSI1MCUiIHkxPSIwJSIgeDI9IjUwJSIgeTI9Ijk5LjcyOTMzOTclIiBpZD0ibGluZWFyR3JhZGllbnQtMSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRkFBMTEiIG9mZnN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c2NTQ5LDI4LjI2MjQ0NDMgQzIuNTA0NzA4MDcsMjMuNTM1NjA0OCAxLjA0OTUzNTY2LDIwLjczODUwMTIgMS4wMDA5NDgyOSwxNi4xNzgzNjc1IEwwLjk5NTIyOTAxNywxNS42NDE1ODg4IEwxLjAwNDM0NDIzLDE1LjYzNTQwNDQgWiIgc3Ryb2tlPSIjNjc2RjdGIiBzdHJva2Utd2lkdGg9IjIiIGZpbGw9InVybCgjbGluZWFyR3JhZGllbnQtMSkiPjwvcGF0aD4KICAgIDwvZz4KPC9zdmc+')
|
|
30
|
+
no-repeat;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.anticon {
|
|
35
|
+
position: relative;
|
|
36
|
+
top: 1px;
|
|
37
|
+
font-size: 18px;
|
|
38
|
+
color: white;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { mapContext } from "../Context";
|
|
3
|
+
import { useLatest } from 'ahooks';
|
|
4
|
+
function useMapEvent(type, fn) {
|
|
5
|
+
var fnRef = useLatest(fn);
|
|
6
|
+
var _useContext = useContext(mapContext),
|
|
7
|
+
instance = _useContext.instance;
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
var eventAction = function eventAction(event) {
|
|
10
|
+
fnRef.current(event);
|
|
11
|
+
};
|
|
12
|
+
instance.on(type, eventAction);
|
|
13
|
+
return function () {
|
|
14
|
+
return instance.off(type, eventAction);
|
|
15
|
+
};
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
+
}, [instance, type]);
|
|
18
|
+
}
|
|
19
|
+
export default useMapEvent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import { mapContext } from "../Context";
|
|
3
|
+
export default function useMapType() {
|
|
4
|
+
var _useContext = useContext(mapContext),
|
|
5
|
+
glaobalKey = _useContext.glaobalKey;
|
|
6
|
+
return useMemo(function () {
|
|
7
|
+
return {
|
|
8
|
+
leaflet: glaobalKey === 'L',
|
|
9
|
+
AMap: glaobalKey === 'AMap'
|
|
10
|
+
};
|
|
11
|
+
}, [glaobalKey]);
|
|
12
|
+
}
|
package/es/Map/icon.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var LevelCenterCenterSvg = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"28px\" height=\"40px\" viewBox=\"0 0 28 40\" version=\"1.1\"><defs><linearGradient x1=\"6.38826004%\" y1=\"96.2639042%\" x2=\"66.7998206%\" y2=\"14.972142%\" id=\"linearGradient-1\"><stop stop-color=\"#000000\" stop-opacity=\"0.2\" offset=\"0%\"/><stop stop-color=\"#000000\" stop-opacity=\"0\" offset=\"100%\"/></linearGradient></defs><g id=\"Img/Add\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M22,28 L28,28 L15.2872963,39.7348034 C15.102574,39.9053163 14.8604062,40 14.6090162,40 L14,40 C13.7238576,40 13.5,39.7761424 13.5,39.5 C13.5,39.3918149 13.5350889,39.2865481 13.6,39.2 L22,28 Z\" id=\"Rectangle\" fill=\"url(#linearGradient-1)\"/><path d=\"M11,23 L17,23 L15.103901,39.1168412 C15.0446525,39.6204542 14.6178366,40 14.1107504,40 L13.8892496,40 C13.3821634,40 12.9553475,39.6204542 12.896099,39.1168412 L11,23 Z\" id=\"Rectangle\" fill=\"#FF8800\"/><circle id=\"Oval\" stroke=\"#FF8800\" fill=\"#FFAA00\" cx=\"14\" cy=\"12\" r=\"11.5\"/><circle id=\"Oval\" fill=\"#FF8800\" cx=\"15\" cy=\"13\" r=\"4\"/><circle id=\"Oval\" fill=\"#FFFFFF\" cx=\"14\" cy=\"12\" r=\"4\"/></g></svg>";
|
|
2
|
+
export function createMapCenterIcon() {
|
|
3
|
+
var L = window.L;
|
|
4
|
+
return L.divIcon({
|
|
5
|
+
iconSize: [28, 40],
|
|
6
|
+
iconAnchor: [14, 40],
|
|
7
|
+
html: "<i class=\"anticon\">".concat(LevelCenterCenterSvg, "</>"),
|
|
8
|
+
className: 'lv-center-map-drag-marker'
|
|
9
|
+
});
|
|
10
|
+
}
|
package/es/Map/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import BasicMap from "./BasicMap";
|
|
2
|
+
import ClusterLayer from "./ClusterLayer";
|
|
3
|
+
import Config from "./Config";
|
|
4
|
+
import Context from "./Context";
|
|
5
|
+
import FindPio from "./FindPio";
|
|
6
|
+
import LevelCenter from "./LevelCenter";
|
|
7
|
+
import LoaderMap from "./LoaderMap";
|
|
8
|
+
import ResetTools from "./ResetTools";
|
|
9
|
+
import SinglePoint from "./SinglePoint";
|
|
10
|
+
import useMarker from "./useMarker";
|
|
11
|
+
import withMap from "./withMap";
|
|
12
|
+
var Map = {
|
|
13
|
+
ClusterLayer: ClusterLayer,
|
|
14
|
+
Config: Config,
|
|
15
|
+
Context: Context,
|
|
16
|
+
FindPio: FindPio,
|
|
17
|
+
LevelCenter: LevelCenter,
|
|
18
|
+
LoaderMap: LoaderMap,
|
|
19
|
+
BasicMap: BasicMap,
|
|
20
|
+
ResetTools: ResetTools,
|
|
21
|
+
SinglePoint: SinglePoint,
|
|
22
|
+
useMarker: useMarker,
|
|
23
|
+
withMap: withMap
|
|
24
|
+
};
|
|
25
|
+
export default Map;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as LMap from '@types/leaflet';
|
|
2
|
+
|
|
3
|
+
export type LMapInstance = typeof LMap & LMapPlugin;
|
|
4
|
+
|
|
5
|
+
export type Map = LMap.Map & AMap.Map;
|
|
6
|
+
|
|
7
|
+
export type Marker = LMap.Marker & AMap.Marker;
|
|
8
|
+
|
|
9
|
+
export type LatLng = LMap.LatLng & AMap.LngLat;
|
|
10
|
+
|
|
11
|
+
export interface IMapOptions {
|
|
12
|
+
url?: string;
|
|
13
|
+
subdomains?: string[];
|
|
14
|
+
crs?: string;
|
|
15
|
+
center?: [number, number];
|
|
16
|
+
maxZoom?: number;
|
|
17
|
+
minZoom?: number;
|
|
18
|
+
zoom?: number;
|
|
19
|
+
zoomOffset?: 0;
|
|
20
|
+
maxBounds: [[number, number], [number, number]];
|
|
21
|
+
distance?: number;
|
|
22
|
+
amapStyle?: 'normal' | 'dark' | 'light' | 'whitesmoke' | 'fresh' | 'grey' | 'graffiti' | 'macaron' | 'blue' | 'darkblue' | 'wine';
|
|
23
|
+
}
|
|
24
|
+
export class IMapInstance {
|
|
25
|
+
constructor(ele: HTMLDivElement, options?: IMapOptions);
|
|
26
|
+
map: AMap.Map | LMap.Map;
|
|
27
|
+
config: IMapOptions;
|
|
28
|
+
createMap(): void;
|
|
29
|
+
destoryMap(): void;
|
|
30
|
+
mapReset(): void;
|
|
31
|
+
setZoom(zoom: number): void;
|
|
32
|
+
setCenter(center: [number, number] | LatLng): void;
|
|
33
|
+
getZoom(): number;
|
|
34
|
+
setZoomAndCenter(zoom: number, center: [number, number] | LatLng): void;
|
|
35
|
+
on(type: string, fn: (e: any) => void): void;
|
|
36
|
+
off(type: string, fn: (e: any) => void): void;
|
|
37
|
+
setCursor(cursor: string);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface MapPoint {
|
|
41
|
+
latitude: number;
|
|
42
|
+
longitude: number;
|
|
43
|
+
deviceType: string;
|
|
44
|
+
deviceStatus: string;
|
|
45
|
+
deviceName: string;
|
|
46
|
+
cid: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type LMapPlugin = {
|
|
50
|
+
markerClusterGroup: (config: any) => ClusterGroupInterface;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export interface LClusterInterface {
|
|
54
|
+
addTo(map: Map): this;
|
|
55
|
+
addLayers(markers: Marker[]);
|
|
56
|
+
getLayers(): Marker[];
|
|
57
|
+
clearLayers(): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type DrawType = 'rect' | 'polygon' | 'circle' | 'clear' | 'close';
|
|
61
|
+
|
|
62
|
+
export interface customConfigProps {
|
|
63
|
+
url: string;
|
|
64
|
+
subdomains: string[];
|
|
65
|
+
crs: string;
|
|
66
|
+
center: [number, number];
|
|
67
|
+
maxZoom: number;
|
|
68
|
+
minZoom: number;
|
|
69
|
+
zoom: number;
|
|
70
|
+
zoomOffset: number;
|
|
71
|
+
distance: number;
|
|
72
|
+
amapStyle: string;
|
|
73
|
+
maxBounds: [[number, number], [number, number]];
|
|
74
|
+
}
|