@vtx/ol-map 1.0.66 → 1.0.67
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/README.md +205 -205
- package/lib/_util/EventEmitter.js +4 -5
- package/lib/_util/EventEmitter.js.map +1 -1
- package/lib/_util/StyleCache.js +4 -5
- package/lib/_util/StyleCache.js.map +1 -1
- package/lib/_util/encryptParams.js +2 -3
- package/lib/_util/encryptParams.js.map +1 -1
- package/lib/_util/filterSpecialCharacters.js +6 -6
- package/lib/_util/filterSpecialCharacters.js.map +1 -1
- package/lib/_util/getComponentProps.js +1 -1
- package/lib/_util/getComponentProps.js.map +1 -1
- package/lib/_util/getCookie.js +5 -6
- package/lib/_util/getCookie.js.map +1 -1
- package/lib/_util/getDefaultMapInfo.js +6 -7
- package/lib/_util/getDefaultMapInfo.js.map +1 -1
- package/lib/_util/getSystemInfo.js +6 -7
- package/lib/_util/getSystemInfo.js.map +1 -1
- package/lib/_util/getToken.js +2 -4
- package/lib/_util/getToken.js.map +1 -1
- package/lib/_util/getUrlParam.js +1 -2
- package/lib/_util/getUrlParam.js.map +1 -1
- package/lib/_util/http.js +24 -25
- package/lib/_util/http.js.map +1 -1
- package/lib/_util/isFunction.js.map +1 -1
- package/lib/_util/isObject.js.map +1 -1
- package/lib/_util/layer.js +31 -35
- package/lib/_util/layer.js.map +1 -1
- package/lib/_util/mapTool.js +36 -37
- package/lib/_util/mapTool.js.map +1 -1
- package/lib/_util/projzh/datum/bd-09.js +1 -2
- package/lib/_util/projzh/datum/bd-09.js.map +1 -1
- package/lib/_util/projzh/datum/gcj-02.js +1 -2
- package/lib/_util/projzh/datum/gcj-02.js.map +1 -1
- package/lib/_util/projzh/datum/index.js +1 -2
- package/lib/_util/projzh/datum/index.js.map +1 -1
- package/lib/_util/projzh/index.js +1 -2
- package/lib/_util/projzh/index.js.map +1 -1
- package/lib/_util/projzh/projection/baidu-mercator.js +1 -2
- package/lib/_util/projzh/projection/baidu-mercator.js.map +1 -1
- package/lib/_util/projzh/projection/index.js +1 -2
- package/lib/_util/projzh/projection/index.js.map +1 -1
- package/lib/_util/projzh/projection/spherical-mercator.js +1 -2
- package/lib/_util/projzh/projection/spherical-mercator.js.map +1 -1
- package/lib/_util/projzh/util.js +1 -2
- package/lib/_util/projzh/util.js.map +1 -1
- package/lib/_util/search.js +9 -12
- package/lib/_util/search.js.map +1 -1
- package/lib/_util/setCookie.js +5 -6
- package/lib/_util/setCookie.js.map +1 -1
- package/lib/_util/transform.js +7 -8
- package/lib/_util/transform.js.map +1 -1
- package/lib/_util/useColSize.js +1 -2
- package/lib/_util/useColSize.js.map +1 -1
- package/lib/_util/useInterval.js.map +1 -1
- package/lib/_util/useSet.js +7 -8
- package/lib/_util/useSet.js.map +1 -1
- package/lib/analysis-layer/index.js +33 -38
- package/lib/analysis-layer/index.js.map +1 -1
- package/lib/buffer-draw/BufferDraw.js +6 -7
- package/lib/buffer-draw/BufferDraw.js.map +1 -1
- package/lib/buffer-draw/index.js +8 -8
- package/lib/buffer-draw/index.js.map +1 -1
- package/lib/circle/Circle.js +6 -7
- package/lib/circle/Circle.js.map +1 -1
- package/lib/circle/index.js +3 -3
- package/lib/circle/index.js.map +1 -1
- package/lib/config.js +1 -2
- package/lib/config.js.map +1 -1
- package/lib/dom/Dom.js +4 -5
- package/lib/dom/Dom.js.map +1 -1
- package/lib/dom/index.js +7 -7
- package/lib/dom/index.js.map +1 -1
- package/lib/events/index.js +2 -4
- package/lib/events/index.js.map +1 -1
- package/lib/feature-draw/FeatureDraw.js +11 -13
- package/lib/feature-draw/FeatureDraw.js.map +1 -1
- package/lib/feature-draw/index.js +9 -9
- package/lib/feature-draw/index.js.map +1 -1
- package/lib/feature-layer/FeatureLayer.js +10 -11
- package/lib/feature-layer/FeatureLayer.js.map +1 -1
- package/lib/feature-layer/createFeatureCollection.js +29 -37
- package/lib/feature-layer/createFeatureCollection.js.map +1 -1
- package/lib/feature-layer/index.js +8 -8
- package/lib/feature-layer/index.js.map +1 -1
- package/lib/feature-layer/style/css.js.map +1 -1
- package/lib/feature-layer/style/index.js.map +1 -1
- package/lib/flow-line-layer/FlowLineLayer.js +6 -7
- package/lib/flow-line-layer/FlowLineLayer.js.map +1 -1
- package/lib/flow-line-layer/index.js +8 -8
- package/lib/flow-line-layer/index.js.map +1 -1
- package/lib/flow-line-layer/style/css.js.map +1 -1
- package/lib/flow-line-layer/style/index.js.map +1 -1
- package/lib/fly-line-layer/FlyLineLayer.js +6 -7
- package/lib/fly-line-layer/FlyLineLayer.js.map +1 -1
- package/lib/fly-line-layer/index.js +4 -4
- package/lib/fly-line-layer/index.js.map +1 -1
- package/lib/fly-line-layer/style/css.js.map +1 -1
- package/lib/fly-line-layer/style/index.js.map +1 -1
- package/lib/group-layer/GroupLayer.js +4 -5
- package/lib/group-layer/GroupLayer.js.map +1 -1
- package/lib/group-layer/index.js +4 -4
- package/lib/group-layer/index.js.map +1 -1
- package/lib/group-layer/style/css.js.map +1 -1
- package/lib/group-layer/style/index.js.map +1 -1
- package/lib/heatmap-layer/HeatmapLayer.js +6 -7
- package/lib/heatmap-layer/HeatmapLayer.js.map +1 -1
- package/lib/heatmap-layer/index.js +4 -4
- package/lib/heatmap-layer/index.js.map +1 -1
- package/lib/heatmap-layer/style/css.js.map +1 -1
- package/lib/heatmap-layer/style/index.js.map +1 -1
- package/lib/high-layer/HighLayer.js +8 -9
- package/lib/high-layer/HighLayer.js.map +1 -1
- package/lib/high-layer/index.js +8 -9
- package/lib/high-layer/index.js.map +1 -1
- package/lib/image-layer/ImageLayer.js +6 -7
- package/lib/image-layer/ImageLayer.js.map +1 -1
- package/lib/image-layer/index.js +7 -7
- package/lib/image-layer/index.js.map +1 -1
- package/lib/image-layer/style/css.js.map +1 -1
- package/lib/image-layer/style/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legend/index.js +10 -12
- package/lib/legend/index.js.map +1 -1
- package/lib/legend/style/css.js.map +1 -1
- package/lib/legend/style/index.js.map +1 -1
- package/lib/legend/style/index.less +60 -60
- package/lib/map/Analysis.js +4 -5
- package/lib/map/Analysis.js.map +1 -1
- package/lib/map/Layers.js +5 -7
- package/lib/map/Layers.js.map +1 -1
- package/lib/map/Popup.js +8 -9
- package/lib/map/Popup.js.map +1 -1
- package/lib/map/getBaseLayers/imagery/amap/AmapImageryProvider.js +1 -2
- package/lib/map/getBaseLayers/imagery/amap/AmapImageryProvider.js.map +1 -1
- package/lib/map/getBaseLayers/imagery/baidu/BaiduImageryProvider.js +1 -2
- package/lib/map/getBaseLayers/imagery/baidu/BaiduImageryProvider.js.map +1 -1
- package/lib/map/getBaseLayers/imagery/geoq/GeoQImageryProvider.js +3 -5
- package/lib/map/getBaseLayers/imagery/geoq/GeoQImageryProvider.js.map +1 -1
- package/lib/map/getBaseLayers/imagery/tdt/TdtImageryProvider.js +3 -5
- package/lib/map/getBaseLayers/imagery/tdt/TdtImageryProvider.js.map +1 -1
- package/lib/map/getBaseLayers/index.js +3 -5
- package/lib/map/getBaseLayers/index.js.map +1 -1
- package/lib/map/index.js +21 -22
- package/lib/map/index.js.map +1 -1
- package/lib/map/style/css.js.map +1 -1
- package/lib/map/style/index.js.map +1 -1
- package/lib/map/style/index.less +99 -99
- package/lib/map-icon/svg/index.js +1 -2
- package/lib/map-icon/svg/index.js.map +1 -1
- package/lib/marker/Marker.js +7 -9
- package/lib/marker/Marker.js.map +1 -1
- package/lib/marker/index.js +3 -3
- package/lib/marker/index.js.map +1 -1
- package/lib/path-line-layer/PathLineLayer.js +11 -56
- package/lib/path-line-layer/PathLineLayer.js.map +1 -1
- package/lib/path-line-layer/getPathLineStyles.js +71 -0
- package/lib/path-line-layer/getPathLineStyles.js.map +1 -0
- package/lib/path-line-layer/index.js +8 -8
- package/lib/path-line-layer/index.js.map +1 -1
- package/lib/path-line-layer/style/css.js.map +1 -1
- package/lib/path-line-layer/style/index.js.map +1 -1
- package/lib/path-play-back/PathPlayBack.js +434 -57
- package/lib/path-play-back/PathPlayBack.js.map +1 -1
- package/lib/path-play-back/index.js +30 -9
- package/lib/path-play-back/index.js.map +1 -1
- package/lib/poi-search/Location.js +4 -4
- package/lib/poi-search/Location.js.map +1 -1
- package/lib/poi-search/PoiList.js +4 -4
- package/lib/poi-search/PoiList.js.map +1 -1
- package/lib/poi-search/Search.js +11 -11
- package/lib/poi-search/Search.js.map +1 -1
- package/lib/poi-search/index.js +5 -6
- package/lib/poi-search/index.js.map +1 -1
- package/lib/poi-search/style/css.js.map +1 -1
- package/lib/poi-search/style/index.js.map +1 -1
- package/lib/poi-search/style/index.less +97 -97
- package/lib/point/Point.js +6 -7
- package/lib/point/Point.js.map +1 -1
- package/lib/point/index.js +3 -3
- package/lib/point/index.js.map +1 -1
- package/lib/polygon/Polygon.js +6 -7
- package/lib/polygon/Polygon.js.map +1 -1
- package/lib/polygon/index.js +3 -3
- package/lib/polygon/index.js.map +1 -1
- package/lib/polyline/Polyline.js +6 -7
- package/lib/polyline/Polyline.js.map +1 -1
- package/lib/polyline/index.js +3 -3
- package/lib/polyline/index.js.map +1 -1
- package/lib/popup/index.js +8 -9
- package/lib/popup/index.js.map +1 -1
- package/lib/popup/style/css.js.map +1 -1
- package/lib/popup/style/index.js.map +1 -1
- package/lib/popup/style/index.less +128 -128
- package/lib/provider/index.js +2 -4
- package/lib/provider/index.js.map +1 -1
- package/lib/renderer/Fill.js +4 -5
- package/lib/renderer/Fill.js.map +1 -1
- package/lib/renderer/Stroke.js +4 -5
- package/lib/renderer/Stroke.js.map +1 -1
- package/lib/renderer/index.js +9 -11
- package/lib/renderer/index.js.map +1 -1
- package/lib/renderer/style/css.js.map +1 -1
- package/lib/renderer/style/index.js.map +1 -1
- package/lib/renderer/transformRgb.js +1 -2
- package/lib/renderer/transformRgb.js.map +1 -1
- package/lib/search-map/VtxModal.js +6 -7
- package/lib/search-map/VtxModal.js.map +1 -1
- package/lib/search-map/index.js +5 -6
- package/lib/search-map/index.js.map +1 -1
- package/lib/search-map/style/css.js.map +1 -1
- package/lib/search-map/style/index.js.map +1 -1
- package/lib/search-map/style/index.less +71 -71
- package/lib/search-map/style/modal.less +58 -58
- package/lib/style/index.less +2 -2
- package/lib/style/themes/compact.less +1 -1
- package/lib/style/themes/dark.less +9 -9
- package/lib/style/themes/default.less +7 -7
- package/lib/style/themes/index.less +1 -1
- package/lib/style/themes/variable.less +5 -5
- package/lib/tile-layer/TileLayer.js +6 -7
- package/lib/tile-layer/TileLayer.js.map +1 -1
- package/lib/tile-layer/index.js +3 -3
- package/lib/tile-layer/index.js.map +1 -1
- package/lib/tile-layer/style/css.js.map +1 -1
- package/lib/tile-layer/style/index.js.map +1 -1
- package/lib/tools/Layer/LayerService.js +6 -7
- package/lib/tools/Layer/LayerService.js.map +1 -1
- package/lib/tools/Layer/LayersCheckService.js +11 -18
- package/lib/tools/Layer/LayersCheckService.js.map +1 -1
- package/lib/tools/Layer/index.js +7 -7
- package/lib/tools/Layer/index.js.map +1 -1
- package/lib/tools/Layer/index.less +43 -43
- package/lib/tools/Search/index.js +14 -16
- package/lib/tools/Search/index.js.map +1 -1
- package/lib/tools/Toolbox/BoxSelect/index.js +4 -5
- package/lib/tools/Toolbox/BoxSelect/index.js.map +1 -1
- package/lib/tools/Toolbox/CircleSelect/index.js +4 -5
- package/lib/tools/Toolbox/CircleSelect/index.js.map +1 -1
- package/lib/tools/Toolbox/EagleEye/index.js +5 -6
- package/lib/tools/Toolbox/EagleEye/index.js.map +1 -1
- package/lib/tools/Toolbox/MapBookmark/Bookmark.js +9 -10
- package/lib/tools/Toolbox/MapBookmark/Bookmark.js.map +1 -1
- package/lib/tools/Toolbox/MapBookmark/index.js +18 -19
- package/lib/tools/Toolbox/MapBookmark/index.js.map +1 -1
- package/lib/tools/Toolbox/MapBookmark/index.less +20 -20
- package/lib/tools/Toolbox/MapDownload/index.js.map +1 -1
- package/lib/tools/Toolbox/MapPrint/index.js +10 -11
- package/lib/tools/Toolbox/MapPrint/index.js.map +1 -1
- package/lib/tools/Toolbox/MapPrint/index.less +4 -4
- package/lib/tools/Toolbox/Measure/Area/index.js +1 -2
- package/lib/tools/Toolbox/Measure/Area/index.js.map +1 -1
- package/lib/tools/Toolbox/Measure/Distance/index.js +1 -2
- package/lib/tools/Toolbox/Measure/Distance/index.js.map +1 -1
- package/lib/tools/Toolbox/Measure/Measure.js +4 -5
- package/lib/tools/Toolbox/Measure/Measure.js.map +1 -1
- package/lib/tools/Toolbox/Measure/index.js +5 -6
- package/lib/tools/Toolbox/Measure/index.js.map +1 -1
- package/lib/tools/Toolbox/PolygonSelect/index.js +4 -5
- package/lib/tools/Toolbox/PolygonSelect/index.js.map +1 -1
- package/lib/tools/Toolbox/ScaleLine/index.js +5 -6
- package/lib/tools/Toolbox/ScaleLine/index.js.map +1 -1
- package/lib/tools/Toolbox/SelectTools/index.js +13 -14
- package/lib/tools/Toolbox/SelectTools/index.js.map +1 -1
- package/lib/tools/Toolbox/SelectTools/index.less +10 -10
- package/lib/tools/Toolbox/SpaceQuery/index.js +5 -5
- package/lib/tools/Toolbox/SpaceQuery/index.js.map +1 -1
- package/lib/tools/Toolbox/SpaceQuery/index.less +16 -16
- package/lib/tools/Toolbox/ZoomInput/index.js +5 -6
- package/lib/tools/Toolbox/ZoomInput/index.js.map +1 -1
- package/lib/tools/Toolbox/ZoomInput/index.less +5 -5
- package/lib/tools/Toolbox/index.js +6 -8
- package/lib/tools/Toolbox/index.js.map +1 -1
- package/lib/tools/Toolbox/index.less +2 -2
- package/lib/tools/Utils/CreateOverlay.js +6 -7
- package/lib/tools/Utils/CreateOverlay.js.map +1 -1
- package/lib/tools/Utils/Draw.js +7 -9
- package/lib/tools/Utils/Draw.js.map +1 -1
- package/lib/tools/Utils/HighLayer.js +8 -9
- package/lib/tools/Utils/HighLayer.js.map +1 -1
- package/lib/tools/Utils/measure.js +1 -2
- package/lib/tools/Utils/measure.js.map +1 -1
- package/lib/tools/Utils/utils.js +30 -39
- package/lib/tools/Utils/utils.js.map +1 -1
- package/lib/tools/View/index.js +9 -10
- package/lib/tools/View/index.js.map +1 -1
- package/lib/tools/View/index.less +28 -28
- package/lib/tools/analysis-tool/index.js +11 -12
- package/lib/tools/analysis-tool/index.js.map +1 -1
- package/lib/tools/base-map-switch/index.js +9 -10
- package/lib/tools/base-map-switch/index.js.map +1 -1
- package/lib/tools/components/Icon/index.js +1 -2
- package/lib/tools/components/Icon/index.js.map +1 -1
- package/lib/tools/components/ItemWrap/index.js +4 -4
- package/lib/tools/components/ItemWrap/index.js.map +1 -1
- package/lib/tools/components/ItemWrap/index.less +41 -41
- package/lib/tools/components/Modal/index.js +3 -4
- package/lib/tools/components/Modal/index.js.map +1 -1
- package/lib/tools/components/Modal/index.less +33 -33
- package/lib/tools/components/MyTabs/index.js.map +1 -1
- package/lib/tools/components/RequiredLabel/index.js +5 -5
- package/lib/tools/components/RequiredLabel/index.js.map +1 -1
- package/lib/tools/components/RequiredLabel/index.less +5 -5
- package/lib/tools/components/Select/index.js +1 -2
- package/lib/tools/components/Select/index.js.map +1 -1
- package/lib/tools/components/Table/index.js +6 -7
- package/lib/tools/components/Table/index.js.map +1 -1
- package/lib/tools/components/Table/index.less +13 -13
- package/lib/tools/components/ToolItem/index.js +1 -2
- package/lib/tools/components/ToolItem/index.js.map +1 -1
- package/lib/tools/components/ToolItem/index.less +27 -27
- package/lib/tools/components/ToolsSelect/index.js +1 -2
- package/lib/tools/components/ToolsSelect/index.js.map +1 -1
- package/lib/tools/components/ToolsSelect/index.less +10 -10
- package/lib/tools/index.js +4 -4
- package/lib/tools/index.js.map +1 -1
- package/lib/tools/layer-control/index.js +11 -14
- package/lib/tools/layer-control/index.js.map +1 -1
- package/lib/tools/style/css.js.map +1 -1
- package/lib/tools/style/index.js.map +1 -1
- package/lib/tools/style/index.less +144 -144
- package/lib/tools-item/index.js +5 -6
- package/lib/tools-item/index.js.map +1 -1
- package/lib/use-props/index.js +1 -2
- package/lib/use-props/index.js.map +1 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -217
|
@@ -13,17 +13,29 @@ var _render = require("ol/render");
|
|
|
13
13
|
var _people = _interopRequireDefault(require("../assets/people.png"));
|
|
14
14
|
var _qd = _interopRequireDefault(require("../assets/qd.png"));
|
|
15
15
|
var _zd = _interopRequireDefault(require("../assets/zd.png"));
|
|
16
|
+
var _lodash = _interopRequireWildcard(require("lodash"));
|
|
17
|
+
var _createFeatureCollection = require("../feature-layer/createFeatureCollection");
|
|
18
|
+
var _getPathLineStyles = _interopRequireDefault(require("../path-line-layer/getPathLineStyles"));
|
|
19
|
+
var _turf = require("@turf/turf");
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
16
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
function _typeof(
|
|
18
|
-
function
|
|
19
|
-
function
|
|
23
|
+
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); }
|
|
24
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
25
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
26
|
+
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); }
|
|
27
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
28
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
29
|
+
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; }
|
|
30
|
+
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; }
|
|
31
|
+
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; }
|
|
20
32
|
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; }
|
|
21
33
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
34
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
23
35
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
24
|
-
function _toPropertyKey(
|
|
25
|
-
function _toPrimitive(
|
|
26
|
-
var PathPlayBack = /*#__PURE__*/function () {
|
|
36
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
37
|
+
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); }
|
|
38
|
+
var PathPlayBack = exports["default"] = /*#__PURE__*/function () {
|
|
27
39
|
function PathPlayBack(options) {
|
|
28
40
|
_classCallCheck(this, PathPlayBack);
|
|
29
41
|
var data = options.data,
|
|
@@ -32,23 +44,66 @@ var PathPlayBack = /*#__PURE__*/function () {
|
|
|
32
44
|
play = options.play,
|
|
33
45
|
speed = options.speed,
|
|
34
46
|
map = options.map,
|
|
35
|
-
style = options.style
|
|
47
|
+
style = options.style,
|
|
48
|
+
onPlaying = options.onPlaying,
|
|
49
|
+
onPlayEnd = options.onPlayEnd,
|
|
50
|
+
_options$repeatPlay = options.repeatPlay,
|
|
51
|
+
repeatPlay = _options$repeatPlay === void 0 ? true : _options$repeatPlay,
|
|
52
|
+
_options$autoView = options.autoView,
|
|
53
|
+
autoView = _options$autoView === void 0 ? false : _options$autoView,
|
|
54
|
+
_options$enableRotati = options.enableRotation,
|
|
55
|
+
enableRotation = _options$enableRotati === void 0 ? false : _options$enableRotati,
|
|
56
|
+
arrowStyle = options.arrowStyle,
|
|
57
|
+
showTrace = options.showTrace,
|
|
58
|
+
_options$traceStyle = options.traceStyle,
|
|
59
|
+
traceStyle = _options$traceStyle === void 0 ? {} : _options$traceStyle,
|
|
60
|
+
_options$showStartPoi = options.showStartPoint,
|
|
61
|
+
showStartPoint = _options$showStartPoi === void 0 ? true : _options$showStartPoi,
|
|
62
|
+
_options$showEndPoint = options.showEndPoint,
|
|
63
|
+
showEndPoint = _options$showEndPoint === void 0 ? true : _options$showEndPoint;
|
|
36
64
|
this._init = false;
|
|
37
65
|
this.speed = speed || 10;
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
66
|
+
this.onPlaying = onPlaying;
|
|
67
|
+
this.onPlayEnd = onPlayEnd;
|
|
68
|
+
this.style = style;
|
|
69
|
+
this.repeatPlay = repeatPlay;
|
|
70
|
+
this.enableRotation = enableRotation;
|
|
71
|
+
this.arrowStyle = arrowStyle;
|
|
72
|
+
this.showTrace = showTrace;
|
|
73
|
+
this.traceStyle = traceStyle;
|
|
74
|
+
this.currentIndex = 0;
|
|
44
75
|
this._distance = 0;
|
|
45
76
|
this._lastTime = Date.now();
|
|
77
|
+
this.autoView = autoView;
|
|
78
|
+
this.lastCoordinate = null;
|
|
79
|
+
this.distanceRatioArr = [];
|
|
80
|
+
this.isPlayEnd = false;
|
|
81
|
+
this.startStyle = new _style.Style({
|
|
82
|
+
image: new _style.Icon(_objectSpread({
|
|
83
|
+
anchor: [0.5, 1],
|
|
84
|
+
src: _qd["default"]
|
|
85
|
+
}, (style === null || style === void 0 ? void 0 : style.start) || {}))
|
|
86
|
+
});
|
|
87
|
+
this.endStyle = new _style.Style({
|
|
88
|
+
image: new _style.Icon(_objectSpread({
|
|
89
|
+
anchor: [0.5, 1],
|
|
90
|
+
src: _zd["default"]
|
|
91
|
+
}, (style === null || style === void 0 ? void 0 : style.end) || {}))
|
|
92
|
+
});
|
|
93
|
+
this.geoMarkerStyle = new _style.Style({
|
|
94
|
+
image: new _style.Icon(_objectSpread({
|
|
95
|
+
anchor: [0.5, 1],
|
|
96
|
+
src: _people["default"]
|
|
97
|
+
}, (style === null || style === void 0 ? void 0 : style.geoMarker) || {}))
|
|
98
|
+
});
|
|
46
99
|
this.map = map;
|
|
47
100
|
if (data !== null && data !== void 0 && data.length) {
|
|
48
101
|
this.loadData(data);
|
|
49
102
|
}
|
|
50
103
|
this.play = play || false;
|
|
51
104
|
this.show = show;
|
|
105
|
+
this.showStartPoint = showStartPoint;
|
|
106
|
+
this.showEndPoint = showEndPoint;
|
|
52
107
|
this._init = true;
|
|
53
108
|
}
|
|
54
109
|
_createClass(PathPlayBack, [{
|
|
@@ -71,99 +126,422 @@ var PathPlayBack = /*#__PURE__*/function () {
|
|
|
71
126
|
}
|
|
72
127
|
}
|
|
73
128
|
}, {
|
|
74
|
-
key: "
|
|
75
|
-
|
|
129
|
+
key: "showStartPoint",
|
|
130
|
+
set: function set(val) {
|
|
76
131
|
if (this.vectorLayer) {
|
|
77
|
-
this.
|
|
132
|
+
var source = this.vectorLayer.getSource();
|
|
133
|
+
if (val) {
|
|
134
|
+
!source.hasFeature(this.startMarker) && source.addFeature(this.startMarker);
|
|
135
|
+
} else {
|
|
136
|
+
source.removeFeature(this.startMarker);
|
|
137
|
+
}
|
|
78
138
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
key: "showEndPoint",
|
|
142
|
+
set: function set(val) {
|
|
143
|
+
if (this.vectorLayer) {
|
|
144
|
+
var source = this.vectorLayer.getSource();
|
|
145
|
+
if (val) {
|
|
146
|
+
!source.hasFeature(this.endMarker) && source.addFeature(this.endMarker);
|
|
147
|
+
} else {
|
|
148
|
+
source.removeFeature(this.endMarker);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}, {
|
|
153
|
+
key: "loadObjectData",
|
|
154
|
+
value: function loadObjectData(data) {
|
|
155
|
+
var coordinates = [];
|
|
156
|
+
var distanceArr = [];
|
|
157
|
+
var routeFeature = data.map(function (item) {
|
|
158
|
+
var geometryInfo = item.geometryInfo;
|
|
159
|
+
var type = geometryInfo.type,
|
|
160
|
+
lngLats = geometryInfo.lngLats,
|
|
161
|
+
coordType = geometryInfo.coordType;
|
|
162
|
+
var lineData = (0, _createFeatureCollection.transformGeometryInfoToWGS84)(lngLats, type, coordType)[0];
|
|
163
|
+
coordinates.push.apply(coordinates, _toConsumableArray(lineData));
|
|
164
|
+
var line = (0, _turf.lineString)(lineData);
|
|
165
|
+
distanceArr.push((0, _turf.length)(line));
|
|
166
|
+
var route = new _geom.LineString(lineData);
|
|
167
|
+
return new _Feature["default"](_objectSpread({
|
|
168
|
+
type: 'route',
|
|
169
|
+
geometry: route
|
|
170
|
+
}, item));
|
|
171
|
+
});
|
|
172
|
+
this.distanceArr = distanceArr;
|
|
173
|
+
var totalDistance = _lodash["default"].sum(distanceArr);
|
|
174
|
+
distanceArr = distanceArr.map(function (distance) {
|
|
175
|
+
return distance / totalDistance;
|
|
176
|
+
});
|
|
177
|
+
this.distanceRatioArr = distanceArr.map(function (distance, index) {
|
|
178
|
+
if (index === 0) {
|
|
179
|
+
return distance;
|
|
180
|
+
} else if (index === distanceArr.length - 1) {
|
|
181
|
+
return 1;
|
|
182
|
+
}
|
|
183
|
+
return _lodash["default"].sum(distanceArr.slice(0, index + 1));
|
|
184
|
+
});
|
|
185
|
+
this.route = new _geom.LineString(coordinates);
|
|
186
|
+
var firstFeature = routeFeature[0];
|
|
187
|
+
var lastFeature = _lodash["default"].last(routeFeature);
|
|
188
|
+
var firstGeometry = new _geom.Point(firstFeature.getGeometry().getFirstCoordinate());
|
|
189
|
+
var lastGeometry = new _geom.Point(lastFeature.getGeometry().getLastCoordinate());
|
|
190
|
+
return {
|
|
191
|
+
routeFeature: routeFeature,
|
|
192
|
+
firstGeometry: firstGeometry,
|
|
193
|
+
lastGeometry: lastGeometry
|
|
104
194
|
};
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: "loadArrayData",
|
|
198
|
+
value: function loadArrayData(data) {
|
|
105
199
|
var route = new _geom.LineString(data);
|
|
106
|
-
var
|
|
200
|
+
var distance = (0, _turf.length)((0, _turf.lineString)(data));
|
|
201
|
+
this.route = route;
|
|
202
|
+
var routeFeature = [new _Feature["default"]({
|
|
107
203
|
type: 'route',
|
|
108
204
|
geometry: route
|
|
205
|
+
})];
|
|
206
|
+
this.distanceArr = [distance];
|
|
207
|
+
this.distanceRatioArr = [1];
|
|
208
|
+
var firstGeometry = new _geom.Point(route.getFirstCoordinate());
|
|
209
|
+
var lastGeometry = new _geom.Point(route.getLastCoordinate());
|
|
210
|
+
return {
|
|
211
|
+
routeFeature: routeFeature,
|
|
212
|
+
firstGeometry: firstGeometry,
|
|
213
|
+
lastGeometry: lastGeometry
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
key: "getDefaultRouteStyle",
|
|
218
|
+
value: function getDefaultRouteStyle(feature) {
|
|
219
|
+
var _this$style, _this$style2;
|
|
220
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
221
|
+
var style = (0, _lodash.isFunction)((_this$style = this.style) === null || _this$style === void 0 ? void 0 : _this$style.route) ? this.style.route(feature) : ((_this$style2 = this.style) === null || _this$style2 === void 0 ? void 0 : _this$style2.route) || {};
|
|
222
|
+
return new _style.Style({
|
|
223
|
+
stroke: new _style.Stroke(_objectSpread(_objectSpread({
|
|
224
|
+
width: 6,
|
|
225
|
+
color: [237, 212, 0, 0.8]
|
|
226
|
+
}, style), options))
|
|
109
227
|
});
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "setRouteStyle",
|
|
231
|
+
value: function setRouteStyle(features) {
|
|
232
|
+
var _this = this;
|
|
233
|
+
features.forEach(function (feature) {
|
|
234
|
+
feature.setStyle(function (feature, resolution) {
|
|
235
|
+
var styles = [_this.getDefaultRouteStyle(feature)];
|
|
236
|
+
if (!(0, _lodash.isEmpty)(_this.arrowStyle)) {
|
|
237
|
+
styles.push.apply(styles, _toConsumableArray((0, _getPathLineStyles["default"])({
|
|
238
|
+
feature: feature,
|
|
239
|
+
resolution: resolution,
|
|
240
|
+
arrowStyle: _this.arrowStyle
|
|
241
|
+
})));
|
|
242
|
+
}
|
|
243
|
+
return styles;
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}, {
|
|
248
|
+
key: "loadData",
|
|
249
|
+
value: function loadData(data) {
|
|
250
|
+
if (this.vectorLayer) {
|
|
251
|
+
this.destroy();
|
|
252
|
+
}
|
|
253
|
+
var routeFeature = null;
|
|
254
|
+
var firstGeometry = null;
|
|
255
|
+
var lastGeometry = null;
|
|
256
|
+
if ((0, _lodash.isArray)(data[0])) {
|
|
257
|
+
var _this$loadArrayData = this.loadArrayData(data);
|
|
258
|
+
routeFeature = _this$loadArrayData.routeFeature;
|
|
259
|
+
firstGeometry = _this$loadArrayData.firstGeometry;
|
|
260
|
+
lastGeometry = _this$loadArrayData.lastGeometry;
|
|
261
|
+
} else {
|
|
262
|
+
var _this$loadObjectData = this.loadObjectData(data);
|
|
263
|
+
routeFeature = _this$loadObjectData.routeFeature;
|
|
264
|
+
firstGeometry = _this$loadObjectData.firstGeometry;
|
|
265
|
+
lastGeometry = _this$loadObjectData.lastGeometry;
|
|
266
|
+
}
|
|
110
267
|
var startMarker = new _Feature["default"]({
|
|
111
268
|
type: 'start',
|
|
112
|
-
geometry:
|
|
269
|
+
geometry: firstGeometry
|
|
113
270
|
});
|
|
271
|
+
startMarker.setStyle(this.startStyle);
|
|
114
272
|
var endMarker = new _Feature["default"]({
|
|
115
273
|
type: 'end',
|
|
116
|
-
geometry:
|
|
274
|
+
geometry: lastGeometry
|
|
117
275
|
});
|
|
276
|
+
endMarker.setStyle(this.endStyle);
|
|
118
277
|
var position = startMarker.getGeometry().clone();
|
|
119
278
|
var geoMarker = new _Feature["default"]({
|
|
120
279
|
type: 'geoMarker',
|
|
121
280
|
geometry: position
|
|
122
281
|
});
|
|
282
|
+
geoMarker.setStyle(this.geoMarkerStyle);
|
|
283
|
+
this.setRouteStyle(routeFeature);
|
|
123
284
|
var vectorLayer = new _layer.Vector({
|
|
124
285
|
source: new _Vector["default"]({
|
|
125
|
-
features: [routeFeature, geoMarker
|
|
126
|
-
})
|
|
127
|
-
style: function style(feature) {
|
|
128
|
-
return styles[feature.get('type')];
|
|
129
|
-
}
|
|
286
|
+
features: [].concat(_toConsumableArray(routeFeature), [geoMarker])
|
|
287
|
+
})
|
|
130
288
|
});
|
|
131
289
|
this.map.addLayer(vectorLayer);
|
|
132
|
-
this.
|
|
290
|
+
this.routeFeatures = routeFeature;
|
|
133
291
|
this.position = position;
|
|
134
292
|
this.vectorLayer = vectorLayer;
|
|
135
293
|
this.geoMarker = geoMarker;
|
|
136
|
-
this.
|
|
294
|
+
this.startMarker = startMarker;
|
|
295
|
+
this.endMarker = endMarker;
|
|
296
|
+
if (!vectorLayer.getSource().hasFeature(startMarker)) {
|
|
297
|
+
vectorLayer.getSource().addFeature(startMarker);
|
|
298
|
+
}
|
|
299
|
+
if (!vectorLayer.getSource().hasFeature(endMarker)) {
|
|
300
|
+
vectorLayer.getSource().addFeature(endMarker);
|
|
301
|
+
}
|
|
302
|
+
if (this.showTrace) {
|
|
303
|
+
this.addTrace();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
key: "moveTo",
|
|
308
|
+
value: function moveTo(process) {
|
|
309
|
+
var _this2 = this;
|
|
310
|
+
this.currentIndex = this.distanceRatioArr.findIndex(function (distance) {
|
|
311
|
+
return distance >= process;
|
|
312
|
+
});
|
|
313
|
+
this._distance = process;
|
|
314
|
+
var distance = this.calculateDistance();
|
|
315
|
+
var route = this.routeFeatures[this.currentIndex].getGeometry();
|
|
316
|
+
var currentCoordinate = route.getCoordinateAt(distance > 1 ? 2 - distance : distance);
|
|
317
|
+
if (distance > 0) {
|
|
318
|
+
var lastCoordinate = route.getCoordinateAt(distance - 0.0001);
|
|
319
|
+
this.setRotation(lastCoordinate, currentCoordinate);
|
|
320
|
+
}
|
|
321
|
+
if (distance >= 1 && this.currentIndex >= this.routeFeatures.length - 1) {
|
|
322
|
+
this.isPlayEnd = true;
|
|
323
|
+
}
|
|
324
|
+
this.position.setCoordinates(currentCoordinate);
|
|
325
|
+
if (this.showTrace) {
|
|
326
|
+
var list = [];
|
|
327
|
+
var getCoordinates = function getCoordinates(_ref) {
|
|
328
|
+
var startCoordinates = _ref.startCoordinates,
|
|
329
|
+
endCoordinates = _ref.endCoordinates,
|
|
330
|
+
lineCoordinates = _ref.lineCoordinates;
|
|
331
|
+
var start = (0, _turf.point)(startCoordinates);
|
|
332
|
+
var end = (0, _turf.point)(endCoordinates);
|
|
333
|
+
var line = (0, _turf.lineString)(lineCoordinates);
|
|
334
|
+
var sliced = (0, _turf.lineSlice)(start, end, line);
|
|
335
|
+
return sliced.geometry.coordinates;
|
|
336
|
+
};
|
|
337
|
+
if (this.currentIndex === 0) {
|
|
338
|
+
list.push(getCoordinates({
|
|
339
|
+
startCoordinates: this.startMarker.getGeometry().getCoordinates(),
|
|
340
|
+
endCoordinates: currentCoordinate,
|
|
341
|
+
lineCoordinates: route.getCoordinates()
|
|
342
|
+
}));
|
|
343
|
+
} else {
|
|
344
|
+
var features = this.routeFeatures.slice(0, this.currentIndex + 1);
|
|
345
|
+
features.forEach(function (feature, index) {
|
|
346
|
+
var geometry = feature.getGeometry();
|
|
347
|
+
var endCoordinates = currentCoordinate;
|
|
348
|
+
if (index !== _this2.currentIndex) {
|
|
349
|
+
endCoordinates = geometry.getLastCoordinate();
|
|
350
|
+
}
|
|
351
|
+
list.push(getCoordinates({
|
|
352
|
+
startCoordinates: geometry.getFirstCoordinate(),
|
|
353
|
+
endCoordinates: endCoordinates,
|
|
354
|
+
lineCoordinates: geometry.getCoordinates()
|
|
355
|
+
}));
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
list.forEach(function (coordinates, index) {
|
|
359
|
+
coordinates.forEach(function (coordinate, i) {
|
|
360
|
+
_this2.setPaintLinePath({
|
|
361
|
+
coordinate: coordinate,
|
|
362
|
+
init: i === 0,
|
|
363
|
+
index: index
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
this.onPlaying && this.onPlaying(this._distance, this.currentIndex);
|
|
369
|
+
}
|
|
370
|
+
}, {
|
|
371
|
+
key: "playEnd",
|
|
372
|
+
value: function playEnd() {
|
|
373
|
+
var _this3 = this;
|
|
374
|
+
if (!this.repeatPlay) {
|
|
375
|
+
this.stopAnimation();
|
|
376
|
+
}
|
|
377
|
+
this.isPlayEnd = true;
|
|
378
|
+
if (this.showTrace) {
|
|
379
|
+
this.lineDashFeatures.forEach(function (feature) {
|
|
380
|
+
_this3.vectorLayer.getSource().removeFeature(feature);
|
|
381
|
+
});
|
|
382
|
+
this.paintLineFeatures.forEach(function (feature) {
|
|
383
|
+
_this3.vectorLayer.getSource().removeFeature(feature);
|
|
384
|
+
feature.setGeometry(null);
|
|
385
|
+
});
|
|
386
|
+
this.setRouteStyle(this.routeFeatures);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}, {
|
|
390
|
+
key: "setRotation",
|
|
391
|
+
value: function setRotation(lastCoordinate, coordinate) {
|
|
392
|
+
if (lastCoordinate && coordinate && this.enableRotation) {
|
|
393
|
+
var x = coordinate[0] - lastCoordinate[0];
|
|
394
|
+
var y = coordinate[1] - lastCoordinate[1];
|
|
395
|
+
var rotation = Math.atan2(y, x);
|
|
396
|
+
this.geoMarkerStyle.getImage().setRotation(Math.atan2(1, 0) - rotation);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// 计算当前路段跑的距离,计算公式:(当前跑的总距离 - 已跑路段的总距离) / 当前路段的百分比
|
|
401
|
+
}, {
|
|
402
|
+
key: "calculateDistance",
|
|
403
|
+
value: function calculateDistance() {
|
|
404
|
+
var currentRouteRatio = this.currentIndex > 0 ? this.distanceRatioArr[this.currentIndex] - this.distanceRatioArr[this.currentIndex - 1] : this.distanceRatioArr[this.currentIndex];
|
|
405
|
+
var distance = (this._distance - (this.currentIndex > 0 ? this.distanceRatioArr[this.currentIndex - 1] : 0)) / currentRouteRatio;
|
|
406
|
+
return distance;
|
|
137
407
|
}
|
|
138
408
|
}, {
|
|
139
409
|
key: "moveFeature",
|
|
140
410
|
value: function moveFeature(event) {
|
|
411
|
+
var vectorContext = (0, _render.getVectorContext)(event);
|
|
141
412
|
var speed = Number(this.speed);
|
|
142
413
|
var time = event.frameState.time;
|
|
143
414
|
var elapsedTime = time - this._lastTime;
|
|
144
415
|
this._distance = (this._distance + speed * elapsedTime / 1e6) % 2;
|
|
416
|
+
var distance = this.calculateDistance();
|
|
145
417
|
this._lastTime = time;
|
|
146
|
-
|
|
418
|
+
if (distance > 1) {
|
|
419
|
+
this.currentIndex = this.currentIndex + 1;
|
|
420
|
+
distance = 0;
|
|
421
|
+
}
|
|
422
|
+
if (this.currentIndex > this.routeFeatures.length - 1) {
|
|
423
|
+
this.playEnd();
|
|
424
|
+
if (this.repeatPlay) {
|
|
425
|
+
this.currentIndex = this.routeFeatures.length - 1;
|
|
426
|
+
} else {
|
|
427
|
+
var _currentCoordinate = this.endMarker.getGeometry().getCoordinates();
|
|
428
|
+
this.position.setCoordinates(_currentCoordinate);
|
|
429
|
+
vectorContext.setStyle(this.geoMarkerStyle);
|
|
430
|
+
vectorContext.drawGeometry(this.position);
|
|
431
|
+
this.onPlayEnd && this.onPlayEnd();
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
var route = this.routeFeatures[this.currentIndex].getGeometry();
|
|
436
|
+
var currentCoordinate = route.getCoordinateAt(distance > 1 ? 2 - distance : distance);
|
|
147
437
|
this.position.setCoordinates(currentCoordinate);
|
|
148
|
-
|
|
149
|
-
|
|
438
|
+
this.setRotation(this.lastCoordinate, currentCoordinate);
|
|
439
|
+
this.lastCoordinate = currentCoordinate;
|
|
440
|
+
if (this.autoView) {
|
|
441
|
+
this.map.getView().fit(this.position, {
|
|
442
|
+
padding: [100, 400, 100, 400],
|
|
443
|
+
maxZoom: this.map.getView().getZoom(),
|
|
444
|
+
duration: 0
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
vectorContext.setStyle(this.geoMarkerStyle);
|
|
150
448
|
vectorContext.drawGeometry(this.position);
|
|
449
|
+
if (this.showTrace) {
|
|
450
|
+
this.setPaintLinePath({
|
|
451
|
+
coordinate: currentCoordinate,
|
|
452
|
+
index: this.currentIndex
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
this.onPlaying && this.onPlaying(this._distance, this.currentIndex);
|
|
151
456
|
this.map.render();
|
|
152
457
|
}
|
|
458
|
+
}, {
|
|
459
|
+
key: "setPaintLinePath",
|
|
460
|
+
value: function setPaintLinePath(_ref2) {
|
|
461
|
+
var coordinate = _ref2.coordinate,
|
|
462
|
+
init = _ref2.init,
|
|
463
|
+
index = _ref2.index;
|
|
464
|
+
var paintLineFeature = this.paintLineFeatures[index];
|
|
465
|
+
if (init) {
|
|
466
|
+
paintLineFeature.setGeometry(null);
|
|
467
|
+
}
|
|
468
|
+
var geometry = paintLineFeature.getGeometry();
|
|
469
|
+
if (geometry) {
|
|
470
|
+
geometry.setCoordinates([[].concat(_toConsumableArray(geometry.getCoordinates()[0]), [coordinate])]);
|
|
471
|
+
} else {
|
|
472
|
+
var lineData = [[coordinate]];
|
|
473
|
+
var route = new _geom.MultiLineString(lineData);
|
|
474
|
+
paintLineFeature.setGeometry(route);
|
|
475
|
+
}
|
|
476
|
+
if (!this.vectorLayer.getSource().hasFeature(paintLineFeature)) {
|
|
477
|
+
this.vectorLayer.getSource().addFeature(paintLineFeature);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}, {
|
|
481
|
+
key: "addTrace",
|
|
482
|
+
value: function addTrace() {
|
|
483
|
+
var _this4 = this;
|
|
484
|
+
if (this._distance === 0) {
|
|
485
|
+
var lineDashFeatures = [];
|
|
486
|
+
var paintLineFeatures = [];
|
|
487
|
+
this.routeFeatures.forEach(function (feature) {
|
|
488
|
+
var lineDashFeature = feature.clone();
|
|
489
|
+
var paintLineFeature = feature.clone();
|
|
490
|
+
paintLineFeature.setGeometry(null);
|
|
491
|
+
lineDashFeature.setStyle(_this4.getDefaultRouteStyle(feature, {
|
|
492
|
+
lineDash: [15]
|
|
493
|
+
}));
|
|
494
|
+
lineDashFeatures.push(lineDashFeature);
|
|
495
|
+
paintLineFeatures.push(paintLineFeature);
|
|
496
|
+
});
|
|
497
|
+
this.lineDashFeatures = lineDashFeatures;
|
|
498
|
+
this.paintLineFeatures = paintLineFeatures;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
153
501
|
}, {
|
|
154
502
|
key: "startAnimation",
|
|
155
503
|
value: function startAnimation() {
|
|
504
|
+
var _this5 = this;
|
|
505
|
+
if (!this.repeatPlay && this.isPlayEnd) {
|
|
506
|
+
// 当不重复播放,且当前在终点时,从起点开始播放
|
|
507
|
+
this.cancel();
|
|
508
|
+
this.geoMarkerStyle.getImage().setRotation(0);
|
|
509
|
+
}
|
|
510
|
+
this.isPlayEnd = false;
|
|
156
511
|
this._animating = true;
|
|
157
512
|
this._lastTime = Date.now();
|
|
158
513
|
this._on_event = this.vectorLayer.on('postrender', this.moveFeature.bind(this));
|
|
159
514
|
this.geoMarker.setGeometry(null);
|
|
515
|
+
if (this.showTrace) {
|
|
516
|
+
this.lineDashFeatures.forEach(function (feature) {
|
|
517
|
+
if (!_this5.vectorLayer.getSource().hasFeature(feature)) {
|
|
518
|
+
_this5.vectorLayer.getSource().addFeature(feature);
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
this.routeFeatures.forEach(function (feature) {
|
|
522
|
+
feature.setStyle(new _style.Style({}));
|
|
523
|
+
});
|
|
524
|
+
}
|
|
160
525
|
}
|
|
161
526
|
}, {
|
|
162
527
|
key: "stopAnimation",
|
|
163
528
|
value: function stopAnimation() {
|
|
164
529
|
this._animating = false;
|
|
165
530
|
this.geoMarker.setGeometry(this.position);
|
|
166
|
-
|
|
531
|
+
if (this._on_event) {
|
|
532
|
+
this.vectorLayer.un('postrender', this._on_event.listener);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}, {
|
|
536
|
+
key: "cancel",
|
|
537
|
+
value: function cancel() {
|
|
538
|
+
this.geoMarkerStyle.getImage().setRotation(0);
|
|
539
|
+
this._distance = 0;
|
|
540
|
+
this.currentIndex = 0;
|
|
541
|
+
var currentCoordinate = this.route.getCoordinateAt(0);
|
|
542
|
+
this.position.setCoordinates(currentCoordinate);
|
|
543
|
+
this.playEnd();
|
|
544
|
+
this.onPlaying && this.onPlaying(this._distance, this.currentIndex);
|
|
167
545
|
}
|
|
168
546
|
}, {
|
|
169
547
|
key: "destroy",
|
|
@@ -172,7 +550,7 @@ var PathPlayBack = /*#__PURE__*/function () {
|
|
|
172
550
|
this.stopAnimation();
|
|
173
551
|
}
|
|
174
552
|
this.map.removeLayer(this.vectorLayer);
|
|
175
|
-
this.
|
|
553
|
+
this.routeFeatures = null;
|
|
176
554
|
this.position = null;
|
|
177
555
|
this.vectorLayer = null;
|
|
178
556
|
this.geoMarker = null;
|
|
@@ -180,5 +558,4 @@ var PathPlayBack = /*#__PURE__*/function () {
|
|
|
180
558
|
}]);
|
|
181
559
|
return PathPlayBack;
|
|
182
560
|
}();
|
|
183
|
-
exports["default"] = PathPlayBack;
|
|
184
561
|
//# sourceMappingURL=PathPlayBack.js.map
|