diff --git a/src/graphics/slope/Slope.ts b/src/graphics/slope/Slope.ts index 670718e..617000c 100644 --- a/src/graphics/slope/Slope.ts +++ b/src/graphics/slope/Slope.ts @@ -6,7 +6,10 @@ import { VectorText, calculateLineMidpoint, } from 'src/jl-graphic'; -import { SlopeKiloMarker } from '../slopeKiloMarker/SlopeKiloMarker'; +import { + SlopeKiloMarker, + KiloMarkerConsts, +} from '../slopeKiloMarker/SlopeKiloMarker'; export interface ISlopeData extends GraphicData { get points(): IPointData[]; // 线坐标点 set points(points: IPointData[]); @@ -22,7 +25,6 @@ export interface ISlopeData extends GraphicData { export const SlopeConsts = { lineColor: '0xffffff', lineWidth: 2, - height: 100, }; export class Slope extends JlGraphic { @@ -63,8 +65,8 @@ export class Slope extends JlGraphic { if (this.datas.slopeNumber !== 0) { distanceY = this.datas.slopeNumber > 0 - ? -SlopeConsts.height / 2 - : SlopeConsts.height / 2; + ? -KiloMarkerConsts.size + : KiloMarkerConsts.size; } this.datas.points.forEach((p, i) => { if (i !== 0) { @@ -98,8 +100,8 @@ export class Slope extends JlGraphic { this.datas.refDeviceId[1] ) as SlopeKiloMarker; this.slopeLong.text = - slopeKiloMarkerR.datas.kilometerSystem?.kilometer - - slopeKiloMarkerL.datas.kilometerSystem?.kilometer; + slopeKiloMarkerR.datas.kilometerSystem[0]?.kilometer - + slopeKiloMarkerL.datas.kilometerSystem[0]?.kilometer; const slopeLongPosition = this.datas.childTransforms?.find( (t) => t.name === this.slopeLong.name )?.transform.position; diff --git a/src/graphics/slope/SlopeAssistant.ts b/src/graphics/slope/SlopeAssistant.ts index 93e7891..95427f6 100644 --- a/src/graphics/slope/SlopeAssistant.ts +++ b/src/graphics/slope/SlopeAssistant.ts @@ -68,11 +68,13 @@ export class SlopeDraw extends GraphicDrawAssistant { const refSlopeKiloMarker = this.app.queryStore.queryById( g.datas.refDeviceId[0] ) as SlopeKiloMarker; - return refSlopeKiloMarker.datas.direction == dirSlop; + return ( + refSlopeKiloMarker.datas.kilometerSystem[0].direction == dirSlop + ); }); const slopeKiloMarkers = this.app.queryStore .queryByType(SlopeKiloMarker.Type) - .filter((g) => g.datas.direction == dirSlop); + .filter((g) => g.datas.kilometerSystem[0].direction == dirSlop); slopeKiloMarkers.sort((a, b) => a.position.x - b.position.x); const slopeKiloMarkersPos = slopeKiloMarkers.map((g) => g.position.x); //检验坡度有效性--是否有增加和删除