Skip to content

Commit

Permalink
strict mode grind
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 committed Jan 10, 2025
1 parent 9e2b47e commit f334ad1
Show file tree
Hide file tree
Showing 10 changed files with 250 additions and 192 deletions.
10 changes: 9 additions & 1 deletion fbw-a380x/src/systems/instruments/src/ND/OansControlPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,15 @@ export class OansControlPanel extends DisplayComponent<OansProps> {
}

private async setBtvRunwayFromFmsRunway() {
[this.landingRunwayNavdata, this.arpCoordinates] = await this.btvUtils.setBtvRunwayFromFmsRunway(this.fmsDataStore);
const destination = this.fmsDataStore.destination.get();
const rwyIdent = this.fmsDataStore.landingRunway.get();

if (destination && rwyIdent) {
[this.landingRunwayNavdata, this.arpCoordinates] = await this.btvUtils.setBtvRunwayFromFmsRunway(
destination,
rwyIdent,
);
}
}

private async btvFallbackSetDistance(distance: number | null) {
Expand Down
175 changes: 108 additions & 67 deletions fbw-common/src/systems/instruments/src/OANC/Oanc.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface BaseOancLabelFilter {

export interface RunwayBtvSelectionLabelFilter extends BaseOancLabelFilter {
type: 'runwayBtvSelection';
runwayIdent: string;
runwayIdent: string | null;
showAdjacent: boolean;
}

Expand Down Expand Up @@ -92,8 +92,8 @@ export function labelStyle(
fmsDataStore: FmsDataStore,
isFmsOrigin: boolean,
isFmsDestination: boolean,
btvSelectedRunway: string,
btvSelectedExit: string,
btvSelectedRunway?: string,
btvSelectedExit?: string,
): LabelStyle {
if (label.style === LabelStyle.RunwayEnd || label.style === LabelStyle.BtvSelectedRunwayEnd) {
return btvSelectedRunway?.substring(4) === label.text ? LabelStyle.BtvSelectedRunwayEnd : LabelStyle.RunwayEnd;
Expand Down
11 changes: 6 additions & 5 deletions fbw-common/src/systems/instruments/src/OANC/OancLabelManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,14 @@ export class OancLabelManager<T extends number> {

element.style.left = `${labelScreenX}px`;
element.style.top = `${labelScreenY}px`;
const labelRotation = label.rotation ?? 0;

if (label.style === LabelStyle.RunwayEnd || label.style === LabelStyle.BtvSelectedRunwayEnd) {
element.style.transform = `translate(-50%, -50%) rotate(${label.rotation - mapCurrentHeading}deg) translate(0px, 50px)`;
element.style.transform = `translate(-50%, -50%) rotate(${labelRotation - mapCurrentHeading}deg) translate(0px, 50px)`;
} else if (label.style === LabelStyle.BtvSelectedRunwayArrow) {
element.style.transform = `translate(-50%, -50%) rotate(${label.rotation - mapCurrentHeading}deg) translate(0px, -100px) rotate(-180deg)`;
element.style.transform = `translate(-50%, -50%) rotate(${labelRotation - mapCurrentHeading}deg) translate(0px, -100px) rotate(-180deg)`;
} else if (label.style === LabelStyle.FmsSelectedRunwayEnd) {
element.style.transform = `translate(-50%, -50%) rotate(${label.rotation - mapCurrentHeading}deg) translate(0px, 82.5px)`;
element.style.transform = `translate(-50%, -50%) rotate(${labelRotation - mapCurrentHeading}deg) translate(0px, 82.5px)`;
} else {
element.style.transform = 'translate(-50%, -50%)';
}
Expand Down Expand Up @@ -205,8 +206,8 @@ export class OancLabelManager<T extends number> {
fmsDataStore: FmsDataStore,
isFmsOrigin: boolean,
isFmsDestination: boolean,
btvSelectedRunway: string,
btvSelectedExit: string,
btvSelectedRunway?: string,
btvSelectedExit?: string,
) {
this.visibleLabelElements.forEach((val, key) => {
const newLabelStyle = labelStyle(
Expand Down
16 changes: 8 additions & 8 deletions fbw-common/src/systems/instruments/src/OANC/OancMarkerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export class OancMarkerManager<T extends number> {
) {
this.crosses.sub((index, type, item, _array) => {
if (type === SubscribableArrayEventType.Added) {
if (!Array.isArray(item[0])) {
if (item && !Array.isArray(item[0])) {
const crossSymbolLabel: Label = {
text: index.toString(),
style: LabelStyle.CrossSymbol,
position: item as Position,
rotation: 0,
associatedFeature: null,
associatedFeature: undefined,
};
this.labelManager.visibleLabels.insert(crossSymbolLabel);
this.labelManager.labels.push(crossSymbolLabel);
Expand All @@ -31,14 +31,14 @@ export class OancMarkerManager<T extends number> {
style: LabelStyle.CrossSymbol,
position: pos,
rotation: 0,
associatedFeature: null,
associatedFeature: undefined,
};
this.labelManager.visibleLabels.insert(crossSymbolLabel);
this.labelManager.labels.push(crossSymbolLabel);
});
}
} else if (type === SubscribableArrayEventType.Removed) {
if (!Array.isArray(item[0])) {
if (item && !Array.isArray(item[0])) {
this.labelManager.visibleLabels.removeAt(
this.labelManager.visibleLabels
.getArray()
Expand All @@ -62,13 +62,13 @@ export class OancMarkerManager<T extends number> {

this.flags.sub((index, type, item, _array) => {
if (type === SubscribableArrayEventType.Added) {
if (!Array.isArray(item[0])) {
if (item && !Array.isArray(item[0])) {
const flagSymbolLabel: Label = {
text: index.toString(),
style: LabelStyle.FlagSymbol,
position: item as Position,
rotation: 0,
associatedFeature: null,
associatedFeature: undefined,
};
this.labelManager.visibleLabels.insert(flagSymbolLabel);
this.labelManager.labels.push(flagSymbolLabel);
Expand All @@ -79,14 +79,14 @@ export class OancMarkerManager<T extends number> {
style: LabelStyle.FlagSymbol,
position: pos,
rotation: 0,
associatedFeature: null,
associatedFeature: undefined,
};
this.labelManager.visibleLabels.insert(flagSymbolLabel);
this.labelManager.labels.push(flagSymbolLabel);
});
}
} else if (type === SubscribableArrayEventType.Removed) {
if (!Array.isArray(item[0])) {
if (item && !Array.isArray(item[0])) {
this.labelManager.visibleLabels.removeAt(
this.labelManager.visibleLabels
.getArray()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-3.0

import { DisplayComponent, EventBus, FSComponent, MappedSubject, Subscribable, VNode } from '@microsoft/msfs-sdk';
import { Arinc429SignStatusMatrix, Arinc429Word, EfisNdMode } from '@flybywiresim/fbw-sdk';
import { Arinc429Register, Arinc429SignStatusMatrix, EfisNdMode } from '@flybywiresim/fbw-sdk';

import { OANC_RENDER_HEIGHT, OANC_RENDER_WIDTH } from './';
import { ArcModeUnderlay } from './OancArcModeCompass';
Expand Down Expand Up @@ -51,7 +51,7 @@ export class OancMovingModeOverlay extends DisplayComponent<OancMapOverlayProps>
bus={this.props.bus}
visible={this.roseModeVisible}
rotation={this.props.rotation.map((r) => {
const word = Arinc429Word.empty();
const word = Arinc429Register.empty();

word.ssm = Arinc429SignStatusMatrix.NormalOperation;
word.value = r;
Expand All @@ -66,7 +66,7 @@ export class OancMovingModeOverlay extends DisplayComponent<OancMapOverlayProps>
bus={this.props.bus}
visible={this.arcModeVisible}
rotation={this.props.rotation.map((r) => {
const word = Arinc429Word.empty();
const word = Arinc429Register.empty();

word.ssm = Arinc429SignStatusMatrix.NormalOperation;
word.value = r;
Expand Down Expand Up @@ -109,7 +109,7 @@ export class OancStaticModeOverlay extends DisplayComponent<OancMapOverlayProps>
bus={this.props.bus}
visible={this.roseModeVisible}
rotation={this.props.rotation.map((r) => {
const word = Arinc429Word.empty();
const word = Arinc429Register.empty();

word.ssm = Arinc429SignStatusMatrix.NormalOperation;
word.value = r;
Expand All @@ -124,7 +124,7 @@ export class OancStaticModeOverlay extends DisplayComponent<OancMapOverlayProps>
bus={this.props.bus}
visible={this.arcModeVisible}
rotation={this.props.rotation.map((r) => {
const word = Arinc429Word.empty();
const word = Arinc429Register.empty();

word.ssm = Arinc429SignStatusMatrix.NormalOperation;
word.value = r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export class OancPositionComputer<T extends number> {
constructor(private readonly oanc: Oanc<T>) {}

public computePosition(): string | undefined {
if (!this.oanc.data) {
return;
}
const features = this.oanc.data.features;

for (const feature of features) {
Expand All @@ -39,7 +42,7 @@ export class OancPositionComputer<T extends number> {
return feature.properties.idlin;
case FeatureType.RunwayElement:
case FeatureType.Stopway:
return feature.properties.idrwy.replace('.', '-');
return feature.properties.idrwy?.replace('.', '-');
case FeatureType.BlastPad:
case FeatureType.RunwayDisplacedArea:
return feature.properties.idthr;
Expand Down
Loading

0 comments on commit f334ad1

Please sign in to comment.