complex-data
Advanced tools
+3
-0
@@ -24,2 +24,5 @@ | ||
| ### 4.9.2 | ||
| - feat:优化TrackData轨迹数据 | ||
| ### 4.9.1 | ||
@@ -26,0 +29,0 @@ - feat:修改模块加载逻辑为ES2020 |
+1
-1
| { | ||
| "name": "complex-data", | ||
| "version": "4.9.1", | ||
| "version": "4.9.2", | ||
| "description": "a complex data", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+41
-15
@@ -9,2 +9,3 @@ import { getNum } from "complex-utils" | ||
| export type directionProp = 'forward' | 'backward' | ||
| export type connectProp = 'data' | 'current' | ||
| export type lnglatType = { | ||
@@ -16,3 +17,3 @@ lng: number | ||
| export interface TrackDataInitOption { | ||
| speed: number | ||
| speed: number // 基础定时器时间间隔 | ||
| } | ||
@@ -63,3 +64,6 @@ | ||
| } | ||
| connect: CONNECT[] | ||
| connect: { | ||
| data: CONNECT[] | ||
| current: CONNECT[] | ||
| } | ||
| icon: Record<trackPointProp, undefined | ICON> | ||
@@ -116,2 +120,3 @@ point: Record<trackPointProp, undefined | POINT> | ||
| this.$marker = { | ||
| // 图标 | ||
| icon: { | ||
@@ -122,2 +127,3 @@ start: undefined, | ||
| }, | ||
| // 点 | ||
| point: { | ||
@@ -128,2 +134,3 @@ start: undefined, | ||
| }, | ||
| // 路线 | ||
| line: { | ||
@@ -133,3 +140,7 @@ data: [], | ||
| }, | ||
| connect: [], | ||
| // 连接点:仅限全轨迹 | ||
| connect: { | ||
| data: [], | ||
| current: [] | ||
| }, | ||
| } | ||
@@ -146,3 +157,3 @@ this.percent = 0 | ||
| abstract resetMap(map: MAP): void | ||
| abstract clearOverlay(map: MAP, marker: LINE | POINT | CONNECT, type: 'point' | 'line' | 'connect'): LINE | ||
| abstract clearOverlay(map: MAP, marker: LINE | POINT | CONNECT, type: 'point' | 'line' | 'connect'): void | ||
| abstract autoView(map: MAP, lnglatList: LNGLAT[]): void | ||
@@ -154,6 +165,5 @@ abstract parseLnglat(lnglat: LNGLAT): lnglatType | ||
| abstract createLine(prop: trackLineProp, map: MAP, lnglat: LNGLAT[]): LINE | ||
| abstract createConnect(option: { start: LNGLAT, startIndex: number, end: LNGLAT, endIndex: number }): CONNECT | ||
| abstract createConnect(option: { start: LNGLAT, startIndex: number, end: LNGLAT, endIndex: number }, prop: connectProp): CONNECT | ||
| abstract movePoint(point: POINT, lnglat: LNGLAT, angle: undefined | number, option: { lastIndex: number, index: number, nextIndex: number, nextLnglat: LNGLAT }): void | ||
| abstract moveLine(direction: directionProp, line: LINE, list: LNGLAT[]): void | ||
| abstract moveConnect(direction: directionProp, connect: CONNECT): void | ||
| setMap(map: MAP, unCreate?: boolean) { | ||
@@ -198,2 +208,14 @@ this.$map = map | ||
| } | ||
| // pushData(value: VALUE, target: 'last' | 'create' = 'last') { | ||
| // if (this.hasPoint(value)) { | ||
| // this.data.list.push(value) | ||
| // this.data.lnglat.push(this.createLnglat(value)) | ||
| // const lastSize = this.data.dict[this.data.dict.length - 1] | ||
| // if (target === 'last') { | ||
| // this.data.dict[this.data.dict.length - 1] = lastSize + 1 | ||
| // } else { | ||
| // this.data.dict.push(lastSize + 1) | ||
| // } | ||
| // } | ||
| // } | ||
| resetData() { | ||
@@ -261,3 +283,3 @@ this.status.data = false | ||
| const startPoint = this.data.lnglat[startIndex] | ||
| this.$marker.connect.push(this.createConnect({ | ||
| this.$marker.connect.data.push(this.createConnect({ | ||
| end: endPoint, | ||
@@ -267,3 +289,3 @@ start: startPoint, | ||
| startIndex: startIndex | ||
| })) | ||
| }, 'data')) | ||
| } | ||
@@ -289,6 +311,10 @@ startIndex = currentIndex + 1 | ||
| this.$marker.line.current = [] | ||
| for (const connect of this.$marker.connect) { | ||
| for (const connect of this.$marker.connect.data) { | ||
| this.clearOverlay(this.$map, connect, 'connect') | ||
| } | ||
| this.$marker.connect = [] | ||
| this.$marker.connect.data = [] | ||
| for (const connect of this.$marker.connect.current) { | ||
| this.clearOverlay(this.$map, connect, 'connect') | ||
| } | ||
| this.$marker.connect.current = [] | ||
| if (this.$marker.point.start) { | ||
@@ -447,4 +473,4 @@ this.clearOverlay(this.$map, this.$marker.point.start, 'point') | ||
| this.moveLine(direction, this.$marker.line.current[i], this.getLineList(i)) | ||
| // 前进操作,对连接点进行操作 | ||
| this.moveConnect(direction, this.$marker.connect[i]) | ||
| // 前进操作,对连接点进行操作:创建连接点:需要遍历可能存在的多个连接点 | ||
| // this.createConnect(direction, this.$marker.connect[i]) | ||
| } | ||
@@ -460,5 +486,5 @@ } | ||
| if (i != lastLineIndex) { | ||
| // 后退操作,对连接点进行操作 | ||
| this.moveConnect(direction, this.$marker.connect[i]) | ||
| } | ||
| // 后退操作,对连接点进行操作:删除连接点:需要遍历可能存在的多个连接点 | ||
| // this.clearOverlay(direction, this.$marker.connect[i]) | ||
| } | ||
| } | ||
@@ -465,0 +491,0 @@ } |
268301
0.39%6843
0.38%