diff options
Diffstat (limited to 'altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java')
| -rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java | 172 |
1 files changed, 0 insertions, 172 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java deleted file mode 100644 index 26e04c83..00000000 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright © 2013 Mike Beattie <mike@ethernal.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -package org.altusmetrum.AltosDroid; - -import java.util.*; -import java.io.*; - -import org.altusmetrum.altoslib_7.*; - -import android.app.Activity; -import android.graphics.*; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.view.*; -import android.widget.*; -import android.location.Location; -import android.content.*; - -public class TabMapOffline extends AltosDroidTab { - - AltosLatLon here; - - private TextView mDistanceView; - private TextView mBearingView; - private TextView mTargetLatitudeView; - private TextView mTargetLongitudeView; - private TextView mReceiverLatitudeView; - private TextView mReceiverLongitudeView; - private AltosMapOffline map_offline; - private AltosMapOnline map_online; - private View view; - private int map_source; - - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - } - - private void make_offline_map() { - } - - private void make_online_map() { - map_online = new AltosMapOnline(view.getContext()); - map_online.onCreateView(altos_droid.map_type); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - view = inflater.inflate(R.layout.tab_map_offline, container, false); - int map_source = AltosDroidPreferences.map_source(); - - mDistanceView = (TextView)view.findViewById(R.id.distance_value_offline); - mBearingView = (TextView)view.findViewById(R.id.bearing_value_offline); - mTargetLatitudeView = (TextView)view.findViewById(R.id.target_lat_value_offline); - mTargetLongitudeView = (TextView)view.findViewById(R.id.target_lon_value_offline); - mReceiverLatitudeView = (TextView)view.findViewById(R.id.receiver_lat_value_offline); - mReceiverLongitudeView = (TextView)view.findViewById(R.id.receiver_lon_value_offline); - map_offline = (AltosMapOffline)view.findViewById(R.id.map_view_offline); - map_offline.onCreateView(altos_droid.map_type); - map_online = new AltosMapOnline(view.getContext()); - map_online.onCreateView(altos_droid.map_type); - set_map_source(AltosDroidPreferences.map_source()); - return view; - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - if (map_online != null) - getChildFragmentManager().beginTransaction().add(R.id.map_online, map_online.mMapFragment).commit(); - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - } - - public String tab_name() { return "offmap"; } - - private void center(double lat, double lon, double accuracy) { - if (map_offline != null) - map_offline.center(lat, lon, accuracy); - if (map_online != null) - map_online.center(lat, lon, accuracy); - } - - public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) { - if (from_receiver != null) { - mBearingView.setText(String.format("%3.0f°", from_receiver.bearing)); - set_value(mDistanceView, AltosConvert.distance, 6, from_receiver.distance); - } - - if (state != null) { - if (state.gps != null) { - mTargetLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S")); - mTargetLongitudeView.setText(AltosDroid.pos(state.gps.lon, "E", "W")); - } - } - - if (receiver != null) { - double accuracy; - - here = new AltosLatLon(receiver.getLatitude(), receiver.getLongitude()); - if (receiver.hasAccuracy()) - accuracy = receiver.getAccuracy(); - else - accuracy = 1000; - mReceiverLatitudeView.setText(AltosDroid.pos(here.lat, "N", "S")); - mReceiverLongitudeView.setText(AltosDroid.pos(here.lon, "E", "W")); - center (here.lat, here.lon, accuracy); - } - if (map_source == AltosDroidPreferences.MAP_SOURCE_OFFLINE) { - if (map_offline != null) - map_offline.show(telem_state, state, from_receiver, receiver); - } else { - if (map_online != null) - map_online.show(telem_state, state, from_receiver, receiver); - } - } - - @Override - public void set_map_type(int map_type) { - if (map_offline != null) - map_offline.set_map_type(map_type); - if (map_online != null) - map_online.set_map_type(map_type); - } - - @Override - public void set_map_source(int map_source) { - this.map_source = map_source; - if (map_source == AltosDroidPreferences.MAP_SOURCE_OFFLINE) { - if (map_online != null) - map_online.set_visible(false); - if (map_offline != null) { - map_offline.set_visible(true); - map_offline.show(last_telem_state, last_state, last_from_receiver, last_receiver); - } - } else { - if (map_offline != null) - map_offline.set_visible(false); - if (map_online != null) { - map_online.set_visible(true); - map_online.show(last_telem_state, last_state, last_from_receiver, last_receiver); - } - } - } - - public TabMapOffline() { - } -} |
