Browse Source

接入路线数据

Caner 2 years ago
parent
commit
bf1cef5207
1 changed files with 3 additions and 10 deletions
  1. 3 10
      src/components/map/map.service.ts

+ 3 - 10
src/components/map/map.service.ts

@@ -172,16 +172,9 @@ export default class MapService extends Service {
           if (el === 'line') {
             for (let j = 0; j < res.length; j++) {
               const es = res[j]
-              console.log('线还需要不同的Id')
-
-              // 区分上下行
-              // const upLinePaths = es.child.filter((ed: { direction: number }) => ed.direction === 1).sort((a: { stationNo: number }, b: { stationNo: number }) => a.stationNo - b.stationNo).map((ec: { lon: string; lat: string }) => ([ +ec.lon, +ec.lat ]))
-              // const downLinePaths = es.child.filter((ed: { direction: number }) => ed.direction === 2).sort((a: { stationNo: number }, b: { stationNo: number }) => a.stationNo - b.stationNo).map((ec: { lon: string; lat: string }) => ([ +ec.lon, +ec.lat ]))
-              // console.log('上行', upLinePaths)
-              // console.log('下行', downLinePaths)
-              // const color = this.colorRandom()
-              // this.marks[this.key][el][es.paramId] = { markMap: this.addLine(upLinePaths, color) }
-              // this.marks[this.key][el][es.paramId] = { markMap: this.addLine(downLinePaths, color) }
+              const paths = es.child?.sort((a: { stationNo: number }, b: { stationNo: number }) => a.stationNo - b.stationNo).map((ec: { lon: string; lat: string }) => ([ +ec.lon, +ec.lat ]))
+              const color = this.colorRandom()
+              this.marks[this.key][el][es.paramId] = { markMap: this.addLine(paths, color) }
             }
           } else {
             for (let z = 0; z < res.length; z++) {