-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
593 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
fbw-a32nx/src/systems/fmgc/src/flightplanning/plans/ObservableFlightPlan.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { EventBus, Subject, Subscribable, Subscription } from '@microsoft/msfs-sdk'; | ||
|
||
import { BaseFlightPlan } from './BaseFlightPlan'; | ||
import { FlightPlanInterface } from '../FlightPlanInterface'; | ||
import { FixInfoData } from './FixInfo'; | ||
import { FlightPlan } from './FlightPlan'; | ||
import { FlightPlanEvents } from '@fmgc/flightplanning/sync/FlightPlanEvents'; | ||
|
||
export class ObservableFlightPlan { | ||
private readonly subscriptions: Subscription[] = []; | ||
|
||
private readonly flightPlanEventsSubscriber = this.bus.getSubscriber<FlightPlanEvents>(); | ||
|
||
constructor( | ||
private readonly bus: EventBus, | ||
private readonly flightPlanInterface: FlightPlanInterface, | ||
private readonly index: number, | ||
) { | ||
const plan = flightPlanInterface.get(index); | ||
|
||
this.initializeFromPlan(plan); | ||
} | ||
|
||
public destroy(): void { | ||
for (const subscription of this.subscriptions) { | ||
subscription.destroy(); | ||
} | ||
} | ||
|
||
private initializeFromPlan(plan: BaseFlightPlan): void { | ||
if (plan instanceof FlightPlan) { | ||
for (let i = 0; i < plan.fixInfos.length; i++) { | ||
const fix = plan.fixInfos[i]; | ||
|
||
this._fixInfos[i + 1].set(fix); | ||
} | ||
} | ||
|
||
this.subscriptions.push( | ||
this.flightPlanEventsSubscriber.on('flightPlan.setFixInfoEntry').handle((event) => { | ||
if (event.planIndex !== plan.index) { | ||
return; | ||
} | ||
|
||
const subject = this._fixInfos[event.index]; | ||
|
||
subject.set(event.fixInfo); | ||
}), | ||
); | ||
} | ||
|
||
private readonly _fixInfos: Record<1 | 2 | 3 | 4, Subject<FixInfoData | null>> = { | ||
1: this.createFixInfoSubject(), | ||
2: this.createFixInfoSubject(), | ||
3: this.createFixInfoSubject(), | ||
4: this.createFixInfoSubject(), | ||
} as const; | ||
public readonly fixInfos: Record<1 | 2 | 3 | 4, Subscribable<FixInfoData | null>> = this._fixInfos; | ||
|
||
private createFixInfoSubject(): Subject<FixInfoData | null> { | ||
const equalityFunc = (a: FixInfoData | null, b: FixInfoData | null): boolean => { | ||
if ((a === null) !== (b === null)) { | ||
return false; | ||
} | ||
|
||
if (a.fix.databaseId !== b.fix.databaseId) { | ||
return false; | ||
} | ||
|
||
for (let i = 0; i < a.radials.length; i++) { | ||
const aRadial = a.radials[i]; | ||
const bRadial = b.radials[i]; | ||
|
||
if (aRadial !== bRadial) { | ||
return false; | ||
} | ||
} | ||
|
||
for (let i = 0; i < a.radii.length; i++) { | ||
const aRadius = a.radii[i]; | ||
const bRadius = b.radii[i]; | ||
|
||
if (aRadius !== bRadius) { | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
return Subject.create<FixInfoData | null>(null, equalityFunc); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
fbw-a380x/src/systems/instruments/src/MFD/pages/FMS/F-PLN/MfdFmsFplnFixInfo.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
@import "../../../../MsfsAvionicsCommon/definitions"; | ||
|
||
.mfd-fms-fpln-fix-info-header { | ||
height: .90rem; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-ref-ident { | ||
margin-top: 1.5em; | ||
margin-left: 2.4em; | ||
|
||
.mfd-fms-fpln-fix-info-ref-ident-label { | ||
font-size: 20px; | ||
margin-right: 0.95em; | ||
} | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-table { | ||
width: 98%; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
|
||
margin-top: 2.75rem; | ||
|
||
.mfd-fms-fpln-fix-info-table-row-1 { | ||
height: 5.5rem; | ||
|
||
border-bottom: 2px solid $display-dark-grey; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-table-row-2 { | ||
height: 11.5rem; | ||
|
||
border-bottom: 2px solid $display-dark-grey; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-table-row-3 { | ||
height: 7rem; | ||
|
||
border-bottom: 2px solid $display-dark-grey; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-table-row-4 { | ||
height: 11.5rem; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-table-col-left { | ||
width: 23%; | ||
|
||
border-right: 2px solid $display-dark-grey; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-table-col-center { | ||
width: 57%; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-table-col-right { | ||
width: 20%; | ||
} | ||
|
||
/* Individual cells */ | ||
|
||
.mfd-fms-fpln-fix-info-fpl-intercept-header { | ||
font-size: 20px; | ||
|
||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; | ||
grid-template-rows: 1fr 1fr; | ||
justify-items: center; | ||
align-content: center; | ||
grid-column-gap: 2rem; | ||
|
||
span:first-child { | ||
grid-column: span 3; | ||
} | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-radial-header { | ||
font-size: 20px; | ||
margin-left: 1.45rem; | ||
margin-top: .6rem; | ||
margin-bottom: .9rem; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-radial-1 { | ||
margin-left: 1.5rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-radial-2 { | ||
margin-left: 1.5rem; | ||
margin-top: 1.25rem; | ||
margin-bottom: 1rem; | ||
} | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-radius-header { | ||
font-size: 20px; | ||
margin-left: 1.45rem; | ||
margin-top: .75rem; | ||
margin-bottom: .9rem; | ||
} | ||
|
||
.mfd-fms-fpln-fix-info-radius-1 { | ||
width: 6rem; | ||
|
||
margin-left: 1.5rem; | ||
margin-bottom: 1rem; | ||
} |
Oops, something went wrong.