暂提
This commit is contained in:
parent
faa462f980
commit
4529277fb5
@ -2,6 +2,12 @@ import { JlGraphic, GraphicData, JlGraphicTemplate } from 'src/jl-graphic';
|
||||
import { Graphics, IPointData } from 'pixi.js';
|
||||
import { RunLine } from '../runLine/RunLine';
|
||||
import { getDrawApp } from 'src/drawApp';
|
||||
// calculateDistanceFromPointToLine
|
||||
import {
|
||||
calculateDistanceFromPointToLine,
|
||||
calculateFootPointFromPointToLine,
|
||||
distance,
|
||||
} from 'src/jl-graphic';
|
||||
|
||||
export interface KilometerPoint {
|
||||
get point(): IPointData;
|
||||
@ -85,7 +91,25 @@ export class PathLine extends JlGraphic {
|
||||
});
|
||||
}
|
||||
generatePathLineKilometerPoints(stas: string[]) {
|
||||
// this.datas.points.forEach()
|
||||
const kilometerPoints: KilometerPoint[] = [];
|
||||
stas.forEach((stasId) => {
|
||||
const sta = this.queryStore.queryById(stasId);
|
||||
this.datas.points.some((p, index) => {
|
||||
if (index) {
|
||||
const prep = this.datas.points[index - 1];
|
||||
const fp = calculateFootPointFromPointToLine(prep, p, sta.position);
|
||||
const length = distance(prep.x, prep.y, p.x, p.y);
|
||||
if (
|
||||
distance(fp.x, fp.y, prep.x, prep.y) <= length &&
|
||||
distance(fp.x, fp.y, p.x, p.y) <= length
|
||||
) {
|
||||
kilometerPoints.push({ point: fp, kilometer: 0 });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
this.datas.kilometerPoints = kilometerPoints;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user