Skip to content

Commit dc1842d

Browse files
committed
feat: add all function types
todo: fix entry spacing issue
1 parent 51c8f54 commit dc1842d

File tree

2 files changed

+185
-4
lines changed

2 files changed

+185
-4
lines changed

examples/gauge/Components/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
UUID,
88
VNode,
99
} from "@microsoft/msfs-sdk"
10-
import { Button, InterfaceNavbarItemV2 } from "./Utils"
10+
import { InterfaceNavbarItemV2 } from "./Utils"
1111

1212
interface InputProps extends ComponentProps {
1313
value: Subscribable<string>

examples/gauge/Components/Pages/Test/Test.tsx

Lines changed: 184 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Subject,
88
VNode,
99
} from "@microsoft/msfs-sdk"
10-
import { NavigraphNavigationDataInterface } from "@navigraph/msfs-navigation-data-interface"
10+
import { Coordinates, NavigraphNavigationDataInterface } from "@navigraph/msfs-navigation-data-interface"
1111
import { Checkbox, Input } from "../../Input"
1212
import { Button, InterfaceNavbarItemV2, InterfaceSwitch } from "../../Utils"
1313

@@ -60,6 +60,176 @@ export class TestPage extends DisplayComponent<TestPageProps> {
6060
name: "SetActivePackage",
6161
functionCallback: input => this.props.interface.download_navigation_data(input ?? ""),
6262
},
63+
{
64+
index: 4,
65+
arguments: ["uuid: string"],
66+
name: "DeletePackage",
67+
functionCallback: input => this.props.interface.delete_package(input ?? ""),
68+
},
69+
{
70+
index: 5,
71+
arguments: ["count?: string"],
72+
name: "CleanPackages",
73+
functionCallback: input => this.props.interface.clean_packages(Number(input)),
74+
},
75+
{
76+
index: 6,
77+
arguments: [],
78+
name: "GetDatabaseInfo",
79+
functionCallback: () => this.props.interface.get_database_info(),
80+
},
81+
{
82+
index: 7,
83+
arguments: ["ident: string"],
84+
name: "GetAirport",
85+
functionCallback: input => this.props.interface.get_airport(input ?? ""),
86+
},
87+
{
88+
index: 8,
89+
arguments: ["ident: string"],
90+
name: "GetWaypoints",
91+
functionCallback: input => this.props.interface.get_waypoints(input ?? ""),
92+
},
93+
{
94+
index: 9,
95+
arguments: ["ident: string"],
96+
name: "GetVhfNavaids",
97+
functionCallback: input => this.props.interface.get_vhf_navaids(input ?? ""),
98+
},
99+
{
100+
index: 10,
101+
arguments: ["ident: string"],
102+
name: "GetNdbNavaids",
103+
functionCallback: input => this.props.interface.get_ndb_navaids(input ?? ""),
104+
},
105+
{
106+
index: 11,
107+
arguments: ["ident: string"],
108+
name: "GetAirways",
109+
functionCallback: input => this.props.interface.get_airways(input ?? ""),
110+
},
111+
{
112+
index: 12,
113+
arguments: ["fixIdent: string", "fixIcao: string"],
114+
name: "GetAirwaysAtFix",
115+
functionCallback: (input, inputAlt) => this.props.interface.get_airways_at_fix(input ?? "", inputAlt ?? ""),
116+
},
117+
{
118+
index: 13,
119+
arguments: ["center: (lat, long)", "range: nm"],
120+
name: "GetAirportsInRange",
121+
functionCallback: (input, inputAlt) =>
122+
this.props.interface.get_airports_in_range(this.strToCoords(input), Number(inputAlt ?? 0)),
123+
},
124+
{
125+
index: 14,
126+
arguments: ["center: (lat, long)", "range: nm"],
127+
name: "GetWaypointsInRange",
128+
functionCallback: (input, inputAlt) =>
129+
this.props.interface.get_waypoints_in_range(this.strToCoords(input), Number(inputAlt ?? 0)),
130+
},
131+
{
132+
index: 15,
133+
arguments: ["center: (lat, long)", "range: nm"],
134+
name: "GetVhfNavaidsInRange",
135+
functionCallback: (input, inputAlt) =>
136+
this.props.interface.get_vhf_navaids_in_range(this.strToCoords(input), Number(inputAlt ?? 0)),
137+
},
138+
{
139+
index: 16,
140+
arguments: ["center: (lat, long)", "range: nm"],
141+
name: "GetNdbNavaidsInRange",
142+
functionCallback: (input, inputAlt) =>
143+
this.props.interface.get_ndb_navaids_in_range(this.strToCoords(input), Number(inputAlt ?? 0)),
144+
},
145+
{
146+
index: 17,
147+
arguments: ["center: (lat, long)", "range: nm"],
148+
name: "GetAirwaysInRange",
149+
functionCallback: (input, inputAlt) =>
150+
this.props.interface.get_airways_in_range(this.strToCoords(input), Number(inputAlt ?? 0)),
151+
},
152+
{
153+
index: 18,
154+
arguments: ["center: (lat, long)", "range: nm"],
155+
name: "GetControlledAirspacesInRange",
156+
functionCallback: (input, inputAlt) =>
157+
this.props.interface.get_controlled_airspaces_in_range(this.strToCoords(input), Number(inputAlt ?? 0)),
158+
},
159+
{
160+
index: 19,
161+
arguments: ["center: (lat, long)", "range: nm"],
162+
name: "GetRestrictiveAirspacesInRange",
163+
functionCallback: (input, inputAlt) =>
164+
this.props.interface.get_restrictive_airspaces_in_range(this.strToCoords(input), Number(inputAlt ?? 0)),
165+
},
166+
{
167+
index: 20,
168+
arguments: ["center: (lat, long)", "range: nm"],
169+
name: "GetCommunicationsInRange",
170+
functionCallback: (input, inputAlt) =>
171+
this.props.interface.get_communications_in_range(this.strToCoords(input), Number(inputAlt ?? 0)),
172+
},
173+
{
174+
index: 21,
175+
arguments: ["airportIdent: string"],
176+
name: "GetRunwaysAtAirport",
177+
functionCallback: input => this.props.interface.get_runways_at_airport(input ?? ""),
178+
},
179+
{
180+
index: 22,
181+
arguments: ["airportIdent: string"],
182+
name: "GetDeparturesAtAirport",
183+
functionCallback: input => this.props.interface.get_departures_at_airport(input ?? ""),
184+
},
185+
{
186+
index: 23,
187+
arguments: ["airportIdent: string"],
188+
name: "GetArrivalsAtAirport",
189+
functionCallback: input => this.props.interface.get_arrivals_at_airport(input ?? ""),
190+
},
191+
{
192+
index: 24,
193+
arguments: ["airportIdent: string"],
194+
name: "GetApproachesAtAirport",
195+
functionCallback: input => this.props.interface.get_approaches_at_airport(input ?? ""),
196+
},
197+
{
198+
index: 25,
199+
arguments: ["airportIdent: string"],
200+
name: "GetWaypointsAtAirport",
201+
functionCallback: input => this.props.interface.get_waypoints_at_airport(input ?? ""),
202+
},
203+
{
204+
index: 26,
205+
arguments: ["airportIdent: string"],
206+
name: "GetNdbNavaidsAtAirport",
207+
functionCallback: input => this.props.interface.get_ndb_navaids_at_airport(input ?? ""),
208+
},
209+
{
210+
index: 27,
211+
arguments: ["airportIdent: string"],
212+
name: "GetGatesAtAirport",
213+
functionCallback: input => this.props.interface.get_gates_at_airport(input ?? ""),
214+
},
215+
{
216+
index: 28,
217+
arguments: ["airportIdent: string"],
218+
name: "GetCommunicationsAtAirport",
219+
functionCallback: input => this.props.interface.get_communications_at_airport(input ?? ""),
220+
},
221+
{
222+
index: 29,
223+
arguments: ["airportIdent: string"],
224+
name: "GetGlsNavaidsAtAirport",
225+
functionCallback: input => this.props.interface.get_gls_navaids_at_airport(input ?? ""),
226+
},
227+
{
228+
index: 30,
229+
arguments: ["airportIdent: string"],
230+
name: "GetPathPointsAtAirport",
231+
functionCallback: input => this.props.interface.get_path_points_at_airport(input ?? ""),
232+
},
63233
]
64234

65235
private readonly input1 = Subject.create("")
@@ -89,6 +259,17 @@ export class TestPage extends DisplayComponent<TestPageProps> {
89259
return input == "true" ? true : false
90260
}
91261

262+
private strToCoords(input?: string): Coordinates {
263+
const splitInput = (input ?? "").replace(/[(){}\s]/g, "").split(",")
264+
265+
const coords: Coordinates = {
266+
lat: Number(splitInput[0] ?? 0.0),
267+
long: Number(splitInput[1] ?? 0.0),
268+
}
269+
270+
return coords
271+
}
272+
92273
private handleFunction = () => {
93274
const functionObj = this.selectedFunctionObj.get()
94275
const input1 = this.input1.get()
@@ -158,7 +339,7 @@ export class TestPage extends DisplayComponent<TestPageProps> {
158339
<p class="mb-8 text-4xl">Test</p>
159340
<div class="size-full w-[875px] flex flex-row">
160341
<div class="w-1/3 flex flex-col">
161-
<div class="overflow-scroll flex-grow bg-ng-background-500">
342+
<div class="size-full overflow-scroll flex-grow bg-ng-background-500">
162343
{this.functionList.map(obj => (
163344
<InterfaceNavbarItemV2
164345
content={""}
@@ -207,7 +388,7 @@ export class TestPage extends DisplayComponent<TestPageProps> {
207388
noTheming
208389
intoNoTheming
209390
hideLast
210-
class={this.input2State.map(obj => (obj.active ? "size-full flex content-center" : ""))}
391+
class={this.input2State.map(obj => (obj.active ? "h-full w-1/2 flex content-center" : ""))}
211392
intoClass="flex-grow flex content-center"
212393
active={this.input2State.map(obj => (obj.active ? (obj.type === InputStateType.String ? 0 : 1) : 2))}
213394
pages={[

0 commit comments

Comments
 (0)