Skip to content

Commit

Permalink
added winds aloft view
Browse files Browse the repository at this point in the history
  • Loading branch information
apps4av committed Jun 6, 2024
1 parent 700875f commit d6aa7fd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/longpress_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class LongPressWidgetState extends State<LongPressWidget> {
int? saaPage;
int? windsPage;
Weather? winds;
String? station = WindsCache.locateNearestStation(ll);
String? station = WindsCache.locateNearestStation(widget.destination.coordinate);
if(station != null) {
winds = Storage().winds.get(station);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/map_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class MapScreenState extends State<MapScreen> {
angle: _northUp ? 0 : Storage().position.heading * pi /
180, child:
CircleAvatar(
backgroundColor: Constants.instrumentBackgroundColor,
backgroundColor: Constants.bottomNavBarBackgroundColor,
child: const Text("10", style: TextStyle(fontSize: 14,
color: Constants.instrumentsNormalValueColor,),)))),
Marker(point: GeoCalculations().calculateOffset(
Expand All @@ -578,7 +578,7 @@ class MapScreenState extends State<MapScreen> {
angle: _northUp ? 0 : Storage().position.heading * pi /
180, child:
CircleAvatar(
backgroundColor: Constants.instrumentBackgroundColor,
backgroundColor: Constants.bottomNavBarBackgroundColor,
child: const Text("5", style: TextStyle(fontSize: 14,
color: Constants.instrumentsNormalValueColor,),)))),
Marker(point: GeoCalculations().calculateOffset(
Expand All @@ -587,7 +587,7 @@ class MapScreenState extends State<MapScreen> {
angle: _northUp ? 0 : Storage().position.heading * pi /
180, child:
CircleAvatar(
backgroundColor: Constants.instrumentBackgroundColor,
backgroundColor: Constants.bottomNavBarBackgroundColor,
child: const Text("2", style: TextStyle(fontSize: 14,
color: Constants.instrumentsNormalValueColor,),)))),
],
Expand Down
11 changes: 5 additions & 6 deletions lib/weather/winds_aloft.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,15 @@ class WindsAloft extends Weather {

@override
toString() {
String wind = "Winds - $station\n\n";
DateTime zulu = expires.toUtc(); // winds in Zulu time
// boilerplate
String wind = "Winds - $station (Temps negative above 24000)\nValid till ${zulu.hour.toString().padLeft(2, "0")}00Z\n\n";
for(double altitude = 3000; altitude < 42000; altitude += 3000) {
double? speed;
double? dir;
(dir, speed) = getWindAtAltitude(altitude);
if(speed == null || dir == null) {
wind += "N/A\n";
break;
}
wind += " @${altitude.round().toString().toString().padLeft(5, "0")}FT ${dir.round().toString().padLeft(3, "0")}\u00b0 ${speed.round()}KT (${getWindAtAltitudeRaw(altitude.round())})\n";
// show dir, speed, and actual string for every 3000ft
wind += " @${altitude.round().toString().toString().padLeft(5, "0")}FT ${dir == null ? "" : "${dir.round().toString().padLeft(3, "0")}\u00b0"} ${speed == null ? "" : "${speed.round()}KT"} (${getWindAtAltitudeRaw(altitude.round())})\n";
}
return wind;
}
Expand Down
20 changes: 10 additions & 10 deletions lib/weather/winds_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ class WindsCache extends WeatherCache {
continue;
}
try {
String station = line.substring(0, 3);
String k3 = line.substring(4, 8);
String k6 = line.substring(9, 16);
String k9 = line.substring(17, 24);
String k12 = line.substring(25, 32);
String k18 = line.substring(33, 40);
String k24 = line.substring(41, 48);
String k30 = line.substring(49, 55);
String k34 = line.substring(56, 62);
String k39 = line.substring(63, 69);
String station = line.substring(0, 3).trim();
String k3 = line.substring(4, 8).trim();
String k6 = line.substring(9, 16).trim();
String k9 = line.substring(17, 24).trim();
String k12 = line.substring(25, 32).trim();
String k18 = line.substring(33, 40).trim();
String k24 = line.substring(41, 48).trim();
String k30 = line.substring(49, 55).trim();
String k34 = line.substring(56, 62).trim();
String k39 = line.substring(63, 69).trim();
LatLng? coordinate = _stationMap[station];
if(coordinate == null) {
continue; // not recognized need this
Expand Down

0 comments on commit d6aa7fd

Please sign in to comment.