- if (state.gps != null) {
- mLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S"));
- mLongitudeView.setText(AltosDroid.pos(state.gps.lon, "W", "E"));
- }
-
- if (mapLoaded) {
+ }
+ public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) {
+ if (state != null) {
+ if (state.from_pad != null) {
+ mDistanceView.setText(String.format("%6.0f m", state.from_pad.distance));
+ mBearingView.setText(String.format("%3.0f°", state.from_pad.bearing));
+ }
+ if (mapLoaded) {
+ if (state.gps != null) {
+ mRocketMarker.setPosition(new LatLng(state.gps.lat, state.gps.lon));
+ mRocketMarker.setVisible(true);
+
+ mPolyline.setPoints(Arrays.asList(new LatLng(state.pad_lat, state.pad_lon), new LatLng(state.gps.lat, state.gps.lon)));
+ mPolyline.setVisible(true);
+ }
+
+ if (state.state == AltosLib.ao_flight_pad) {
+ mPadMarker.setPosition(new LatLng(state.pad_lat, state.pad_lon));
+ mPadMarker.setVisible(true);
+ }
+ }