|
7 | 7 | Subject, |
8 | 8 | VNode, |
9 | 9 | } from "@microsoft/msfs-sdk" |
10 | | -import { NavigraphNavigationDataInterface } from "@navigraph/msfs-navigation-data-interface" |
| 10 | +import { Coordinates, NavigraphNavigationDataInterface } from "@navigraph/msfs-navigation-data-interface" |
11 | 11 | import { Checkbox, Input } from "../../Input" |
12 | 12 | import { Button, InterfaceNavbarItemV2, InterfaceSwitch } from "../../Utils" |
13 | 13 |
|
@@ -60,6 +60,176 @@ export class TestPage extends DisplayComponent<TestPageProps> { |
60 | 60 | name: "SetActivePackage", |
61 | 61 | functionCallback: input => this.props.interface.download_navigation_data(input ?? ""), |
62 | 62 | }, |
| 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 | + }, |
63 | 233 | ] |
64 | 234 |
|
65 | 235 | private readonly input1 = Subject.create("") |
@@ -89,6 +259,17 @@ export class TestPage extends DisplayComponent<TestPageProps> { |
89 | 259 | return input == "true" ? true : false |
90 | 260 | } |
91 | 261 |
|
| 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 | + |
92 | 273 | private handleFunction = () => { |
93 | 274 | const functionObj = this.selectedFunctionObj.get() |
94 | 275 | const input1 = this.input1.get() |
@@ -158,7 +339,7 @@ export class TestPage extends DisplayComponent<TestPageProps> { |
158 | 339 | <p class="mb-8 text-4xl">Test</p> |
159 | 340 | <div class="size-full w-[875px] flex flex-row"> |
160 | 341 | <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"> |
162 | 343 | {this.functionList.map(obj => ( |
163 | 344 | <InterfaceNavbarItemV2 |
164 | 345 | content={""} |
@@ -207,7 +388,7 @@ export class TestPage extends DisplayComponent<TestPageProps> { |
207 | 388 | noTheming |
208 | 389 | intoNoTheming |
209 | 390 | 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" : ""))} |
211 | 392 | intoClass="flex-grow flex content-center" |
212 | 393 | active={this.input2State.map(obj => (obj.active ? (obj.type === InputStateType.String ? 0 : 1) : 2))} |
213 | 394 | pages={[ |
|
0 commit comments