From 46143c64dbdcbbfb478b2df4949c617682427d63 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 8 Feb 2012 12:01:04 +0000 Subject: Moved rdf stuff to new branch --- src/net/cbaines/suma/BuildingActivity.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/net/cbaines/suma/BuildingActivity.java b/src/net/cbaines/suma/BuildingActivity.java index 7637439..987d139 100644 --- a/src/net/cbaines/suma/BuildingActivity.java +++ b/src/net/cbaines/suma/BuildingActivity.java @@ -25,9 +25,6 @@ import java.util.HashSet; import android.content.Context; import android.os.Bundle; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.util.FileManager; import com.j256.ormlite.android.apptools.OrmLiteBaseActivity; public class BuildingActivity extends OrmLiteBaseActivity { @@ -47,7 +44,7 @@ public class BuildingActivity extends OrmLiteBaseActivity { final DatabaseHelper helper = getHelper(); // create an empty model - Model model = ModelFactory.createDefaultModel(); + // Model model = ModelFactory.createDefaultModel(); // use the FileManager to find the input file InputStream in = getResources().openRawResource(R.raw.u9); @@ -56,7 +53,7 @@ public class BuildingActivity extends OrmLiteBaseActivity { } // read the RDF/XML file - model.read(in, null); + // model.read(in, null); -- cgit v1.2.3 From 420be2795802a4a828c2d0063b9a9cdf382130e1 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 20 Feb 2012 10:29:21 +0000 Subject: Added libs to folder libs/ --- libs/ormlite-android-4.33.jar | Bin 0 -> 44784 bytes libs/ormlite-core-4.33.jar | Bin 0 -> 256726 bytes libs/osmdroid-android-3.0.5.jar | Bin 0 -> 256286 bytes libs/slf4j-android-1.5.8.jar | Bin 0 -> 28822 bytes src/net/cbaines/suma/BusActivity.java | 576 +++++++++--------- src/net/cbaines/suma/BusSpecificStopView.java | 256 ++++---- src/net/cbaines/suma/BusStopActivity.java | 836 +++++++++++++------------- src/net/cbaines/suma/StopView.java | 247 ++++---- 8 files changed, 1005 insertions(+), 910 deletions(-) create mode 100644 libs/ormlite-android-4.33.jar create mode 100644 libs/ormlite-core-4.33.jar create mode 100644 libs/osmdroid-android-3.0.5.jar create mode 100644 libs/slf4j-android-1.5.8.jar diff --git a/libs/ormlite-android-4.33.jar b/libs/ormlite-android-4.33.jar new file mode 100644 index 0000000..76001fa Binary files /dev/null and b/libs/ormlite-android-4.33.jar differ diff --git a/libs/ormlite-core-4.33.jar b/libs/ormlite-core-4.33.jar new file mode 100644 index 0000000..6d1e059 Binary files /dev/null and b/libs/ormlite-core-4.33.jar differ diff --git a/libs/osmdroid-android-3.0.5.jar b/libs/osmdroid-android-3.0.5.jar new file mode 100644 index 0000000..8617fef Binary files /dev/null and b/libs/osmdroid-android-3.0.5.jar differ diff --git a/libs/slf4j-android-1.5.8.jar b/libs/slf4j-android-1.5.8.jar new file mode 100644 index 0000000..e0128bc Binary files /dev/null and b/libs/slf4j-android-1.5.8.jar differ diff --git a/src/net/cbaines/suma/BusActivity.java b/src/net/cbaines/suma/BusActivity.java index b802cfb..2b76176 100644 --- a/src/net/cbaines/suma/BusActivity.java +++ b/src/net/cbaines/suma/BusActivity.java @@ -24,320 +24,338 @@ import android.widget.Toast; import com.j256.ormlite.android.apptools.OrmLiteBaseActivity; -public class BusActivity extends OrmLiteBaseActivity implements Preferences { - final static String TAG = "BusActivity"; - - private TextView U1RouteTextView; - private TextView U1NRouteTextView; - private TextView U2RouteTextView; - private TextView U6RouteTextView; - private TextView U9RouteTextView; - - private TextView busIDTextView; - - private TextView busContentMessage; - private LinearLayout busActivityContentLayout; - - Toast activityToast; - - /** - * The bus this activity is focused on - */ - private Bus bus; - /** - * The bus stop this activity is working from - */ - private BusStop busStop; - - Runnable refreshData; - - protected Timetable timetable; - private Timetable visibleTimetable; - - private ListView timetableView; - - private Context instance; - - // BusStops and if they are being updated by the handler - List busStops; - - private HashMap tasks = new HashMap(); - - Handler handler; - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.bus_activity); - instance = this; - - String busID = getIntent().getExtras().getString("busID"); - String busStopID = getIntent().getExtras().getString("busStopID"); - final DatabaseHelper helper = getHelper(); - - try { - List buses = helper.getBusDao().queryForEq(Bus.ID_FIELD_NAME, busID); - bus = null; - if (buses.size() == 0) { - Log.e(TAG, "Bus " + busID + " not found!"); - } else if (buses.size() == 1) { - bus = buses.get(0); - } else if (buses.size() > 1) { - Log.e(TAG, "Found more than one bus? " + busID); - } - - helper.getBusRouteDao().refresh(bus.route); - - busStop = null; - if (busStopID != null) { - List busStops = helper.getBusStopDao().queryForEq(BusStop.ID_FIELD_NAME, busStopID); - if (busStops.size() == 0) { - Log.e(TAG, "BusStop " + busStopID + " not found!"); - } else if (busStops.size() == 1) { - busStop = busStops.get(0); - } else if (busStops.size() > 1) { - Log.e(TAG, "Found more than one busStop? " + busStopID); - } - } - - U1RouteTextView = (TextView) findViewById(R.id.busActivityU1); - U1NRouteTextView = (TextView) findViewById(R.id.busActivityU1N); - U2RouteTextView = (TextView) findViewById(R.id.busActivityU2); - U6RouteTextView = (TextView) findViewById(R.id.busActivityU6); - U9RouteTextView = (TextView) findViewById(R.id.busActivityU9); - - busIDTextView = (TextView) findViewById(R.id.busActivityBusID); - - busContentMessage = (TextView) findViewById(R.id.busActivityMessage); - busActivityContentLayout = (LinearLayout) findViewById(R.id.busActivityContentLayout); - timetableView = (ListView) findViewById(R.id.busActivityTimes); - - if (bus.id != null) { - Log.i(TAG, "Bus id is not null (" + bus.id + ") setting busIDTextView"); - busIDTextView.setText(bus.id + " " + bus.getName()); - } else { - Log.w(TAG, "Bus id is null?"); - // Might not ever happen - busIDTextView.setText("Unidentified"); - } - - U1RouteTextView.setVisibility(View.GONE); - U1NRouteTextView.setVisibility(View.GONE); - U2RouteTextView.setVisibility(View.GONE); - U6RouteTextView.setVisibility(View.GONE); - U9RouteTextView.setVisibility(View.GONE); - - // if (bus.route.uniLink) { - Log.i(TAG, "Bus is uniLink"); - if (bus.route.code.equals("U1")) { - U1RouteTextView.setVisibility(View.VISIBLE); - } else if (bus.route.code.equals("U1N")) { - U1NRouteTextView.setVisibility(View.VISIBLE); - } else if (bus.route.code.equals("U2")) { - U2RouteTextView.setVisibility(View.VISIBLE); - } else if (bus.route.code.equals("U6")) { - U6RouteTextView.setVisibility(View.VISIBLE); - } else if (bus.route.code.equals("U9")) { - U9RouteTextView.setVisibility(View.VISIBLE); - } else { - Log.e(TAG, "Route not found " + bus.route.code); - } - // } else { - // Log.i(TAG, "Bus is not uniLink"); - // } - - } catch (NumberFormatException e) { - e.printStackTrace(); - } catch (SQLException e) { - e.printStackTrace(); - } +public class BusActivity extends OrmLiteBaseActivity implements + Preferences { + final static String TAG = "BusActivity"; - busStops = bus.route.getRouteSection(instance, bus.direction); - Log.i(TAG, "Got " + busStops.size() + " bus stops for this bus"); + private TextView U1RouteTextView; + private TextView U1NRouteTextView; + private TextView U2RouteTextView; + private TextView U6RouteTextView; + private TextView U9RouteTextView; - if (bus.destination != null) { - Log.i(TAG, "Bus destination is " + bus.destination); - } else { - Log.i(TAG, "Bus destination is null"); - } + private TextView busIDTextView; + + private TextView busContentMessage; + private LinearLayout busActivityContentLayout; + + Toast activityToast; - /* - * for (int i = 0;; i++) { BusStop nextStop = bus.route.moveInRoute(instance, busStops.get(i), bus.direction, - * 1); - * - * if (nextStop.equals(busStop) || (bus.destination != null && bus.destination.equals(nextStop))) { break; } - * - * busStops.add(nextStop); busStopsActive.add(false); - * - * if (busStops.size() > 50) { Log.e(TAG, "Got more than 50 bus stops"); break; } } + /** + * The bus this activity is focused on */ + private Bus bus; + /** + * The bus stop this activity is working from + */ + private BusStop busStop; + + Runnable refreshData; + + protected Timetable timetable; + private Timetable visibleTimetable; + + private ListView timetableView; - refreshData = new Runnable() { - @Override - public void run() { - for (int num = timetableView.getFirstVisiblePosition(); num < timetableView.getLastVisiblePosition(); num++) { - Stop stop = timetable.get(num); + private Context instance; - GetTimetableStopTask task = tasks.get(busStops.get(num)); + // BusStops and if they are being updated by the handler + List busStops; - if (stop.timeOfFetch == null || (stop.timeOfFetch.getTime() - System.currentTimeMillis()) > 20000) { - if (task != null) { - if (task.getStatus() == AsyncTask.Status.FINISHED) { - task = null; - } + private HashMap tasks = new HashMap(); + + Handler handler; + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.bus_activity); + instance = this; + + String busID = getIntent().getExtras().getString("busID"); + String busStopID = getIntent().getExtras().getString("busStopID"); + final DatabaseHelper helper = getHelper(); + + try { + List buses = helper.getBusDao().queryForEq(Bus.ID_FIELD_NAME, + busID); + bus = null; + if (buses.size() == 0) { + Log.e(TAG, "Bus " + busID + " not found!"); + } else if (buses.size() == 1) { + bus = buses.get(0); + } else if (buses.size() > 1) { + Log.e(TAG, "Found more than one bus? " + busID); } - if (task == null) { - task = new GetTimetableStopTask(); - BusStop[] str = { stop.busStop }; - task.execute(str); - tasks.put(stop.busStop, task); + helper.getBusRouteDao().refresh(bus.route); + + busStop = null; + if (busStopID != null) { + List busStops = helper.getBusStopDao().queryForEq( + BusStop.ID_FIELD_NAME, busStopID); + if (busStops.size() == 0) { + Log.e(TAG, "BusStop " + busStopID + " not found!"); + } else if (busStops.size() == 1) { + busStop = busStops.get(0); + } else if (busStops.size() > 1) { + Log.e(TAG, "Found more than one busStop? " + busStopID); + } } - } - } - handler.postDelayed(refreshData, 50000); - } - }; + U1RouteTextView = (TextView) findViewById(R.id.busActivityU1); + U1NRouteTextView = (TextView) findViewById(R.id.busActivityU1N); + U2RouteTextView = (TextView) findViewById(R.id.busActivityU2); + U6RouteTextView = (TextView) findViewById(R.id.busActivityU6); + U9RouteTextView = (TextView) findViewById(R.id.busActivityU9); + + busIDTextView = (TextView) findViewById(R.id.busActivityBusID); + + busContentMessage = (TextView) findViewById(R.id.busActivityMessage); + busActivityContentLayout = (LinearLayout) findViewById(R.id.busActivityContentLayout); + timetableView = (ListView) findViewById(R.id.busActivityTimes); + + if (bus.id != null) { + Log.i(TAG, "Bus id is not null (" + bus.id + + ") setting busIDTextView"); + busIDTextView.setText(bus.id + " " + bus.getName()); + } else { + Log.w(TAG, "Bus id is null?"); + // Might not ever happen + busIDTextView.setText("Unidentified"); + } - } + U1RouteTextView.setVisibility(View.GONE); + U1NRouteTextView.setVisibility(View.GONE); + U2RouteTextView.setVisibility(View.GONE); + U6RouteTextView.setVisibility(View.GONE); + U9RouteTextView.setVisibility(View.GONE); + + // if (bus.route.uniLink) { + Log.i(TAG, "Bus is uniLink"); + if (bus.route.code.equals("U1")) { + U1RouteTextView.setVisibility(View.VISIBLE); + } else if (bus.route.code.equals("U1N")) { + U1NRouteTextView.setVisibility(View.VISIBLE); + } else if (bus.route.code.equals("U2")) { + U2RouteTextView.setVisibility(View.VISIBLE); + } else if (bus.route.code.equals("U6")) { + U6RouteTextView.setVisibility(View.VISIBLE); + } else if (bus.route.code.equals("U9")) { + U9RouteTextView.setVisibility(View.VISIBLE); + } else { + Log.e(TAG, "Route not found " + bus.route.code); + } + // } else { + // Log.i(TAG, "Bus is not uniLink"); + // } + + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } - public void onResume() { - super.onResume(); + busStops = bus.route.getRouteSection(instance, bus.direction); + Log.i(TAG, "Got " + busStops.size() + " bus stops for this bus"); - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); - if (sharedPrefs.getBoolean(UNI_LINK_BUS_TIMES, UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT) - || sharedPrefs.getBoolean(NON_UNI_LINK_BUS_TIMES, NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)) { - Log.i(TAG, "Live Times enabled"); - timetable = (Timetable) getLastNonConfigurationInstance(); + if (bus.destination != null) { + Log.i(TAG, "Bus destination is " + bus.destination); + } else { + Log.i(TAG, "Bus destination is null"); + } - handler = new Handler(); + /* + * for (int i = 0;; i++) { BusStop nextStop = + * bus.route.moveInRoute(instance, busStops.get(i), bus.direction, 1); + * + * if (nextStop.equals(busStop) || (bus.destination != null && + * bus.destination.equals(nextStop))) { break; } + * + * busStops.add(nextStop); busStopsActive.add(false); + * + * if (busStops.size() > 50) { Log.e(TAG, "Got more than 50 bus stops"); + * break; } } + */ + + refreshData = new Runnable() { + public void run() { + for (int num = timetableView.getFirstVisiblePosition(); num < timetableView + .getLastVisiblePosition(); num++) { + Stop stop = timetable.get(num); + + GetTimetableStopTask task = tasks.get(busStops.get(num)); + + if (stop.timeOfFetch == null + || (stop.timeOfFetch.getTime() - System + .currentTimeMillis()) > 20000) { + if (task != null) { + if (task.getStatus() == AsyncTask.Status.FINISHED) { + task = null; + } + } + + if (task == null) { + task = new GetTimetableStopTask(); + BusStop[] str = { stop.busStop }; + task.execute(str); + tasks.put(stop.busStop, task); + } + } + + } + handler.postDelayed(refreshData, 50000); + } + }; - if (timetable == null) { - Log.i(TAG, "No Previous timetable"); - timetable = new Timetable(); - for (int i = 0; i < busStops.size(); i++) { - timetable.add(new Stop(bus, busStops.get(i), null, null, false)); - } - Log.v(TAG, "Finished adding placeholder stops"); - } else { - Log.i(TAG, "Displaying previous timetable"); - - } - displayTimetable(timetable); - handler.postDelayed(refreshData, 500); - - } else { - Log.i(TAG, "Live Times Disabled"); - busContentMessage.setText("Live bus times disabled"); - busContentMessage.setVisibility(View.VISIBLE); } - } + public void onResume() { + super.onResume(); + + SharedPreferences sharedPrefs = PreferenceManager + .getDefaultSharedPreferences(this); + if (sharedPrefs.getBoolean(UNI_LINK_BUS_TIMES, + UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT) + || sharedPrefs.getBoolean(NON_UNI_LINK_BUS_TIMES, + NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)) { + Log.i(TAG, "Live Times enabled"); + timetable = (Timetable) getLastNonConfigurationInstance(); + + handler = new Handler(); + + if (timetable == null) { + Log.i(TAG, "No Previous timetable"); + timetable = new Timetable(); + for (int i = 0; i < busStops.size(); i++) { + timetable.add(new Stop(bus, busStops.get(i), null, null, + false)); + } + Log.v(TAG, "Finished adding placeholder stops"); + } else { + Log.i(TAG, "Displaying previous timetable"); - public void onPause() { - if (handler != null) { // BusTimes are enabled - handler.removeCallbacks(refreshData); - for (GetTimetableStopTask task : tasks.values()) { - if (task != null) { - task.cancel(true); + } + displayTimetable(timetable); + handler.postDelayed(refreshData, 500); + + } else { + Log.i(TAG, "Live Times Disabled"); + busContentMessage.setText("Live bus times disabled"); + busContentMessage.setVisibility(View.VISIBLE); } - } - Log.i(TAG, "Stoping refreshing timetable data"); } - super.onPause(); - } + public void onPause() { + if (handler != null) { // BusTimes are enabled + handler.removeCallbacks(refreshData); + for (GetTimetableStopTask task : tasks.values()) { + if (task != null) { + task.cancel(true); + } + } - private class GetTimetableStopTask extends AsyncTask { - private String errorMessage; + Log.i(TAG, "Stoping refreshing timetable data"); + } - private BusStop busStop; + super.onPause(); + } - private int position; + private class GetTimetableStopTask extends + AsyncTask { + private String errorMessage; - protected void onPreExecute() { - // progBar.setVisibility(View.VISIBLE); - } + private BusStop busStop; - protected Stop doInBackground(BusStop... busStopArray) { - busStop = busStopArray[0]; - position = busStops.indexOf(busStop); - Stop stop = null; + private int position; - try { - Log.i(TAG, "Fetching stop for busStop " + position); - stop = DataManager.getStop(instance, bus, busStop); - if (stop == null) { - stop = new Stop(bus, busStop, null, null, false); + protected void onPreExecute() { + // progBar.setVisibility(View.VISIBLE); } - Log.i(TAG, "Finished fetching stop for busStop " + position); - } catch (SQLException e) { - errorMessage = "Error message regarding SQL?"; - e.printStackTrace(); - } catch (ClientProtocolException e) { - errorMessage = "ClientProtocolException!?!"; - e.printStackTrace(); - } catch (IOException e) { - errorMessage = "Error fetching bus times from server, are you connected to the internet?"; - e.printStackTrace(); - } catch (JSONException e) { - errorMessage = "Error parsing bus times"; - e.printStackTrace(); - } - return stop; - } - protected void onPostExecute(Stop stop) { - // Log.i(TAG, "Got timetable"); - if (stop == null) { - Log.i(TAG, "Its null"); - - busContentMessage.setText(errorMessage); - busContentMessage.setVisibility(View.VISIBLE); - } else { - synchronized (timetable) { - timetable.set(position, stop); - displayTimetable(timetable); + protected Stop doInBackground(BusStop... busStopArray) { + busStop = busStopArray[0]; + position = busStops.indexOf(busStop); + Stop stop = null; + + try { + Log.i(TAG, "Fetching stop for busStop " + position); + stop = DataManager.getStop(instance, bus, busStop); + if (stop == null) { + stop = new Stop(bus, busStop, null, null, false); + } + Log.i(TAG, "Finished fetching stop for busStop " + position); + } catch (SQLException e) { + errorMessage = "Error message regarding SQL?"; + e.printStackTrace(); + } catch (ClientProtocolException e) { + errorMessage = "ClientProtocolException!?!"; + e.printStackTrace(); + } catch (IOException e) { + errorMessage = "Error fetching bus times from server, are you connected to the internet?"; + e.printStackTrace(); + } catch (JSONException e) { + errorMessage = "Error parsing bus times"; + e.printStackTrace(); + } + return stop; + } + + protected void onPostExecute(Stop stop) { + // Log.i(TAG, "Got timetable"); + if (stop == null) { + Log.i(TAG, "Its null"); + + busContentMessage.setText(errorMessage); + busContentMessage.setVisibility(View.VISIBLE); + } else { + synchronized (timetable) { + timetable.set(position, stop); + displayTimetable(timetable); + } + } } - } + } - } - - private void displayTimetable(Timetable timetable) { - visibleTimetable = (Timetable) timetable.clone(); - - // Log.i(TAG, "Displaying timetable, it contains " + visibleTimetable.size() + " stops"); - - if (timetable.size() == 0) { - busContentMessage.setText("No Busses"); - busContentMessage.setVisibility(View.VISIBLE); - busActivityContentLayout.setGravity(Gravity.CENTER); - } else { - if (visibleTimetable.size() == 0) { - busActivityContentLayout.setGravity(Gravity.CENTER); - busContentMessage.setText("No Busses (With the current enabled routes)"); - busContentMessage.setVisibility(View.VISIBLE); - timetableView.setVisibility(View.GONE); - } else { - timetableView.setVisibility(View.VISIBLE); - busContentMessage.setVisibility(View.GONE); - BusSpecificTimetableAdapter adapter; - if ((adapter = (BusSpecificTimetableAdapter) timetableView.getAdapter()) != null) { - adapter.updateTimetable(visibleTimetable); + private void displayTimetable(Timetable timetable) { + visibleTimetable = (Timetable) timetable.clone(); + + // Log.i(TAG, "Displaying timetable, it contains " + + // visibleTimetable.size() + " stops"); + + if (timetable.size() == 0) { + busContentMessage.setText("No Busses"); + busContentMessage.setVisibility(View.VISIBLE); + busActivityContentLayout.setGravity(Gravity.CENTER); } else { - adapter = new BusSpecificTimetableAdapter(this, visibleTimetable); - timetableView.setAdapter(adapter); - if (busStop != null) { - Log.i(TAG, - "Moving to position of " + busStop.description + " which is " - + busStops.indexOf(busStop)); - timetableView.setSelection(busStops.indexOf(busStop)); - } + if (visibleTimetable.size() == 0) { + busActivityContentLayout.setGravity(Gravity.CENTER); + busContentMessage + .setText("No Busses (With the current enabled routes)"); + busContentMessage.setVisibility(View.VISIBLE); + timetableView.setVisibility(View.GONE); + } else { + timetableView.setVisibility(View.VISIBLE); + busContentMessage.setVisibility(View.GONE); + BusSpecificTimetableAdapter adapter; + if ((adapter = (BusSpecificTimetableAdapter) timetableView + .getAdapter()) != null) { + adapter.updateTimetable(visibleTimetable); + } else { + adapter = new BusSpecificTimetableAdapter(this, + visibleTimetable); + timetableView.setAdapter(adapter); + if (busStop != null) { + Log.i(TAG, + "Moving to position of " + busStop.description + + " which is " + + busStops.indexOf(busStop)); + timetableView.setSelection(busStops.indexOf(busStop)); + } + } + busActivityContentLayout.setGravity(Gravity.TOP); + } } - busActivityContentLayout.setGravity(Gravity.TOP); - } } - } } diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java index 77601ff..bdebcba 100644 --- a/src/net/cbaines/suma/BusSpecificStopView.java +++ b/src/net/cbaines/suma/BusSpecificStopView.java @@ -36,152 +36,178 @@ import android.widget.Toast; import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.dao.Dao; -public class BusSpecificStopView extends LinearLayout implements OnClickListener, OnLongClickListener { +public class BusSpecificStopView extends LinearLayout implements + OnClickListener, OnLongClickListener { - private static final String TAG = "BusSpecificStopView"; + private static final String TAG = "BusSpecificStopView"; - // private static final String TAG = "StopView"; + // private static final String TAG = "StopView"; - private final TextView location; - private final TextView time; - private String onClickMessage = ""; - private final BusActivity context; + private final TextView location; + private final TextView time; + private String onClickMessage = ""; + private final BusActivity context; - private Stop stop; + private Stop stop; - public BusSpecificStopView(BusActivity context, Stop stop) { - super(context); + public BusSpecificStopView(BusActivity context, Stop stop) { + super(context); - this.context = context; + this.context = context; - this.setOrientation(HORIZONTAL); + this.setOrientation(HORIZONTAL); - location = new TextView(context); - location.setTextSize(22f); + location = new TextView(context); + location.setTextSize(22f); - time = new TextView(context); - time.setTextSize(22f); - time.setGravity(Gravity.RIGHT); + time = new TextView(context); + time.setTextSize(22f); + time.setGravity(Gravity.RIGHT); - setStop(stop); + setStop(stop); - addView(location, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); - addView(time, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); + addView(location, new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); + addView(time, new LayoutParams(LayoutParams.FILL_PARENT, + LayoutParams.WRAP_CONTENT)); - } - - public void setStop(Stop stop) { - - // Log.i(TAG, "Time of arival " + stop.arivalTime); - - this.stop = stop; - - if (stop == null) { - Log.e(TAG, "stop == null"); - } - if (stop.busStop == null) { - Log.e(TAG, "stop.busStop == null"); - } - if (stop.busStop.description == null) { - Log.e(TAG, "stop.busStop.description == null"); } - if (stop.busStop.description.length() > 20) { - location.setText(stop.busStop.description.substring(0, 20)); // TODO - } else { - location.setText(stop.busStop.description); // TODO - } - if (stop.arivalTime != null) { - time.setText(stop.getShortTimeToArival()); - } else { - time.setText(""); - } + public void setStop(Stop stop) { - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + // Log.i(TAG, "Time of arival " + stop.arivalTime); - try { - Dao busDao = helper.getBusDao(); + this.stop = stop; - busDao.refresh(stop.bus); - - if (stop.arivalTime != null) { + if (stop == null) { + Log.e(TAG, "stop == null"); + } + if (stop.busStop == null) { + Log.e(TAG, "stop.busStop == null"); + } + if (stop.busStop.description == null) { + Log.e(TAG, "stop.busStop.description == null"); + } - if (stop.bus.id != null) { - if (stop.live) { - onClickMessage = "Bus " + stop.bus.toString() + " at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); - } else { - onClickMessage = "Timetabled bus " + stop.bus.toString() + " at " - + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); - } + if (stop.busStop.description.length() > 20) { + location.setText(stop.busStop.description.substring(0, 20)); // TODO } else { - if (stop.live) { - onClickMessage = "Unidentified bus (" + stop.bus.getName() + ") at " - + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); - } else { - onClickMessage = "Timetabled bus (" + stop.bus.getName() + ") at " - + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); - } + location.setText(stop.busStop.description); // TODO } - } else { - if (stop.bus.id != null) { - if (stop.live) { - onClickMessage = "Bus " + stop.bus.toString(); - } else { - onClickMessage = "Timetabled bus " + stop.bus.toString(); - } + if (stop.arivalTime != null) { + time.setText(stop.getShortTimeToArival()); } else { - if (stop.live) { - onClickMessage = "Unidentified bus (" + stop.bus.getName() + ")"; - } else { - onClickMessage = "Timetabled bus (" + stop.bus.getName() + ")"; - } + time.setText(""); } - } - } catch (SQLException e) { - e.printStackTrace(); - } - this.setOnClickListener(this); - this.setOnLongClickListener(this); - } + DatabaseHelper helper = OpenHelperManager.getHelper(context, + DatabaseHelper.class); + + try { + Dao busDao = helper.getBusDao(); + + busDao.refresh(stop.bus); + + if (stop.arivalTime != null) { + + if (stop.bus.id != null) { + if (stop.live) { + onClickMessage = "Bus " + + stop.bus.toString() + + " at " + + DateFormat.getTimeInstance(DateFormat.SHORT) + .format(stop.arivalTime); + } else { + onClickMessage = "Timetabled bus " + + stop.bus.toString() + + " at " + + DateFormat.getTimeInstance(DateFormat.SHORT) + .format(stop.arivalTime); + } + } else { + if (stop.live) { + onClickMessage = "Unidentified bus (" + + stop.bus.getName() + + ") at " + + DateFormat.getTimeInstance(DateFormat.SHORT) + .format(stop.arivalTime); + } else { + onClickMessage = "Timetabled bus (" + + stop.bus.getName() + + ") at " + + DateFormat.getTimeInstance(DateFormat.SHORT) + .format(stop.arivalTime); + } + } + } else { + if (stop.bus.id != null) { + if (stop.live) { + onClickMessage = "Bus " + stop.bus.toString(); + } else { + onClickMessage = "Timetabled bus " + + stop.bus.toString(); + } + } else { + if (stop.live) { + onClickMessage = "Unidentified bus (" + + stop.bus.getName() + ")"; + } else { + onClickMessage = "Timetabled bus (" + + stop.bus.getName() + ")"; + } + } + } + } catch (SQLException e) { + e.printStackTrace(); + } - public void onClick(View v) { - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, onClickMessage, Toast.LENGTH_SHORT); - } else { - context.activityToast.setText(onClickMessage); - context.activityToast.setDuration(Toast.LENGTH_SHORT); + this.setOnClickListener(this); + this.setOnLongClickListener(this); } - context.activityToast.show(); - } - - @Override - public boolean onLongClick(View v) { // TODO - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - try { - Dao busDao = helper.getBusDao(); - - busDao.refresh(stop.bus); - - if (stop.bus.id != null) { - Intent i = new Intent(context, MapActivity.class); - i.putExtra("poiPoint", stop.busStop.point.toDoubleString()); - ((Activity) context).startActivityForResult(i, 0); - } else { + public void onClick(View v) { if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, "Arival prediction not avalible for timetabled buses", Toast.LENGTH_SHORT); + context.activityToast = Toast.makeText(context, onClickMessage, + Toast.LENGTH_SHORT); } else { - context.activityToast.setText("Arival prediction not avalible for timetabled buses"); - context.activityToast.setDuration(Toast.LENGTH_SHORT); + context.activityToast.setText(onClickMessage); + context.activityToast.setDuration(Toast.LENGTH_SHORT); } context.activityToast.show(); - } + } - } catch (SQLException e) { - e.printStackTrace(); + public boolean onLongClick(View v) { // TODO + DatabaseHelper helper = OpenHelperManager.getHelper(context, + DatabaseHelper.class); + + try { + Dao busDao = helper.getBusDao(); + + busDao.refresh(stop.bus); + + if (stop.bus.id != null) { + Intent i = new Intent(context, MapActivity.class); + i.putExtra("poiPoint", stop.busStop.point.toDoubleString()); + ((Activity) context).startActivityForResult(i, 0); + } else { + if (context.activityToast == null) { + context.activityToast = Toast + .makeText( + context, + "Arival prediction not avalible for timetabled buses", + Toast.LENGTH_SHORT); + } else { + context.activityToast + .setText("Arival prediction not avalible for timetabled buses"); + context.activityToast.setDuration(Toast.LENGTH_SHORT); + } + context.activityToast.show(); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + return false; } - return false; - } } diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java index 03dcbca..d9eaed3 100644 --- a/src/net/cbaines/suma/BusStopActivity.java +++ b/src/net/cbaines/suma/BusStopActivity.java @@ -59,455 +59,481 @@ import com.j256.ormlite.dao.Dao; import com.j256.ormlite.stmt.PreparedQuery; import com.j256.ormlite.stmt.QueryBuilder; -public class BusStopActivity extends OrmLiteBaseActivity implements OnCheckedChangeListener, Preferences, OnItemClickListener { +public class BusStopActivity extends OrmLiteBaseActivity + implements OnCheckedChangeListener, Preferences, OnItemClickListener { - final static String TAG = "BusTimeActivity"; - - private boolean dataChanged; - - private ListView busTimeList; - private TextView busName; - private TextView busID; - private CheckBox busFavourite; - private TextView busStopMessage; - private ProgressBar progBar; - private LinearLayout busTimeContentLayout; - - protected Timetable timetable; - private Timetable visibleTimetable; - - protected String busStopID; - private String busStopName; - - private Dao busStopDao; - - private BusStop busStop; - - private GetTimetableTask timetableTask; - - private Context instance; - - private Handler mHandler; - private Runnable refreshData; - - private CheckBox U1RouteRadioButton; - private CheckBox U1NRouteRadioButton; - private CheckBox U2RouteRadioButton; - private CheckBox U6RouteRadioButton; - private CheckBox U9RouteRadioButton; - - private static final int POI_DIALOG_ID = 0; - private POIDialog busDialog; - - private HashSet routes = new HashSet(); - - Toast activityToast; - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.bustimes); - - final DatabaseHelper helper = getHelper(); - - instance = this; - - busStopID = getIntent().getExtras().getString("busStopID"); - busStopName = getIntent().getExtras().getString("busStopName"); - - U1RouteRadioButton = (CheckBox) findViewById(R.id.radio_u1); - U1NRouteRadioButton = (CheckBox) findViewById(R.id.radio_u1n); - U2RouteRadioButton = (CheckBox) findViewById(R.id.radio_u2); - U6RouteRadioButton = (CheckBox) findViewById(R.id.radio_u6); - U9RouteRadioButton = (CheckBox) findViewById(R.id.radio_u9); - - U1RouteRadioButton.setOnCheckedChangeListener(this); - U1NRouteRadioButton.setOnCheckedChangeListener(this); - U2RouteRadioButton.setOnCheckedChangeListener(this); - U6RouteRadioButton.setOnCheckedChangeListener(this); - U9RouteRadioButton.setOnCheckedChangeListener(this); - - try { - Dao busRouteDao = helper.getBusRouteDao(); - Dao routeStopsDao = helper.getRouteStopsDao(); - - for (BusRoute route : busRouteDao) { - QueryBuilder queryBuilder = routeStopsDao.queryBuilder(); - - queryBuilder.where().eq(RouteStops.ROUTE_ID_FIELD_NAME, route.id).and().eq(RouteStops.STOP_ID_FIELD_NAME, busStopID); - queryBuilder.setCountOf(true); - PreparedQuery preparedQuery = queryBuilder.prepare(); - - long count = routeStopsDao.countOf(preparedQuery); - - if (route.code.equals("U1")) { - if (count != 0) { - U1RouteRadioButton.setVisibility(View.VISIBLE); - routes.add(route); - } else { - U1RouteRadioButton.setVisibility(View.GONE); - } - } else if (route.code.equals("U1N")) { - if (count != 0) { - U1NRouteRadioButton.setVisibility(View.VISIBLE); - routes.add(route); - } else { - U1NRouteRadioButton.setVisibility(View.GONE); - } - } else if (route.code.equals("U2")) { - if (count != 0) { - U2RouteRadioButton.setVisibility(View.VISIBLE); - routes.add(route); - } else { - U2RouteRadioButton.setVisibility(View.GONE); - } - } else if (route.code.equals("U6")) { - if (count != 0) { - U6RouteRadioButton.setVisibility(View.VISIBLE); - routes.add(route); - } else { - U6RouteRadioButton.setVisibility(View.GONE); - } - } else if (route.code.equals("U9")) { - if (count != 0) { - U9RouteRadioButton.setVisibility(View.VISIBLE); - routes.add(route); - } else { - U9RouteRadioButton.setVisibility(View.GONE); - } - } - } + final static String TAG = "BusTimeActivity"; - busStopDao = helper.getBusStopDao(); + private boolean dataChanged; - busStop = busStopDao.queryForId(busStopID); + private ListView busTimeList; + private TextView busName; + private TextView busID; + private CheckBox busFavourite; + private TextView busStopMessage; + private ProgressBar progBar; + private LinearLayout busTimeContentLayout; - busFavourite = (CheckBox) findViewById(R.id.favouriteCheckBox); - busFavourite.setChecked(busStop.favourite); - busFavourite.setOnCheckedChangeListener(this); + protected Timetable timetable; + private Timetable visibleTimetable; - } catch (SQLException e) { - e.printStackTrace(); - } + protected String busStopID; + private String busStopName; - busName = (TextView) findViewById(R.id.busStopName); - busID = (TextView) findViewById(R.id.busStopID); + private Dao busStopDao; - busStopMessage = (TextView) findViewById(R.id.busStopMessage); - progBar = (ProgressBar) findViewById(R.id.busStopLoadBar); - busTimeList = (ListView) findViewById(R.id.busStopTimes); - busTimeContentLayout = (LinearLayout) findViewById(R.id.busTimeContentLayout); + private BusStop busStop; - Log.i(TAG, "Got busstop id " + busStopID); + private GetTimetableTask timetableTask; - busName.setText(busStopName); - busID.setText(busStopID); - } + private Context instance; - public void onResume() { - super.onResume(); + private Handler mHandler; + private Runnable refreshData; - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); - if (sharedPrefs.getBoolean(UNI_LINK_BUS_TIMES, UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT) - || sharedPrefs.getBoolean(NON_UNI_LINK_BUS_TIMES, NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)) { - Log.i(TAG, "Live Times enabled"); - timetable = (Timetable) getLastNonConfigurationInstance(); + private CheckBox U1RouteRadioButton; + private CheckBox U1NRouteRadioButton; + private CheckBox U2RouteRadioButton; + private CheckBox U6RouteRadioButton; + private CheckBox U9RouteRadioButton; - refreshData = new Runnable() { - @Override - public void run() { - timetableTask = new GetTimetableTask(); - timetableTask.execute(busStopID); - mHandler.postDelayed(refreshData, 20000); - } - }; - - mHandler = new Handler(); - - if (timetable == null) { - Log.i(TAG, "No Previous timetable"); - mHandler.post(refreshData); - } else { - Log.i(TAG, "Displaying previous timetable"); - displayTimetable(timetable); - if (System.currentTimeMillis() - timetable.fetchTime.getTime() > 20000) { - mHandler.post(refreshData); + private static final int POI_DIALOG_ID = 0; + private POIDialog busDialog; + + private HashSet routes = new HashSet(); + + Toast activityToast; + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.bustimes); + + final DatabaseHelper helper = getHelper(); + + instance = this; + + busStopID = getIntent().getExtras().getString("busStopID"); + busStopName = getIntent().getExtras().getString("busStopName"); + + U1RouteRadioButton = (CheckBox) findViewById(R.id.radio_u1); + U1NRouteRadioButton = (CheckBox) findViewById(R.id.radio_u1n); + U2RouteRadioButton = (CheckBox) findViewById(R.id.radio_u2); + U6RouteRadioButton = (CheckBox) findViewById(R.id.radio_u6); + U9RouteRadioButton = (CheckBox) findViewById(R.id.radio_u9); + + U1RouteRadioButton.setOnCheckedChangeListener(this); + U1NRouteRadioButton.setOnCheckedChangeListener(this); + U2RouteRadioButton.setOnCheckedChangeListener(this); + U6RouteRadioButton.setOnCheckedChangeListener(this); + U9RouteRadioButton.setOnCheckedChangeListener(this); + + try { + Dao busRouteDao = helper.getBusRouteDao(); + Dao routeStopsDao = helper.getRouteStopsDao(); + + for (BusRoute route : busRouteDao) { + QueryBuilder queryBuilder = routeStopsDao + .queryBuilder(); + + queryBuilder.where() + .eq(RouteStops.ROUTE_ID_FIELD_NAME, route.id).and() + .eq(RouteStops.STOP_ID_FIELD_NAME, busStopID); + queryBuilder.setCountOf(true); + PreparedQuery preparedQuery = queryBuilder + .prepare(); + + long count = routeStopsDao.countOf(preparedQuery); + + if (route.code.equals("U1")) { + if (count != 0) { + U1RouteRadioButton.setVisibility(View.VISIBLE); + routes.add(route); + } else { + U1RouteRadioButton.setVisibility(View.GONE); + } + } else if (route.code.equals("U1N")) { + if (count != 0) { + U1NRouteRadioButton.setVisibility(View.VISIBLE); + routes.add(route); + } else { + U1NRouteRadioButton.setVisibility(View.GONE); + } + } else if (route.code.equals("U2")) { + if (count != 0) { + U2RouteRadioButton.setVisibility(View.VISIBLE); + routes.add(route); + } else { + U2RouteRadioButton.setVisibility(View.GONE); + } + } else if (route.code.equals("U6")) { + if (count != 0) { + U6RouteRadioButton.setVisibility(View.VISIBLE); + routes.add(route); + } else { + U6RouteRadioButton.setVisibility(View.GONE); + } + } else if (route.code.equals("U9")) { + if (count != 0) { + U9RouteRadioButton.setVisibility(View.VISIBLE); + routes.add(route); + } else { + U9RouteRadioButton.setVisibility(View.GONE); + } + } + } + + busStopDao = helper.getBusStopDao(); + + busStop = busStopDao.queryForId(busStopID); + + busFavourite = (CheckBox) findViewById(R.id.favouriteCheckBox); + busFavourite.setChecked(busStop.favourite); + busFavourite.setOnCheckedChangeListener(this); + + } catch (SQLException e) { + e.printStackTrace(); } - } - } else { - Log.i(TAG, "Live Times Disabled"); - progBar.setVisibility(View.GONE); - busStopMessage.setText("Live bus times disabled"); - busStopMessage.setVisibility(View.VISIBLE); - } + busName = (TextView) findViewById(R.id.busStopName); + busID = (TextView) findViewById(R.id.busStopID); + + busStopMessage = (TextView) findViewById(R.id.busStopMessage); + progBar = (ProgressBar) findViewById(R.id.busStopLoadBar); + busTimeList = (ListView) findViewById(R.id.busStopTimes); + busTimeContentLayout = (LinearLayout) findViewById(R.id.busTimeContentLayout); - } + Log.i(TAG, "Got busstop id " + busStopID); - public void onPause() { - if (mHandler != null) { // BusTimes are enabled - mHandler.removeCallbacks(refreshData); - if (timetableTask != null) // Could happen if the handler has not created the timetableTask yet - timetableTask.cancel(true); - Log.i(TAG, "Stoping refreshing timetable data"); + busName.setText(busStopName); + busID.setText(busStopID); } - super.onPause(); - } + public void onResume() { + super.onResume(); + + SharedPreferences sharedPrefs = PreferenceManager + .getDefaultSharedPreferences(this); + if (sharedPrefs.getBoolean(UNI_LINK_BUS_TIMES, + UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT) + || sharedPrefs.getBoolean(NON_UNI_LINK_BUS_TIMES, + NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)) { + Log.i(TAG, "Live Times enabled"); + timetable = (Timetable) getLastNonConfigurationInstance(); + + refreshData = new Runnable() { + public void run() { + timetableTask = new GetTimetableTask(); + timetableTask.execute(busStopID); + mHandler.postDelayed(refreshData, 20000); + } + }; + + mHandler = new Handler(); + + if (timetable == null) { + Log.i(TAG, "No Previous timetable"); + mHandler.post(refreshData); + } else { + Log.i(TAG, "Displaying previous timetable"); + displayTimetable(timetable); + if (System.currentTimeMillis() - timetable.fetchTime.getTime() > 20000) { + mHandler.post(refreshData); + } + } + + } else { + Log.i(TAG, "Live Times Disabled"); + progBar.setVisibility(View.GONE); + busStopMessage.setText("Live bus times disabled"); + busStopMessage.setVisibility(View.VISIBLE); + } - public void finish() { - if (dataChanged) { - getIntent().putExtra("busStopChanged", busStopID); } - setResult(RESULT_OK, getIntent()); - - super.finish(); - } - - public void onCheckedChanged(CompoundButton button, boolean checked) { - if (button.equals(busFavourite)) { - busStop.favourite = checked; - try { - busStopDao.update(busStop); - dataChanged = true; - } catch (SQLException e) { - e.printStackTrace(); - } - } else { - Log.i(TAG, "Route radio button made " + checked); - if (timetable != null) { // If there is a timetable to display - displayTimetable(timetable); - } + public void onPause() { + if (mHandler != null) { // BusTimes are enabled + mHandler.removeCallbacks(refreshData); + if (timetableTask != null) // Could happen if the handler has not + // created the timetableTask yet + timetableTask.cancel(true); + Log.i(TAG, "Stoping refreshing timetable data"); + } + + super.onPause(); } - } - @Override - public Object onRetainNonConfigurationInstance() { - return timetable; - } + public void finish() { + if (dataChanged) { + getIntent().putExtra("busStopChanged", busStopID); + } - private class GetTimetableTask extends AsyncTask { - String errorMessage; + setResult(RESULT_OK, getIntent()); - protected void onPreExecute() { - progBar.setVisibility(View.VISIBLE); + super.finish(); } - protected Timetable doInBackground(String... activity) { - Timetable newTimetable = null; - try { - final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(instance); - - newTimetable = DataManager.getTimetable(instance, busStopID, sharedPrefs.getBoolean(MapActivity.UNI_LINK_BUS_TIMES, - MapActivity.UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT), sharedPrefs.getBoolean( - MapActivity.NON_UNI_LINK_BUS_TIMES, MapActivity.NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)); - } catch (SQLException e) { - errorMessage = "Error message regarding SQL?"; - e.printStackTrace(); - } catch (ClientProtocolException e) { - errorMessage = "ClientProtocolException!?!"; - e.printStackTrace(); - } catch (IOException e) { - errorMessage = "Error fetching bus times from server, are you connected to the internet?"; - e.printStackTrace(); - } catch (JSONException e) { - errorMessage = "Error parsing bus times"; - e.printStackTrace(); - } catch (Exception e) { - Log.e(TAG, e.getMessage(), e.getCause()); - } - - return newTimetable; + public void onCheckedChanged(CompoundButton button, boolean checked) { + if (button.equals(busFavourite)) { + busStop.favourite = checked; + try { + busStopDao.update(busStop); + dataChanged = true; + } catch (SQLException e) { + e.printStackTrace(); + } + } else { + Log.i(TAG, "Route radio button made " + checked); + if (timetable != null) { // If there is a timetable to display + displayTimetable(timetable); + } + } } - protected void onPostExecute(Timetable newTimetable) { - Log.i(TAG, "Got timetable for " + busStopID); - if (newTimetable == null) { - Log.i(TAG, "Its null"); - - progBar.setVisibility(View.GONE); - busStopMessage.setText(errorMessage); - busStopMessage.setVisibility(View.VISIBLE); - } else { - progBar.setVisibility(View.GONE); - timetable = newTimetable; - displayTimetable(timetable); - } + @Override + public Object onRetainNonConfigurationInstance() { + return timetable; } - } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.stop_menu, menu); - return true; - } + private class GetTimetableTask extends + AsyncTask { + String errorMessage; - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle item selection - if (item.getItemId() == R.id.menu_previous_stop || item.getItemId() == R.id.menu_next_stop) { - Log.v(TAG, "Got a request for the stop movement"); + protected void onPreExecute() { + progBar.setVisibility(View.VISIBLE); + } - Log.v(TAG, routes.size() + " routes avalible from this stop"); + protected Timetable doInBackground(String... activity) { + Timetable newTimetable = null; + try { + final SharedPreferences sharedPrefs = PreferenceManager + .getDefaultSharedPreferences(instance); + + newTimetable = DataManager + .getTimetable( + instance, + busStopID, + sharedPrefs + .getBoolean( + MapActivity.UNI_LINK_BUS_TIMES, + MapActivity.UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT), + sharedPrefs + .getBoolean( + MapActivity.NON_UNI_LINK_BUS_TIMES, + MapActivity.NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)); + } catch (SQLException e) { + errorMessage = "Error message regarding SQL?"; + e.printStackTrace(); + } catch (ClientProtocolException e) { + errorMessage = "ClientProtocolException!?!"; + e.printStackTrace(); + } catch (IOException e) { + errorMessage = "Error fetching bus times from server, are you connected to the internet?"; + e.printStackTrace(); + } catch (JSONException e) { + errorMessage = "Error parsing bus times"; + e.printStackTrace(); + } catch (Exception e) { + Log.e(TAG, e.getMessage(), e.getCause()); + } - ArrayList busStops = new ArrayList(); + return newTimetable; + } - for (BusRoute route : routes) { - try { - Set tmpStops; - if (item.getItemId() == R.id.menu_next_stop) { - tmpStops = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), 1); - } else { - tmpStops = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), -1); - } - for (BusStop busStop : tmpStops) { - if (!busStops.contains(busStop)) { - busStops.add(busStop); + protected void onPostExecute(Timetable newTimetable) { + Log.i(TAG, "Got timetable for " + busStopID); + if (newTimetable == null) { + Log.i(TAG, "Its null"); + + progBar.setVisibility(View.GONE); + busStopMessage.setText(errorMessage); + busStopMessage.setVisibility(View.VISIBLE); + } else { + progBar.setVisibility(View.GONE); + timetable = newTimetable; + displayTimetable(timetable); } - } - } catch (SQLException e) { - e.printStackTrace(); } - } + } - Log.i(TAG, "stops " + busStops); + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.stop_menu, menu); + return true; + } - if (busStops.size() == 1) { - Intent i = new Intent(this, BusStopActivity.class); - BusStop stop = (BusStop) busStops.iterator().next(); - if (stop == null) { - Log.e(TAG, "stop == null"); - } - if (stop.id == null) { - Log.e(TAG, "stop.id == null"); - } - i.putExtra("busStopID", stop.id); - i.putExtra("busStopName", stop.description); - startActivity(i); - } else { - showDialog(POI_DIALOG_ID); - if (busDialog == null) { - Log.e(TAG, "Very wierd, just tried to launch the favourite's dialog, but its null?"); - return false; - } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle item selection + if (item.getItemId() == R.id.menu_previous_stop + || item.getItemId() == R.id.menu_next_stop) { + Log.v(TAG, "Got a request for the stop movement"); + + Log.v(TAG, routes.size() + " routes avalible from this stop"); + + ArrayList busStops = new ArrayList(); + + for (BusRoute route : routes) { + try { + Set tmpStops; + if (item.getItemId() == R.id.menu_next_stop) { + tmpStops = route.moveInRoute(this, getHelper() + .getBusStopDao().queryForId(busStopID), 1); + } else { + tmpStops = route.moveInRoute(this, getHelper() + .getBusStopDao().queryForId(busStopID), -1); + } + for (BusStop busStop : tmpStops) { + if (!busStops.contains(busStop)) { + busStops.add(busStop); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } + } - busDialog.setMessage(""); - busDialog.setItems(busStops); - busDialog.setTitle("Choose Bus Stop"); - - Log.i(TAG, "Showing dialog"); - } - - } else if (item.getItemId() == R.id.menu_refresh_stop) { - if (mHandler != null) { // BusTimes are enabled - mHandler.removeCallbacks(refreshData); - timetableTask.cancel(true); - Log.i(TAG, "Stoping refreshing timetable data"); - - mHandler.post(refreshData); - } else { - // TODO: Toast here... - } - } else { - Log.e(TAG, "No known menu option selected"); - return super.onOptionsItemSelected(item); - } - return true; - } - - private void displayTimetable(Timetable timetable) { - visibleTimetable = (Timetable) timetable.clone(); - - Log.i(TAG, "It contains " + visibleTimetable.size() + " stops"); - - if (timetable.size() == 0) { - busStopMessage.setText("No Busses"); - busStopMessage.setVisibility(View.VISIBLE); - busTimeContentLayout.setGravity(Gravity.CENTER); - } else { - - for (Iterator stopIter = visibleTimetable.iterator(); stopIter.hasNext();) { - Stop stop = stopIter.next(); - Log.i(TAG, "Begin filtering, looking at " + stop + " with route " + stop.bus.route.code); - if (stop.bus.route.code.equals("U1")) { - if (!U1RouteRadioButton.isChecked()) { - stopIter.remove(); - } - } else if (stop.bus.route.code.equals("U1N")) { - if (!U1NRouteRadioButton.isChecked()) { - stopIter.remove(); - } - } else if (stop.bus.route.code.equals("U2")) { - if (!U2RouteRadioButton.isChecked()) { - stopIter.remove(); - } - } else if (stop.bus.route.code.equals("U6")) { - if (!U6RouteRadioButton.isChecked()) { - stopIter.remove(); - } - } else if (stop.bus.route.code.equals("U9")) { - if (!U9RouteRadioButton.isChecked()) { - stopIter.remove(); - } - } - } - - if (visibleTimetable.size() == 0) { - busTimeContentLayout.setGravity(Gravity.CENTER); - busStopMessage.setText("No Busses (With the current enabled routes)"); - busStopMessage.setVisibility(View.VISIBLE); - busTimeList.setVisibility(View.GONE); - } else { - busTimeList.setVisibility(View.VISIBLE); - busStopMessage.setVisibility(View.GONE); - TimetableAdapter adapter; - if ((adapter = (TimetableAdapter) busTimeList.getAdapter()) != null) { - adapter.updateTimetable(visibleTimetable); + Log.i(TAG, "stops " + busStops); + + if (busStops.size() == 1) { + Intent i = new Intent(this, BusStopActivity.class); + BusStop stop = (BusStop) busStops.iterator().next(); + if (stop == null) { + Log.e(TAG, "stop == null"); + } + if (stop.id == null) { + Log.e(TAG, "stop.id == null"); + } + i.putExtra("busStopID", stop.id); + i.putExtra("busStopName", stop.description); + startActivity(i); + } else { + showDialog(POI_DIALOG_ID); + if (busDialog == null) { + Log.e(TAG, + "Very wierd, just tried to launch the favourite's dialog, but its null?"); + return false; + } + + busDialog.setMessage(""); + busDialog.setItems(busStops); + busDialog.setTitle("Choose Bus Stop"); + + Log.i(TAG, "Showing dialog"); + } + + } else if (item.getItemId() == R.id.menu_refresh_stop) { + if (mHandler != null) { // BusTimes are enabled + mHandler.removeCallbacks(refreshData); + timetableTask.cancel(true); + Log.i(TAG, "Stoping refreshing timetable data"); + + mHandler.post(refreshData); + } else { + // TODO: Toast here... + } } else { - adapter = new TimetableAdapter(this, visibleTimetable); - busTimeList.setAdapter(adapter); + Log.e(TAG, "No known menu option selected"); + return super.onOptionsItemSelected(item); } - busTimeContentLayout.setGravity(Gravity.TOP); - } + return true; } - } - - @Override - protected Dialog onCreateDialog(int id) { - switch (id) { - case POI_DIALOG_ID: - busDialog = new POIDialog(instance); - busDialog.setOnItemClickListener(this); - return busDialog; + + private void displayTimetable(Timetable timetable) { + visibleTimetable = (Timetable) timetable.clone(); + + Log.i(TAG, "It contains " + visibleTimetable.size() + " stops"); + + if (timetable.size() == 0) { + busStopMessage.setText("No Busses"); + busStopMessage.setVisibility(View.VISIBLE); + busTimeContentLayout.setGravity(Gravity.CENTER); + } else { + + for (Iterator stopIter = visibleTimetable.iterator(); stopIter + .hasNext();) { + Stop stop = stopIter.next(); + Log.i(TAG, "Begin filtering, looking at " + stop + + " with route " + stop.bus.route.code); + if (stop.bus.route.code.equals("U1")) { + if (!U1RouteRadioButton.isChecked()) { + stopIter.remove(); + } + } else if (stop.bus.route.code.equals("U1N")) { + if (!U1NRouteRadioButton.isChecked()) { + stopIter.remove(); + } + } else if (stop.bus.route.code.equals("U2")) { + if (!U2RouteRadioButton.isChecked()) { + stopIter.remove(); + } + } else if (stop.bus.route.code.equals("U6")) { + if (!U6RouteRadioButton.isChecked()) { + stopIter.remove(); + } + } else if (stop.bus.route.code.equals("U9")) { + if (!U9RouteRadioButton.isChecked()) { + stopIter.remove(); + } + } + } + + if (visibleTimetable.size() == 0) { + busTimeContentLayout.setGravity(Gravity.CENTER); + busStopMessage + .setText("No Busses (With the current enabled routes)"); + busStopMessage.setVisibility(View.VISIBLE); + busTimeList.setVisibility(View.GONE); + } else { + busTimeList.setVisibility(View.VISIBLE); + busStopMessage.setVisibility(View.GONE); + TimetableAdapter adapter; + if ((adapter = (TimetableAdapter) busTimeList.getAdapter()) != null) { + adapter.updateTimetable(visibleTimetable); + } else { + adapter = new TimetableAdapter(this, visibleTimetable); + busTimeList.setAdapter(adapter); + } + busTimeContentLayout.setGravity(Gravity.TOP); + } + } } - return null; - } - - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - Log.i(TAG, "OnItemClick pos " + position + " id " + id); - - String poiId = busDialog.adapter.getItemStringId(position); - - Log.i(TAG, "POI " + poiId + " selected"); - - Intent i = new Intent(this, BusStopActivity.class); - try { - busStop = busStopDao.queryForId(poiId); - - if (busStop == null) { - Log.e(TAG, "stop == null"); - } - if (busStop.id == null) { - Log.e(TAG, "stop.id == null"); - } - i.putExtra("busStopID", busStop.id); - i.putExtra("busStopName", busStop.description); - startActivity(i); - } catch (SQLException e) { - e.printStackTrace(); + + @Override + protected Dialog onCreateDialog(int id) { + switch (id) { + case POI_DIALOG_ID: + busDialog = new POIDialog(instance); + busDialog.setOnItemClickListener(this); + return busDialog; + } + return null; } - } + public void onItemClick(AdapterView parent, View view, int position, + long id) { + Log.i(TAG, "OnItemClick pos " + position + " id " + id); + + String poiId = busDialog.adapter.getItemStringId(position); + + Log.i(TAG, "POI " + poiId + " selected"); + + Intent i = new Intent(this, BusStopActivity.class); + try { + busStop = busStopDao.queryForId(poiId); + + if (busStop == null) { + Log.e(TAG, "stop == null"); + } + if (busStop.id == null) { + Log.e(TAG, "stop.id == null"); + } + i.putExtra("busStopID", busStop.id); + i.putExtra("busStopName", busStop.description); + startActivity(i); + } catch (SQLException e) { + e.printStackTrace(); + } + + } } diff --git a/src/net/cbaines/suma/StopView.java b/src/net/cbaines/suma/StopView.java index 764072e..f942137 100644 --- a/src/net/cbaines/suma/StopView.java +++ b/src/net/cbaines/suma/StopView.java @@ -36,135 +36,160 @@ import android.widget.Toast; import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.dao.Dao; -public class StopView extends LinearLayout implements OnClickListener, OnLongClickListener { +public class StopView extends LinearLayout implements OnClickListener, + OnLongClickListener { - // private final ImageView icon; + // private final ImageView icon; - // private static final String TAG = "StopView"; + // private static final String TAG = "StopView"; - private final TextView name; - private final TextView time; - private String onClickMessage = ""; - private final BusStopActivity context; + private final TextView name; + private final TextView time; + private String onClickMessage = ""; + private final BusStopActivity context; - private Stop stop; + private Stop stop; - public StopView(BusStopActivity context, Stop stop) { - super(context); + public StopView(BusStopActivity context, Stop stop) { + super(context); - this.context = context; + this.context = context; - this.setOrientation(HORIZONTAL); + this.setOrientation(HORIZONTAL); - name = new TextView(context); - name.setTextSize(22f); + name = new TextView(context); + name.setTextSize(22f); - time = new TextView(context); - time.setTextSize(22f); - time.setGravity(Gravity.RIGHT); + time = new TextView(context); + time.setTextSize(22f); + time.setGravity(Gravity.RIGHT); - setStop(stop); + setStop(stop); - addView(name, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); - addView(time, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); - } - - public void setStop(Stop stop) { - - // Log.i(TAG, "Time of arival " + stop.arivalTime); - - this.stop = stop; - - name.setText(stop.bus.getName()); - time.setText(stop.getTimeToArival()); - - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - - try { - Dao busDao = helper.getBusDao(); - - busDao.refresh(stop.bus); - - if (stop.bus.id != null) { - if (stop.live) { - onClickMessage = "Bus " + stop.bus.toString() + " at " - + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); - } else { - onClickMessage = "Timetabled bus " + stop.bus.toString() + " at " - + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); - } - } else { - if (stop.live) { - onClickMessage = "Unidentified bus (" + stop.bus.getName() + ") at " - + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); - } else { - onClickMessage = "Timetabled bus (" + stop.bus.getName() + ") at " - + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime); - } - } - } catch (SQLException e) { - e.printStackTrace(); + addView(name, new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); + addView(time, new LayoutParams(LayoutParams.FILL_PARENT, + LayoutParams.WRAP_CONTENT)); } - this.setOnClickListener(this); - this.setOnLongClickListener(this); - } + public void setStop(Stop stop) { + + // Log.i(TAG, "Time of arival " + stop.arivalTime); + + this.stop = stop; + + name.setText(stop.bus.getName()); + time.setText(stop.getTimeToArival()); + + DatabaseHelper helper = OpenHelperManager.getHelper(context, + DatabaseHelper.class); + + try { + Dao busDao = helper.getBusDao(); + + busDao.refresh(stop.bus); + + if (stop.bus.id != null) { + if (stop.live) { + onClickMessage = "Bus " + + stop.bus.toString() + + " at " + + DateFormat.getTimeInstance(DateFormat.SHORT) + .format(stop.arivalTime); + } else { + onClickMessage = "Timetabled bus " + + stop.bus.toString() + + " at " + + DateFormat.getTimeInstance(DateFormat.SHORT) + .format(stop.arivalTime); + } + } else { + if (stop.live) { + onClickMessage = "Unidentified bus (" + + stop.bus.getName() + + ") at " + + DateFormat.getTimeInstance(DateFormat.SHORT) + .format(stop.arivalTime); + } else { + onClickMessage = "Timetabled bus (" + + stop.bus.getName() + + ") at " + + DateFormat.getTimeInstance(DateFormat.SHORT) + .format(stop.arivalTime); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } - public void onClick(View v) { - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, onClickMessage, Toast.LENGTH_SHORT); - } else { - context.activityToast.setText(onClickMessage); - context.activityToast.setDuration(Toast.LENGTH_SHORT); + this.setOnClickListener(this); + this.setOnLongClickListener(this); } - context.activityToast.show(); - - } - - @Override - public boolean onLongClick(View v) { - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - - try { - Dao busDao = helper.getBusDao(); - Dao busRouteDao = helper.getBusRouteDao(); - - busDao.refresh(stop.bus); - busRouteDao.refresh(stop.bus.route); - - Log.i("StopView", "Bus route " + stop.bus.route + " Uni-Link " + stop.bus.route.uniLink + " Bus ID " - + stop.bus.id); - - if (stop.bus.id != null && stop.bus.route.uniLink) { - Intent i = new Intent(context, BusActivity.class); - i.putExtra("busID", stop.bus.id); - i.putExtra("busStopID", stop.busStop.id); - ((Activity) context).startActivityForResult(i, 0); - } else { - if (!stop.bus.route.uniLink) { - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, - "Bus schedules only avalible for Uni-Link buses", Toast.LENGTH_SHORT); - } else { - context.activityToast.setText("Bus schedules only avalible for Uni-Link buses"); - context.activityToast.setDuration(Toast.LENGTH_SHORT); - } - context.activityToast.show(); + + public void onClick(View v) { + if (context.activityToast == null) { + context.activityToast = Toast.makeText(context, onClickMessage, + Toast.LENGTH_SHORT); } else { - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, - "Bus schedules not avalible for unidentified buses", Toast.LENGTH_SHORT); - } else { - context.activityToast.setText("Bus schedules not avalible for unidentified buses"); + context.activityToast.setText(onClickMessage); context.activityToast.setDuration(Toast.LENGTH_SHORT); - } - context.activityToast.show(); } - } + context.activityToast.show(); + + } - } catch (SQLException e) { - e.printStackTrace(); + public boolean onLongClick(View v) { + DatabaseHelper helper = OpenHelperManager.getHelper(context, + DatabaseHelper.class); + + try { + Dao busDao = helper.getBusDao(); + Dao busRouteDao = helper.getBusRouteDao(); + + busDao.refresh(stop.bus); + busRouteDao.refresh(stop.bus.route); + + Log.i("StopView", "Bus route " + stop.bus.route + " Uni-Link " + + stop.bus.route.uniLink + " Bus ID " + stop.bus.id); + + if (stop.bus.id != null && stop.bus.route.uniLink) { + Intent i = new Intent(context, BusActivity.class); + i.putExtra("busID", stop.bus.id); + i.putExtra("busStopID", stop.busStop.id); + ((Activity) context).startActivityForResult(i, 0); + } else { + if (!stop.bus.route.uniLink) { + if (context.activityToast == null) { + context.activityToast = Toast + .makeText( + context, + "Bus schedules only avalible for Uni-Link buses", + Toast.LENGTH_SHORT); + } else { + context.activityToast + .setText("Bus schedules only avalible for Uni-Link buses"); + context.activityToast.setDuration(Toast.LENGTH_SHORT); + } + context.activityToast.show(); + } else { + if (context.activityToast == null) { + context.activityToast = Toast + .makeText( + context, + "Bus schedules not avalible for unidentified buses", + Toast.LENGTH_SHORT); + } else { + context.activityToast + .setText("Bus schedules not avalible for unidentified buses"); + context.activityToast.setDuration(Toast.LENGTH_SHORT); + } + context.activityToast.show(); + } + } + + } catch (SQLException e) { + e.printStackTrace(); + } + return true; } - return true; - } } -- cgit v1.2.3 From b9924e1aaac1d8b58df81ea7931b79a400fe59fe Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 24 Feb 2012 12:41:21 +0000 Subject: Added new libs for rdf stuff. --- libs/androjena_0.5.jar | Bin 0 -> 2026332 bytes libs/arqoid_0.5.jar | Bin 0 -> 1673754 bytes libs/icu4j-3.4.5.jar | Bin 0 -> 3241046 bytes libs/iri-0.8.jar | Bin 0 -> 151589 bytes libs/lucenoid_3.0.2.jar | Bin 0 -> 1070153 bytes libs/slf4j-android-1.5.8.jar | Bin 28822 -> 0 bytes libs/slf4j-android-1.6.1-RC1.jar | Bin 0 -> 32008 bytes libs/tdboid_0.4.jar | Bin 0 -> 766853 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 libs/androjena_0.5.jar create mode 100644 libs/arqoid_0.5.jar create mode 100644 libs/icu4j-3.4.5.jar create mode 100644 libs/iri-0.8.jar create mode 100644 libs/lucenoid_3.0.2.jar delete mode 100644 libs/slf4j-android-1.5.8.jar create mode 100644 libs/slf4j-android-1.6.1-RC1.jar create mode 100644 libs/tdboid_0.4.jar diff --git a/libs/androjena_0.5.jar b/libs/androjena_0.5.jar new file mode 100644 index 0000000..f630089 Binary files /dev/null and b/libs/androjena_0.5.jar differ diff --git a/libs/arqoid_0.5.jar b/libs/arqoid_0.5.jar new file mode 100644 index 0000000..9ce294b Binary files /dev/null and b/libs/arqoid_0.5.jar differ diff --git a/libs/icu4j-3.4.5.jar b/libs/icu4j-3.4.5.jar new file mode 100644 index 0000000..cf19021 Binary files /dev/null and b/libs/icu4j-3.4.5.jar differ diff --git a/libs/iri-0.8.jar b/libs/iri-0.8.jar new file mode 100644 index 0000000..f096c68 Binary files /dev/null and b/libs/iri-0.8.jar differ diff --git a/libs/lucenoid_3.0.2.jar b/libs/lucenoid_3.0.2.jar new file mode 100644 index 0000000..6822c23 Binary files /dev/null and b/libs/lucenoid_3.0.2.jar differ diff --git a/libs/slf4j-android-1.5.8.jar b/libs/slf4j-android-1.5.8.jar deleted file mode 100644 index e0128bc..0000000 Binary files a/libs/slf4j-android-1.5.8.jar and /dev/null differ diff --git a/libs/slf4j-android-1.6.1-RC1.jar b/libs/slf4j-android-1.6.1-RC1.jar new file mode 100644 index 0000000..480348f Binary files /dev/null and b/libs/slf4j-android-1.6.1-RC1.jar differ diff --git a/libs/tdboid_0.4.jar b/libs/tdboid_0.4.jar new file mode 100644 index 0000000..34f94b2 Binary files /dev/null and b/libs/tdboid_0.4.jar differ -- cgit v1.2.3 From 6e971428e780adc781c3d8146168590dabec7ada Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 24 Feb 2012 20:47:11 +0000 Subject: Added a BuildingActivity, with a photo, and am begining to use rdf data :) --- assets/photos.rdf | 15009 +++++++++++++++++++++++++ assets/places.rdf | 12102 ++++++++++++++++++++ gen/net/cbaines/suma/R.java | 127 +- res/layout/building_activity.xml | 39 + res/layout/bus_stop_activity.xml | 137 + res/layout/bustimes.xml | 137 - src/net/cbaines/suma/BuildingActivity.java | 157 +- src/net/cbaines/suma/BuildingNumOverlay.java | 445 +- src/net/cbaines/suma/BusStopActivity.java | 72 +- src/net/cbaines/suma/BusStopOverlay.java | 480 +- src/net/cbaines/suma/DataManager.java | 1445 +-- src/net/cbaines/suma/MapActivity.java | 2119 ++-- 12 files changed, 29819 insertions(+), 2450 deletions(-) create mode 100644 assets/photos.rdf create mode 100644 assets/places.rdf create mode 100644 res/layout/building_activity.xml create mode 100644 res/layout/bus_stop_activity.xml delete mode 100644 res/layout/bustimes.xml diff --git a/assets/photos.rdf b/assets/photos.rdf new file mode 100644 index 0000000..652a7b9 --- /dev/null +++ b/assets/photos.rdf @@ -0,0 +1,15009 @@ + + + + CC-BY + + + + + + + + + + + + + + + 2011-02-22 + + + + + + + + + + + + + + + + + + + + + + + + 2011-02-22T17:33:16Z + + + 2011-02-22T17:33:52Z + + + 2010 + + + + + + + + + + + + 1.4993 + + + 534934 + + + 667 + + + 1000 + + + + + + Building 12 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 391271 + + + 667 + + + 1000 + + + + + + Building 13 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 477131 + + + 667 + + + 1000 + + + + + + Building 14 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 358799 + + + 667 + + + 1000 + + + + + + Building 15b + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 449646 + + + 667 + + + 1000 + + + + + + Building 15 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 467958 + + + 667 + + + 1000 + + + + + + Building 16 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 476702 + + + 667 + + + 1000 + + + + + + Building 17 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 404612 + + + 667 + + + 1000 + + + + + + Building 18 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 389375 + + + 667 + + + 1000 + + + + + + Building 19 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 410135 + + + 667 + + + 1000 + + + + + + Building 1 + + + + + + 2010 + + + + + + + + + + + + 0.6670 + + + 402975 + + + 1000 + + + 667 + + + + + + Building 21 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 527449 + + + 667 + + + 1000 + + + + + + Building 25 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 437411 + + + 667 + + + 1000 + + + + + + Building 26 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 471455 + + + 667 + + + 1000 + + + + + + Building 27 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 438277 + + + 667 + + + 1000 + + + + + + Building 28 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 383473 + + + 667 + + + 1000 + + + + + + Building 29 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 458661 + + + 667 + + + 1000 + + + + + + Building 2 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 445704 + + + 667 + + + 1000 + + + + + + Building 30 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 510032 + + + 667 + + + 1000 + + + + + + Building 32 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 470026 + + + 667 + + + 1000 + + + + + + Building 34 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 448005 + + + 667 + + + 1000 + + + + + + Building 35 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 534934 + + + 667 + + + 1000 + + + + + + Building 36 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 461234 + + + 667 + + + 1000 + + + + + + Building 37 + + + + + + 2010 + + + + + + + + + + + + 2.2075 + + + 491315 + + + 453 + + + 1000 + + + + + + Building 38a + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 438744 + + + 667 + + + 1000 + + + + + + Building 39 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 562596 + + + 667 + + + 1000 + + + + + + Building 3 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 433870 + + + 667 + + + 1000 + + + + + + Building 40 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 441929 + + + 667 + + + 1000 + + + + + + Building 41 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 325853 + + + 667 + + + 1000 + + + + + + Building 42 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 472569 + + + 667 + + + 1000 + + + + + + Building 43 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 429708 + + + 667 + + + 1000 + + + + + + Building 44 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 515864 + + + 667 + + + 1000 + + + + + + Building 45 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 354456 + + + 667 + + + 1000 + + + + + + Building 46 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 577523 + + + 667 + + + 1000 + + + + + + Building 48 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 405512 + + + 667 + + + 1000 + + + + + + Building 4 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 607920 + + + 667 + + + 1000 + + + + + + Building 50 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 421033 + + + 667 + + + 1000 + + + + + + Building 52 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 435080 + + + 667 + + + 1000 + + + + + + Building 53 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 448156 + + + 667 + + + 1000 + + + + + + Building 54 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 423683 + + + 667 + + + 1000 + + + + + + Building 56 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 350437 + + + 667 + + + 1000 + + + + + + Building 57 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 316045 + + + 667 + + + 1000 + + + + + + Building 58a + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 396018 + + + 667 + + + 1000 + + + + + + Building 58 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 328850 + + + 667 + + + 1000 + + + + + + Building 59 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 478242 + + + 667 + + + 1000 + + + + + + Building 5 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 349532 + + + 667 + + + 1000 + + + + + + Building 60 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 311017 + + + 667 + + + 1000 + + + + + + Building 61 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 523347 + + + 667 + + + 1000 + + + + + + Building 65A + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 505519 + + + 667 + + + 1000 + + + + + + Building 65B + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 565439 + + + 667 + + + 1000 + + + + + + Building 65 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 340097 + + + 667 + + + 1000 + + + + + + Building 67 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 435743 + + + 667 + + + 1000 + + + + + + Building 6 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 396212 + + + 667 + + + 1000 + + + + + + Building 7 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 365394 + + + 667 + + + 1000 + + + + + + Building 85 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 320372 + + + 667 + + + 1000 + + + + + + Building 86 + + + + + + 2010 + + + + + + + + + + + + 1.4993 + + + 492177 + + + 667 + + + 1000 + + + + + + Building 9 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7438 + + + 67 + + + 100 + + + + + + Building 12 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7152 + + + 67 + + + 100 + + + + + + Building 13 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7179 + + + 67 + + + 100 + + + + + + Building 14 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6859 + + + 67 + + + 100 + + + + + + Building 15b + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7399 + + + 67 + + + 100 + + + + + + Building 15 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7743 + + + 67 + + + 100 + + + + + + Building 16 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6534 + + + 67 + + + 100 + + + + + + Building 17 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6501 + + + 67 + + + 100 + + + + + + Building 18 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6964 + + + 67 + + + 100 + + + + + + Building 19 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6471 + + + 67 + + + 100 + + + + + + Building 1 + + + + + + 2010 + + + + + + + + + + + + 0.6700 + + + 6923 + + + 100 + + + 67 + + + + + + Building 21 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7761 + + + 67 + + + 100 + + + + + + Building 25 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6323 + + + 67 + + + 100 + + + + + + Building 26 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7442 + + + 67 + + + 100 + + + + + + Building 27 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6857 + + + 67 + + + 100 + + + + + + Building 28 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6867 + + + 67 + + + 100 + + + + + + Building 29 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6793 + + + 67 + + + 100 + + + + + + Building 2 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7391 + + + 67 + + + 100 + + + + + + Building 30 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7158 + + + 67 + + + 100 + + + + + + Building 32 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7242 + + + 67 + + + 100 + + + + + + Building 34 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6708 + + + 67 + + + 100 + + + + + + Building 35 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7438 + + + 67 + + + 100 + + + + + + Building 36 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6950 + + + 67 + + + 100 + + + + + + Building 37 + + + + + + 2010 + + + + + + + + + + + + 2.2222 + + + 7195 + + + 45 + + + 100 + + + + + + Building 38a + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6645 + + + 67 + + + 100 + + + + + + Building 39 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 8090 + + + 67 + + + 100 + + + + + + Building 3 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6790 + + + 67 + + + 100 + + + + + + Building 40 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6752 + + + 67 + + + 100 + + + + + + Building 41 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6373 + + + 67 + + + 100 + + + + + + Building 42 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7225 + + + 67 + + + 100 + + + + + + Building 43 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7059 + + + 67 + + + 100 + + + + + + Building 44 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7264 + + + 67 + + + 100 + + + + + + Building 45 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6382 + + + 67 + + + 100 + + + + + + Building 46 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7266 + + + 67 + + + 100 + + + + + + Building 48 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6931 + + + 67 + + + 100 + + + + + + Building 4 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7685 + + + 67 + + + 100 + + + + + + Building 50 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6211 + + + 67 + + + 100 + + + + + + Building 52 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7326 + + + 67 + + + 100 + + + + + + Building 53 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7446 + + + 67 + + + 100 + + + + + + Building 54 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7805 + + + 67 + + + 100 + + + + + + Building 56 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6971 + + + 67 + + + 100 + + + + + + Building 57 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6537 + + + 67 + + + 100 + + + + + + Building 58a + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 5621 + + + 67 + + + 100 + + + + + + Building 58 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6769 + + + 67 + + + 100 + + + + + + Building 59 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7403 + + + 67 + + + 100 + + + + + + Building 5 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6063 + + + 67 + + + 100 + + + + + + Building 60 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 5476 + + + 67 + + + 100 + + + + + + Building 61 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6446 + + + 67 + + + 100 + + + + + + Building 65A + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7310 + + + 67 + + + 100 + + + + + + Building 65B + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7500 + + + 67 + + + 100 + + + + + + Building 65 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 5514 + + + 67 + + + 100 + + + + + + Building 67 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 5987 + + + 67 + + + 100 + + + + + + Building 6 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7173 + + + 67 + + + 100 + + + + + + Building 7 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6658 + + + 67 + + + 100 + + + + + + Building 85 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 6700 + + + 67 + + + 100 + + + + + + Building 86 + + + + + + 2010 + + + + + + + + + + + + 1.4925 + + + 7670 + + + 67 + + + 100 + + + + + + Building 9 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 24454 + + + 133 + + + 200 + + + + + + Building 12 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22883 + + + 133 + + + 200 + + + + + + Building 13 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22431 + + + 133 + + + 200 + + + + + + Building 14 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 21086 + + + 133 + + + 200 + + + + + + Building 15b + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 23745 + + + 133 + + + 200 + + + + + + Building 15 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 24728 + + + 133 + + + 200 + + + + + + Building 16 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 21150 + + + 133 + + + 200 + + + + + + Building 17 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 20797 + + + 133 + + + 200 + + + + + + Building 18 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 21629 + + + 133 + + + 200 + + + + + + Building 19 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 20093 + + + 133 + + + 200 + + + + + + Building 1 + + + + + + 2010 + + + + + + + + + + + + 0.6650 + + + 22703 + + + 200 + + + 133 + + + + + + Building 21 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 25546 + + + 133 + + + 200 + + + + + + Building 25 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 20734 + + + 133 + + + 200 + + + + + + Building 26 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 24225 + + + 133 + + + 200 + + + + + + Building 27 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22503 + + + 133 + + + 200 + + + + + + Building 28 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22123 + + + 133 + + + 200 + + + + + + Building 29 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22580 + + + 133 + + + 200 + + + + + + Building 2 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 23476 + + + 133 + + + 200 + + + + + + Building 30 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 24502 + + + 133 + + + 200 + + + + + + Building 32 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22842 + + + 133 + + + 200 + + + + + + Building 34 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22012 + + + 133 + + + 200 + + + + + + Building 35 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 24454 + + + 133 + + + 200 + + + + + + Building 36 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22146 + + + 133 + + + 200 + + + + + + Building 37 + + + + + + 2010 + + + + + + + + + + + + 2.1978 + + + 24772 + + + 91 + + + 200 + + + + + + Building 38a + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 21496 + + + 133 + + + 200 + + + + + + Building 39 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 26794 + + + 133 + + + 200 + + + + + + Building 3 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 21206 + + + 133 + + + 200 + + + + + + Building 40 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 21154 + + + 133 + + + 200 + + + + + + Building 41 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 19392 + + + 133 + + + 200 + + + + + + Building 42 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22610 + + + 133 + + + 200 + + + + + + Building 43 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 23577 + + + 133 + + + 200 + + + + + + Building 44 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 24864 + + + 133 + + + 200 + + + + + + Building 45 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 20132 + + + 133 + + + 200 + + + + + + Building 46 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 25065 + + + 133 + + + 200 + + + + + + Building 48 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 22344 + + + 133 + + + 200 + + + + + + Building 4 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 26888 + + + 133 + + + 200 + + + + + + Building 50 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 20118 + + + 133 + + + 200 + + + + + + Building 52 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 23673 + + + 133 + + + 200 + + + + + + Building 53 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 24382 + + + 133 + + + 200 + + + + + + Building 54 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 24863 + + + 133 + + + 200 + + + + + + Building 56 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 21229 + + + 133 + + + 200 + + + + + + Building 57 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 19709 + + + 133 + + + 200 + + + + + + Building 58a + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 18634 + + + 133 + + + 200 + + + + + + Building 58 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 20574 + + + 133 + + + 200 + + + + + + Building 59 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 23578 + + + 133 + + + 200 + + + + + + Building 5 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 18769 + + + 133 + + + 200 + + + + + + Building 60 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 16756 + + + 133 + + + 200 + + + + + + Building 61 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 21789 + + + 133 + + + 200 + + + + + + Building 65A + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 23907 + + + 133 + + + 200 + + + + + + Building 65B + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 26170 + + + 133 + + + 200 + + + + + + Building 65 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 16955 + + + 133 + + + 200 + + + + + + Building 67 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 19900 + + + 133 + + + 200 + + + + + + Building 6 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 23029 + + + 133 + + + 200 + + + + + + Building 7 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 20014 + + + 133 + + + 200 + + + + + + Building 85 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 19593 + + + 133 + + + 200 + + + + + + Building 86 + + + + + + 2010 + + + + + + + + + + + + 1.5038 + + + 25754 + + + 133 + + + 200 + + + + + + Building 9 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 51921 + + + 200 + + + 300 + + + + + + Building 12 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 46395 + + + 200 + + + 300 + + + + + + Building 13 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 47273 + + + 200 + + + 300 + + + + + + Building 14 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 42364 + + + 200 + + + 300 + + + + + + Building 15b + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 48530 + + + 200 + + + 300 + + + + + + Building 15 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 50792 + + + 200 + + + 300 + + + + + + Building 16 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 44944 + + + 200 + + + 300 + + + + + + Building 17 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 43168 + + + 200 + + + 300 + + + + + + Building 18 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 44267 + + + 200 + + + 300 + + + + + + Building 19 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 41628 + + + 200 + + + 300 + + + + + + Building 1 + + + + + + 2010 + + + + + + + + + + + + 0.6667 + + + 47307 + + + 300 + + + 200 + + + + + + Building 21 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 54502 + + + 200 + + + 300 + + + + + + Building 25 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 43942 + + + 200 + + + 300 + + + + + + Building 26 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 50630 + + + 200 + + + 300 + + + + + + Building 27 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 47256 + + + 200 + + + 300 + + + + + + Building 28 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 45441 + + + 200 + + + 300 + + + + + + Building 29 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 47621 + + + 200 + + + 300 + + + + + + Building 2 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 47701 + + + 200 + + + 300 + + + + + + Building 30 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 52508 + + + 200 + + + 300 + + + + + + Building 32 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 47774 + + + 200 + + + 300 + + + + + + Building 34 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 46326 + + + 200 + + + 300 + + + + + + Building 35 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 51921 + + + 200 + + + 300 + + + + + + Building 36 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 46230 + + + 200 + + + 300 + + + + + + Building 37 + + + + + + 2010 + + + + + + + + + + + + 2.2059 + + + 50490 + + + 136 + + + 300 + + + + + + Building 38a + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 45138 + + + 200 + + + 300 + + + + + + Building 39 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 56335 + + + 200 + + + 300 + + + + + + Building 3 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 43938 + + + 200 + + + 300 + + + + + + Building 40 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 44234 + + + 200 + + + 300 + + + + + + Building 41 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 38589 + + + 200 + + + 300 + + + + + + Building 42 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 47782 + + + 200 + + + 300 + + + + + + Building 43 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 48799 + + + 200 + + + 300 + + + + + + Building 44 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 53546 + + + 200 + + + 300 + + + + + + Building 45 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 40281 + + + 200 + + + 300 + + + + + + Building 46 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 54883 + + + 200 + + + 300 + + + + + + Building 48 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 45823 + + + 200 + + + 300 + + + + + + Building 4 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 58999 + + + 200 + + + 300 + + + + + + Building 50 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 42635 + + + 200 + + + 300 + + + + + + Building 52 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 48533 + + + 200 + + + 300 + + + + + + Building 53 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 51363 + + + 200 + + + 300 + + + + + + Building 54 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 50932 + + + 200 + + + 300 + + + + + + Building 56 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 42176 + + + 200 + + + 300 + + + + + + Building 57 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 38951 + + + 200 + + + 300 + + + + + + Building 58a + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 39628 + + + 200 + + + 300 + + + + + + Building 58 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 40158 + + + 200 + + + 300 + + + + + + Building 59 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 48776 + + + 200 + + + 300 + + + + + + Building 5 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 38417 + + + 200 + + + 300 + + + + + + Building 60 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 34480 + + + 200 + + + 300 + + + + + + Building 61 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 47692 + + + 200 + + + 300 + + + + + + Building 65A + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 50400 + + + 200 + + + 300 + + + + + + Building 65B + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 56680 + + + 200 + + + 300 + + + + + + Building 65 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 35483 + + + 200 + + + 300 + + + + + + Building 67 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 42629 + + + 200 + + + 300 + + + + + + Building 6 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 46805 + + + 200 + + + 300 + + + + + + Building 7 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 40743 + + + 200 + + + 300 + + + + + + Building 85 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 38907 + + + 200 + + + 300 + + + + + + Building 86 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 54181 + + + 200 + + + 300 + + + + + + Building 9 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 90122 + + + 267 + + + 400 + + + + + + Building 12 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 77892 + + + 267 + + + 400 + + + + + + Building 13 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 81293 + + + 267 + + + 400 + + + + + + Building 14 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 70805 + + + 267 + + + 400 + + + + + + Building 15b + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 82960 + + + 267 + + + 400 + + + + + + Building 15 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 86765 + + + 267 + + + 400 + + + + + + Building 16 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 79031 + + + 267 + + + 400 + + + + + + Building 17 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 74009 + + + 267 + + + 400 + + + + + + Building 18 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 74451 + + + 267 + + + 400 + + + + + + Building 19 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 71957 + + + 267 + + + 400 + + + + + + Building 1 + + + + + + 2010 + + + + + + + + + + + + 0.6675 + + + 80039 + + + 400 + + + 267 + + + + + + Building 21 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 94634 + + + 267 + + + 400 + + + + + + Building 25 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 76874 + + + 267 + + + 400 + + + + + + Building 26 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 87235 + + + 267 + + + 400 + + + + + + Building 27 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 80862 + + + 267 + + + 400 + + + + + + Building 28 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 75692 + + + 267 + + + 400 + + + + + + Building 29 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 82121 + + + 267 + + + 400 + + + + + + Building 2 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 81398 + + + 267 + + + 400 + + + + + + Building 30 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 91168 + + + 267 + + + 400 + + + + + + Building 32 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 82587 + + + 267 + + + 400 + + + + + + Building 34 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 80238 + + + 267 + + + 400 + + + + + + Building 35 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 90122 + + + 267 + + + 400 + + + + + + Building 36 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 80252 + + + 267 + + + 400 + + + + + + Building 37 + + + + + + 2010 + + + + + + + + + + + + 2.2099 + + + 87624 + + + 181 + + + 400 + + + + + + Building 38a + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 77420 + + + 267 + + + 400 + + + + + + Building 39 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 97872 + + + 267 + + + 400 + + + + + + Building 3 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 75543 + + + 267 + + + 400 + + + + + + Building 40 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 76228 + + + 267 + + + 400 + + + + + + Building 41 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 64895 + + + 267 + + + 400 + + + + + + Building 42 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 82679 + + + 267 + + + 400 + + + + + + Building 43 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 82222 + + + 267 + + + 400 + + + + + + Building 44 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 93303 + + + 267 + + + 400 + + + + + + Building 45 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 68359 + + + 267 + + + 400 + + + + + + Building 46 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 97718 + + + 267 + + + 400 + + + + + + Building 48 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 77678 + + + 267 + + + 400 + + + + + + Building 4 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 104274 + + + 267 + + + 400 + + + + + + Building 50 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 74503 + + + 267 + + + 400 + + + + + + Building 52 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 81971 + + + 267 + + + 400 + + + + + + Building 53 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 86799 + + + 267 + + + 400 + + + + + + Building 54 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 84926 + + + 267 + + + 400 + + + + + + Building 56 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 70345 + + + 267 + + + 400 + + + + + + Building 57 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 64331 + + + 267 + + + 400 + + + + + + Building 58a + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 68512 + + + 267 + + + 400 + + + + + + Building 58 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 65822 + + + 267 + + + 400 + + + + + + Building 59 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 83262 + + + 267 + + + 400 + + + + + + Building 5 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 65040 + + + 267 + + + 400 + + + + + + Building 60 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 58589 + + + 267 + + + 400 + + + + + + Building 61 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 85485 + + + 267 + + + 400 + + + + + + Building 65A + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 87266 + + + 267 + + + 400 + + + + + + Building 65B + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 99082 + + + 267 + + + 400 + + + + + + Building 65 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 60477 + + + 267 + + + 400 + + + + + + Building 67 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 75413 + + + 267 + + + 400 + + + + + + Building 6 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 78313 + + + 267 + + + 400 + + + + + + Building 7 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 69142 + + + 267 + + + 400 + + + + + + Building 85 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 64715 + + + 267 + + + 400 + + + + + + Building 86 + + + + + + 2010 + + + + + + + + + + + + 1.4981 + + + 92932 + + + 267 + + + 400 + + + + + + Building 9 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 198247 + + + 400 + + + 600 + + + + + + Building 12 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 158749 + + + 400 + + + 600 + + + + + + Building 13 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 175656 + + + 400 + + + 600 + + + + + + Building 14 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 144555 + + + 400 + + + 600 + + + + + + Building 15b + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 173622 + + + 400 + + + 600 + + + + + + Building 15 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 183146 + + + 400 + + + 600 + + + + + + Building 16 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 174390 + + + 400 + + + 600 + + + + + + Building 17 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 156296 + + + 400 + + + 600 + + + + + + Building 18 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 153222 + + + 400 + + + 600 + + + + + + Building 19 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 154592 + + + 400 + + + 600 + + + + + + Building 1 + + + + + + 2010 + + + + + + + + + + + + 0.6667 + + + 163060 + + + 600 + + + 400 + + + + + + Building 21 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 204481 + + + 400 + + + 600 + + + + + + Building 25 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 166229 + + + 400 + + + 600 + + + + + + Building 26 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 184527 + + + 400 + + + 600 + + + + + + Building 27 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 170875 + + + 400 + + + 600 + + + + + + Building 28 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 154503 + + + 400 + + + 600 + + + + + + Building 29 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 175310 + + + 400 + + + 600 + + + + + + Building 2 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 171651 + + + 400 + + + 600 + + + + + + Building 30 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 196241 + + + 400 + + + 600 + + + + + + Building 32 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 178927 + + + 400 + + + 600 + + + + + + Building 34 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 172206 + + + 400 + + + 600 + + + + + + Building 35 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 198247 + + + 400 + + + 600 + + + + + + Building 36 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 173427 + + + 400 + + + 600 + + + + + + Building 37 + + + + + + 2010 + + + + + + + + + + + + 2.2059 + + + 186789 + + + 272 + + + 600 + + + + + + Building 38a + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 166019 + + + 400 + + + 600 + + + + + + Building 39 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 210477 + + + 400 + + + 600 + + + + + + Building 3 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 162978 + + + 400 + + + 600 + + + + + + Building 40 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 165185 + + + 400 + + + 600 + + + + + + Building 41 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 131109 + + + 400 + + + 600 + + + + + + Building 42 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 178888 + + + 400 + + + 600 + + + + + + Building 43 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 170080 + + + 400 + + + 600 + + + + + + Building 44 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 199965 + + + 400 + + + 600 + + + + + + Building 45 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 139688 + + + 400 + + + 600 + + + + + + Building 46 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 214537 + + + 400 + + + 600 + + + + + + Building 48 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 160451 + + + 400 + + + 600 + + + + + + Building 4 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 228195 + + + 400 + + + 600 + + + + + + Building 50 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 160097 + + + 400 + + + 600 + + + + + + Building 52 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 170308 + + + 400 + + + 600 + + + + + + Building 53 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 180479 + + + 400 + + + 600 + + + + + + Building 54 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 173620 + + + 400 + + + 600 + + + + + + Building 56 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 141815 + + + 400 + + + 600 + + + + + + Building 57 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 129393 + + + 400 + + + 600 + + + + + + Building 58a + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 149316 + + + 400 + + + 600 + + + + + + Building 58 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 133113 + + + 400 + + + 600 + + + + + + Building 59 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 180392 + + + 400 + + + 600 + + + + + + Building 5 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 136545 + + + 400 + + + 600 + + + + + + Building 60 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 122296 + + + 400 + + + 600 + + + + + + Building 61 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 190096 + + + 400 + + + 600 + + + + + + Building 65A + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 189564 + + + 400 + + + 600 + + + + + + Building 65B + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 214678 + + + 400 + + + 600 + + + + + + Building 65 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 129113 + + + 400 + + + 600 + + + + + + Building 67 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 164187 + + + 400 + + + 600 + + + + + + Building 6 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 159866 + + + 400 + + + 600 + + + + + + Building 7 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 144100 + + + 400 + + + 600 + + + + + + Building 85 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 129082 + + + 400 + + + 600 + + + + + + Building 86 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 195160 + + + 400 + + + 600 + + + + + + Building 9 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 346146 + + + 533 + + + 800 + + + + + + Building 12 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 264070 + + + 533 + + + 800 + + + + + + Building 13 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 307203 + + + 533 + + + 800 + + + + + + Building 14 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 241073 + + + 533 + + + 800 + + + + + + Building 15b + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 296887 + + + 533 + + + 800 + + + + + + Building 15 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 311030 + + + 533 + + + 800 + + + + + + Building 16 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 307357 + + + 533 + + + 800 + + + + + + Building 17 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 267272 + + + 533 + + + 800 + + + + + + Building 18 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 258132 + + + 533 + + + 800 + + + + + + Building 19 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 269036 + + + 533 + + + 800 + + + + + + Building 1 + + + + + + 2010 + + + + + + + + + + + + 0.6663 + + + 273667 + + + 800 + + + 533 + + + + + + Building 21 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 348256 + + + 533 + + + 800 + + + + + + Building 25 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 288389 + + + 533 + + + 800 + + + + + + Building 26 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 313778 + + + 533 + + + 800 + + + + + + Building 27 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 290510 + + + 533 + + + 800 + + + + + + Building 28 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 257404 + + + 533 + + + 800 + + + + + + Building 29 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 301653 + + + 533 + + + 800 + + + + + + Building 2 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 293601 + + + 533 + + + 800 + + + + + + Building 30 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 336032 + + + 533 + + + 800 + + + + + + Building 32 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 308673 + + + 533 + + + 800 + + + + + + Building 34 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 296845 + + + 533 + + + 800 + + + + + + Building 35 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 346146 + + + 533 + + + 800 + + + + + + Building 36 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 301610 + + + 533 + + + 800 + + + + + + Building 37 + + + + + + 2010 + + + + + + + + + + + + 2.2099 + + + 326347 + + + 362 + + + 800 + + + + + + Building 38a + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 285866 + + + 533 + + + 800 + + + + + + Building 39 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 366422 + + + 533 + + + 800 + + + + + + Building 3 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 284499 + + + 533 + + + 800 + + + + + + Building 40 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 288307 + + + 533 + + + 800 + + + + + + Building 41 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 219196 + + + 533 + + + 800 + + + + + + Building 42 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 309457 + + + 533 + + + 800 + + + + + + Building 43 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 284969 + + + 533 + + + 800 + + + + + + Building 44 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 342923 + + + 533 + + + 800 + + + + + + Building 45 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 235509 + + + 533 + + + 800 + + + + + + Building 46 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 376357 + + + 533 + + + 800 + + + + + + Building 48 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 270215 + + + 533 + + + 800 + + + + + + Building 4 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 396678 + + + 533 + + + 800 + + + + + + Building 50 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 276927 + + + 533 + + + 800 + + + + + + Building 52 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 288002 + + + 533 + + + 800 + + + + + + Building 53 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 301131 + + + 533 + + + 800 + + + + + + Building 54 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 287578 + + + 533 + + + 800 + + + + + + Building 56 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 235366 + + + 533 + + + 800 + + + + + + Building 57 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 214214 + + + 533 + + + 800 + + + + + + Building 58a + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 257863 + + + 533 + + + 800 + + + + + + Building 58 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 221223 + + + 533 + + + 800 + + + + + + Building 59 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 312508 + + + 533 + + + 800 + + + + + + Building 5 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 231237 + + + 533 + + + 800 + + + + + + Building 60 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 207303 + + + 533 + + + 800 + + + + + + Building 61 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 337285 + + + 533 + + + 800 + + + + + + Building 65A + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 329315 + + + 533 + + + 800 + + + + + + Building 65B + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 372229 + + + 533 + + + 800 + + + + + + Building 65 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 222204 + + + 533 + + + 800 + + + + + + Building 67 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 285073 + + + 533 + + + 800 + + + + + + Building 6 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 267806 + + + 533 + + + 800 + + + + + + Building 7 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 243434 + + + 533 + + + 800 + + + + + + Building 85 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 213866 + + + 533 + + + 800 + + + + + + Building 86 + + + + + + 2010 + + + + + + + + + + + + 1.5009 + + + 329533 + + + 533 + + + 800 + + + + + + Building 9 + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4864136 + + + 2304 + + + 3456 + + + + + + Building 12 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3322089 + + + 2304 + + + 3456 + + + + + + Building 13 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4542120 + + + 2304 + + + 3456 + + + + + + Building 14 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3030565 + + + 2304 + + + 3456 + + + + + + Building 15b + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3853704 + + + 2304 + + + 3456 + + + + + + Building 15 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3802980 + + + 2304 + + + 3456 + + + + + + Building 16 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4472313 + + + 2304 + + + 3456 + + + + + + Building 17 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3430321 + + + 2304 + + + 3456 + + + + + + Building 18 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3540763 + + + 2304 + + + 3456 + + + + + + Building 19 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3646269 + + + 2304 + + + 3456 + + + + + + Building 1 + + + + + + + + + 2010 + + + + + + + + + + + + 0.6667 + + + 3458612 + + + 3456 + + + 2304 + + + + + + Building 21 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4372970 + + + 2304 + + + 3456 + + + + + + Building 25 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3724740 + + + 2304 + + + 3456 + + + + + + Building 26 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3862360 + + + 2304 + + + 3456 + + + + + + Building 27 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3746349 + + + 2304 + + + 3456 + + + + + + Building 28 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3373790 + + + 2304 + + + 3456 + + + + + + Building 29 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4014987 + + + 2304 + + + 3456 + + + + + + Building 2 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3940895 + + + 2304 + + + 3456 + + + + + + Building 30 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4535969 + + + 2304 + + + 3456 + + + + + + Building 32 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3937194 + + + 2304 + + + 3456 + + + + + + Building 34 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3684651 + + + 2304 + + + 3456 + + + + + + Building 35 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4864136 + + + 2304 + + + 3456 + + + + + + Building 36 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4005720 + + + 2304 + + + 3456 + + + + + + Building 37 + + + + + + + + + 2010 + + + + + + + + + + + + 2.2075 + + + 6361547 + + + 2173 + + + 4797 + + + + + + Building 38a + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4129277 + + + 2304 + + + 3456 + + + + + + Building 39 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 8648477 + + + 3168 + + + 4752 + + + + + + Building 3 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3754602 + + + 2304 + + + 3456 + + + + + + Building 40 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3863722 + + + 2304 + + + 3456 + + + + + + Building 41 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 2668562 + + + 2304 + + + 3456 + + + + + + Building 42 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4339163 + + + 2304 + + + 3456 + + + + + + Building 43 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3830713 + + + 2304 + + + 3456 + + + + + + Building 44 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4068912 + + + 2304 + + + 3456 + + + + + + Building 45 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3215122 + + + 2304 + + + 3456 + + + + + + Building 46 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 4780220 + + + 2304 + + + 3456 + + + + + + Building 48 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3494398 + + + 2304 + + + 3456 + + + + + + Building 4 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 5207751 + + + 2304 + + + 3456 + + + + + + Building 50 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3534017 + + + 2304 + + + 3456 + + + + + + Building 52 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3855820 + + + 2304 + + + 3456 + + + + + + Building 53 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3659487 + + + 2304 + + + 3456 + + + + + + Building 54 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3398962 + + + 2304 + + + 3456 + + + + + + Building 56 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3046237 + + + 2304 + + + 3456 + + + + + + Building 57 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 2612049 + + + 2304 + + + 3456 + + + + + + Building 58a + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3610728 + + + 2304 + + + 3456 + + + + + + Building 58 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 2927568 + + + 2304 + + + 3456 + + + + + + Building 59 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 7245903 + + + 3168 + + + 4752 + + + + + + Building 5 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3108605 + + + 2304 + + + 3456 + + + + + + Building 60 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 2918391 + + + 2304 + + + 3456 + + + + + + Building 61 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 8061092 + + + 3168 + + + 4752 + + + + + + Building 65A + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 7609554 + + + 3168 + + + 4752 + + + + + + Building 65B + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 7818746 + + + 3168 + + + 4752 + + + + + + Building 65 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3063979 + + + 2304 + + + 3456 + + + + + + Building 67 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3779804 + + + 2304 + + + 3456 + + + + + + Building 6 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 5893925 + + + 3168 + + + 4752 + + + + + + Building 7 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3314498 + + + 2304 + + + 3456 + + + + + + Building 85 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3017739 + + + 2304 + + + 3456 + + + + + + Building 86 + + + + + + + + + 2010 + + + + + + + + + + + + 1.5000 + + + 3887778 + + + 2304 + + + 3456 + + + + + + Building 9 + + + + + + + + + + + + + + + François-Xavier Beckers + + diff --git a/assets/places.rdf b/assets/places.rdf new file mode 100644 index 0000000..55bb8fd --- /dev/null +++ b/assets/places.rdf @@ -0,0 +1,12102 @@ + + + + + + + + + + + + + + + + 2012-01-09T20:55:41Z + + + 2012-01-09T20:55:42Z + + + + + + + + + + + + + + + 2012-01-09T20:55:39Z + + + 2012-01-09T20:55:40Z + + + + + + + + + + + + + + + 2012-01-09T20:55:41Z + + + 2012-01-09T20:55:41Z + + + + + + + + + + + + + + + 2012-01-09T20:55:40Z + + + 2012-01-09T20:55:40Z + + + + + + + + + + + + + + + 2012-01-09T20:55:40Z + + + 2012-01-09T20:55:41Z + + + + + + + + + + + + + + + + + + 2012-01-09 + + + Open Org Places Document describing buildings, and other geospacial entities related to the University of Southampton. Data about completion dates and architects has not been formally verified and should not be treated as definitive. + + + + + + + + + + + + Buildings and Places + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2012-01-09T20:55:42Z + + + 2012-01-09T20:55:42Z + + + + + + + + + + + + + + + 2012-01-09T20:55:38Z + + + 2012-01-09T20:55:39Z + + + + + + + + + + + + + + + + + + Building 2 Annexe + + + 0002A + + + + + + Building 0002A is non-residential + + + + + + 1965 + + + POLYGON((-1.3962631 50.9375993,-1.3960836 50.9378388,-1.3958288 50.9377629,-1.3960083 50.9375235,-1.3962631 50.9375993)) + + + + + + + + + + + + Building 1 + + + 50.9376734 + + + -1.3960704 + + + 1 + + + + + + + + + + + + Building 1 is non-residential + + + + + + + + + POLYGON((-1.3954464 50.9332268,-1.3952596 50.9332756,-1.3952172 50.9332109,-1.3954040 50.9331622,-1.3954464 50.9332268)) + + + + + + + + + + + + 26 University Road + + + 50.933235 + + + -1.395323 + + + 1050 + + + + + + Building 1050 is non-residential + + + + + + POLYGON((-1.3954310 50.9332600,-1.3952645 50.9333035,-1.3953197 50.9333876,-1.3954863 50.9333442,-1.3954310 50.9332600)) + + + + + + + + + + + + 28 University Road + + + 50.933338 + + + -1.395356 + + + 1051 + + + + + + Building 1051 is non-residential + + + + + + energy/b11/ekw + + + + + + + + + + + + Energy Centre (CHP) + + + 11 + + + + + + Building 11 is non-residential + + + + + + POLYGON((-1.3960740 50.9331501,-1.3958781 50.9331819,-1.3957922 50.9329716,-1.3959882 50.9329398,-1.3960740 50.9331501)) + + + + + + + + + + + + 31 University Road + + + 50.9330414 + + + -1.3959296 + + + 1101 + + + + + + Building 1101 is non-residential + + + + + + POLYGON((-1.3961365 50.9333535,-1.3959607 50.9333820,-1.3959404 50.9333322,-1.3961162 50.9333037,-1.3961365 50.9333535)) + + + + + + + + + + + + 39 University Road + + + 50.9333389 + + + -1.3960392 + + + 1102 + + + + + + Building 1102 is non-residential + + + + + + POLYGON((-1.3962115 50.9334519,-1.3961891 50.9333972,-1.3960172 50.9334251,-1.3960396 50.9334798,-1.3962115 50.9334519)) + + + + + + + + + + + + 41 University Rd - Chaplaincy + + + 50.9334345 + + + -1.396101 + + + 1104 + + + + + + Building 1104 is non-residential + + + + + + POLYGON((-1.3962463 50.9335257,-1.3960813 50.9335524,-1.3960653 50.9335133,-1.3962303 50.9334866,-1.3962463 50.9335257)) + + + + + + + + + + + + 43 University Road + + + 50.933516 + + + -1.3961544 + + + 1105 + + + + + + Building 1105 is non-residential + + + + + + POLYGON((-1.3961755 50.9336170,-1.3961574 50.9335727,-1.3962950 50.9335504,-1.3963131 50.9335947,-1.3961755 50.9336170)) + + + + + + + + + + + + 45 University Road + + + 50.9335868 + + + -1.3962246 + + + 1106 + + + + + + Building 1106 is non-residential + + + + + + POLYGON((-1.3963312 50.9336390,-1.3961936 50.9336613,-1.3961755 50.9336170,-1.3963131 50.9335947,-1.3963312 50.9336390)) + + + + + + + + + + + + 47 University Road + + + 50.9336275 + + + -1.3962471 + + + 1107 + + + + + + Building 1107 is non-residential + + + + + + + + + + + + + + + Interchange Kiosk + + + 50.936291 + + + -1.397173 + + + 115 + + + + + + Building 115 is non-residential + + + + + + + + + POLYGON((-1.3951457 50.9380189,-1.3951091 50.9378950,-1.3950515 50.9379021,-1.3950888 50.9380256,-1.3951457 50.9380189)) + + + + + + + + + + + + 130 Burgess Road + + + 50.938011 + + + -1.395103 + + + 1220 + + + + + + Building 1220 is residential + + + + + + POLYGON((-1.3949939 50.9379092,-1.3949363 50.9379162,-1.3949750 50.9380389,-1.3950319 50.9380322,-1.3949939 50.9379092)) + + + + + + + + + + + + 134 Burgess Road + + + 50.938026 + + + -1.395002 + + + 1221 + + + + + + Building 1221 is residential + + + + + + POLYGON((-1.3949363 50.9379162,-1.3948787 50.9379233,-1.3949181 50.9380455,-1.3949750 50.9380389,-1.3949363 50.9379162)) + + + + + + + + + + + + 136 Burgess Road + + + 50.938034 + + + -1.39495 + + + 1222 + + + + + + Building 1222 is residential + + + + + + + + + + + + + + + The Stile + + + 1223 + + + + + + Building 1223 is non-residential + + + + + + + + + + + + + + + College Keep + + + 50.898575 + + + -1.396685 + + + 123 + + + + + + Building 123 is non-residential + + + + + + + + + + + + + + + Gamma House + + + 125 + + + + + + Building 125 is non-residential + + + + + + + + + 1960 + + + energy/b13/ekw + + + POLYGON((-1.3942111 50.9360496,-1.3938252 50.9359386,-1.3939287 50.9357957,-1.3931940 50.9355843,-1.3933083 50.9354265,-1.3946257 50.9358055,-1.3944872 50.9359967,-1.3942904 50.9359400,-1.3942111 50.9360496)) + + + + + + + + + + + + Tizard + + + 50.935551 + + + -1.393488 + + + 13 + + + + + + Sir Basil Spence + + + + + + Building 13 is non-residential + + + + + + + + + + + + + + + 16 Highfield Road + + + 1310 + + + + + + Building 1310 is non-residential + + + + + + + + + + + + + + + 1A Oakhurst Road + + + 50.933636 + + + -1.400937 + + + 1390 + + + + + + Building 1390 is residential + + + + + + + + + + + + + + + 1B Oakhurst Road + + + 50.933636 + + + -1.400937 + + + 1391 + + + + + + Building 1391 is residential + + + + + + POLYGON((-1.4039112 50.9381502,-1.4037908 50.9382178,-1.4036894 50.9381461,-1.4038098 50.9380785,-1.4039112 50.9381502)) + + + + + + + + + + + + 17 Oaklands Way + + + 50.9381522 + + + -1.4037955 + + + 1395 + + + + + + Building 1395 is residential + + + + + + + + + + + + + + + Workshop adjacent to B13 + + + 13A + + + + + + Building 13A is non-residential + + + + + + + + + POLYGON((-1.3979419 50.9331271,-1.3978802 50.9330999,-1.3979409 50.9330451,-1.3980027 50.9330722,-1.3979419 50.9331271)) + + + + + + + + + + + + 8 Chamberlain Road + + + 50.9330741 + + + -1.3979365 + + + 1401 + + + + + + Building 1401 is residential + + + + + + POLYGON((-1.3980584 50.9330967,-1.3979976 50.9331516,-1.3979419 50.9331271,-1.3980027 50.9330722,-1.3980584 50.9330967)) + + + + + + + + + + + + 10 Chamberlain Road + + + 50.933101 + + + -1.3979888 + + + 1402 + + + + + + Building 1402 is residential + + + + + + POLYGON((-1.3980753 50.9332075,-1.3980221 50.9331840,-1.3980933 50.9331197,-1.3981465 50.9331432,-1.3980753 50.9332075)) + + + + + + + + + + + + 12 Chamberlain Road + + + 50.9331489 + + + -1.3980886 + + + 1403 + + + + + + Building 1403 is residential + + + + + + POLYGON((-1.3981310 50.9332320,-1.3980753 50.9332075,-1.3981465 50.9331432,-1.3982022 50.9331677,-1.3981310 50.9332320)) + + + + + + + + + + + + 14 Chamberlain Road + + + 50.9331759 + + + -1.3981409 + + + 1404 + + + + + + Building 1404 is residential + + + + + + POLYGON((-1.3982147 50.9332866,-1.3981648 50.9332647,-1.3982279 50.9332078,-1.3982777 50.9332297,-1.3982147 50.9332866)) + + + + + + + + + + + + 16 Chamberlain Road + + + 50.9332298 + + + -1.3982264 + + + 1405 + + + + + + Building 1405 is residential + + + + + + POLYGON((-1.3983297 50.9332525,-1.3982666 50.9333094,-1.3982147 50.9332866,-1.3982777 50.9332297,-1.3983297 50.9332525)) + + + + + + + + + + + + 18 Chamberlain Road + + + 50.9332568 + + + -1.3982834 + + + 1406 + + + + + + Building 1406 is residential + + + + + + POLYGON((-1.3983793 50.9333739,-1.3983087 50.9333428,-1.3983724 50.9332853,-1.3984431 50.9333164,-1.3983793 50.9333739)) + + + + + + + + + + + + 20 Chamberlain Road + + + 50.9333077 + + + -1.398388 + + + 1407 + + + + + + Building 1407 is residential + + + + + + POLYGON((-1.3985004 50.9333416,-1.3984366 50.9333991,-1.3983793 50.9333739,-1.3984431 50.9333164,-1.3985004 50.9333416)) + + + + + + + + + + + + 22 Chamberlain Road + + + 50.9333406 + + + -1.3984498 + + + 1408 + + + + + + Building 1408 is residential + + + + + + POLYGON((-1.3985527 50.9334455,-1.3984850 50.9334158,-1.3985501 50.9333570,-1.3986178 50.9333867,-1.3985527 50.9334455)) + + + + + + + + + + + + 24 Chamberlain Road + + + 50.9333886 + + + -1.3985496 + + + 1409 + + + + + + Building 1409 is residential + + + + + + POLYGON((-1.3986697 50.9334094,-1.3986045 50.9334683,-1.3985527 50.9334455,-1.3986178 50.9333867,-1.3986697 50.9334094)) + + + + + + + + + + + + 26 Chamberlain Road + + + 50.9334155 + + + -1.3986066 + + + 1410 + + + + + + Building 1410 is residential + + + + + + POLYGON((-1.3987810 50.9334650,-1.3987028 50.9334306,-1.3986403 50.9334870,-1.3987185 50.9335214,-1.3987810 50.9334650)) + + + + + + + + + + + + 28 Chamberlain Road + + + 50.9334605 + + + -1.398716 + + + 1411 + + + + + + Building 1411 is residential + + + + + + POLYGON((-1.3988461 50.9334936,-1.3987837 50.9335500,-1.3987185 50.9335214,-1.3987810 50.9334650,-1.3988461 50.9334936)) + + + + + + + + + + + + 30 Chamberlain Road + + + 50.9334904 + + + -1.3987777 + + + 1412 + + + + + + Building 1412 is residential + + + + + + POLYGON((-1.3990691 50.9335921,-1.3990014 50.9335588,-1.3989293 50.9336172,-1.3989970 50.9336504,-1.3990691 50.9335921)) + + + + + + + + + + + + 32 Chamberlain Road + + + 50.9336012 + + + -1.3990059 + + + 1413 + + + + + + Building 1413 is residential + + + + + + POLYGON((-1.3990492 50.9336761,-1.3991213 50.9336178,-1.3990691 50.9335921,-1.3989970 50.9336504,-1.3990492 50.9336761)) + + + + + + + + + + + + 34 Chamberlain Road + + + 50.9336342 + + + -1.3990629 + + + 1414 + + + + + + Building 1414 is residential + + + + + + POLYGON((-1.3992232 50.9336687,-1.3991587 50.9336370,-1.3990864 50.9336955,-1.3991510 50.9337272,-1.3992232 50.9336687)) + + + + + + + + + + + + 36 Chamberlain Road + + + 50.9336731 + + + -1.3991675 + + + 1415 + + + + + + Building 1415 is residential + + + + + + POLYGON((-1.3992075 50.9337549,-1.3992797 50.9336965,-1.3992232 50.9336687,-1.3991510 50.9337272,-1.3992075 50.9337549)) + + + + + + + + + + + + 38 Chamberlain Road + + + 50.9337061 + + + -1.3992198 + + + 1416 + + + + + + Building 1416 is residential + + + + + + POLYGON((-1.3993856 50.9337499,-1.3993280 50.9337215,-1.3992599 50.9337766,-1.3993176 50.9338048,-1.3993856 50.9337499)) + + + + + + + + + + + + 40 Chamberlain Road + + + 50.933742 + + + -1.3993291 + + + 1417 + + + + + + Building 1417 is residential + + + + + + POLYGON((-1.3993732 50.9338321,-1.3994412 50.9337772,-1.3993856 50.9337499,-1.3993176 50.9338048,-1.3993732 50.9338321)) + + + + + + + + + + + + 42 Chamberlain Road + + + 50.933772 + + + -1.3993814 + + + 1418 + + + + + + Building 1418 is residential + + + + + + POLYGON((-1.3994955 50.9338699,-1.3994313 50.9338384,-1.3994954 50.9337865,-1.3995597 50.9338180,-1.3994955 50.9338699)) + + + + + + + + + + + + 44 Chamberlain Road + + + 50.9338139 + + + -1.3994954 + + + 1419 + + + + + + Building 1419 is non-residential + + + + + + POLYGON((-1.3996171 50.9338462,-1.3995528 50.9338981,-1.3994955 50.9338699,-1.3995597 50.9338180,-1.3996171 50.9338462)) + + + + + + + + + + + + 46 Chamberlain Road S/Union + + + 50.9338439 + + + -1.3995477 + + + 1420 + + + + + + Building 1420 is non-residential + + + + + + POLYGON((-1.3997912 50.9340060,-1.3997235 50.9339746,-1.3997870 50.9339202,-1.3998547 50.9339516,-1.3997912 50.9340060)) + + + + + + + + + + + + 48 Chamberlain Road + + + 50.9339487 + + + -1.3997949 + + + 1421 + + + + + + Building 1421 is residential + + + + + + POLYGON((-1.3999098 50.9339771,-1.3998463 50.9340315,-1.3997912 50.9340060,-1.3998547 50.9339516,-1.3999098 50.9339771)) + + + + + + + + + + + + 50 Chamberlain Road + + + 50.9339817 + + + -1.3998519 + + + 1422 + + + + + + Building 1422 is residential + + + + + + POLYGON((-1.3999535 50.9340837,-1.3998912 50.9340548,-1.3999568 50.9339986,-1.4000192 50.9340275,-1.3999535 50.9340837)) + + + + + + + + + + + + 52 Chamberlain Road + + + 50.9340266 + + + -1.3999612 + + + 1423 + + + + + + Building 1423 is residential + + + + + + POLYGON((-1.4000769 50.9340543,-1.4000112 50.9341105,-1.3999535 50.9340837,-1.4000192 50.9340275,-1.4000769 50.9340543)) + + + + + + + + + + + + 54 Chamberlain Road + + + 50.9340535 + + + -1.4000135 + + + 1424 + + + + + + Building 1424 is residential + + + + + + POLYGON((-1.4000936 50.9341661,-1.4000291 50.9341361,-1.4001044 50.9340716,-1.4001690 50.9341016,-1.4000936 50.9341661)) + + + + + + + + + + + + 56 Chamberlain Road + + + 50.9341015 + + + -1.4001038 + + + 1425 + + + + + + Building 1425 is residential + + + + + + POLYGON((-1.4002402 50.9341346,-1.4001648 50.9341992,-1.4000936 50.9341661,-1.4001690 50.9341016,-1.4002402 50.9341346)) + + + + + + + + + + + + 58 Chamberlain Road + + + 50.9341314 + + + -1.4001608 + + + 1426 + + + + + + Building 1426 is residential + + + + + + 1968 and 1978 + + + energy/b15/ekw + + + POLYGON((-1.3938263 50.9361099,-1.3936815 50.9360682,-1.3937180 50.9360178,-1.3929257 50.9357898,-1.3930253 50.9356524,-1.3937766 50.9358685,-1.3937251 50.9359395,-1.3939109 50.9359930,-1.3938263 50.9361099)) + + + + + + + + + + + + Wolfson/Rayleigh + + + 50.9358355 + + + -1.3933722 + + + 15 + + + + + + + + + + + + Building 15 is non-residential + + + + + + POLYGON((-1.3841637 50.9307957,-1.3842036 50.9307234,-1.3839995 50.9306787,-1.3839596 50.9307509,-1.3841637 50.9307957)) + + + + + + + + + + + + Unit 6 Store + + + 50.9307365 + + + -1.3840867 + + + 150 + + + + + + Building 150 is non-residential + + + + + + POLYGON((-1.3940465 50.9331469,-1.3940449 50.9331465,-1.3939470 50.9331241,-1.3939803 50.9330663,-1.3940799 50.9330891,-1.3940465 50.9331469)) + + + + + + + + + + + + 17 Hartley Avenue + + + 50.933098 + + + -1.393987 + + + 1501 + + + + + + Building 1501 is residential + + + + + + POLYGON((-1.3940414 50.9332277,-1.3940640 50.9331884,-1.3939557 50.9331636,-1.3939331 50.9332029,-1.3940414 50.9332277)) + + + + + + + + + + + + 19 Hartley Avenue + + + 50.933182 + + + -1.393974 + + + 1502 + + + + + + Building 1502 is residential + + + + + + POLYGON((-1.3940759 50.9332752,-1.3940536 50.9333139,-1.3939336 50.9332864,-1.3939559 50.9332478,-1.3940759 50.9332752)) + + + + + + + + + + + + 21 Hartley Avenue + + + 50.93327 + + + -1.393982 + + + 1503 + + + + + + Building 1503 is residential + + + + + + POLYGON((-1.3940512 50.9334135,-1.3939104 50.9333812,-1.3939385 50.9333325,-1.3940792 50.9333648,-1.3940512 50.9334135)) + + + + + + + + + + + + 23 Hartley Avenue + + + 50.933353 + + + -1.393979 + + + 1504 + + + + + + Building 1504 is residential + + + + + + POLYGON((-1.3941098 50.9334584,-1.3940766 50.9335160,-1.3939018 50.9334760,-1.3939350 50.9334184,-1.3941098 50.9334584)) + + + + + + + + + + + + 25 Hartley Avenue + + + 50.933445 + + + -1.393965 + + + 1505 + + + + + + Building 1505 is residential + + + + + + POLYGON((-1.3940766 50.9335160,-1.3940425 50.9335752,-1.3938677 50.9335352,-1.3939018 50.9334760,-1.3940766 50.9335160)) + + + + + + + + + + + + 27 Hartley Avenue + + + 50.933529 + + + -1.393944 + + + 1506 + + + + + + Building 1506 is residential + + + + + + POLYGON((-1.3940300 50.9336106,-1.3940056 50.9336530,-1.3938605 50.9336197,-1.3938849 50.9335773,-1.3940300 50.9336106)) + + + + + + + + + + + + 29 Hartley Avenue + + + 50.933605 + + + -1.393915 + + + 1507 + + + + + + Building 1507 is residential + + + + + + POLYGON((-1.3940329 50.9337099,-1.3940098 50.9337499,-1.3938328 50.9337094,-1.3938559 50.9336694,-1.3940329 50.9337099)) + + + + + + + + + + + + 31 Hartley Avenue + + + 50.933701 + + + -1.393915 + + + 1508 + + + + + + Building 1508 is residential + + + + + + POLYGON((-1.3839246 50.9312292,-1.3839644 50.9311569,-1.3837603 50.9311122,-1.3837204 50.9311845,-1.3839246 50.9312292)) + + + + + + + + + + + + Unit 12 Bindery + + + 50.9311694 + + + -1.3838409 + + + 151 + + + + + + Building 151 is non-residential + + + + + + POLYGON((-1.3838847 50.9313015,-1.3839246 50.9312292,-1.3837204 50.9311845,-1.3836806 50.9312567,-1.3838847 50.9313015)) + + + + + + + + + + + + Unit 13 Print Centre + + + 50.9312434 + + + -1.3838018 + + + 152 + + + + + + Building 152 is non-residential + + + + + + POLYGON((-1.4013088 50.9289840,-1.4013565 50.9289326,-1.4012850 50.9289062,-1.4012372 50.9289576,-1.4013088 50.9289840)) + + + + + + + + + + + + 65 Heatherdeane Road + + + 50.928944 + + + -1.401279 + + + 1580 + + + + + + Building 1580 is residential + + + + + + + + + 1989 + + + POLYGON((-1.3958537 50.9375688,-1.3956908 50.9377833,-1.3954078 50.9376980,-1.3955707 50.9374835,-1.3958537 50.9375688)) + + + + + + + + + + + + Building 16 + + + 50.9376285 + + + -1.3956608 + + + 16 + + + + + + + + + Sheppard Robson + + + + + + Building 16 is non-residential + + + + + + POLYGON((-1.3926182 50.9350922,-1.3925451 50.9350736,-1.3925931 50.9349986,-1.3926661 50.9350172,-1.3926182 50.9350922)) + + + + + + + + + + + + 62 Granby Grove + + + 50.9350404 + + + -1.3925923 + + + 1601 + + + + + + Building 1601 is residential + + + + + + POLYGON((-1.3927421 50.9350365,-1.3926942 50.9351115,-1.3926182 50.9350922,-1.3926661 50.9350172,-1.3927421 50.9350365)) + + + + + + + + + + + + 64 Granby Grove + + + 50.9350607 + + + -1.3926691 + + + 1602 + + + + + + Building 1602 is residential + + + + + + POLYGON((-1.4033851 50.9380972,-1.4033779 50.9379757,-1.4031633 50.9379807,-1.4031705 50.9381022,-1.4033851 50.9380972)) + + + + + + + + + + + + 34 Bassett Crescent East + + + 50.9380349 + + + -1.4032566 + + + 1603 + + + + + + Building 1603 is non-residential + + + + + + POLYGON((-1.4040993 50.9426200,-1.4038802 50.9426814,-1.4037073 50.9424363,-1.4039263 50.9423749,-1.4040993 50.9426200)) + + + + + + + + + + + + Bassett House + + + 50.9425216 + + + -1.4039043 + + + 1604 + + + + + + Building 1604 is non-residential + + + + + + POLYGON((-1.3786349 50.9361294,-1.3785129 50.9361898,-1.3784676 50.9361535,-1.3785896 50.9360930,-1.3786349 50.9361294)) + + + + + + + + + + + + 24 Mead Crescent + + + 50.936123 + + + -1.37853 + + + 1610 + + + + + + Building 1610 is residential + + + + + + POLYGON((-1.3802433 50.9347636,-1.3800682 50.9347934,-1.3800421 50.9347326,-1.3802173 50.9347028,-1.3802433 50.9347636)) + + + + + + + + + + + + 72 Mead Crescent + + + 50.934734 + + + -1.380123 + + + 1612 + + + + + + Building 1612 is residential + + + + + + POLYGON((-1.3906000 50.9366931,-1.3905501 50.9367647,-1.3904659 50.9367414,-1.3905158 50.9366698,-1.3906000 50.9366931)) + + + + + + + + + + + + 158 Mayfield Road + + + 50.936714 + + + -1.390499 + + + 1622 + + + + + + Building 1622 is residential + + + + + + + + + + + + + + + 13 Chestnut Lodge + + + 1626 + + + + + + Building 1626 is residential + + + + + + POLYGON((-1.3937526 50.9369803,-1.3936615 50.9369721,-1.3936753 50.9369116,-1.3937663 50.9369198,-1.3937526 50.9369803)) + + + + + + + + + + + + 185 Broadlands Road + + + 50.9369467 + + + -1.393715 + + + 1630 + + + + + + Building 1630 is residential + + + + + + + + + + + + + + + 10 Orchards Way + + + 50.929989 + + + -1.398211 + + + 1640 + + + + + + Building 1640 is residential + + + + + + POLYGON((-1.3908605 50.9285603,-1.3906720 50.9285423,-1.3907033 50.9284117,-1.3908919 50.9284297,-1.3908605 50.9285603)) + + + + + + + + + + + + 18-20 Shaftesbury Avenue + + + 50.9284882 + + + -1.3907767 + + + 165 + + + + + + Building 165 is residential + + + + + + + + + + + + + + + 1A Victoria Place, Portsmouth + + + 50.789497 + + + -1.082381 + + + 166 + + + + + + Building 166 is residential + + + + + + + + + + + + Data Centre + + + 167 + + + + + + Building 167 is non-residential + + + + + + 1960 + + + energy/b17/ekw + + + POLYGON((-1.3947792 50.9364360,-1.3945432 50.9364557,-1.3944542 50.9360544,-1.3946902 50.9360348,-1.3947792 50.9364360)) + + + + + + + + + + + + R J Mitchell Wind Tunnel + + + 50.9362396 + + + -1.3946145 + + + 17 + + + + + + + + + + + + Building 17 is non-residential + + + + + + POLYGON((-1.4032984 50.9421913,-1.4033171 50.9421268,-1.4031306 50.9421053,-1.4031119 50.9421699,-1.4032984 50.9421913)) + + + + + + + + + + + + 50 Glen Eyre Road + + + 50.9421475 + + + -1.4032158 + + + 1710 + + + + + + Building 1710 is residential + + + + + + POLYGON((-1.3004706 51.0678672,-1.3004929 51.0683357,-1.3004035 51.0686871,-1.3003140 51.0688605,-1.3001947 51.0688464,-1.2997548 51.0696007,-1.2996206 51.0695679,-1.3000382 51.0687293,-1.3001947 51.0687574,-1.3003289 51.0684529,-1.3003364 51.0678813,-1.3004706 51.0678672)) + + + + + + + + + + + + Erasmus Park + + + 51.0686667 + + + -1.3001172 + + + 1730 + + + + + + Building 1730 is residential + + + + + + + + + + + + + + + Erasmus - House 01 + + + 1730-01 + + + + + + Building 1730-01 is residential + + + + + + + + + + + + + + + Erasmus - House 02 + + + 1730-02 + + + + + + Building 1730-02 is residential + + + + + + + + + + + + + + + Erasmus - House 03 + + + 1730-03 + + + + + + Building 1730-03 is residential + + + + + + + + + + + + + + + Erasmus - House 04 + + + 1730-04 + + + + + + Building 1730-04 is residential + + + + + + + + + + + + + + + Erasmus - House 05 + + + 1730-05 + + + + + + Building 1730-05 is residential + + + + + + + + + + + + + + + Erasmus - House 06 + + + 1730-06 + + + + + + Building 1730-06 is residential + + + + + + + + + + + + + + + Erasmus - House 07 + + + 1730-07 + + + + + + Building 1730-07 is residential + + + + + + + + + + + + + + + Erasmus - House 08 + + + 1730-08 + + + + + + Building 1730-08 is residential + + + + + + + + + + + + + + + Erasmus - House 09 + + + 1730-09 + + + + + + Building 1730-09 is residential + + + + + + + + + + + + + + + Erasmus - House 10 + + + 1730-10 + + + + + + Building 1730-10 is residential + + + + + + + + + + + + + + + Erasmus - House 11 + + + 1730-11 + + + + + + Building 1730-11 is residential + + + + + + + + + + + + + + + Erasmus - House 12 + + + 1730-12 + + + + + + Building 1730-12 is residential + + + + + + + + + + + + + + + Erasmus - House 13 + + + 1730-13 + + + + + + Building 1730-13 is residential + + + + + + + + + + + + + + + Erasmus - House 14 + + + 1730-14 + + + + + + Building 1730-14 is residential + + + + + + + + + + + + + + + Erasmus - House 15 + + + 1730-15 + + + + + + Building 1730-15 is residential + + + + + + + + + + + + + + + Erasmus - House 16 + + + 1730-16 + + + + + + Building 1730-16 is residential + + + + + + + + + + + + + + + Erasmus - House 17 + + + 1730-17 + + + + + + Building 1730-17 is residential + + + + + + + + + + + + + + + Erasmus - House 18 + + + 1730-18 + + + + + + Building 1730-18 is residential + + + + + + + + + + + + + + + Erasmus - Flat 19 + + + 1730-19 + + + + + + Building 1730-19 is residential + + + + + + + + + + + + + + + Erasmus - Flat 20 + + + 1730-20 + + + + + + Building 1730-20 is residential + + + + + + + + + + + + + + + Erasmus - Flat 21 + + + 1730-21 + + + + + + Building 1730-21 is residential + + + + + + + + + + + + + + + Erasmus - Flat 22 + + + 1730-22 + + + + + + Building 1730-22 is residential + + + + + + + + + + + + + + + Erasmus - Flat 23 + + + 1730-23 + + + + + + Building 1730-23 is residential + + + + + + + + + + + + + + + Erasmus - Flat 24 + + + 1730-24 + + + + + + Building 1730-24 is residential + + + + + + + + + + + + + + + Erasmus - Flat 25 + + + 1730-25 + + + + + + Building 1730-25 is residential + + + + + + + + + + + + + + + Erasmus - Flat 26 + + + 1730-26 + + + + + + Building 1730-26 is residential + + + + + + + + + + + + + + + Erasmus - Flat 27 + + + 1730-27 + + + + + + Building 1730-27 is residential + + + + + + + + + + + + + + + Erasmus - Flat 28 + + + 1730-28 + + + + + + Building 1730-28 is residential + + + + + + + + + + + + + + + Erasmus - Flat 29 + + + 1730-29 + + + + + + Building 1730-29 is residential + + + + + + + + + + + + + + + Erasmus - Flat 30 + + + 1730-30 + + + + + + Building 1730-30 is residential + + + + + + + + + + + + + + + Erasmus - Flat 31 + + + 1730-31 + + + + + + Building 1730-31 is residential + + + + + + + + + + + + + + + Erasmus - Flat 32 + + + 1730-32 + + + + + + Building 1730-32 is residential + + + + + + + + + + + + + + + Erasmus - Flat 33 + + + 1730-33 + + + + + + Building 1730-33 is residential + + + + + + + + + + + + + + + Erasmus - Flat 34 + + + 1730-34 + + + + + + Building 1730-34 is residential + + + + + + + + + + + + + + + Erasmus - Flat 35 + + + 1730-35 + + + + + + Building 1730-35 is residential + + + + + + + + + + + + + + + Erasmus - Flat 36 + + + 1730-36 + + + + + + Building 1730-36 is residential + + + + + + + + + + + + + + + Erasmus - Flat 37 + + + 1730-37 + + + + + + Building 1730-37 is residential + + + + + + + + + + + + + + + Erasmus - Flat 38 + + + 1730-38 + + + + + + Building 1730-38 is residential + + + + + + + + + + + + + + + Erasmus - Flat 39 + + + 1730-39 + + + + + + Building 1730-39 is residential + + + + + + + + + + + + + + + Erasmus - Flat 40 + + + 1730-40 + + + + + + Building 1730-40 is residential + + + + + + + + + + + + + + + Erasmus - Flat 41 + + + 1730-41 + + + + + + Building 1730-41 is residential + + + + + + + + + + + + + + + Erasmus - Flat 42 + + + 1730-42 + + + + + + Building 1730-42 is residential + + + + + + + + + + + + + + + Annexe + + + 177 + + + + + + Building 177 is non-residential + + + + + + + + + 2004 + + + Swimming pool 25 m long x 12 m (6 lanes) wide Hall - 8 full size badminton courts, gymnasium + + + energy/b18/ekw + + + POLYGON((-1.3969522 50.9335808,-1.3961882 50.9337979,-1.3964428 50.9341473,-1.3969822 50.9340906,-1.3971020 50.9340151,-1.3971469 50.9338546,-1.3969522 50.9335808)) + + + + + + + + + + + + Jubilee Sports Complex + + + 50.9338813 + + + -1.3966792 + + + 18 + + + + + + + + + Rick Mather Architects + + + + + + Building 18 is non-residential + + + + + + + + + 2007 + + + energy/b19/ekw + + + POLYGON((-1.3928779 50.9357341,-1.3930914 50.9354394,-1.3928414 50.9353675,-1.3926280 50.9356621,-1.3928779 50.9357341)) + + + + + + + + + + + + ISVR + + + 50.9355444 + + + -1.392867 + + + 19 + + + + + + Wilson Mason Architects + + + + + + Building 19 is non-residential + + + + + + + + + 1968 + + + energy/b2/ekw + + + POLYGON((-1.3976631 50.9365593,-1.3977070 50.9365006,-1.3980119 50.9365913,-1.3984571 50.9359967,-1.3982743 50.9359423,-1.3979238 50.9364104,-1.3974604 50.9362726,-1.3973218 50.9364578,-1.3976631 50.9365593)) + + + + + + + + + + + + Building 2 + + + 50.9362789 + + + -1.3981275 + + + 2 + + + + + + Sir Basil Spence + + + + + + Building 2 is non-residential + + + + + + 1991 and 2004 + + + POLYGON((-1.3953605 50.9370322,-1.3952021 50.9370932,-1.3948858 50.9367672,-1.3950442 50.9367062,-1.3953605 50.9370322)) + + + + + + + + + + + + High Voltage Laboratory + + + 50.9368962 + + + -1.3951265 + + + 20 + + + + + + + + + + + + Building 20 is non-residential + + + + + + + + + 1963 + + + Iconic 1960s building which appeared on Royal Mail postage stamps + + + POLYGON((-1.3934706 50.9350665,-1.3932176 50.9354158,-1.3927710 50.9352873,-1.3929058 50.9351012,-1.3930554 50.9351443,-1.3931736 50.9349811,-1.3934706 50.9350665)) + + + + + + + + + + + + Faraday + + + 50.9351646 + + + -1.3932157 + + + 21 + + + + + + Sir Basil Spence + + + + + + Building 21 is non-residential + + + + + + energy/b22/ekw + + + POLYGON((-1.3944155 50.9351636,-1.3938508 50.9350004,-1.3939351 50.9348845,-1.3944998 50.9350477,-1.3944155 50.9351636)) + + + + + + + + + + + + Civil Eng Temp Accommodation + + + 50.9350233 + + + -1.3941636 + + + 22 + + + + + + Building 22 is non-residential + + + + + + + + + 1931/1947 + + + energy/b25/ekw + + + POLYGON((-1.3935901 50.9350150,-1.3930847 50.9348683,-1.3933129 50.9345562,-1.3937121 50.9346722,-1.3938184 50.9347030,-1.3935901 50.9350150)) + + + + + + + + + + + + EScience Building + + + 50.9347702 + + + -1.3934585 + + + 25 + + + + + + + + + Gutteridge & Gutteridge + + + + + + Building 25 is non-residential + + + + + + + + + 1955 + + + POLYGON((-1.3941355 50.9348109,-1.3942396 50.9346726,-1.3940978 50.9346302,-1.3939936 50.9347685,-1.3941355 50.9348109)) + + + + + + + + + + + + Building 26 + + + 50.9347143 + + + -1.3941216 + + + 26 + + + + + + + + + Gutteridge & Gutteridge + + + + + + Building 26 is non-residential + + + + + + + + + 1937 + + + POLYGON((-1.3942144 50.9341620,-1.3940655 50.9343654,-1.3938184 50.9347030,-1.3937121 50.9346722,-1.3937553 50.9346130,-1.3933507 50.9344955,-1.3937032 50.9340135,-1.3942144 50.9341620)) + + + + + + + + + + + + Chemistry + + + 50.93432 + + + -1.393776 + + + 27 + + + + + + + + + Gutteridge & Gutteridge + + + + + + Building 27 is non-residential + + + + + + + + + 1959 and 1966 + + + POLYGON((-1.3940978 50.9346302,-1.3948595 50.9348580,-1.3949230 50.9347737,-1.3941615 50.9345460,-1.3940978 50.9346302)) + + + + + + + + + + + + Froude + + + 50.9346967 + + + -1.3945278 + + + 28 + + + + + + + + + Sir Basil Spence + + + + + + Building 28 is non-residential + + + + + + + + + 1960 + + + POLYGON((-1.3937032 50.9340135,-1.3942144 50.9341620,-1.3943035 50.9340401,-1.3937923 50.9338916,-1.3937032 50.9340135)) + + + + + + + + + + + + Graham Hills + + + 50.9340008 + + + -1.3939798 + + + 29 + + + + + + + + + Sir Basil Spence + + + + + + Building 29 is non-residential + + + + + + + + + 1997 + + + POLYGON((-1.3948582 50.9345142,-1.3946930 50.9344663,-1.3946439 50.9345334,-1.3940655 50.9343654,-1.3942144 50.9341620,-1.3942593 50.9341005,-1.3950028 50.9343165,-1.3948582 50.9345142)) + + + + + + + + + + + + Synthetic Chemistry + + + 50.9343082 + + + -1.3944765 + + + 30 + + + + + + + + + Wilson Mason Architects + + + + + + Building 30 is non-residential + + + + + + + + + + + + + + + Combinatorial Chemistry + + + 30A + + + + + + Building 30A is non-residential + + + + + + + + + + + + + + + Hartley Store + + + 31 + + + + + + Building 31 is non-residential + + + + + + + + + 2006 + + + energy/b32/ekw + + + POLYGON((-1.3960952 50.9368069,-1.3958352 50.9368250,-1.3956962 50.9360329,-1.3959562 50.9360148,-1.3960952 50.9368069)) + + + + + + + + + + + + EEE Building + + + 50.9364157 + + + -1.395905 + + + 32 + + + + + + John McAslan & Partners + + + + + + Building 32 is non-residential + + + + + + 1938/1985 + + + energy/b33/ekw + + + + + + + + + + + + Estates (Maintenance) + + + 33 + + + + + + + + + + + + Building 33 is non-residential + + + + + + + + + 1948 + + + POLYGON((-1.3954637 50.9346674,-1.3950365 50.9345440,-1.3951889 50.9343346,-1.3956161 50.9344580,-1.3954637 50.9346674)) + + + + + + + + + + + + Education + + + 50.9344936 + + + -1.395317 + + + 34 + + + + + + + + + Gutteridge & Gutteridge + + + + + + Building 34 is non-residential + + + + + + + + + 1938 + + + POLYGON((-1.3950819 50.9341413,-1.3941784 50.9338803,-1.3944536 50.9335019,-1.3945981 50.9335436,-1.3945068 50.9336691,-1.3948464 50.9337672,-1.3947227 50.9339373,-1.3951421 50.9340585,-1.3950819 50.9341413)) + + + + + + + + + + + + David Kiddle + + + 50.93383 + + + -1.394475 + + + 35 + + + + + + + + + Gutteridge & Gutteridge + + + + + + Building 35 is non-residential + + + + + + 1914 (1935/1559/1965/1995) + + + Special Collections Learning Centre Cafe Termodex energy efficiency and perimeter lighting control + + + energy/b36/ekw + + + POLYGON((-1.3953488 50.9355079,-1.3951265 50.9354437,-1.3952192 50.9353163,-1.3948356 50.9352055,-1.3952298 50.9346636,-1.3955237 50.9347485,-1.3954783 50.9348108,-1.3953747 50.9347809,-1.3953178 50.9348592,-1.3955178 50.9349170,-1.3958210 50.9345001,-1.3960442 50.9345646,-1.3958693 50.9348050,-1.3960718 50.9348635,-1.3957341 50.9353278,-1.3955239 50.9352671,-1.3953488 50.9355079)) + + + + + + + + + + + + Library (inc. blds 10 12 & 14) + + + 50.934986 + + + -1.395156 + + + 36 + + + + + + + + + Building 36 is non-residential + + + + + + 1970 + + + Mainly open plan office space. The new extension features a three storey atrium with good use of natural light and ventilation. Efficient energy consumption provided by use of photovoltaic cells. + + + POLYGON((-1.3960675 50.9341793,-1.3956485 50.9336461,-1.3955131 50.9338109,-1.3953403 50.9338757,-1.3954081 50.9339888,-1.3952832 50.9341605,-1.3959426 50.9343510,-1.3960675 50.9341793)) + + + + + + + + + + + + George Thomas + + + 50.934147 + + + -1.395696 + + + 37 + + + + + + + + + Building 37 is non-residential + + + + + + energy/b37a/ekw + + + + + + + + + + + + George Thomas Building Exten + + + 50.933811 + + + -1.395687 + + + 37A + + + + + + Building 37A is non-residential + + + + + + + + + 1960 + + + Staff dining room, bars, coffee bar and staff sitting area. Used for social events and staff clubs + + + POLYGON((-1.3976549 50.9356166,-1.3969856 50.9354210,-1.3971977 50.9351327,-1.3977400 50.9352912,-1.3978812 50.9350993,-1.3980082 50.9351364,-1.3976549 50.9356166)) + + + + + + + + + + + + Staff Social Centre + + + 50.9354059 + + + -1.3974278 + + + 38 + + + + + + Sir Basil Spence + + + + + + Building 38 is non-residential + + + + + + + + + 2003 + + + POLYGON((-1.3994264 50.9367813,-1.3994459 50.9366769,-1.3992875 50.9366651,-1.3992680 50.9367695,-1.3994264 50.9367813)) + + + + + + + + + + + + Soton Stat Sci Res Institute + + + 50.936722 + + + -1.399298 + + + 39 + + + + + + + + + Charles Walker + + + + + + Building 39 is non-residential + + + + + + + + + 1963 + + + energy/b4/ekw + + + POLYGON((-1.3978226 50.9362215,-1.3976941 50.9361835,-1.3976483 50.9362451,-1.3975004 50.9362015,-1.3976876 50.9359500,-1.3978981 50.9356671,-1.3980946 50.9357253,-1.3978538 50.9360488,-1.3979336 50.9360724,-1.3978226 50.9362215)) + + + + + + + + + + + + Law + + + 50.9360909 + + + -1.3977134 + + + 4 + + + + + + Sir Basil Spence + + + + + + Building 4 is non-residential + + + + + + + + + 1939/1948/1956 + + + Dining area, Students' Union clubs and societies, offices + + + POLYGON((-1.3980066 50.9351399,-1.3981022 50.9350126,-1.3975618 50.9348515,-1.3974088 50.9345818,-1.3971047 50.9346504,-1.3972488 50.9349044,-1.3973590 50.9349372,-1.3972539 50.9350773,-1.3976292 50.9351892,-1.3977284 50.9350570,-1.3980066 50.9351399)) + + + + + + + + + + + + West Bld & Staff Social Centre + + + 50.9347275 + + + -1.3973325 + + + 40 + + + + + + + + + Gutteridge & Gutteridge + + + + + + Building 40 is non-residential + + + + + + + + + 1978 + + + POLYGON((-1.3952764 50.9337572,-1.3954855 50.9334698,-1.3953275 50.9334242,-1.3953066 50.9334529,-1.3952161 50.9334268,-1.3948216 50.9335191,-1.3948536 50.9335734,-1.3952130 50.9334893,-1.3952758 50.9335075,-1.3951258 50.9337138,-1.3952764 50.9337572)) + + + + + + + + + + + + Early Years Centre + + + 50.933559 + + + -1.395301 + + + 41 + + + + + + + + + John S Bonnington Partnership + + + + + + Building 41 is non-residential + + + + + + + + + 1966 + + + Dining area, Coffee Bar, Internet Cafe, The Cube Nightclub, SUSU Bar and sports facilities + + + POLYGON((-1.3978262 50.9345781,-1.3979746 50.9343821,-1.3978861 50.9343555,-1.3979799 50.9342316,-1.3979060 50.9342094,-1.3981327 50.9339100,-1.3978882 50.9338365,-1.3978357 50.9339059,-1.3973625 50.9337637,-1.3972321 50.9339360,-1.3974022 50.9339871,-1.3972552 50.9341812,-1.3970640 50.9341237,-1.3969251 50.9343072,-1.3978262 50.9345781)) + + + + + + + + + + + + Students' Union/Refectory + + + 50.934219 + + + -1.397511 + + + 42 + + + + + + + + + Sir Basil Spence + + + + + + Building 42 is non-residential + + + + + + + + + 1966 + + + POLYGON((-1.3990198 50.9348888,-1.3988484 50.9348373,-1.3989374 50.9347197,-1.3984863 50.9345841,-1.3988057 50.9341622,-1.3994282 50.9343493,-1.3990198 50.9348888)) + + + + + + + + + + + + Shackleton + + + 50.934322 + + + -1.399062 + + + 44 + + + + + + + + + Sir Basil Spence + + + + + + Building 44 is non-residential + + + + + + + + + + + + + + + Geodata Institute + + + 44A + + + + + + Building 44A is non-residential + + + + + + + + + + + + + + + Potting Shed behind B44 + + + 44B + + + + + + Building 44B is non-residential + + + + + + + + + 1994 + + + POLYGON((-1.3941526 50.9379660,-1.3943937 50.9377729,-1.3940913 50.9376230,-1.3939442 50.9376340,-1.3937025 50.9378275,-1.3940042 50.9379771,-1.3941526 50.9379660)) + + + + + + + + + + + + Health Profs & Rehab Sciences + + + 50.937801 + + + -1.394014 + + + 45 + + + + + + + + + Sir Norman Foster + + + + + + Building 45 is non-residential + + + + + + + + + 1966 + + + POLYGON((-1.3996489 50.9354933,-1.3990765 50.9353241,-1.3998238 50.9343202,-1.4001201 50.9344078,-1.3994895 50.9352549,-1.3997657 50.9353366,-1.3996489 50.9354933)) + + + + + + + + + + + + Physics + + + 50.9348505 + + + -1.3996014 + + + 46 + + + + + + Sir Basil Spence + + + + + + Building 46 is non-residential + + + + + + + + + 1992 + + + POLYGON((-1.3995604 50.9358040,-1.3996729 50.9356529,-1.3994007 50.9355725,-1.3992882 50.9357235,-1.3995604 50.9358040)) + + + + + + + + + + + + University Health Centre + + + 50.935696 + + + -1.399485 + + + 48 + + + + + + + + + Gutteridge + + + + + + Building 48 is non-residential + + + + + + + + + 1939 + + + POLYGON((-1.3950560 50.9357353,-1.3945298 50.9355844,-1.3946286 50.9354487,-1.3951542 50.9356008,-1.3950560 50.9357353)) + + + + + + + + + + + + Eustice + + + 50.9355883 + + + -1.3948313 + + + 5 + + + + + + + + + Gutteridge & Gutteridge + + + + + + Building 5 is non-residential + + + + + + + + + 1959 + + + Art Gallery + + + POLYGON((-1.3992828 50.9363321,-1.3992608 50.9359305,-1.3996124 50.9361521,-1.3992828 50.9363321)) + + + + + + + + + + + + John Hansard Gallery + + + 50.936142 + + + -1.3994 + + + 50 + + + + + + + + + Ronald Sims + + + + + + Building 50 is non-residential + + + + + + + + + 1974 + + + POLYGON((-1.3989189 50.9360475,-1.3990932 50.9358134,-1.3987332 50.9357070,-1.3985944 50.9358934,-1.3987408 50.9359367,-1.3987053 50.9359844,-1.3989189 50.9360475)) + + + + + + + + + + + + Turner Sims Concert Hall + + + 50.9358682 + + + -1.3988324 + + + 52 + + + + + + + + + John S. Bonnington Partnership + + + + + + Building 52 is non-residential + + + + + + + + + 2008 + + + Clean rooms + + + POLYGON((-1.3986455 50.9377312,-1.3984184 50.9377341,-1.3984230 50.9376582,-1.3979953 50.9375443,-1.3979271 50.9375326,-1.3979086 50.9373778,-1.3981388 50.9374137,-1.3983320 50.9370935,-1.3985171 50.9371379,-1.3985621 50.9370653,-1.3986872 50.9370595,-1.3988239 50.9370980,-1.3988587 50.9370478,-1.3991136 50.9370361,-1.3990244 50.9371622,-1.3991451 50.9371911,-1.3990964 50.9372717,-1.3989712 50.9372417,-1.3986455 50.9377312)) + + + + + + + + + + + + New Mountbatten + + + 50.937412 + + + -1.398236 + + + 53 + + + + + + Jestico + Whiles + + + + + + Building 53 is non-residential + + + + + + + + + 1963 & 1965 + + + POLYGON((-1.3989387 50.9363685,-1.3990922 50.9361623,-1.3988288 50.9360844,-1.3987745 50.9361574,-1.3984963 50.9360751,-1.3983971 50.9362084,-1.3989387 50.9363685)) + + + + + + + + + + + + Mathematics + + + 50.9362228 + + + -1.3988756 + + + 54 + + + + + + + + + Ronald Sims + + + + + + Building 54 is non-residential + + + + + + + + + + + + + + + Human Performance Laboratory + + + 56 + + + + + + Building 56 is non-residential + + + + + + 1996 + + + POLYGON((-1.3969805 50.9345282,-1.3970524 50.9344332,-1.3965905 50.9342943,-1.3965186 50.9343893,-1.3969805 50.9345282)) + + + + + + + + + + + + Students' Union Retail Centre + + + 50.934399 + + + -1.396755 + + + 57 + + + + + + + + + + + + Building 57 is non-residential + + + + + + 1975 + + + POLYGON((-1.3988875 50.9368534,-1.3991156 50.9365452,-1.3985030 50.9363651,-1.3982749 50.9366733,-1.3988875 50.9368534)) + + + + + + + + + + + + Murray + + + 50.936592 + + + -1.398697 + + + 58 + + + + + + + + + + + + Building 58 is non-residential + + + + + + 1997 + + + POLYGON((-1.3980198 50.9369398,-1.3982977 50.9365593,-1.3981692 50.9365209,-1.3978437 50.9369544,-1.3980198 50.9369398)) + + + + + + + + + + + + Building 58A + + + 50.9367447 + + + -1.3980786 + + + 58A + + + + + + + + + Building 58A is non-residential + + + + + + + + + 1997 + + + energy/b59/ekw + + + POLYGON((-1.3979271 50.9375326,-1.3979086 50.9373778,-1.3978854 50.9371267,-1.3975656 50.9371384,-1.3976027 50.9375034,-1.3977371 50.9374976,-1.3977371 50.9375414,-1.3979271 50.9375326)) + + + + + + + + + + + + New Zepler + + + 50.9374063 + + + -1.3977863 + + + 59 + + + + + + + + + Wilson Mason + + + + + + Building 59 is non-residential + + + + + + + + + 1964 + + + Theatre plays host to touring productions as well as own and student productions + + + energy/b6/ekw + + + POLYGON((-1.3974985 50.9361984,-1.3967725 50.9359779,-1.3969794 50.9357074,-1.3977054 50.9359278,-1.3974985 50.9361984)) + + + + + + + + + + + + Nuffield Theatre + + + 50.9359585 + + + -1.3972189 + + + 6 + + + + + + Sir Basil Spence + + + + + + Building 6 is non-residential + + + + + + + + + 1999 + + + Commercial services building encompassing university offices, residential and commercial accommodation + + + POLYGON((-1.3983350 50.9377429,-1.3981218 50.9376465,-1.3971346 50.9376932,-1.3970002 50.9377809,-1.3969075 50.9377925,-1.3969075 50.9378305,-1.3974173 50.9378188,-1.3978854 50.9377896,-1.3983350 50.9377429)) + + + + + + + + + + + + Gower + + + 50.93774 + + + -1.3975471 + + + 60 + + + + + + Wilson Mason + + + + + + Building 60 is residential + + + + + + + + + + + + + + + Ship Science Store + + + 61 + + + + + + Building 61 is non-residential + + + + + + + + + 1975 (2005) + + + POLYGON((-1.4059302 50.9373666,-1.4039531 50.9375771,-1.4038626 50.9372397,-1.4037001 50.9372570,-1.4036652 50.9371270,-1.4038877 50.9371033,-1.4038626 50.9370097,-1.4037893 50.9370175,-1.4037334 50.9368089,-1.4040121 50.9367792,-1.4040671 50.9369845,-1.4040073 50.9369909,-1.4040330 50.9370865,-1.4045166 50.9370350,-1.4044909 50.9369392,-1.4043266 50.9369567,-1.4042657 50.9367296,-1.4053052 50.9366189,-1.4053657 50.9368446,-1.4051103 50.9368718,-1.4051359 50.9369671,-1.4053978 50.9369393,-1.4054869 50.9372717,-1.4058932 50.9372284,-1.4059302 50.9373666)) + + + + + + + + + + + + Boldrewood + + + 50.9372304 + + + -1.4049952 + + + 62 + + + + + + Sir Basil Spence + + + + + + Building 62 is non-residential + + + + + + 1965 + + + POLYGON((-1.3098769 51.0658166,-1.3094050 51.0660649,-1.3095168 51.0661488,-1.3095582 51.0661402,-1.3096045 51.0661471,-1.3096301 51.0661620,-1.3096431 51.0661875,-1.3096456 51.0662121,-1.3096345 51.0662332,-1.3096185 51.0662529,-1.3095917 51.0662654,-1.3095536 51.0662689,-1.3095147 51.0662628,-1.3094840 51.0662500,-1.3094701 51.0662359,-1.3094623 51.0662164,-1.3094377 51.0662197,-1.3093827 51.0662193,-1.3083527 51.0654461,-1.3085831 51.0653249,-1.3093456 51.0658972,-1.3097211 51.0656996,-1.3098769 51.0658166)) + + + + + + + + + + + + East Site + + + 51.0657027 + + + -1.3088779 + + + 63A + + + + + + + + + Building 63A is non-residential + + + + + + 1980's + + + POLYGON((-1.3088342 51.0653596,-1.3087433 51.0654074,-1.3085890 51.0652916,-1.3086799 51.0652438,-1.3088342 51.0653596)) + + + + + + + + + + + + Terrapin + + + 51.065325 + + + -1.3087201 + + + 63C + + + + + + + + + Building 63C is non-residential + + + + + + 1999 + + + POLYGON((-1.3099429 51.0657237,-1.3099876 51.0656360,-1.3095067 51.0655394,-1.3094621 51.0656270,-1.3099429 51.0657237)) + + + + + + + + + + + + Adminstration + + + 51.0656271 + + + -1.3097192 + + + 63F + + + + + + + + + Building 63F is non-residential + + + + + + POLYGON((-1.3101874 51.0653656,-1.3101324 51.0654736,-1.3096050 51.0653675,-1.3096600 51.0652595,-1.3101874 51.0653656)) + + + + + + + + + + + + Graphics Building + + + 51.0653675 + + + -1.3098995 + + + 63G + + + + + + + + + Building 63G is non-residential + + + + + + POLYGON((-1.3109987 51.0658846,-1.3103528 51.0657547,-1.3103032 51.0658522,-1.3103980 51.0658712,-1.3101971 51.0662658,-1.3104893 51.0663246,-1.3105268 51.0662509,-1.3102961 51.0662045,-1.3103206 51.0661564,-1.3106329 51.0662193,-1.3106784 51.0661299,-1.3104298 51.0660799,-1.3104560 51.0660284,-1.3108023 51.0660980,-1.3108420 51.0660201,-1.3105751 51.0659665,-1.3106014 51.0659149,-1.3109478 51.0659845,-1.3109987 51.0658846)) + + + + + + + + + + + + West Site + + + 51.066025 + + + -1.310366 + + + 63K + + + + + + Building 63K is non-residential + + + + + + 1996 + + + POLYGON((-1.3104422 51.0664605,-1.3104816 51.0663831,-1.3100778 51.0663020,-1.3100385 51.0663793,-1.3104422 51.0664605)) + + + + + + + + + + + + Students' Union + + + 51.066373 + + + -1.3102375 + + + 63L + + + + + + + + + Building 63L is non-residential + + + + + + + + + 1925 (1996) + + + POLYGON((-1.4032755 50.9296022,-1.4019743 50.9291870,-1.4020642 50.9290751,-1.4022717 50.9291413,-1.4023636 50.9290270,-1.4022028 50.9289757,-1.4026632 50.9284025,-1.4028493 50.9284619,-1.4027932 50.9285317,-1.4024901 50.9289090,-1.4035465 50.9292461,-1.4035006 50.9293032,-1.4034368 50.9292828,-1.4032533 50.9295113,-1.4033291 50.9295355,-1.4032755 50.9296022)) + + + + + + + + + + + + Parkes Bldg + + + 50.929203 + + + -1.402838 + + + 65 + + + + + + Hawkins Brown (1996) + + + + + + Building 65 is non-residential + + + + + + 1960s + + + POLYGON((-1.4028493 50.9284619,-1.4031749 50.9285658,-1.4031536 50.9285922,-1.4033635 50.9286592,-1.4032876 50.9287537,-1.4031736 50.9287173,-1.4029721 50.9289682,-1.4028781 50.9289382,-1.4030717 50.9286972,-1.4029212 50.9286492,-1.4029702 50.9285882,-1.4027932 50.9285317,-1.4028493 50.9284619)) + + + + + + + + + + + + Archaelogy (ex-Crawford) + + + 50.928783 + + + -1.403128 + + + 65A + + + + + + + + + Building 65A is non-residential + + + + + + 1960s + + + POLYGON((-1.4034801 50.9288099,-1.4037885 50.9289083,-1.4038333 50.9288526,-1.4035248 50.9287542,-1.4034801 50.9288099)) + + + + + + + + + + + + Burgess + + + 50.9288317 + + + -1.4036629 + + + 65B + + + + + + + + + Building 65B is non-residential + + + + + + + + + 2000 + + + Practical teaching area features medical ward + + + POLYGON((-1.3968026 50.9370448,-1.3965726 50.9370608,-1.3964448 50.9363323,-1.3966748 50.9363162,-1.3968026 50.9370448)) + + + + + + + + + + + + Nightingale + + + 50.9366885 + + + -1.3966181 + + + 67 + + + + + + + + + Wilson Mason + + + + + + Building 67 is non-residential + + + + + + 1995 + + + POLYGON((-1.3963326 50.8930905,-1.3959426 50.8934286,-1.3961110 50.8935059,-1.3959993 50.8936028,-1.3956529 50.8934438,-1.3957068 50.8933971,-1.3946911 50.8929310,-1.3945351 50.8930663,-1.3946007 50.8933290,-1.3943005 50.8933589,-1.3942303 50.8930781,-1.3943355 50.8929869,-1.3941198 50.8928879,-1.3938009 50.8931644,-1.3931056 50.8928453,-1.3940620 50.8920160,-1.3935202 50.8917674,-1.3936629 50.8916436,-1.3952712 50.8923817,-1.3947448 50.8928381,-1.3950135 50.8929614,-1.3951413 50.8928506,-1.3958955 50.8931967,-1.3961269 50.8929961,-1.3963326 50.8930905)) + + + + + + + + + + + + National Oceanography Centre + + + 50.892773 + + + -1.394491 + + + 68 + + + + + + + + + Building 68 is non-residential + + + + + + + + + + + + + + + National Oceanography Centre - Block A1 + + + 68-A1 + + + + + + Building 68-A1 is non-residential + + + + + + + + + + + + + + + National Oceanography Centre - Block A6 + + + 68-A6 + + + + + + Building 68-A6 is non-residential + + + + + + + + + + + + + + + National Oceanography Centre - Block N9 + + + 68-N9 + + + + + + Building 68-N9 is non-residential + + + + + + + + + 1959 + + + energy/b7/ekw + + + POLYGON((-1.3945298 50.9355844,-1.3946286 50.9354487,-1.3939881 50.9352633,-1.3940562 50.9351699,-1.3938924 50.9351225,-1.3938361 50.9351999,-1.3936253 50.9351389,-1.3935590 50.9352298,-1.3934904 50.9352100,-1.3934451 50.9352719,-1.3945298 50.9355844)) + + + + + + + + + + + + Lanchester + + + 50.9353558 + + + -1.3940282 + + + 7 + + + + + + + + + Sir Basil Spence + + + + + + Building 7 is non-residential + + + + + + POLYGON((-1.4031318 50.9417446,-1.4032027 50.9414496,-1.4031113 50.9414463,-1.4030120 50.9417361,-1.4031318 50.9417446)) + + + + + + + + + + + + Chamberlain A + + + 50.941608 + + + -1.4031107 + + + 70A + + + + + + Building 70A is residential + + + + + + POLYGON((-1.4027537 50.9417172,-1.4026061 50.9415785,-1.4026912 50.9414692,-1.4025610 50.9414289,-1.4024509 50.9415702,-1.4022341 50.9415794,-1.4022435 50.9416677,-1.4025067 50.9416565,-1.4026278 50.9417703,-1.4027537 50.9417172)) + + + + + + + + + + + + South Hill A + + + 50.9415981 + + + -1.4025225 + + + 70AA + + + + + + Building 70AA is residential + + + + + + POLYGON((-1.4032942 50.9414529,-1.4031113 50.9414463,-1.4032629 50.9409754,-1.4034196 50.9409886,-1.4033093 50.9413969,-1.4032942 50.9414529)) + + + + + + + + + + + + Chamberlain B + + + 50.9412373 + + + -1.4032631 + + + 70B + + + + + + Building 70B is residential + + + + + + POLYGON((-1.4021717 50.9415656,-1.4020585 50.9416141,-1.4018999 50.9414670,-1.4016616 50.9414780,-1.4016509 50.9413863,-1.4019118 50.9413742,-1.4020072 50.9412499,-1.4021523 50.9412941,-1.4020387 50.9414422,-1.4021717 50.9415656)) + + + + + + + + + + + + South Hill B + + + 50.941452 + + + -1.401953 + + + 70BB + + + + + + Building 70BB is residential + + + + + + POLYGON((-1.4035242 50.9417724,-1.4036235 50.9416077,-1.4037855 50.9416373,-1.4038168 50.9415781,-1.4036653 50.9415451,-1.4038064 50.9413080,-1.4036600 50.9412751,-1.4035607 50.9414299,-1.4033093 50.9413969,-1.4032942 50.9414529,-1.4035398 50.9414859,-1.4033675 50.9417613,-1.4035242 50.9417724)) + + + + + + + + + + + + Chamberlain C + + + 50.941536 + + + -1.403592 + + + 70C + + + + + + Building 70C is residential + + + + + + POLYGON((-1.4029265 50.9413253,-1.4024938 50.9413368,-1.4024439 50.9413969,-1.4022966 50.9413484,-1.4023515 50.9412822,-1.4022231 50.9411547,-1.4023507 50.9411037,-1.4024828 50.9412348,-1.4029197 50.9412233,-1.4029265 50.9413253)) + + + + + + + + + + + + South Hill C + + + 50.9412837 + + + -1.4024437 + + + 70CC + + + + + + Building 70CC is residential + + + + + + POLYGON((-1.4035242 50.9417724,-1.4033675 50.9417613,-1.4031318 50.9417446,-1.4030120 50.9417361,-1.4029859 50.9418020,-1.4028709 50.9417987,-1.4027977 50.9419041,-1.4034040 50.9419831,-1.4035242 50.9417724)) + + + + + + + + + + + + Chamberlain Dining Room + + + 50.941843 + + + -1.4032263 + + + 70D + + + + + + Building 70D is residential + + + + + + POLYGON((-1.4035346 50.9420844,-1.4034059 50.9420748,-1.4034196 50.9420020,-1.4035483 50.9420117,-1.4035346 50.9420844)) + + + + + + + + + + + + Chamberlain Boiler House + + + 50.9420383 + + + -1.4034784 + + + 70E + + + + + + Building 70E is residential + + + + + + + + + + + + + + + Chamberlain Bin Store + + + 70F + + + + + + Building 70F is residential + + + + + + + + + + + + + + + Chilworth Estate + + + 71 + + + + + + Building 71 is non-residential + + + + + + POLYGON((-1.3745871 50.9378713,-1.3744746 50.9379024,-1.3743958 50.9377895,-1.3745083 50.9377583,-1.3745871 50.9378713)) + + + + + + + + + + + + Connaught A (Old Quad) + + + 50.937782 + + + -1.374458 + + + 72A1-A + + + + + + Building 72A1-A is residential + + + + + + POLYGON((-1.3743958 50.9377895,-1.3743129 50.9376705,-1.3744254 50.9376393,-1.3745083 50.9377583,-1.3743958 50.9377895)) + + + + + + + + + + + + Connaught B (Old Quad) + + + 50.937683 + + + -1.374393 + + + 72A1-B + + + + + + Building 72A1-B is residential + + + + + + POLYGON((-1.3743129 50.9376705,-1.3742299 50.9375515,-1.3743424 50.9375203,-1.3744254 50.9376393,-1.3743129 50.9376705)) + + + + + + + + + + + + Connaught C (Old Quad) + + + 50.937595 + + + -1.374334 + + + 72A1-C + + + + + + Building 72A1-C is residential + + + + + + POLYGON((-1.3745550 50.9373530,-1.3743257 50.9374165,-1.3743761 50.9374888,-1.3746055 50.9374253,-1.3745550 50.9373530)) + + + + + + + + + + + + Connaught D (Old Quad) + + + 50.937393 + + + -1.37445 + + + 72A2-D + + + + + + Building 72A2-D is residential + + + + + + POLYGON((-1.3747844 50.9372895,-1.3745550 50.9373530,-1.3746055 50.9374253,-1.3748349 50.9373618,-1.3747844 50.9372895)) + + + + + + + + + + + + Connaught E (Old Quad) + + + 50.937344 + + + -1.37467 + + + 72A2-E + + + + + + Building 72A2-E is residential + + + + + + POLYGON((-1.3750634 50.9372986,-1.3750129 50.9372262,-1.3747844 50.9372895,-1.3748349 50.9373618,-1.3750634 50.9372986)) + + + + + + + + + + + + Connaught F (Old Quad) + + + 50.937279 + + + -1.374884 + + + 72A2-F + + + + + + Building 72A2-F is residential + + + + + + POLYGON((-1.3750634 50.9372986,-1.3751494 50.9374219,-1.3752753 50.9373871,-1.3751892 50.9372637,-1.3750634 50.9372986)) + + + + + + + + + + + + Connaught G (Old Quad) + + + 50.937355 + + + -1.375187 + + + 72A2-G + + + + + + Building 72A2-G is residential + + + + + + POLYGON((-1.3751494 50.9374219,-1.3752330 50.9375419,-1.3753589 50.9375070,-1.3752753 50.9373871,-1.3751494 50.9374219)) + + + + + + + + + + + + Connaught H (Old Quad) + + + 50.937454 + + + -1.375257 + + + 72A2-H + + + + + + Building 72A2-H is residential + + + + + + POLYGON((-1.3752330 50.9375419,-1.3753208 50.9376678,-1.3754467 50.9376330,-1.3753589 50.9375070,-1.3752330 50.9375419)) + + + + + + + + + + + + Connaught J (New Quad) + + + 50.937561 + + + -1.375327 + + + 72A2-J + + + + + + Building 72A2-J is residential + + + + + + POLYGON((-1.3754467 50.9376330,-1.3744746 50.9379024,-1.3745426 50.9379999,-1.3748842 50.9379053,-1.3752211 50.9378120,-1.3755148 50.9377307,-1.3754467 50.9376330)) + + + + + + + + + + + + Connaught K (New Quad) + + + 50.937805 + + + -1.374989 + + + 72A2-K + + + + + + Building 72A2-K is residential + + + + + + POLYGON((-1.3753154 50.9379472,-1.3752211 50.9378120,-1.3748842 50.9379053,-1.3749784 50.9380405,-1.3753154 50.9379472)) + + + + + + + + + + + + Connaught L (New Quad) + + + 50.937973 + + + -1.375083 + + + 72A2-L + + + + + + Building 72A2-L is residential + + + + + + + + + + + + + + + Connaught Hall Squash Court + + + 72B + + + + + + Building 72B is residential + + + + + + POLYGON((-1.3756324 50.9384019,-1.3753154 50.9379472,-1.3751011 50.9380066,-1.3754181 50.9384613,-1.3756324 50.9384019)) + + + + + + + + + + + + Connaught Hall Dining Room + + + 50.93819 + + + -1.375367 + + + 72C + + + + + + Building 72C is residential + + + + + + + + + + + + + + + Connaught Hall/Lobby/Laundry + + + 72CC + + + + + + Building 72CC is residential + + + + + + POLYGON((-1.3753367 50.9385554,-1.3752949 50.9384954,-1.3754181 50.9384613,-1.3756324 50.9384019,-1.3756742 50.9384619,-1.3755556 50.9384947,-1.3754570 50.9385220,-1.3753367 50.9385554)) + + + + + + + + + + + + Connaught M (New Quad) + + + 50.938461 + + + -1.37549 + + + 72D-M + + + + + + Building 72D-M is residential + + + + + + POLYGON((-1.3753367 50.9385554,-1.3750875 50.9386245,-1.3750457 50.9385645,-1.3752949 50.9384954,-1.3753367 50.9385554)) + + + + + + + + + + + + Connaught N (New Quad) + + + 50.938553 + + + -1.375209 + + + 72D-N + + + + + + Building 72D-N is residential + + + + + + POLYGON((-1.3750875 50.9386245,-1.3748382 50.9386936,-1.3747964 50.9386336,-1.3750457 50.9385645,-1.3750875 50.9386245)) + + + + + + + + + + + + Connaught P (New Quad) + + + 50.938625 + + + -1.374951 + + + 72D-P + + + + + + Building 72D-P is residential + + + + + + POLYGON((-1.3747738 50.9386142,-1.3746292 50.9386543,-1.3744195 50.9383536,-1.3745642 50.9383136,-1.3747738 50.9386142)) + + + + + + + + + + + + Connaught Q (New Quad) + + + 50.938484 + + + -1.374581 + + + 72E-Q + + + + + + Building 72E-Q is residential + + + + + + POLYGON((-1.3744195 50.9383536,-1.3742098 50.9380529,-1.3743545 50.9380129,-1.3745642 50.9383136,-1.3744195 50.9383536)) + + + + + + + + + + + + Connaught R (New Quad) + + + 50.938183 + + + -1.374367 + + + 72E-R + + + + + + Building 72E-R is residential + + + + + + POLYGON((-1.3756721 50.9386618,-1.3755735 50.9386891,-1.3754570 50.9385220,-1.3755556 50.9384947,-1.3756721 50.9386618)) + + + + + + + + + + + + Connaught S (New Quad) + + + 50.938591 + + + -1.375544 + + + 72F-S + + + + + + Building 72F-S is residential + + + + + + POLYGON((-1.3742109 50.9375174,-1.3741529 50.9374343,-1.3740299 50.9374684,-1.3740878 50.9375514,-1.3742109 50.9375174)) + + + + + + + + + + + + Connaught Hall, The Bungalow + + + 50.937477 + + + -1.374106 + + + 72G + + + + + + Building 72G is residential + + + + + + + + + + + + + + + Connaugt Garages + + + 72X + + + + + + Building 72X is residential + + + + + + + + + + + + + + + Oakhurst Road + + + 73 + + + + + + Building 73 is residential + + + + + + POLYGON((-1.4031150 50.9433490,-1.4030468 50.9432829,-1.4027724 50.9433954,-1.4028407 50.9434615,-1.4031150 50.9433490)) + + + + + + + + + + + + Glen Eyre Hall Block A Richard Newitt + + + 50.943379 + + + -1.4029587 + + + 73A + + + + + + Building 73A is residential + + + + + + POLYGON((-1.4033580 50.9435146,-1.4034497 50.9434771,-1.4032686 50.9433017,-1.4031769 50.9433392,-1.4033580 50.9435146)) + + + + + + + + + + + + Glen Eyre Hall Block B Richard Newitt + + + 50.9434045 + + + -1.4032985 + + + 73B + + + + + + Building 73B is residential + + + + + + + + + + + + + + + Glen Eyre Hall Bungalow 1 + + + 50.94405 + + + -1.400848 + + + 73B1 + + + + + + Building 73B1 is residential + + + + + + + + + + + + + + + Glen Eyre Bungalow 2 + + + 50.94405 + + + -1.400848 + + + 73B2 + + + + + + Building 73B2 is residential + + + + + + + + + + + + + + + Glen Eyre Bungalow 3 + + + 50.94405 + + + -1.400848 + + + 73B3 + + + + + + Building 73B3 is residential + + + + + + + + + + + + + + + Glen Eyre Hall Bungalow 4 + + + 50.94405 + + + -1.400848 + + + 73B4 + + + + + + Building 73B4 is residential + + + + + + POLYGON((-1.4033999 50.9435987,-1.4031254 50.9437111,-1.4030529 50.9436409,-1.4033274 50.9435284,-1.4033999 50.9435987)) + + + + + + + + + + + + Glen Eyre Hall Block C Richard Newitt + + + 50.9436282 + + + -1.4032123 + + + 73C + + + + + + Building 73C is residential + + + + + + POLYGON((-1.4026438 50.9438956,-1.4025815 50.9438351,-1.4023125 50.9439454,-1.4023749 50.9440058,-1.4026438 50.9438956)) + + + + + + + + + + + + Glen Eyre Hall Block D Richard Newitt + + + 50.9439382 + + + -1.4024566 + + + 73D + + + + + + Building 73D is residential + + + + + + POLYGON((-1.4022525 50.9439496,-1.4021590 50.9439878,-1.4019751 50.9438096,-1.4020685 50.9437714,-1.4022525 50.9439496)) + + + + + + + + + + + + Glen Eyre Hall Block E Richard Newitt + + + 50.9438934 + + + -1.4021067 + + + 73E + + + + + + Building 73E is residential + + + + + + POLYGON((-1.4023885 50.9436503,-1.4021262 50.9437578,-1.4020517 50.9436856,-1.4023140 50.9435781,-1.4023885 50.9436503)) + + + + + + + + + + + + Glen Eyre Hall Block F Richard Newitt + + + 50.9436793 + + + -1.402203 + + + 73F + + + + + + Building 73F is residential + + + + + + POLYGON((-1.4019955 50.9437002,-1.4018917 50.9437427,-1.4017679 50.9436227,-1.4018716 50.9435802,-1.4019955 50.9437002)) + + + + + + + + + + + + Glen Eyre Hall Block G Richard Newitt + + + 50.9436666 + + + -1.4018785 + + + 73G + + + + + + Building 73G is residential + + + + + + POLYGON((-1.4022518 50.9441608,-1.4021089 50.9440225,-1.4017929 50.9441520,-1.4018576 50.9442147,-1.4020465 50.9441374,-1.4021245 50.9442130,-1.4022518 50.9441608)) + + + + + + + + + + + + Glen Eyre Hall Block H Richard Newitt + + + 50.9441011 + + + -1.4020052 + + + 73H + + + + + + Building 73H is residential + + + + + + POLYGON((-1.4017643 50.9440878,-1.4016547 50.9441327,-1.4012224 50.9437139,-1.4013368 50.9436670,-1.4014174 50.9437419,-1.4014829 50.9437137,-1.4014807 50.9436979,-1.4015003 50.9436759,-1.4015233 50.9436670,-1.4015538 50.9436649,-1.4015833 50.9436683,-1.4015997 50.9436773,-1.4016161 50.9436938,-1.4016193 50.9437137,-1.4016117 50.9437330,-1.4015866 50.9437488,-1.4015517 50.9437530,-1.4015200 50.9437461,-1.4014439 50.9437774,-1.4017643 50.9440878)) + + + + + + + + + + + + Glen Eyre Hall Block J + + + 50.943919 + + + -1.401488 + + + 73J + + + + + + Building 73J is residential + + + + + + POLYGON((-1.4011127 50.9430626,-1.4013662 50.9433406,-1.4009199 50.9435132,-1.4005903 50.9431840,-1.4008743 50.9429795,-1.4010062 50.9430179,-1.4009859 50.9430466,-1.4010569 50.9430754,-1.4011127 50.9430626)) + + + + + + + + + + + + Glen Eyre Hall, Chancellor's Court, Selbourne + + + 50.9432479 + + + -1.4009757 + + + 73K + + + + + + Building 73K is residential + + + + + + POLYGON((-1.4010214 50.9437848,-1.4006004 50.9439573,-1.4002404 50.9436218,-1.4005802 50.9433630,-1.4007019 50.9434173,-1.4006410 50.9434748,-1.4006968 50.9435196,-1.4007424 50.9435068,-1.4010214 50.9437848)) + + + + + + + + + + + + Glen Eyre Hall, Chancellor's Court, Jellicoe + + + 50.9437049 + + + -1.4006309 + + + 73L + + + + + + Building 73L is residential + + + + + + POLYGON((-1.3998194 50.9433502,-1.3994543 50.9436186,-1.3998042 50.9439605,-1.4002454 50.9437880,-1.3999766 50.9435132,-1.3999259 50.9435228,-1.3998701 50.9434716,-1.3999310 50.9434173,-1.3998194 50.9433502)) + + + + + + + + + + + + Glen Eyre Hall, Chancellor's Court, Roll + + + 50.9437017 + + + -1.3998397 + + + 73M + + + + + + Building 73M is residential + + + + + + + + + + + + + + + Block A Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-A + + + + + + Building 73N-A is residential + + + + + + + + + + + + + + + Block B Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-B + + + + + + Building 73N-B is residential + + + + + + + + + + + + + + + Block C Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-C + + + + + + Building 73N-C is residential + + + + + + + + + + + + + + + Block D Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-D + + + + + + Building 73N-D is residential + + + + + + + + + + + + + + + Block E Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-E + + + + + + Building 73N-E is residential + + + + + + + + + + + + + + + Block F Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-F + + + + + + Building 73N-F is residential + + + + + + + + + + + + + + + Block G Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-G + + + + + + Building 73N-G is residential + + + + + + + + + + + + + + + Block H Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-H + + + + + + Building 73N-H is residential + + + + + + + + + + + + + + + Block J Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-J + + + + + + Building 73N-J is residential + + + + + + + + + + + + + + + Block K Glen Eyre Hall Old Terrace + + + 50.94236 + + + -1.402854 + + + 73N-K + + + + + + Building 73N-K is residential + + + + + + + + + + + + + + + Glen Eyre Hall Main Building + + + 50.943848 + + + -1.402873 + + + 73Q1 + + + + + + Building 73Q1 is residential + + + + + + + + + + + + + + + Glen Eyre Hall Dining Hall + + + 50.943848 + + + -1.402873 + + + 73Q2 + + + + + + Building 73Q2 is residential + + + + + + POLYGON((-1.4047328 50.9435361,-1.4045244 50.9435379,-1.4045197 50.9433258,-1.4047281 50.9433240,-1.4047328 50.9435361)) + + + + + + + + + + + + Beechmount House + + + 50.9434354 + + + -1.404631 + + + 73R + + + + + + Building 73R is residential + + + + + + POLYGON((-1.4014971 50.9441888,-1.4014142 50.9442227,-1.4013838 50.9441932,-1.4012982 50.9442283,-1.4011816 50.9441154,-1.4012710 50.9440788,-1.4012275 50.9440366,-1.4013066 50.9440041,-1.4014971 50.9441888)) + + + + + + + + + + + + Glen Eyre Hall Squash Court + + + 50.944126 + + + -1.401352 + + + 73S + + + + + + Building 73S is residential + + + + + + POLYGON((-1.3997477 50.9432368,-1.3996460 50.9432790,-1.3995189 50.9431572,-1.3993996 50.9432067,-1.3995221 50.9433240,-1.3994305 50.9433620,-1.3993067 50.9432436,-1.3992324 50.9432744,-1.3991671 50.9432118,-1.3996513 50.9430110,-1.3997243 50.9430810,-1.3996270 50.9431213,-1.3997477 50.9432368)) + + + + + + + + + + + + Glen Eyre Hall Brunei House + + + 50.9431457 + + + -1.3994289 + + + 73T + + + + + + Building 73T is residential + + + + + + POLYGON((-1.4032175 50.9432005,-1.4031102 50.9432445,-1.4029941 50.9431321,-1.4031015 50.9430881,-1.4032175 50.9432005)) + + + + + + + + + + + + Glen Eyre Hall Block W + + + 50.9431776 + + + -1.4031058 + + + 73W + + + + + + Building 73W is residential + + + + + + POLYGON((-1.4029029 50.9429412,-1.4024515 50.9431041,-1.4024921 50.9429635,-1.4028218 50.9428517,-1.4029029 50.9429412)) + + + + + + + + + + + + Block Q Glen Eyre Hall New Terrace + + + 50.9429667 + + + -1.4026798 + + + 73X-Q + + + + + + Building 73X-Q is residential + + + + + + POLYGON((-1.4024515 50.9431041,-1.4022030 50.9428453,-1.4023197 50.9427846,-1.4024921 50.9429635,-1.4024515 50.9431041)) + + + + + + + + + + + + Block R Glen Eyre Hall New Terrace + + + 50.9429188 + + + -1.4023501 + + + 73X-R + + + + + + Building 73X-R is residential + + + + + + POLYGON((-1.4023197 50.9427846,-1.4021523 50.9426024,-1.4019545 50.9425897,-1.4022030 50.9428453,-1.4023197 50.9427846)) + + + + + + + + + + + + Block S Glen Eyre Hall New Terrace + + + 50.9427239 + + + -1.4021625 + + + 73X-S + + + + + + Building 73X-S is residential + + + + + + POLYGON((-1.4021523 50.9426024,-1.4024262 50.9424331,-1.4023248 50.9423500,-1.4019545 50.9425897,-1.4021523 50.9426024)) + + + + + + + + + + + + Block T Glen Eyre Hall New Terrace + + + 50.9424938 + + + -1.4022081 + + + 73X-T + + + + + + Building 73X-T is residential + + + + + + POLYGON((-1.4024614 50.9298764,-1.4024033 50.9299497,-1.4019961 50.9298123,-1.4018507 50.9299910,-1.4022578 50.9301239,-1.4021924 50.9302064,-1.4016325 50.9300231,-1.4017198 50.9299177,-1.4015962 50.9298764,-1.4016907 50.9297756,-1.4017925 50.9298123,-1.4018943 50.9296885,-1.4024614 50.9298764)) + + + + + + + + + + + + Highfield Hall Aubrey House + + + 50.9298947 + + + -1.4018216 + + + 75A + + + + + + Building 75A is residential + + + + + + + + + + + + + + + Highfield Hall Laundry + + + 75B + + + + + + Building 75B is residential + + + + + + POLYGON((-1.4028286 50.9303017,-1.4026780 50.9302510,-1.4025899 50.9303550,-1.4024507 50.9303082,-1.4027035 50.9300099,-1.4028255 50.9300509,-1.4027417 50.9301498,-1.4029095 50.9302063,-1.4028286 50.9303017)) + + + + + + + + + + + + Highfield Hall Wolfe House + + + 50.9301743 + + + -1.402665 + + + 75C + + + + + + Building 75C is residential + + + + + + POLYGON((-1.3785756 50.9374564,-1.3783847 50.9371602,-1.3782295 50.9371999,-1.3784204 50.9374961,-1.3785756 50.9374564)) + + + + + + + + + + + + Montefiore Hall Block A + + + 50.937321 + + + -1.3784044 + + + 76A + + + + + + Building 76A is residential + + + + + + POLYGON((-1.3780709 50.9379332,-1.3779247 50.9379706,-1.3775389 50.9373718,-1.3776851 50.9373344,-1.3780709 50.9379332)) + + + + + + + + + + + + Montefiore Hall Block B + + + 50.9376576 + + + -1.3778009 + + + 76B + + + + + + Building 76B is residential + + + + + + POLYGON((-1.3772809 50.9377515,-1.3771228 50.9375061,-1.3769829 50.9375419,-1.3770211 50.9376012,-1.3768782 50.9376377,-1.3769387 50.9377315,-1.3770779 50.9376959,-1.3771374 50.9377882,-1.3772809 50.9377515)) + + + + + + + + + + + + Montefiore Hall Block C + + + 50.937645 + + + -1.377127 + + + 76C + + + + + + Building 76C is residential + + + + + + POLYGON((-1.3769387 50.9377315,-1.3767796 50.9377722,-1.3768288 50.9378486,-1.3766755 50.9378878,-1.3765172 50.9376421,-1.3766664 50.9376039,-1.3767151 50.9376795,-1.3768782 50.9376377,-1.3769387 50.9377315)) + + + + + + + + + + + + Montefiore Hall Block D + + + 50.937752 + + + -1.376708 + + + 76D + + + + + + Building 76D is residential + + + + + + POLYGON((-1.3763758 50.9379838,-1.3762161 50.9380247,-1.3760300 50.9377359,-1.3761897 50.9376950,-1.3763758 50.9379838)) + + + + + + + + + + + + Montefiore Hall Block E + + + 50.937859 + + + -1.376204 + + + 76E + + + + + + Building 76E is residential + + + + + + POLYGON((-1.3773451 50.9378581,-1.3775000 50.9380986,-1.3773677 50.9381324,-1.3773164 50.9380528,-1.3771511 50.9380952,-1.3770924 50.9380043,-1.3772496 50.9379640,-1.3772046 50.9378941,-1.3773451 50.9378581)) + + + + + + + + + + + + Montefiore Hall Block F + + + 50.938011 + + + -1.37733 + + + 76F + + + + + + Building 76F is residential + + + + + + POLYGON((-1.3770373 50.9382155,-1.3768969 50.9382515,-1.3767378 50.9380046,-1.3768797 50.9379683,-1.3769297 50.9380460,-1.3770924 50.9380043,-1.3771511 50.9380952,-1.3769869 50.9381373,-1.3770373 50.9382155)) + + + + + + + + + + + + Montefiore Hall Block G + + + 50.938107 + + + -1.376933 + + + 76G + + + + + + Building 76G is residential + + + + + + POLYGON((-1.3765523 50.9383310,-1.3763930 50.9380838,-1.3762614 50.9381175,-1.3763167 50.9382032,-1.3762033 50.9382322,-1.3762641 50.9383265,-1.3763867 50.9382952,-1.3764299 50.9383623,-1.3765523 50.9383310)) + + + + + + + + + + + + Montefiore Hall Block H + + + 50.938232 + + + -1.376402 + + + 76H + + + + + + Building 76H is residential + + + + + + POLYGON((-1.3777166 50.9384646,-1.3775822 50.9384990,-1.3774043 50.9382229,-1.3775388 50.9381885,-1.3777166 50.9384646)) + + + + + + + + + + + + Montefiore Hall Block J + + + 50.938339 + + + -1.377561 + + + 76J + + + + + + Building 76J is residential + + + + + + POLYGON((-1.3770977 50.9385829,-1.3769418 50.9383410,-1.3767985 50.9383777,-1.3769543 50.9386196,-1.3770977 50.9385829)) + + + + + + + + + + + + Montefiore Hall Block K + + + 50.938484 + + + -1.376944 + + + 76K + + + + + + Building 76K is residential + + + + + + POLYGON((-1.3763341 50.9387718,-1.3764569 50.9387403,-1.3762884 50.9384788,-1.3761656 50.9385103,-1.3763341 50.9387718)) + + + + + + + + + + + + Montefiore Hall Block L + + + 50.938629 + + + -1.376306 + + + 76L + + + + + + Building 76L is residential + + + + + + POLYGON((-1.3776042 50.9386021,-1.3772042 50.9387044,-1.3771430 50.9386094,-1.3775430 50.9385071,-1.3776042 50.9386021)) + + + + + + + + + + + + Montefiore Hall Block M + + + 50.938606 + + + -1.377389 + + + 76M + + + + + + Building 76M is residential + + + + + + POLYGON((-1.3769745 50.9387236,-1.3769283 50.9386518,-1.3765089 50.9387591,-1.3765552 50.9388309,-1.3769745 50.9387236)) + + + + + + + + + + + + Montefiore Hall Block N + + + 50.938763 + + + -1.376751 + + + 76N + + + + + + Building 76N is residential + + + + + + POLYGON((-1.3773232 50.9390014,-1.3772033 50.9390320,-1.3770201 50.9387478,-1.3771401 50.9387171,-1.3773232 50.9390014)) + + + + + + + + + + + + Montefiore Hall Block P + + + 50.938877 + + + -1.377196 + + + 76P + + + + + + Building 76P is residential + + + + + + POLYGON((-1.3765591 50.9391519,-1.3766940 50.9391174,-1.3765258 50.9388563,-1.3763909 50.9388908,-1.3765591 50.9391519)) + + + + + + + + + + + + Montefiore Hall Block Q + + + 50.939026 + + + -1.376536 + + + 76Q + + + + + + Building 76Q is residential + + + + + + POLYGON((-1.3772104 50.9391257,-1.3771526 50.9390360,-1.3767291 50.9391444,-1.3767869 50.9392341,-1.3772104 50.9391257)) + + + + + + + + + + + + Montefiore Hall Block R + + + 50.939156 + + + -1.376976 + + + 76R + + + + + + Building 76R is residential + + + + + + POLYGON((-1.3765775 50.9392573,-1.3765338 50.9391895,-1.3761181 50.9392959,-1.3761617 50.9393637,-1.3765775 50.9392573)) + + + + + + + + + + + + Montefiore Hall Block S + + + 50.939289 + + + -1.376349 + + + 76S + + + + + + Building 76S is residential + + + + + + POLYGON((-1.3782975 50.9380598,-1.3779132 50.9381581,-1.3778431 50.9380493,-1.3782275 50.9379510,-1.3782975 50.9380598)) + + + + + + + + + + + + Montefiore Hall Social Centre + + + 50.9380566 + + + -1.3780581 + + + 76SC + + + + + + Building 76SC is residential + + + + + + POLYGON((-1.3769287 50.9395342,-1.3767993 50.9395673,-1.3766234 50.9392943,-1.3767528 50.9392612,-1.3769287 50.9395342)) + + + + + + + + + + + + Montefiore Hall Block T + + + 50.939426 + + + -1.376783 + + + 76T + + + + + + Building 76T is residential + + + + + + POLYGON((-1.3781864 50.9383228,-1.3780251 50.9383641,-1.3779834 50.9382994,-1.3781448 50.9382581,-1.3781864 50.9383228)) + + + + + + + + + + + + Montefiore Hall Laundry + + + 50.9383121 + + + -1.3780779 + + + 76U + + + + + + Building 76U is residential + + + + + + POLYGON((-1.3783310 50.9375652,-1.3782668 50.9374657,-1.3779335 50.9375510,-1.3779977 50.9376505,-1.3783310 50.9375652)) + + + + + + + + + + + + Montefiore Hall Block V + + + 50.937561 + + + -1.3781373 + + + 76V + + + + + + Building 76V is residential + + + + + + POLYGON((-1.3781856 50.9372867,-1.3781228 50.9371892,-1.3777861 50.9372753,-1.3778489 50.9373728,-1.3781856 50.9372867)) + + + + + + + + + + + + Montefiore Hall Block W + + + 50.9372773 + + + -1.3779839 + + + 76W + + + + + + Building 76W is residential + + + + + + POLYGON((-1.3786053 50.9370970,-1.3784478 50.9371373,-1.3783074 50.9369194,-1.3784649 50.9368791,-1.3786053 50.9370970)) + + + + + + + + + + + + Montefiore Hall Block X + + + 50.9370062 + + + -1.3784588 + + + 76X + + + + + + Building 76X is residential + + + + + + + + + + + + + + + Montefiore Cycle Store + + + 76Y + + + + + + Building 76Y is residential + + + + + + POLYGON((-1.3771265 50.9374670,-1.3769365 50.9375156,-1.3768944 50.9374503,-1.3770844 50.9374017,-1.3771265 50.9374670)) + + + + + + + + + + + + Montefiore Hall - Reception + + + 50.937473 + + + -1.376976 + + + 76Z + + + + + + Building 76Z is residential + + + + + + POLYGON((-1.4070051 50.9205393,-1.4068860 50.9205725,-1.4068255 50.9204863,-1.4065153 50.9205727,-1.4064538 50.9204850,-1.4067583 50.9204002,-1.4067025 50.9203207,-1.4068274 50.9202859,-1.4070051 50.9205393)) + + + + + + + + + + + + St Margaret's Hall + + + 50.920439 + + + -1.4068368 + + + 77 + + + + + + Building 77 is residential + + + + + + + + + + + + + + + St Margaret's Bin Store + + + 77A + + + + + + Building 77A is residential + + + + + + POLYGON((-1.3772479 50.9366915,-1.3771882 50.9365958,-1.3767457 50.9367053,-1.3768054 50.9368011,-1.3772479 50.9366915)) + + + + + + + + + + + + South Stoneham House + + + 50.936687 + + + -1.376944 + + + 78A + + + + + + Building 78A is residential + + + + + + POLYGON((-1.3776734 50.9367750,-1.3775727 50.9366134,-1.3773241 50.9366750,-1.3774248 50.9368366,-1.3776734 50.9367750)) + + + + + + + + + + + + South Stoneham Tower + + + 50.936699 + + + -1.377465 + + + 78B + + + + + + Building 78B is residential + + + + + + POLYGON((-1.3772479 50.9366915,-1.3775727 50.9366134,-1.3776763 50.9365890,-1.3777938 50.9366920,-1.3777070 50.9367242,-1.3777683 50.9367982,-1.3779573 50.9367113,-1.3776814 50.9364602,-1.3771882 50.9365958,-1.3772479 50.9366915)) + + + + + + + + + + + + South Stoneham Dining Room + + + 50.936543 + + + -1.377534 + + + 78C + + + + + + Building 78C is residential + + + + + + + + + + + + + + + South Stoneham Staff Block + + + 78D + + + + + + Building 78D is residential + + + + + + POLYGON((-1.3760824 50.9373886,-1.3758890 50.9373749,-1.3759048 50.9372859,-1.3760982 50.9372996,-1.3760824 50.9373886)) + + + + + + + + + + + + South Stoneham Warden's Lodge + + + 50.9373466 + + + -1.3759936 + + + 78E + + + + + + Building 78E is residential + + + + + + + + + + + + + + + South Stoneham Garages + + + 78F + + + + + + Building 78F is residential + + + + + + POLYGON((-1.4026281 50.9406757,-1.4025521 50.9405986,-1.4027100 50.9405368,-1.4029127 50.9407423,-1.4020855 50.9410662,-1.4019191 50.9408975,-1.4021014 50.9408262,-1.4021410 50.9408664,-1.4026281 50.9406757)) + + + + + + + + + + + + Hartley Grove A + + + 50.940872 + + + -1.402425 + + + 79A + + + + + + Building 79A is residential + + + + + + POLYGON((-1.4021822 50.9405912,-1.4020458 50.9406447,-1.4017435 50.9403382,-1.4016090 50.9403908,-1.4015162 50.9402967,-1.4017871 50.9401906,-1.4021822 50.9405912)) + + + + + + + + + + + + Hartley Grove B + + + 50.940411 + + + -1.401899 + + + 79B + + + + + + Building 79B is residential + + + + + + POLYGON((-1.4016976 50.9405719,-1.4014555 50.9406667,-1.4015723 50.9407851,-1.4014103 50.9408486,-1.4011870 50.9406222,-1.4015911 50.9404640,-1.4016976 50.9405719)) + + + + + + + + + + + + Hartley Grove C + + + 50.940643 + + + -1.401371 + + + 79C + + + + + + Building 79C is residential + + + + + + 1989 + + + Large water tank + + + energy/b8/ekw + + + POLYGON((-1.3948871 50.9365735,-1.3947424 50.9366016,-1.3946958 50.9365062,-1.3948405 50.9364781,-1.3948871 50.9365735)) + + + + + + + + + + + + A B Woods Laboratory + + + 50.936537 + + + -1.3947926 + + + 8 + + + + + + + + + + + + Building 8 is non-residential + + + + + + POLYGON((-1.3909645 50.9459407,-1.3906712 50.9461236,-1.3905730 50.9460610,-1.3906802 50.9459942,-1.3905580 50.9459162,-1.3906567 50.9458546,-1.3907848 50.9459362,-1.3908721 50.9458818,-1.3909645 50.9459407)) + + + + + + + + + + + + Bencraft Court Block A + + + 50.945967 + + + -1.3907157 + + + 81A + + + + + + Building 81A is residential + + + + + + POLYGON((-1.3906567 50.9458546,-1.3905335 50.9457761,-1.3906176 50.9457237,-1.3905329 50.9456698,-1.3902390 50.9458530,-1.3903277 50.9459095,-1.3904389 50.9458402,-1.3905580 50.9459162,-1.3906567 50.9458546)) + + + + + + + + + + + + Bencraft Court Block B + + + 50.9458051 + + + -1.3904644 + + + 81B + + + + + + Building 81B is residential + + + + + + POLYGON((-1.3908697 50.9457253,-1.3909564 50.9456713,-1.3908428 50.9455989,-1.3909641 50.9455234,-1.3908670 50.9454615,-1.3905329 50.9456698,-1.3906176 50.9457237,-1.3907438 50.9456451,-1.3908697 50.9457253)) + + + + + + + + + + + + Bencraft Court Block C + + + 50.945606 + + + -1.390787 + + + 81C + + + + + + Building 81C is residential + + + + + + POLYGON((-1.3910020 50.9459032,-1.3908555 50.9458099,-1.3909459 50.9457535,-1.3910924 50.9458468,-1.3910020 50.9459032)) + + + + + + + + + + + + Bencraft Court Bar + + + 50.9458246 + + + -1.3909756 + + + 81D + + + + + + Building 81D is residential + + + + + + POLYGON((-1.3912258 50.9456806,-1.3912635 50.9456571,-1.3911243 50.9455685,-1.3910867 50.9455920,-1.3912258 50.9456806)) + + + + + + + + + + + + Bencraft Court Cycle Sheds + + + 50.9456236 + + + -1.3911761 + + + 81E + + + + + + Building 81E is residential + + + + + + POLYGON((-1.4080197 50.9171553,-1.4072988 50.9172264,-1.4072771 50.9171390,-1.4076671 50.9171005,-1.4076069 50.9168580,-1.4073696 50.9168814,-1.4073996 50.9170020,-1.4072666 50.9170152,-1.4072185 50.9168215,-1.4079149 50.9167528,-1.4079421 50.9168623,-1.4078111 50.9168752,-1.4078578 50.9170631,-1.4079935 50.9170497,-1.4080197 50.9171553)) + + + + + + + + + + + + Gateley Hall + + + 50.9169714 + + + -1.4077298 + + + 82A + + + + + + Building 82A is residential + + + + + + POLYGON((-1.4103138 50.9158463,-1.4100326 50.9159209,-1.4100545 50.9159538,-1.4098829 50.9159994,-1.4098616 50.9159675,-1.4096344 50.9160278,-1.4095585 50.9159140,-1.4097735 50.9158570,-1.4096601 50.9156872,-1.4094477 50.9157435,-1.4093777 50.9156386,-1.4096785 50.9155588,-1.4096214 50.9154732,-1.4097569 50.9154372,-1.4098000 50.9155017,-1.4100341 50.9154396,-1.4100953 50.9155312,-1.4098093 50.9156071,-1.4099387 50.9158009,-1.4102316 50.9157232,-1.4103138 50.9158463)) + + + + + + + + + + + + Romero Hall + + + 50.9157541 + + + -1.4098021 + + + 82B + + + + + + Building 82B is residential + + + + + + 2010 + + + POLYGON((-1.3956719 50.9368417,-1.3955433 50.9368916,-1.3952366 50.9366297,-1.3949299 50.9361435,-1.3951673 50.9360998,-1.3953850 50.9364053,-1.3955927 50.9363928,-1.3956125 50.9364863,-1.3954839 50.9365425,-1.3956719 50.9368417)) + + + + + + + + + + + + Life Sciences + + + 50.936436 + + + -1.395323 + + + 85 + + + + + + + + + Building 85 is non-residential + + + + + + POLYGON((-1.3969243 50.9375542,-1.3966648 50.9375630,-1.3966370 50.9372154,-1.3968965 50.9372067,-1.3969243 50.9375542)) + + + + + + + + + + + + Portacabin by Gower Building + + + 50.93739 + + + -1.396765 + + + 86 + + + + + + Building 86 is non-residential + + + + + + + + + + + + + + + Chilworth Laboratories + + + 89 + + + + + + Building 89 is non-residential + + + + + + + + + 1939 and 1957 + + + POLYGON((-1.3950560 50.9357353,-1.3949903 50.9358260,-1.3933795 50.9353625,-1.3934451 50.9352719,-1.3950560 50.9357353)) + + + + + + + + + + + + Engineering Workshops + + + 50.9355501 + + + -1.394215 + + + 9 + + + + + + Gutteridge & Gutteridge (1957) + + + + + + Building 9 is non-residential + + + + + + POLYGON((-1.3635847 50.9515068,-1.3637988 50.9515069,-1.3637989 50.9514271,-1.3635847 50.9514270,-1.3635847 50.9515068)) + + + + + + + + + + + + Staff P/kabin 1 Wide Lane + + + 50.951485 + + + -1.363689 + + + 9001 + + + + + + Building 9001 is non-residential + + + + + + + + + + + + + + + P/kabin 2 rear Bld 35 + + + 9002 + + + + + + Building 9002 is non-residential + + + + + + + + + + + + + + + Boiler House, Wide Lane + + + 9003 + + + + + + Building 9003 is non-residential + + + + + + POLYGON((-1.3635846 50.9516903,-1.3635847 50.9515068,-1.3634704 50.9515067,-1.3634702 50.9516902,-1.3635846 50.9516903)) + + + + + + + + + + + + Gardening Shed Wide Lane + + + 50.951576 + + + -1.363506 + + + 9004 + + + + + + Building 9004 is non-residential + + + + + + + + + + + + + + + Changing Room 1 Wide Lane + + + 50.950558 + + + -1.365365 + + + 9011 + + + + + + Building 9011 is non-residential + + + + + + + + + + + + + + + Changing Room 2 Wide Lane + + + 50.950558 + + + -1.365365 + + + 9012 + + + + + + Building 9012 is non-residential + + + + + + + + + + + + + + + P/kabin Occ Health rr 26/28 UR + + + 9014 + + + + + + Building 9014 is non-residential + + + + + + + + + + + + + + + P/kabin 1 ORC behind B46 + + + 9015 + + + + + + Building 9015 is non-residential + + + + + + + + + + + + + + + P/kabin 2 ORC behind B46 + + + 9016 + + + + + + Building 9016 is non-residential + + + + + + + + + + + + + + + P/kabin 1 behind B35 + + + 9017 + + + + + + Building 9017 is non-residential + + + + + + + + + + + + + + + P/kabin 2 behind B35 + + + 9018 + + + + + + Building 9018 is non-residential + + + + + + + + + + + + + + + Plumbers' Store behind B35 + + + 9019 + + + + + + Building 9019 is non-residential + + + + + + POLYGON((-1.4258066 50.9621448,-1.4252818 50.9622651,-1.4251923 50.9621101,-1.4257171 50.9619898,-1.4258066 50.9621448)) + + + + + + + + + + + + Alpha House + + + 50.9621255 + + + -1.4255025 + + + 92 + + + + + + Building 92 is non-residential + + + + + + POLYGON((-1.3636640 50.9525145,-1.3632707 50.9525019,-1.3633049 50.9520775,-1.3636983 50.9520901,-1.3636640 50.9525145)) + + + + + + + + + + + + New Sports Pavilion Wide Lane + + + 50.952282 + + + -1.363412 + + + 93 + + + + + + Building 93 is non-residential + + + + + + + + + + + + + + + Boat House 1 + + + 50.934563 + + + -1.380039 + + + 94A + + + + + + Building 94A is non-residential + + + + + + + + + + + + + + + Boat House 2 + + + 50.934563 + + + -1.380039 + + + 94B + + + + + + Building 94B is non-residential + + + + + + POLYGON((-1.3806328 50.9340272,-1.3805379 50.9339956,-1.3807486 50.9337448,-1.3808434 50.9337764,-1.3806328 50.9340272)) + + + + + + + + + + + + Westsuit Drying/Store + + + 50.9337771 + + + -1.3807397 + + + 94C + + + + + + Building 94C is non-residential + + + + + + + + + + + + + + + Store 1 + + + 94D + + + + + + Building 94D is non-residential + + + + + + + + + + + + + + + Petrol Store + + + 94E + + + + + + Building 94E is non-residential + + + + + + POLYGON((-1.3805669 50.9342639,-1.3806294 50.9341895,-1.3805462 50.9341617,-1.3804837 50.9342362,-1.3805669 50.9342639)) + + + + + + + + + + + + Boat House Changing Rooms + + + 50.934185 + + + -1.380549 + + + 94F + + + + + + Building 94F is non-residential + + + + + + POLYGON((-1.3805659 50.9341325,-1.3804314 50.9340876,-1.3804701 50.9340416,-1.3806045 50.9340864,-1.3805659 50.9341325)) + + + + + + + + + + + + Workshop + + + 50.934058 + + + -1.380509 + + + 94G + + + + + + Building 94G is non-residential + + + + + + POLYGON((-1.3805659 50.9341325,-1.3806474 50.9341597,-1.3807346 50.9340559,-1.3806532 50.9340287,-1.3805659 50.9341325)) + + + + + + + + + + + + Classroom + + + 50.934078 + + + -1.380648 + + + 94H + + + + + + Building 94H is non-residential + + + + + + + + + + + + + + + Store 2 + + + 94J + + + + + + Building 94J is non-residential + + + + + + + + + + + + + + + Container 1 + + + 94K + + + + + + Building 94K is non-residential + + + + + + + + + + + + + + + Container 2 + + + 94L + + + + + + Building 94L is non-residential + + + + + + + + + + + + + + + Container 3 + + + 94M + + + + + + Building 94M is non-residential + + + + + + + + + + + + + + + Container 4 + + + 94N + + + + + + Building 94N is non-residential + + + + + + + + + + + + + + + Old Sports Pavilion Wide Lane + + + 95 + + + + + + Building 95 is non-residential + + + + + + POLYGON((-1.4369358 50.9327336,-1.4371914 50.9325362,-1.4368740 50.9323729,-1.4369722 50.9322972,-1.4360339 50.9318146,-1.4355557 50.9321840,-1.4363067 50.9325702,-1.4364312 50.9324740,-1.4369358 50.9327336)) + + + + + + + + + + + + South Academic Block + + + 50.932362 + + + -1.436441 + + + 9500 + + + + + + Building 9500 is non-residential + + + + + + POLYGON((-1.4367117 50.9327785,-1.4363067 50.9325702,-1.4360717 50.9324494,-1.4360082 50.9324984,-1.4358792 50.9324321,-1.4352033 50.9329542,-1.4353718 50.9330407,-1.4354888 50.9331008,-1.4357236 50.9329195,-1.4362072 50.9331682,-1.4367117 50.9327785)) + + + + + + + + + + + + Lab & Path Block + + + 50.932819 + + + -1.435797 + + + 9510 + + + + + + Building 9510 is non-residential + + + + + + POLYGON((-1.4362277 50.9334808,-1.4354597 50.9340739,-1.4346040 50.9336337,-1.4353718 50.9330407,-1.4354888 50.9331008,-1.4362277 50.9334808)) + + + + + + + + + + + + West Wing + + + 50.933701 + + + -1.435561 + + + 9520 + + + + + + Building 9520 is non-residential + + + + + + POLYGON((-1.4353718 50.9330407,-1.4346040 50.9336337,-1.4344022 50.9335297,-1.4343061 50.9336039,-1.4335190 50.9331992,-1.4343829 50.9325319,-1.4353718 50.9330407)) + + + + + + + + + + + + Centre Block + + + 50.933247 + + + -1.434392 + + + 9530 + + + + + + Building 9530 is non-residential + + + + + + POLYGON((-1.4359476 50.9353251,-1.4350476 50.9357708,-1.4348667 50.9356258,-1.4346011 50.9357573,-1.4343249 50.9355359,-1.4345920 50.9354036,-1.4342335 50.9351162,-1.4347705 50.9348502,-1.4351094 50.9351219,-1.4351929 50.9350805,-1.4352990 50.9351656,-1.4352033 50.9352130,-1.4352912 50.9352835,-1.4356649 50.9350984,-1.4359476 50.9353251)) + + + + + + + + + + + + P/Anne Maternity Unit + + + 50.935337 + + + -1.434907 + + + 9550 + + + + + + Building 9550 is non-residential + + + + + + + + + + + + + + + IDS + + + 9555 + + + + + + Building 9555 is non-residential + + + + + + + + + + + + + + + Duthie + + + 9560 + + + + + + Building 9560 is non-residential + + + + + + + + + + + + + + + Duthie/Tenovus Link + + + 9561 + + + + + + Building 9561 is non-residential + + + + + + + + + + + + + + + Tenovus + + + 9570 + + + + + + Building 9570 is non-residential + + + + + + POLYGON((-1.4346207 50.9343583,-1.4343700 50.9345408,-1.4341753 50.9344346,-1.4339006 50.9346345,-1.4333153 50.9343151,-1.4337639 50.9339886,-1.4343942 50.9339600,-1.4344133 50.9341276,-1.4339233 50.9341498,-1.4342391 50.9343221,-1.4343742 50.9342238,-1.4346207 50.9343583)) + + + + + + + + + + + + Somers Cancer Research + + + 50.934307 + + + -1.433555 + + + 9580 + + + + + + Building 9580 is non-residential + + + + + + + + + + + + + + + MRC Building + + + 9581 + + + + + + Building 9581 is non-residential + + + + + + POLYGON((-1.3964567 50.9131625,-1.3955077 50.9130771,-1.3955557 50.9128651,-1.3961332 50.9129171,-1.3961892 50.9126701,-1.3954832 50.9126065,-1.3956652 50.9118028,-1.3967515 50.9119006,-1.3966807 50.9122137,-1.3968550 50.9122294,-1.3968973 50.9120424,-1.3973357 50.9120818,-1.3972746 50.9123516,-1.3976540 50.9123857,-1.3975970 50.9126372,-1.3971525 50.9125972,-1.3971816 50.9124684,-1.3968242 50.9124362,-1.3967295 50.9128547,-1.3966300 50.9128457,-1.3966577 50.9127231,-1.3965582 50.9127141,-1.3964567 50.9131625)) + + + + + + + + + + + + Royal South Hants + + + 50.9125279 + + + -1.3973994 + + + 9585 + + + + + + Building 9585 is non-residential + + + + + + POLYGON((-1.4279798 50.9402903,-1.4277190 50.9404626,-1.4275714 50.9403739,-1.4277685 50.9402437,-1.4276831 50.9401924,-1.4278701 50.9400689,-1.4282314 50.9402860,-1.4281081 50.9403674,-1.4279798 50.9402903)) + + + + + + + + + + + + Aldermoor Health Centre + + + 50.940327 + + + -1.427804 + + + 9590 + + + + + + Building 9590 is non-residential + + + + + + + + + + + + + + + North Hampshire Hospital, Basingstoke + + + 51.279823 + + + -1.110778 + + + 9591 + + + + + + Building 9591 is non-residential + + + + + + + + + + + + + + + Royal Hampshire County Hospital, Winchester + + + 51.061089 + + + -1.330204 + + + 9592 + + + + + + Building 9592 is non-residential + + + + + + + + + + + + + + + St. Mary's Hospital, Portsmouth + + + 50.800404 + + + -1.065159 + + + 9593 + + + + + + Building 9593 is non-residential + + + + + + + + + + + + + + + St Mary's Hospital, Isle of Wight + + + 50.711353 + + + -1.300592 + + + 9594 + + + + + + Building 9594 is non-residential + + + + + + + + + + + + + + + Nurses' accommodation, Portsmouth + + + 50.789497 + + + -1.082381 + + + 9595 + + + + + + Building 9595 is non-residential + + + + + + POLYGON((-1.4235992 50.9620903,-1.4233685 50.9621431,-1.4231140 50.9617027,-1.4233447 50.9616498,-1.4235992 50.9620903)) + + + + + + + + + + + + 3 Venture Road + + + 50.9619135 + + + -1.4233506 + + + 96 + + + + + + Building 96 is non-residential + + + + + + POLYGON((-1.4252696 50.9610255,-1.4246987 50.9611564,-1.4246100 50.9610028,-1.4249841 50.9609171,-1.4248666 50.9607138,-1.4250634 50.9606687,-1.4252696 50.9610255)) + + + + + + + + + + + + Epsilon House + + + 50.9609746 + + + -1.4250697 + + + 97 + + + + + + Building 97 is non-residential + + + + + + POLYGON((-1.4228427 50.9614741,-1.4228850 50.9612993,-1.4227499 50.9612863,-1.4229145 50.9606066,-1.4225310 50.9605698,-1.4224892 50.9607427,-1.4225856 50.9607519,-1.4224660 50.9612459,-1.4223410 50.9612339,-1.4222956 50.9614216,-1.4228427 50.9614741)) + + + + + + + + + + + + 2 Venture Road + + + 50.961019 + + + -1.4226617 + + + 99 + + + + + + Building 99 is non-residential + + + POLYGON((-1.3990823 50.9377130,-1.4006918 50.9342877,-1.3979531 50.9330237,-1.3961531 50.9328590,-1.3956357 50.9329379,-1.3954335 50.9331140,-1.3950459 50.9331990,-1.3951385 50.9333849,-1.3946835 50.9334752,-1.3944391 50.9334114,-1.3944644 50.9331512,-1.3939419 50.9330131,-1.3938408 50.9334699,-1.3928043 50.9349887,-1.3925852 50.9349356,-1.3924841 50.9351109,-1.3927200 50.9351640,-1.3923620 50.9357142,-1.3944239 50.9363169,-1.3945234 50.9365712,-1.3951385 50.9371501,-1.3938914 50.9370279,-1.3939167 50.9369164,-1.3936133 50.9368793,-1.3934026 50.9378988,-1.3935543 50.9379095,-1.3936049 50.9381643,-1.3990823 50.9377130)) + + + + + + Highfield Campus + + + 1 + + + POLYGON((-1.4392547 50.9337565,-1.4392547 50.9332940,-1.4381754 50.9326954,-1.4384560 50.9325321,-1.4345488 50.9302464,-1.4317425 50.9323824,-1.4315698 50.9337429,-1.4339012 50.9348312,-1.4341602 50.9355931,-1.4348510 50.9361236,-1.4365564 50.9353482,-1.4357361 50.9342871,-1.4392547 50.9337565)) + + + + + + Southampton General Hospital + + + 18 + + + POLYGON((-1.4034619 50.9368059,-1.4062591 50.9360660,-1.4064260 50.9376872,-1.4054058 50.9377964,-1.4046488 50.9379783,-1.4041933 50.9379096,-1.4038789 50.9380430,-1.4039815 50.9381360,-1.4037634 50.9382573,-1.4035709 50.9381360,-1.4031090 50.9381320,-1.4030577 50.9374204,-1.4033207 50.9373557,-1.4035389 50.9370363,-1.4034619 50.9368059)) + + + + + + Boldrewood Campus + + + 50.9372223 + + + -1.4046552 + + + 2 + + + POLYGON((-1.3980658 50.9135097,-1.3952237 50.9132480,-1.3955633 50.9117098,-1.3990719 50.9116384,-1.3990467 50.9126851,-1.3983677 50.9127168,-1.3980658 50.9135097)) + + + + + + Royal South Hants Hospital + + + 20 + + + POLYGON((-1.4033313 50.9296693,-1.4011463 50.9289554,-1.4021913 50.9277164,-1.4041790 50.9282737,-1.4033313 50.9296693)) + + + + + + Avenue Campus + + + 50.928699 + + + -1.402511 + + + 3 + + + POLYGON((-1.3664622 50.9482380,-1.3647258 50.9494535,-1.3650860 50.9505474,-1.3647001 50.9509444,-1.3632810 50.9513658,-1.3626464 50.9517979,-1.3602112 50.9547041,-1.3641899 50.9548553,-1.3689403 50.9544880,-1.3680314 50.9529215,-1.3682886 50.9492590,-1.3664622 50.9482380)) + + + + + + Recreation Facilities at Wide Lane + + + 39 + + + POLYGON((-1.3104990 51.0653919,-1.3091437 51.0651497,-1.3090241 51.0653251,-1.3086520 51.0651497,-1.3080940 51.0654169,-1.3093961 51.0663689,-1.3104193 51.0665693,-1.3111235 51.0658595,-1.3103661 51.0657009,-1.3104990 51.0653919)) + + + + + + Winchester School of Art + + + 51.065765 + + + -1.30954 + + + 4 + + + POLYGON((-1.3841191 50.9303904,-1.3845444 50.9304838,-1.3839286 50.9315982,-1.3835033 50.9315048,-1.3841191 50.9303904)) + + + + + + Belgrave Industrial Site + + + 50.9309864 + + + -1.3840253 + + + 45 + + + POLYGON((-1.4200515 50.9655440,-1.4196262 50.9651958,-1.4211360 50.9642985,-1.4215825 50.9638565,-1.4214762 50.9629458,-1.4219441 50.9621556,-1.4223056 50.9607761,-1.4223268 50.9596912,-1.4257080 50.9601733,-1.4286638 50.9603609,-1.4336611 50.9602537,-1.4339588 50.9608296,-1.4332145 50.9610573,-1.4335547 50.9618208,-1.4317047 50.9619547,-1.4303863 50.9628655,-1.4290466 50.9619011,-1.4270477 50.9623699,-1.4290591 50.9643976,-1.4275013 50.9649480,-1.4248037 50.9641822,-1.4237090 50.9641512,-1.4225182 50.9647539,-1.4219015 50.9654101,-1.4211785 50.9656913,-1.4200515 50.9655440)) + + + + + + The University of Southampton Science Park + + + 50.962158 + + + -1.424618 + + + 5 + + + POLYGON((-1.4030286 50.9305226,-1.4014071 50.9299818,-1.4017779 50.9296106,-1.4032176 50.9301239,-1.4030286 50.9305226)) + + + + + + Highfield Hall + + + 50.930084 + + + -1.402286 + + + 56 + + + + + + POLYGON((-1.4016517 50.9418655,-1.4013481 50.9423883,-1.4011390 50.9423458,-1.3990076 50.9432298,-1.3990615 50.9439693,-1.3995269 50.9439608,-1.3999721 50.9440756,-1.4009299 50.9442286,-1.4017056 50.9443178,-1.4023532 50.9443476,-1.4026162 50.9443433,-1.4030614 50.9442243,-1.4035470 50.9439311,-1.4034863 50.9430811,-1.4033919 50.9428303,-1.4031626 50.9425668,-1.4027106 50.9422481,-1.4016517 50.9418655)) + + + + + + Glen Eyre Hall + + + 50.943504 + + + -1.401615 + + + 57 + + + + + + POLYGON((-1.4030801 50.9407406,-1.4032299 50.9407878,-1.4027057 50.9419262,-1.4018819 50.9416725,-1.4014232 50.9415428,-1.4012828 50.9413835,-1.4030801 50.9407406)) + + + + + + South Hill Hall + + + 50.94146 + + + -1.402248 + + + 58 + + + + + + POLYGON((-1.4027057 50.9419262,-1.4032299 50.9422742,-1.4036418 50.9421090,-1.4039226 50.9413540,-1.4032299 50.9407878,-1.4027057 50.9419262)) + + + + + + Chamberlain Hall + + + 50.941608 + + + -1.403273 + + + 59 + + + POLYGON((-1.3963013 50.8937513,-1.3942781 50.8935386,-1.3933204 50.8934195,-1.3924032 50.8927474,-1.3922278 50.8921944,-1.3935902 50.8912840,-1.3963553 50.8925687,-1.3961530 50.8927134,-1.3967330 50.8930197,-1.3963013 50.8937513)) + + + + + + National Oceanography Centre Campus + + + 50.8927263 + + + -1.3946555 + + + 6 + + + + + + POLYGON((-1.4012828 50.9413835,-1.4030801 50.9407406,-1.4021815 50.9398971,-1.4008429 50.9404220,-1.4012828 50.9413835)) + + + + + + Hartley Grove + + + 50.940693 + + + -1.401696 + + + 60 + + + POLYGON((-1.3917348 50.9458870,-1.3908607 50.9464318,-1.3900583 50.9459207,-1.3909324 50.9453760,-1.3917348 50.9458870)) + + + + + + Bencraft Hall + + + 50.945885 + + + -1.390811 + + + 62 + + + + + + POLYGON((-1.3756787 50.9387817,-1.3757050 50.9376211,-1.3754814 50.9374885,-1.3750604 50.9370408,-1.3738765 50.9373973,-1.3743632 50.9387983,-1.3756787 50.9387817)) + + + + + + Connaught Hall + + + 50.937965 + + + -1.374632 + + + 63 + + + + + + POLYGON((-1.3789171 50.9373740,-1.3786071 50.9367713,-1.3783302 50.9367713,-1.3781653 50.9369750,-1.3778355 50.9371869,-1.3772750 50.9373490,-1.3760088 50.9376358,-1.3759626 50.9395765,-1.3768859 50.9396638,-1.3766683 50.9402373,-1.3770376 50.9403287,-1.3779213 50.9390778,-1.3789171 50.9373740)) + + + + + + Montefiore Hall + + + 50.938297 + + + -1.377164 + + + 64 + + + + + + POLYGON((-1.3780071 50.9367009,-1.3776782 50.9369745,-1.3771652 50.9371569,-1.3759155 50.9374636,-1.3755866 50.9372564,-1.3754551 50.9369414,-1.3775730 50.9363445,-1.3780071 50.9367009)) + + + + + + Stoneham Hall + + + 50.9369483 + + + -1.3765588 + + + 65 + + + POLYGON((-1.3005228 51.0677314,-1.3005750 51.0683404,-1.3004482 51.0688089,-1.2999040 51.0697038,-1.2994641 51.0696101,-1.2999561 51.0686450,-1.3000605 51.0683311,-1.3000531 51.0680125,-1.3005228 51.0677314)) + + + + + + Erasmus Park + + + 51.0687982 + + + -1.3000948 + + + 70 + + + POLYGON((-1.3800720 50.9347696,-1.3797898 50.9344413,-1.3800286 50.9343866,-1.3802818 50.9341313,-1.3801805 50.9339352,-1.3799562 50.9337528,-1.3802022 50.9334929,-1.3810849 50.9337164,-1.3805061 50.9346875,-1.3800720 50.9347696)) + + + + + + Boat House + + + 8 + + + The Glen Eyre Lane Halls Complex consists of Glen Eyre Hall, Hartley Grove Hall, South Hill Hall and Chamberlain Hall. This set of halls are often just referred to collectively as 'Glen'. + + + + + + Glen Eyre Halls Complex + + + The Wessex Lane Halls Complex consists of Stoneham Hall, Montefiore Hall and Connaught Hall. This set of halls are often just referred to collectively as "Wessex Lane". + + + + + + Wessex Lane Halls Complex + + diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java index d8cc3af..3c3078e 100644 --- a/gen/net/cbaines/suma/R.java +++ b/gen/net/cbaines/suma/R.java @@ -54,74 +54,79 @@ public final class R { public static final int u9_radio_button=0x7f02001d; } public static final class id { - public static final int busActivityBusID=0x7f0a0005; - public static final int busActivityContentLayout=0x7f0a000b; - public static final int busActivityHeaderLayout=0x7f0a0004; - public static final int busActivityMessage=0x7f0a000c; - public static final int busActivityTimes=0x7f0a000d; - public static final int busActivityU1=0x7f0a0006; - public static final int busActivityU1N=0x7f0a0007; - public static final int busActivityU2=0x7f0a0008; - public static final int busActivityU6=0x7f0a0009; - public static final int busActivityU9=0x7f0a000a; - public static final int busStopID=0x7f0a0018; - public static final int busStopListItems=0x7f0a000f; - public static final int busStopLoadBar=0x7f0a001d; - public static final int busStopMessage=0x7f0a001a; - public static final int busStopName=0x7f0a0010; - public static final int busStopTimes=0x7f0a001b; - public static final int busTimeContentLayout=0x7f0a0019; - public static final int centerLoadBar=0x7f0a001c; - public static final int check1=0x7f0a002c; - public static final int childname=0x7f0a002b; - public static final int donateBitcoinAddress=0x7f0a0023; + public static final int buildingActivityFavouriteCheckBox=0x7f0a0006; + public static final int buildingActivityID=0x7f0a0007; + public static final int buildingActivityImage=0x7f0a0008; + public static final int buildingActivityName=0x7f0a0004; + public static final int busActivityBusID=0x7f0a000a; + public static final int busActivityContentLayout=0x7f0a0010; + public static final int busActivityHeaderLayout=0x7f0a0009; + public static final int busActivityMessage=0x7f0a0011; + public static final int busActivityTimes=0x7f0a0012; + public static final int busActivityU1=0x7f0a000b; + public static final int busActivityU1N=0x7f0a000c; + public static final int busActivityU2=0x7f0a000d; + public static final int busActivityU6=0x7f0a000e; + public static final int busActivityU9=0x7f0a000f; + public static final int busStopID=0x7f0a001a; + public static final int busStopListItems=0x7f0a0021; + public static final int busStopLoadBar=0x7f0a001f; + public static final int busStopMessage=0x7f0a001c; + public static final int busStopName=0x7f0a0013; + public static final int busStopTimes=0x7f0a001d; + public static final int busTimeContentLayout=0x7f0a001b; + public static final int centerLoadBar=0x7f0a001e; + public static final int check1=0x7f0a0030; + public static final int childname=0x7f0a002f; + public static final int donateBitcoinAddress=0x7f0a0027; public static final int donateButton=0x7f0a0003; - public static final int donateDialogErrorMessage=0x7f0a0022; - public static final int donateDialogMessage=0x7f0a001f; - public static final int donateDialogMessageLayout=0x7f0a0021; - public static final int donateDialogProgress=0x7f0a0020; - public static final int favouriteCheckBox=0x7f0a0017; - public static final int favouriteDialogMessage=0x7f0a0029; - public static final int favouriteListItems=0x7f0a002a; - public static final int findContentLayout=0x7f0a0025; - public static final int findListItems=0x7f0a0027; - public static final int findLoadBar=0x7f0a0026; + public static final int donateDialogErrorMessage=0x7f0a0026; + public static final int donateDialogMessage=0x7f0a0023; + public static final int donateDialogMessageLayout=0x7f0a0025; + public static final int donateDialogProgress=0x7f0a0024; + public static final int favouriteCheckBox=0x7f0a0019; + public static final int favouriteDialogMessage=0x7f0a002d; + public static final int favouriteListItems=0x7f0a002e; + public static final int findContentLayout=0x7f0a0029; + public static final int findListItems=0x7f0a002b; + public static final int findLoadBar=0x7f0a002a; public static final int helpExpandableListView=0x7f0a0002; - public static final int layout_root=0x7f0a000e; - public static final int linearLayout1=0x7f0a0011; - public static final int linearLayout2=0x7f0a001e; - public static final int mapview=0x7f0a0028; - public static final int menu_about=0x7f0a0032; - public static final int menu_favourites=0x7f0a0033; - public static final int menu_find=0x7f0a002e; - public static final int menu_find_my_location=0x7f0a0030; - public static final int menu_next_stop=0x7f0a0036; - public static final int menu_preferences=0x7f0a002f; - public static final int menu_previous_stop=0x7f0a0034; - public static final int menu_refresh_stop=0x7f0a0035; - public static final int menu_view=0x7f0a0031; - public static final int radio_u1=0x7f0a0012; - public static final int radio_u1n=0x7f0a0013; - public static final int radio_u2=0x7f0a0014; - public static final int radio_u6=0x7f0a0015; - public static final int radio_u9=0x7f0a0016; - public static final int searchBar=0x7f0a0024; + public static final int layout_root=0x7f0a0020; + public static final int linearLayout1=0x7f0a0005; + public static final int linearLayout2=0x7f0a0022; + public static final int mapview=0x7f0a002c; + public static final int menu_about=0x7f0a0036; + public static final int menu_favourites=0x7f0a0037; + public static final int menu_find=0x7f0a0032; + public static final int menu_find_my_location=0x7f0a0034; + public static final int menu_next_stop=0x7f0a003a; + public static final int menu_preferences=0x7f0a0033; + public static final int menu_previous_stop=0x7f0a0038; + public static final int menu_refresh_stop=0x7f0a0039; + public static final int menu_view=0x7f0a0035; + public static final int radio_u1=0x7f0a0014; + public static final int radio_u1n=0x7f0a0015; + public static final int radio_u2=0x7f0a0016; + public static final int radio_u6=0x7f0a0017; + public static final int radio_u9=0x7f0a0018; + public static final int searchBar=0x7f0a0028; public static final int textView1=0x7f0a0000; public static final int textView2=0x7f0a0001; - public static final int view_list=0x7f0a002d; + public static final int view_list=0x7f0a0031; } public static final class layout { public static final int about_dialog=0x7f030000; - public static final int bus_activity=0x7f030001; - public static final int bus_stop_dialog=0x7f030002; - public static final int bustimes=0x7f030003; - public static final int donate_dialog=0x7f030004; - public static final int find=0x7f030005; - public static final int main=0x7f030006; - public static final int poi_dialog=0x7f030007; - public static final int view_child_row=0x7f030008; - public static final int view_dialog=0x7f030009; - public static final int view_group_row=0x7f03000a; + public static final int building_activity=0x7f030001; + public static final int bus_activity=0x7f030002; + public static final int bus_stop_activity=0x7f030003; + public static final int bus_stop_dialog=0x7f030004; + public static final int donate_dialog=0x7f030005; + public static final int find=0x7f030006; + public static final int main=0x7f030007; + public static final int poi_dialog=0x7f030008; + public static final int view_child_row=0x7f030009; + public static final int view_dialog=0x7f03000a; + public static final int view_group_row=0x7f03000b; } public static final class menu { public static final int map_menu=0x7f090000; diff --git a/res/layout/building_activity.xml b/res/layout/building_activity.xml new file mode 100644 index 0000000..4a465ee --- /dev/null +++ b/res/layout/building_activity.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/bus_stop_activity.xml b/res/layout/bus_stop_activity.xml new file mode 100644 index 0000000..24200c6 --- /dev/null +++ b/res/layout/bus_stop_activity.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/bustimes.xml b/res/layout/bustimes.xml deleted file mode 100644 index 24200c6..0000000 --- a/res/layout/bustimes.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/net/cbaines/suma/BuildingActivity.java b/src/net/cbaines/suma/BuildingActivity.java index 987d139..930c2d1 100644 --- a/src/net/cbaines/suma/BuildingActivity.java +++ b/src/net/cbaines/suma/BuildingActivity.java @@ -19,67 +19,148 @@ package net.cbaines.suma; +import java.io.IOException; import java.io.InputStream; -import java.util.HashSet; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Iterator; import android.content.Context; +import android.graphics.drawable.Drawable; import android.os.Bundle; - +import android.util.Log; +import android.view.View; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; +import android.widget.ImageButton; +import android.widget.TextView; + +import com.hp.hpl.jena.query.Query; +import com.hp.hpl.jena.query.QueryExecution; +import com.hp.hpl.jena.query.QueryExecutionFactory; +import com.hp.hpl.jena.query.QueryFactory; +import com.hp.hpl.jena.query.QuerySolution; +import com.hp.hpl.jena.query.ResultSet; +import com.hp.hpl.jena.rdf.model.Literal; +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.rdf.model.RDFNode; +import com.hp.hpl.jena.rdf.model.Resource; +import com.hp.hpl.jena.tdb.TDBFactory; import com.j256.ormlite.android.apptools.OrmLiteBaseActivity; -public class BuildingActivity extends OrmLiteBaseActivity { +public class BuildingActivity extends OrmLiteBaseActivity implements OnCheckedChangeListener { - final static String TAG = "BusTimeActivity"; + final static String TAG = "BusTimeActivity"; - private boolean dataChanged; + private boolean dataChanged; - private Context instance; + private Context instance; - private HashSet routes = new HashSet(); + private ImageButton imageButton; - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.bustimes); + private TextView buildingName; + private TextView buildingID; - final DatabaseHelper helper = getHelper(); + private CheckBox favouritesCheckBox; - // create an empty model - // Model model = ModelFactory.createDefaultModel(); + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.building_activity); + instance = this; - // use the FileManager to find the input file - InputStream in = getResources().openRawResource(R.raw.u9); - if (in == null) { - throw new IllegalArgumentException("File not found"); - } + String ID = getIntent().getExtras().getString("buildingID"); + + favouritesCheckBox = (CheckBox) findViewById(R.id.buildingActivityFavouriteCheckBox); + // favouritesCheckBox.setChecked(busStop.favourite); + favouritesCheckBox.setOnCheckedChangeListener(this); + + buildingName = (TextView) findViewById(R.id.buildingActivityName); + buildingID = (TextView) findViewById(R.id.buildingActivityName); + + Log.i(TAG, "Building id " + ID); + + buildingID.setText(ID); + + try { + URL url = new URL("http://data.southampton.ac.uk/images/buildings/600/" + ID + ".jpg"); + + InputStream is = (InputStream) url.getContent(); + Drawable image = Drawable.createFromStream(is, "src"); + + imageButton = new ImageButton(this); + imageButton = (ImageButton) findViewById(R.id.buildingActivityImage); + imageButton.setImageDrawable(image); + imageButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + + } + }); + + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } - // read the RDF/XML file - // model.read(in, null); - - + String directory = "/data/data/net.cbaines.suma/databases"; + Model model = TDBFactory.createModel(directory); - instance = this; + String queryString = ID; + Query query = QueryFactory.create(queryString); + QueryExecution qexec = QueryExecutionFactory.create(query, model); + try { + ResultSet results = qexec.execSelect(); + for (; results.hasNext();) { + QuerySolution soln = results.nextSolution(); - } + Log.i(TAG, "solution " + soln.toString()); - public void onResume() { - super.onResume(); + for (Iterator iter = soln.varNames(); iter.hasNext();) { + Log.i(TAG, "solnVarName " + iter.next()); + } - } + // RDFNode x = soln.get("varName"); // Get a result variable by + // name. + // Resource r = soln.getResource("VarR"); // Get a result + // variable + // - must be a resource + // Literal l = soln.getLiteral("VarL"); // Get a result variable + // - + // must be a literal + } + } finally { + qexec.close(); + } - public void onPause() { + } + + public void onResume() { + super.onResume(); + + } - super.onPause(); - } + public void onPause() { - public void finish() { - setResult(RESULT_OK, getIntent()); + super.onPause(); + } - super.finish(); - } + public void finish() { + setResult(RESULT_OK, getIntent()); - @Override - public Object onRetainNonConfigurationInstance() { - return null; - } + super.finish(); + } + + @Override + public Object onRetainNonConfigurationInstance() { + return null; + } + + public void onCheckedChanged(CompoundButton arg0, boolean arg1) { + // TODO Auto-generated method stub + + } } diff --git a/src/net/cbaines/suma/BuildingNumOverlay.java b/src/net/cbaines/suma/BuildingNumOverlay.java index 32616a7..74688a0 100644 --- a/src/net/cbaines/suma/BuildingNumOverlay.java +++ b/src/net/cbaines/suma/BuildingNumOverlay.java @@ -29,6 +29,8 @@ import org.osmdroid.views.MapView; import org.osmdroid.views.MapView.Projection; import org.osmdroid.views.overlay.Overlay; +import android.app.Activity; +import android.content.Intent; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; @@ -45,260 +47,283 @@ import com.j256.ormlite.dao.Dao; public class BuildingNumOverlay extends Overlay { - private ArrayList buildings; + private ArrayList buildings; - private final Point mCurScreenCoords = new Point(); - private final Point mTouchScreenPoint = new Point(); - private final Point mItemPoint = new Point(); + private final Point mCurScreenCoords = new Point(); + private final Point mTouchScreenPoint = new Point(); + private final Point mItemPoint = new Point(); - private final Rect mRect = new Rect(); + private final Rect mRect = new Rect(); - private final Drawable marker; - private final Drawable favMarker; + private final Drawable marker; + private final Drawable favMarker; - private final Paint paint; + private final Paint paint; - private static final String TAG = "BuildingNumOverlay"; + private static final String TAG = "BuildingNumOverlay"; - private final MapActivity context; + private final MapActivity context; - private Dao buildingDao; + private Dao buildingDao; - private float userScale = 1f; + private float userScale = 1f; - public BuildingNumOverlay(MapActivity context, List buildings) throws SQLException { - super(context); + public BuildingNumOverlay(MapActivity context, List buildings) throws SQLException { + super(context); - this.context = context; + this.context = context; - marker = context.getResources().getDrawable(R.drawable.building); - favMarker = context.getResources().getDrawable(R.drawable.building_fav); + marker = context.getResources().getDrawable(R.drawable.building); + favMarker = context.getResources().getDrawable(R.drawable.building_fav); - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - buildingDao = helper.getBuildingDao(); + DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + buildingDao = helper.getBuildingDao(); - paint = new Paint(); - paint.setColor(Color.BLACK); - paint.setAntiAlias(true); - paint.setStyle(Style.FILL); - paint.setAlpha(120); - paint.setStrokeWidth(6); - paint.setTextAlign(Paint.Align.CENTER); + paint = new Paint(); + paint.setColor(Color.BLACK); + paint.setAntiAlias(true); + paint.setStyle(Style.FILL); + paint.setAlpha(120); + paint.setStrokeWidth(6); + paint.setTextAlign(Paint.Align.CENTER); - this.buildings = (ArrayList) buildings; - } - - /** - * Draw a marker on each of our items. populate() must have been called first.
- *
- * The marker will be drawn twice for each Item in the Overlay--once in the shadow phase, skewed and darkened, then - * again in the non-shadow phase. The bottom-center of the marker will be aligned with the geographical coordinates - * of the Item.
- *
- * The order of drawing may be changed by overriding the getIndexToDraw(int) method. An item may provide an - * alternate marker via its OverlayItem.getMarker(int) method. If that method returns null, the default marker is - * used.
- *
- * The focused item is always drawn last, which puts it visually on top of the other items.
- * - * @param canvas - * the Canvas upon which to draw. Note that this may already have a transformation applied, so be sure to - * leave it the way you found it - * @param mapView - * the MapView that requested the draw. Use MapView.getProjection() to convert between on-screen pixels - * and latitude/longitude pairs - * @param shadow - * if true, draw the shadow layer. If false, draw the overlay contents. - */ - @Override - public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) { - - if (shadow || !isEnabled()) { - return; + this.buildings = (ArrayList) buildings; } - float scale = mScale * userScale; - - final Projection pj = mapView.getProjection(); - - final int markerWidth = (int) (marker.getIntrinsicWidth() * userScale); - final int markerHeight = (int) (marker.getIntrinsicHeight() * userScale); - - mRect.set(0, 0, 0 + markerWidth, 0 + markerHeight); - mRect.offset(-markerWidth / 2, -markerHeight); - marker.setBounds(mRect); - favMarker.setBounds(mRect); - - /* Draw in backward cycle, so the items with the least index are on the front. */ - for (Iterator buildingIter = buildings.iterator(); buildingIter.hasNext();) { - final Building building = buildingIter.next(); - - // Log.i(TAG, "Looking at drawing stop " + stop.id); - - pj.toMapPixels(building.point, mCurScreenCoords); - - // draw it - if (building.favourite) { - Overlay.drawAt(canvas, favMarker, mCurScreenCoords.x, mCurScreenCoords.y, false); - } else { - Overlay.drawAt(canvas, marker, mCurScreenCoords.x, mCurScreenCoords.y, false); - } - - String idString = String.valueOf(building.id); - - int yOfset = 10; - switch (idString.length()) { - case 1: - paint.setTextSize(25 * scale); - yOfset = 18; - break; - case 2: - paint.setTextSize(24 * scale); - yOfset = 18; - break; - case 3: - paint.setTextSize(17 * scale); - yOfset = 20; - break; - case 4: - paint.setTextSize(14 * scale); - yOfset = 23; - break; - case 5: - paint.setTextSize(10 * scale); - yOfset = 20; - break; - case 6: - paint.setTextSize(9 * scale); - yOfset = 24; - break; - default: - Log.w(TAG, "Reverting to default text size for length " + idString.length()); - paint.setTextSize(15 * scale); - break; - } - canvas.drawText(idString, mCurScreenCoords.x, mCurScreenCoords.y - (yOfset * scale), paint); - } - } + /** + * Draw a marker on each of our items. populate() must have been called + * first.
+ *
+ * The marker will be drawn twice for each Item in the Overlay--once in the + * shadow phase, skewed and darkened, then again in the non-shadow phase. + * The bottom-center of the marker will be aligned with the geographical + * coordinates of the Item.
+ *
+ * The order of drawing may be changed by overriding the getIndexToDraw(int) + * method. An item may provide an alternate marker via its + * OverlayItem.getMarker(int) method. If that method returns null, the + * default marker is used.
+ *
+ * The focused item is always drawn last, which puts it visually on top of + * the other items.
+ * + * @param canvas + * the Canvas upon which to draw. Note that this may already have + * a transformation applied, so be sure to leave it the way you + * found it + * @param mapView + * the MapView that requested the draw. Use + * MapView.getProjection() to convert between on-screen pixels + * and latitude/longitude pairs + * @param shadow + * if true, draw the shadow layer. If false, draw the overlay + * contents. + */ + @Override + public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) { + + if (shadow || !isEnabled()) { + return; + } - @Override - public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) { + float scale = mScale * userScale; + + final Projection pj = mapView.getProjection(); + + final int markerWidth = (int) (marker.getIntrinsicWidth() * userScale); + final int markerHeight = (int) (marker.getIntrinsicHeight() * userScale); + + mRect.set(0, 0, 0 + markerWidth, 0 + markerHeight); + mRect.offset(-markerWidth / 2, -markerHeight); + marker.setBounds(mRect); + favMarker.setBounds(mRect); + + /* + * Draw in backward cycle, so the items with the least index are on the + * front. + */ + for (Iterator buildingIter = buildings.iterator(); buildingIter.hasNext();) { + final Building building = buildingIter.next(); + + // Log.i(TAG, "Looking at drawing stop " + stop.id); + + pj.toMapPixels(building.point, mCurScreenCoords); + + // draw it + if (building.favourite) { + Overlay.drawAt(canvas, favMarker, mCurScreenCoords.x, mCurScreenCoords.y, false); + } else { + Overlay.drawAt(canvas, marker, mCurScreenCoords.x, mCurScreenCoords.y, false); + } + + String idString = String.valueOf(building.id); + + int yOfset = 10; + switch (idString.length()) { + case 1: + paint.setTextSize(25 * scale); + yOfset = 18; + break; + case 2: + paint.setTextSize(24 * scale); + yOfset = 18; + break; + case 3: + paint.setTextSize(17 * scale); + yOfset = 20; + break; + case 4: + paint.setTextSize(14 * scale); + yOfset = 23; + break; + case 5: + paint.setTextSize(10 * scale); + yOfset = 20; + break; + case 6: + paint.setTextSize(9 * scale); + yOfset = 24; + break; + default: + Log.w(TAG, "Reverting to default text size for length " + idString.length()); + paint.setTextSize(15 * scale); + break; + } + canvas.drawText(idString, mCurScreenCoords.x, mCurScreenCoords.y - (yOfset * scale), paint); + } + } - if (!this.isEnabled()) - return false; + @Override + public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) { - final Building building = getSelectedItem(event, mapView); + if (!this.isEnabled()) + return false; - if (building == null) { - // Log.v(TAG, "No building pressed"); - return false; - } else { - Log.v(TAG, "building Pressed " + building.id); + final Building building = getSelectedItem(event, mapView); - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, building.name + " (" + building.id + ")", - Toast.LENGTH_SHORT); - } else { - context.activityToast.setDuration(Toast.LENGTH_SHORT); - context.activityToast.setText(building.name + " (" + building.id + ")"); - } - context.activityToast.show(); + if (building == null) { + // Log.v(TAG, "No building pressed"); + return false; + } else { + Log.v(TAG, "building Pressed " + building.id); + + if (context.activityToast == null) { + context.activityToast = Toast.makeText(context, building.name + " (" + building.id + ")", + Toast.LENGTH_SHORT); + } else { + context.activityToast.setDuration(Toast.LENGTH_SHORT); + context.activityToast.setText(building.name + " (" + building.id + ")"); + } + context.activityToast.show(); + + return true; + } - return true; } - } - - public boolean onDoubleTap(final MotionEvent e, final MapView mapView) { - return false; - } + public boolean onDoubleTap(final MotionEvent event, final MapView mapView) { + Building building = getSelectedItem(event, mapView); - @Override - public boolean onLongPress(final MotionEvent event, final MapView mapView) { + if (building == null) { + // Log.v(TAG, "No busStop pressed"); + return false; + } else { + Log.i(TAG, "Pressed " + building.id); - if (!this.isEnabled()) - return false; + Intent i = new Intent(context, BuildingActivity.class); + i.putExtra("buildingID", building.id); + ((Activity) context).startActivityForResult(i, 0); - final Building building = getSelectedItem(event, mapView); + return true; + } + } - if (building == null) { - // Log.v(TAG, "No building pressed"); - return false; - } else { - Log.v(TAG, "building Pressed " + building.id); + @Override + public boolean onLongPress(final MotionEvent event, final MapView mapView) { - if (building.favourite) { - building.favourite = false; + if (!this.isEnabled()) + return false; - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, building.id + " removed from favourites", - Toast.LENGTH_SHORT); - } else { - context.activityToast.setDuration(Toast.LENGTH_SHORT); - context.activityToast.setText(building.id + " removed from favourites"); - } - context.activityToast.show(); + final Building building = getSelectedItem(event, mapView); - } else { - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, building.id + " made a favourite", - Toast.LENGTH_SHORT); + if (building == null) { + // Log.v(TAG, "No building pressed"); + return false; } else { - context.activityToast.setDuration(Toast.LENGTH_SHORT); - context.activityToast.setText(building.id + " made a favourite"); + Log.v(TAG, "building Pressed " + building.id); + + if (building.favourite) { + building.favourite = false; + + if (context.activityToast == null) { + context.activityToast = Toast.makeText(context, building.id + " removed from favourites", + Toast.LENGTH_SHORT); + } else { + context.activityToast.setDuration(Toast.LENGTH_SHORT); + context.activityToast.setText(building.id + " removed from favourites"); + } + context.activityToast.show(); + + } else { + if (context.activityToast == null) { + context.activityToast = Toast.makeText(context, building.id + " made a favourite", + Toast.LENGTH_SHORT); + } else { + context.activityToast.setDuration(Toast.LENGTH_SHORT); + context.activityToast.setText(building.id + " made a favourite"); + } + context.activityToast.show(); + + building.favourite = true; + } + + try { + buildingDao.update(building); + } catch (SQLException e) { + e.printStackTrace(); + } + + Collections.sort(buildings, new POIFavouriteComparator()); + + mapView.invalidate(); + + return true; } - context.activityToast.show(); - - building.favourite = true; - } - - try { - buildingDao.update(building); - } catch (SQLException e) { - e.printStackTrace(); - } - - Collections.sort(buildings, new POIFavouriteComparator()); - mapView.invalidate(); - - return true; } - } - - private Building getSelectedItem(final MotionEvent event, final MapView mapView) { - final Projection pj = mapView.getProjection(); - final int eventX = (int) event.getX(); - final int eventY = (int) event.getY(); + private Building getSelectedItem(final MotionEvent event, final MapView mapView) { + final Projection pj = mapView.getProjection(); + final int eventX = (int) event.getX(); + final int eventY = (int) event.getY(); - /* These objects are created to avoid construct new ones every cycle. */ - pj.fromMapPixels(eventX, eventY, mTouchScreenPoint); + /* These objects are created to avoid construct new ones every cycle. */ + pj.fromMapPixels(eventX, eventY, mTouchScreenPoint); - // Iterate back through the array to properly deal with overlap - for (int i = buildings.size() - 1; i > 0; i--) { - final Building building = buildings.get(i); + // Iterate back through the array to properly deal with overlap + for (int i = buildings.size() - 1; i > 0; i--) { + final Building building = buildings.get(i); - pj.toPixels(building.point, mItemPoint); + pj.toPixels(building.point, mItemPoint); - if (marker.getBounds().contains(mTouchScreenPoint.x - mItemPoint.x, mTouchScreenPoint.y - mItemPoint.y)) { - return building; - } + if (marker.getBounds().contains(mTouchScreenPoint.x - mItemPoint.x, mTouchScreenPoint.y - mItemPoint.y)) { + return building; + } + } + return null; } - return null; - } - public void refresh() { - for (int i = 0; i < buildings.size(); i++) { - refresh(buildings.get(i)); + public void refresh() { + for (int i = 0; i < buildings.size(); i++) { + refresh(buildings.get(i)); + } } - } - public void refresh(Building building) { - if (building.favourite) { - buildings.remove(building); - buildings.add(building); + public void refresh(Building building) { + if (building.favourite) { + buildings.remove(building); + buildings.add(building); + } } - } } diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java index d9eaed3..0d4dea4 100644 --- a/src/net/cbaines/suma/BusStopActivity.java +++ b/src/net/cbaines/suma/BusStopActivity.java @@ -59,8 +59,8 @@ import com.j256.ormlite.dao.Dao; import com.j256.ormlite.stmt.PreparedQuery; import com.j256.ormlite.stmt.QueryBuilder; -public class BusStopActivity extends OrmLiteBaseActivity - implements OnCheckedChangeListener, Preferences, OnItemClickListener { +public class BusStopActivity extends OrmLiteBaseActivity implements OnCheckedChangeListener, + Preferences, OnItemClickListener { final static String TAG = "BusTimeActivity"; @@ -106,7 +106,7 @@ public class BusStopActivity extends OrmLiteBaseActivity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.bustimes); + setContentView(R.layout.bus_stop_activity); final DatabaseHelper helper = getHelper(); @@ -132,15 +132,12 @@ public class BusStopActivity extends OrmLiteBaseActivity Dao routeStopsDao = helper.getRouteStopsDao(); for (BusRoute route : busRouteDao) { - QueryBuilder queryBuilder = routeStopsDao - .queryBuilder(); + QueryBuilder queryBuilder = routeStopsDao.queryBuilder(); - queryBuilder.where() - .eq(RouteStops.ROUTE_ID_FIELD_NAME, route.id).and() + queryBuilder.where().eq(RouteStops.ROUTE_ID_FIELD_NAME, route.id).and() .eq(RouteStops.STOP_ID_FIELD_NAME, busStopID); queryBuilder.setCountOf(true); - PreparedQuery preparedQuery = queryBuilder - .prepare(); + PreparedQuery preparedQuery = queryBuilder.prepare(); long count = routeStopsDao.countOf(preparedQuery); @@ -211,12 +208,9 @@ public class BusStopActivity extends OrmLiteBaseActivity public void onResume() { super.onResume(); - SharedPreferences sharedPrefs = PreferenceManager - .getDefaultSharedPreferences(this); - if (sharedPrefs.getBoolean(UNI_LINK_BUS_TIMES, - UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT) - || sharedPrefs.getBoolean(NON_UNI_LINK_BUS_TIMES, - NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)) { + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + if (sharedPrefs.getBoolean(UNI_LINK_BUS_TIMES, UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT) + || sharedPrefs.getBoolean(NON_UNI_LINK_BUS_TIMES, NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)) { Log.i(TAG, "Live Times enabled"); timetable = (Timetable) getLastNonConfigurationInstance(); @@ -294,8 +288,7 @@ public class BusStopActivity extends OrmLiteBaseActivity return timetable; } - private class GetTimetableTask extends - AsyncTask { + private class GetTimetableTask extends AsyncTask { String errorMessage; protected void onPreExecute() { @@ -305,21 +298,12 @@ public class BusStopActivity extends OrmLiteBaseActivity protected Timetable doInBackground(String... activity) { Timetable newTimetable = null; try { - final SharedPreferences sharedPrefs = PreferenceManager - .getDefaultSharedPreferences(instance); - - newTimetable = DataManager - .getTimetable( - instance, - busStopID, - sharedPrefs - .getBoolean( - MapActivity.UNI_LINK_BUS_TIMES, - MapActivity.UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT), - sharedPrefs - .getBoolean( - MapActivity.NON_UNI_LINK_BUS_TIMES, - MapActivity.NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)); + final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(instance); + + newTimetable = DataManager.getTimetable(instance, busStopID, sharedPrefs.getBoolean( + MapActivity.UNI_LINK_BUS_TIMES, MapActivity.UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT), sharedPrefs + .getBoolean(MapActivity.NON_UNI_LINK_BUS_TIMES, + MapActivity.NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)); } catch (SQLException e) { errorMessage = "Error message regarding SQL?"; e.printStackTrace(); @@ -365,8 +349,7 @@ public class BusStopActivity extends OrmLiteBaseActivity @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection - if (item.getItemId() == R.id.menu_previous_stop - || item.getItemId() == R.id.menu_next_stop) { + if (item.getItemId() == R.id.menu_previous_stop || item.getItemId() == R.id.menu_next_stop) { Log.v(TAG, "Got a request for the stop movement"); Log.v(TAG, routes.size() + " routes avalible from this stop"); @@ -377,11 +360,9 @@ public class BusStopActivity extends OrmLiteBaseActivity try { Set tmpStops; if (item.getItemId() == R.id.menu_next_stop) { - tmpStops = route.moveInRoute(this, getHelper() - .getBusStopDao().queryForId(busStopID), 1); + tmpStops = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), 1); } else { - tmpStops = route.moveInRoute(this, getHelper() - .getBusStopDao().queryForId(busStopID), -1); + tmpStops = route.moveInRoute(this, getHelper().getBusStopDao().queryForId(busStopID), -1); } for (BusStop busStop : tmpStops) { if (!busStops.contains(busStop)) { @@ -410,8 +391,7 @@ public class BusStopActivity extends OrmLiteBaseActivity } else { showDialog(POI_DIALOG_ID); if (busDialog == null) { - Log.e(TAG, - "Very wierd, just tried to launch the favourite's dialog, but its null?"); + Log.e(TAG, "Very wierd, just tried to launch the favourite's dialog, but its null?"); return false; } @@ -450,11 +430,9 @@ public class BusStopActivity extends OrmLiteBaseActivity busTimeContentLayout.setGravity(Gravity.CENTER); } else { - for (Iterator stopIter = visibleTimetable.iterator(); stopIter - .hasNext();) { + for (Iterator stopIter = visibleTimetable.iterator(); stopIter.hasNext();) { Stop stop = stopIter.next(); - Log.i(TAG, "Begin filtering, looking at " + stop - + " with route " + stop.bus.route.code); + Log.i(TAG, "Begin filtering, looking at " + stop + " with route " + stop.bus.route.code); if (stop.bus.route.code.equals("U1")) { if (!U1RouteRadioButton.isChecked()) { stopIter.remove(); @@ -480,8 +458,7 @@ public class BusStopActivity extends OrmLiteBaseActivity if (visibleTimetable.size() == 0) { busTimeContentLayout.setGravity(Gravity.CENTER); - busStopMessage - .setText("No Busses (With the current enabled routes)"); + busStopMessage.setText("No Busses (With the current enabled routes)"); busStopMessage.setVisibility(View.VISIBLE); busTimeList.setVisibility(View.GONE); } else { @@ -510,8 +487,7 @@ public class BusStopActivity extends OrmLiteBaseActivity return null; } - public void onItemClick(AdapterView parent, View view, int position, - long id) { + public void onItemClick(AdapterView parent, View view, int position, long id) { Log.i(TAG, "OnItemClick pos " + position + " id " + id); String poiId = busDialog.adapter.getItemStringId(position); diff --git a/src/net/cbaines/suma/BusStopOverlay.java b/src/net/cbaines/suma/BusStopOverlay.java index 06a1729..060ad47 100644 --- a/src/net/cbaines/suma/BusStopOverlay.java +++ b/src/net/cbaines/suma/BusStopOverlay.java @@ -44,308 +44,314 @@ import com.j256.ormlite.dao.Dao; public class BusStopOverlay extends Overlay implements RouteColorConstants { - List busStops; + List busStops; - private final Point mCurScreenCoords = new Point(); - private final Point mTouchScreenPoint = new Point(); - private final Point mItemPoint = new Point(); + private final Point mCurScreenCoords = new Point(); + private final Point mTouchScreenPoint = new Point(); + private final Point mItemPoint = new Point(); - private final Rect mRect = new Rect(); + private final Rect mRect = new Rect(); - private final Drawable marker; - private final Drawable favMarker; + private final Drawable marker; + private final Drawable favMarker; - private final Paint paint; + private final Paint paint; - private static final String TAG = "BusStopOverlay"; + private static final String TAG = "BusStopOverlay"; - private final MapActivity context; + private final MapActivity context; - private Dao busStopDao; + private Dao busStopDao; - private float userScale = 1f; + private float userScale = 1f; - private boolean[] routes = new boolean[5]; + private boolean[] routes = new boolean[5]; - public BusStopOverlay(MapActivity context, List busStops) throws SQLException { - super(context); + public BusStopOverlay(MapActivity context, List busStops) throws SQLException { + super(context); - this.context = context; + this.context = context; - marker = context.getResources().getDrawable(R.drawable.busstop); - favMarker = context.getResources().getDrawable(R.drawable.busstop_fav); + marker = context.getResources().getDrawable(R.drawable.busstop); + favMarker = context.getResources().getDrawable(R.drawable.busstop_fav); - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - busStopDao = helper.getBusStopDao(); + DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + busStopDao = helper.getBusStopDao(); - paint = new Paint(); - paint.setStyle(Style.FILL); - paint.setStrokeWidth(6); + paint = new Paint(); + paint.setStyle(Style.FILL); + paint.setStrokeWidth(6); - this.busStops = busStops; - } - - void setRoutes(int route, boolean visible) { - routes[route] = visible; - } - - @Override - public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) { - - if (shadow) { - return; + this.busStops = busStops; } - float scale = mScale * userScale; + void setRoutes(int route, boolean visible) { + routes[route] = visible; + } - final Projection pj = mapView.getProjection(); + @Override + public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) { - final int markerWidth = (int) (marker.getIntrinsicWidth() * userScale); - final int markerHeight = (int) (marker.getIntrinsicHeight() * userScale); + if (shadow) { + return; + } - mRect.set(0, 0, 0 + markerWidth, 0 + markerHeight); - mRect.offset(-markerWidth / 2, -markerHeight); - marker.setBounds(mRect); - favMarker.setBounds(mRect); + float scale = mScale * userScale; - /* Draw in backward cycle, so the items with the least index are on the front. */ + final Projection pj = mapView.getProjection(); - for (int stopNum = 0; stopNum < busStops.size(); stopNum++) { - BusStop stop = busStops.get(stopNum); + final int markerWidth = (int) (marker.getIntrinsicWidth() * userScale); + final int markerHeight = (int) (marker.getIntrinsicHeight() * userScale); - byte routeNum = 0; - final byte stopRoutes = stop.routes; + mRect.set(0, 0, 0 + markerWidth, 0 + markerHeight); + mRect.offset(-markerWidth / 2, -markerHeight); + marker.setBounds(mRect); + favMarker.setBounds(mRect); - boolean drawing = false; + /* + * Draw in backward cycle, so the items with the least index are on the + * front. + */ - if (stop.uniLink) { + for (int stopNum = 0; stopNum < busStops.size(); stopNum++) { + BusStop stop = busStops.get(stopNum); - for (int i = 0; i < 5; i++) { - if ((stopRoutes & (1 << i)) != 0) { - routeNum++; - if (routes[i]) { - drawing = true; - } - } - } + byte routeNum = 0; + final byte stopRoutes = stop.routes; - if (!drawing) - continue; + boolean drawing = false; - } + if (stop.uniLink) { - pj.toMapPixels(stop.point, mCurScreenCoords); + for (int i = 0; i < 5; i++) { + if ((stopRoutes & (1 << i)) != 0) { + routeNum++; + if (routes[i]) { + drawing = true; + } + } + } - if (stop.favourite) { - Overlay.drawAt(canvas, favMarker, mCurScreenCoords.x, mCurScreenCoords.y, false); - } else { - Overlay.drawAt(canvas, marker, mCurScreenCoords.x, mCurScreenCoords.y, false); - } + if (!drawing) + continue; - if (stop.uniLink) { + } - int makersPlaced = 0; - int yOfsetPerMarker = (int) (10 * scale); - int markerYSize = (int) (8 * scale); + pj.toMapPixels(stop.point, mCurScreenCoords); - float rectLeft = mCurScreenCoords.x + (8.8f * scale); - float rectRight = rectLeft + markerYSize; + if (stop.favourite) { + Overlay.drawAt(canvas, favMarker, mCurScreenCoords.x, mCurScreenCoords.y, false); + } else { + Overlay.drawAt(canvas, marker, mCurScreenCoords.x, mCurScreenCoords.y, false); + } - if (routeNum == 5) { - markerYSize = (int) (5 * scale); - yOfsetPerMarker = (int) (7 * scale); - } else if (routeNum == 4) { - markerYSize = (int) (6.5f * scale); - yOfsetPerMarker = (int) (8 * scale); + if (stop.uniLink) { + + int makersPlaced = 0; + int yOfsetPerMarker = (int) (10 * scale); + int markerYSize = (int) (8 * scale); + + float rectLeft = mCurScreenCoords.x + (8.8f * scale); + float rectRight = rectLeft + markerYSize; + + if (routeNum == 5) { + markerYSize = (int) (5 * scale); + yOfsetPerMarker = (int) (7 * scale); + } else if (routeNum == 4) { + markerYSize = (int) (6.5f * scale); + yOfsetPerMarker = (int) (8 * scale); + } + + for (int i = 0; i < 5; i++) { + if ((stopRoutes & (1 << i)) != 0) { + + // Log.i(TAG, "Route " + route + " is " + + // routes.get(route)); + + // Log.i(TAG, "Index is " + busRoutes.indexOf(route) + + // " busRoutes " + busRoutes); + + if (i == 0) { + paint.setColor(U1); + } else if (i == 1) { + paint.setColor(U1N); + } else if (i == 2) { + paint.setColor(U2); + } else if (i == 3) { + paint.setColor(U6); + } else if (i == 4) { + paint.setColor(U9); + } else { + Log.e(TAG, "Unknown route code"); + } + + canvas.drawRect(rectLeft, mCurScreenCoords.y + + ((yOfsetPerMarker * makersPlaced) - (45 * scale)), rectRight, mCurScreenCoords.y + + (yOfsetPerMarker * makersPlaced) - ((45 * scale) - markerYSize), paint); + + makersPlaced++; + } + } + } } + } - for (int i = 0; i < 5; i++) { - if ((stopRoutes & (1 << i)) != 0) { + @Override + public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) { - // Log.i(TAG, "Route " + route + " is " + routes.get(route)); + BusStop busStop = getSelectedItem(event, mapView); - // Log.i(TAG, "Index is " + busRoutes.indexOf(route) + " busRoutes " + busRoutes); + if (busStop == null) { + // Log.v(TAG, "No busStop pressed"); + return false; + } else { + Log.i(TAG, "busStop Pressed " + busStop.id); - if (i == 0) { - paint.setColor(U1); - } else if (i == 1) { - paint.setColor(U1N); - } else if (i == 2) { - paint.setColor(U2); - } else if (i == 3) { - paint.setColor(U6); - } else if (i == 4) { - paint.setColor(U9); + if (context.activityToast == null) { + context.activityToast = Toast.makeText(context, busStop.description + " (" + busStop.id + ")", + Toast.LENGTH_SHORT); } else { - Log.e(TAG, "Unknown route code"); + context.activityToast.setDuration(Toast.LENGTH_SHORT); + context.activityToast.setText(busStop.description + " (" + busStop.id + ")"); } + context.activityToast.show(); - canvas.drawRect(rectLeft, mCurScreenCoords.y - + ((yOfsetPerMarker * makersPlaced) - (45 * scale)), rectRight, mCurScreenCoords.y - + (yOfsetPerMarker * makersPlaced) - ((45 * scale) - markerYSize), paint); - - makersPlaced++; - } + return true; } - } } - } - - @Override - public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) { - BusStop busStop = getSelectedItem(event, mapView); + public boolean onDoubleTap(final MotionEvent event, final MapView mapView) { - if (busStop == null) { - // Log.v(TAG, "No busStop pressed"); - return false; - } else { - Log.i(TAG, "busStop Pressed " + busStop.id); + BusStop busStop = getSelectedItem(event, mapView); - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, busStop.description + " (" + busStop.id + ")", - Toast.LENGTH_SHORT); - } else { - context.activityToast.setDuration(Toast.LENGTH_SHORT); - context.activityToast.setText(busStop.description + " (" + busStop.id + ")"); - } - context.activityToast.show(); - - return true; - } - } - - public boolean onDoubleTap(final MotionEvent event, final MapView mapView) { - - BusStop busStop = getSelectedItem(event, mapView); + if (busStop == null) { + // Log.v(TAG, "No busStop pressed"); + return false; + } else { + Log.i(TAG, "Pressed " + busStop.id); - if (busStop == null) { - // Log.v(TAG, "No busStop pressed"); - return false; - } else { - Log.i(TAG, "Pressed " + busStop.id); + Intent i = new Intent(context, BusStopActivity.class); + i.putExtra("busStopID", busStop.id); + i.putExtra("busStopName", busStop.description); + ((Activity) context).startActivityForResult(i, 0); - Intent i = new Intent(context, BusStopActivity.class); - i.putExtra("busStopID", busStop.id); - i.putExtra("busStopName", busStop.description); - ((Activity) context).startActivityForResult(i, 0); + return true; + } - return true; } - } - - @Override - public boolean onLongPress(final MotionEvent event, final MapView mapView) { - - BusStop busStop = getSelectedItem(event, mapView); + @Override + public boolean onLongPress(final MotionEvent event, final MapView mapView) { - if (busStop == null) { - // Log.v(TAG, "No busStop pressed"); - return false; - } else { - Log.i(TAG, "Pressed " + busStop.id); + BusStop busStop = getSelectedItem(event, mapView); - if (busStop.favourite) { - busStop.favourite = false; - - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, busStop.id + " removed from favourites", - Toast.LENGTH_SHORT); - } else { - context.activityToast.setDuration(Toast.LENGTH_SHORT); - context.activityToast.setText(busStop.id + " removed from favourites"); - } - context.activityToast.show(); - } else { - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, busStop.id + " made a favourite", - Toast.LENGTH_SHORT); + if (busStop == null) { + // Log.v(TAG, "No busStop pressed"); + return false; } else { - context.activityToast.setDuration(Toast.LENGTH_SHORT); - context.activityToast.setText(busStop.id + " made a favourite"); - } - context.activityToast.show(); - - busStop.favourite = true; - } + Log.i(TAG, "Pressed " + busStop.id); + + if (busStop.favourite) { + busStop.favourite = false; + + if (context.activityToast == null) { + context.activityToast = Toast.makeText(context, busStop.id + " removed from favourites", + Toast.LENGTH_SHORT); + } else { + context.activityToast.setDuration(Toast.LENGTH_SHORT); + context.activityToast.setText(busStop.id + " removed from favourites"); + } + context.activityToast.show(); + } else { + if (context.activityToast == null) { + context.activityToast = Toast.makeText(context, busStop.id + " made a favourite", + Toast.LENGTH_SHORT); + } else { + context.activityToast.setDuration(Toast.LENGTH_SHORT); + context.activityToast.setText(busStop.id + " made a favourite"); + } + context.activityToast.show(); + + busStop.favourite = true; + } - try { - busStopDao.update(busStop); - } catch (SQLException e) { - e.printStackTrace(); - } + try { + busStopDao.update(busStop); + } catch (SQLException e) { + e.printStackTrace(); + } - Collections.sort(busStops, new POIFavouriteComparator()); + Collections.sort(busStops, new POIFavouriteComparator()); - mapView.invalidate(); + mapView.invalidate(); - return true; - } - } - - public void refresh() { - try { - for (int i = 0; i < busStops.size(); i++) { - BusStop busStop = busStops.get(i); - busStopDao.refresh(busStop); - if (busStop.favourite) { - busStops.remove(i); - busStops.add(busStop); - } else { - busStops.set(i, busStop); + return true; } - } - } catch (SQLException e) { - e.printStackTrace(); } - } - - /** - * Replaces any bus stops that equal the argument in the overlay with the argument - * - * @param busStop - */ - public void refresh(BusStop busStop) { - for (int i = 0; i < busStops.size(); i++) { - if (busStop.equals(busStops.get(i))) { - busStops.set(i, busStop); - } + + public void refresh() { + try { + for (int i = 0; i < busStops.size(); i++) { + BusStop busStop = busStops.get(i); + busStopDao.refresh(busStop); + if (busStop.favourite) { + busStops.remove(i); + busStops.add(busStop); + } else { + busStops.set(i, busStop); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } } - } - - private BusStop getSelectedItem(final MotionEvent event, final MapView mapView) { - final Projection pj = mapView.getProjection(); - final int eventX = (int) event.getX(); - final int eventY = (int) event.getY(); - - /* These objects are created to avoid construct new ones every cycle. */ - pj.fromMapPixels(eventX, eventY, mTouchScreenPoint); - - for (int i = busStops.size() - 1; i > 0; i--) { - BusStop busStop = busStops.get(i); - - pj.toPixels(busStop.point, mItemPoint); - - if (marker.getBounds().contains(mTouchScreenPoint.x - mItemPoint.x, mTouchScreenPoint.y - mItemPoint.y)) { - if (busStop.uniLink) { - boolean drawing = false; - for (int route = 0; route < 5; route++) { - if ((busStop.routes & (1 << route)) != 0) { - if (routes[route]) { - drawing = true; - break; - } + + /** + * Replaces any bus stops that equal the argument in the overlay with the + * argument + * + * @param busStop + */ + public void refresh(BusStop busStop) { + for (int i = 0; i < busStops.size(); i++) { + if (busStop.equals(busStops.get(i))) { + busStops.set(i, busStop); } - } - if (!drawing) - continue; } + } - return busStop; - } + private BusStop getSelectedItem(final MotionEvent event, final MapView mapView) { + final Projection pj = mapView.getProjection(); + final int eventX = (int) event.getX(); + final int eventY = (int) event.getY(); + + /* These objects are created to avoid construct new ones every cycle. */ + pj.fromMapPixels(eventX, eventY, mTouchScreenPoint); + + for (int i = busStops.size() - 1; i > 0; i--) { + BusStop busStop = busStops.get(i); + + pj.toPixels(busStop.point, mItemPoint); + + if (marker.getBounds().contains(mTouchScreenPoint.x - mItemPoint.x, mTouchScreenPoint.y - mItemPoint.y)) { + if (busStop.uniLink) { + boolean drawing = false; + for (int route = 0; route < 5; route++) { + if ((busStop.routes & (1 << route)) != 0) { + if (routes[route]) { + drawing = true; + break; + } + } + } + if (!drawing) + continue; + } + + return busStop; + } + } + return null; } - return null; - } } diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index c6a3a36..56dac5c 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -23,6 +23,8 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; @@ -58,6 +60,10 @@ import org.xml.sax.XMLReader; import android.content.Context; import android.util.Log; +import com.hp.hpl.jena.query.Dataset; +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.rdf.model.ModelFactory; +import com.hp.hpl.jena.tdb.TDBFactory; import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.dao.Dao; import com.j256.ormlite.stmt.PreparedQuery; @@ -66,823 +72,914 @@ import com.j256.ormlite.table.TableUtils; public class DataManager { - private final static String TAG = "DataManager"; + private final static String TAG = "DataManager"; - private final static String busStopUrl = "http://data.southampton.ac.uk/bus-stop/"; + private final static String busStopUrl = "http://data.southampton.ac.uk/bus-stop/"; - private static DatabaseHelper helper; - private static Dao busRouteDao; - private static Dao busDao; - private static Dao busStopDao; + private static DatabaseHelper helper; + private static Dao busRouteDao; + private static Dao busDao; + private static Dao busStopDao; - public static void loadBuildings(Context context) throws SQLException, IOException { - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - Dao buildingDao = helper.getBuildingDao(); + public static void loadBuildings(Context context) throws SQLException, IOException { + DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + Dao buildingDao = helper.getBuildingDao(); - TableUtils.clearTable(helper.getConnectionSource(), Building.class); + TableUtils.clearTable(helper.getConnectionSource(), Building.class); - Log.i(TAG, "Begining loading buildings from csv"); + Log.i(TAG, "Begining loading buildings from csv"); - HashMap buildingPoints = new HashMap(); + HashMap buildingPoints = new HashMap(); - InputStream inputStream = context.getAssets().open("buildings_points.csv"); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); - String strLine; - try { - String def = bufferedReader.readLine(); - // Log.i(TAG, "Reading the definition " + def); + InputStream inputStream = context.getAssets().open("buildings_points.csv"); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String strLine; + try { + String def = bufferedReader.readLine(); + // Log.i(TAG, "Reading the definition " + def); - while ((strLine = bufferedReader.readLine()) != null) { - // Log.i(TAG, "Data: " + strLine); - String[] dataBits = strLine.split(","); - GeoPoint point = Util.csLatLongToGeoPoint(dataBits[2], dataBits[1]); - // Log.i(TAG, "Creating building with id " + dataBits[0] + " and " + point.getLatitudeE6() + " " + - // point.getLongitudeE6()); - buildingPoints.put(dataBits[0], point); - } + while ((strLine = bufferedReader.readLine()) != null) { + // Log.i(TAG, "Data: " + strLine); + String[] dataBits = strLine.split(","); + GeoPoint point = Util.csLatLongToGeoPoint(dataBits[2], dataBits[1]); + // Log.i(TAG, "Creating building with id " + dataBits[0] + + // " and " + point.getLatitudeE6() + " " + + // point.getLongitudeE6()); + buildingPoints.put(dataBits[0], point); + } + + bufferedReader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + // Log.i(TAG, "Number of building points " + buildingPoints.size()); + + inputStream = context.getAssets().open("building_estates.csv"); + bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + + try { + String def = bufferedReader.readLine(); + // Log.i(TAG, "Reading the definition " + def); + + while ((strLine = bufferedReader.readLine()) != null) { + // Log.i(TAG, "Data: " + strLine); + if (strLine.startsWith("\"")) { + String[] quoteBits = strLine.split("\""); + // Log.i(TAG, "QuoteBits " + quoteBits[0] + " | " + + // quoteBits[1]); + String[] dataBits = quoteBits[2].split(","); + // Log.i(TAG, "dataBits " + dataBits[0] + " | " + + // dataBits[1]); + + if (buildingPoints.get(dataBits[1]) == null) { + // Log.w(TAG, "Building " + dataBits[1] + + // " has a null point"); + continue; + } + + Building bdg = new Building(dataBits[1], buildingPoints.get(dataBits[1]), dataBits[3].equals("R"), + quoteBits[0]); + /* + * Polygon poly = buildingPolys.get(dataBits[1]); + * + * if (poly != null) { bdg.outline = poly; // Log.i(TAG, + * "Adding building " + key + " " + + * bdg.point.getLatitudeE6() + " " + + * bdg.point.getLongitudeE6() + " " + poly); } else { // + * Log.i(TAG, "Adding building " + key + " " + + * bdg.point.getLatitudeE6() + " " + + * bdg.point.getLongitudeE6()); } + */ + + // Log.i(TAG, "Creating building " + bdg.id + " " + bdg.name + // + " " + bdg.point + " " + + // bdg.residential + " " + bdg.outline); + + buildingDao.create(bdg); + + } else { + + String[] dataBits = strLine.split(","); + + if (buildingPoints.get(dataBits[1]) == null) { + // Log.w(TAG, "Building " + dataBits[1] + + // " has a null point"); + continue; + } + + Building bdg = new Building(dataBits[1], buildingPoints.get(dataBits[1]), dataBits[3].equals("R"), + dataBits[0]); + /* + * Polygon poly = buildingPolys.get(dataBits[1]); + * + * if (poly != null) { bdg.outline = poly; // Log.i(TAG, + * "Adding building " + key + " " + + * bdg.point.getLatitudeE6() + " " + + * bdg.point.getLongitudeE6() + " " + poly); } else { // + * Log.i(TAG, "Adding building " + key + " " + + * bdg.point.getLatitudeE6() + " " + + * bdg.point.getLongitudeE6()); } + */ + + // Log.i(TAG, "Creating building " + bdg.id + " " + bdg.name + // + " " + bdg.point + " " + + // bdg.residential + " " + bdg.outline); + + buildingDao.create(bdg); + + } + } + + bufferedReader.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + /* + * for (Iterator iter = buildingPoints.keySet().iterator(); + * iter.hasNext();) { String key = iter.next(); + * + * Building bdg = new Building(key, buildingPoints.get(key), false); + * Polygon poly = buildingPolys.get(key); + * + * if (poly != null) { bdg.outline = poly; // Log.i(TAG, + * "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + + * bdg.point.getLongitudeE6() + " " + poly); } else { // Log.i(TAG, + * "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + + * bdg.point.getLongitudeE6()); } + * + * buildingDao.create(bdg); } + */ - bufferedReader.close(); - } catch (IOException e) { - e.printStackTrace(); } - // Log.i(TAG, "Number of building points " + buildingPoints.size()); + public static void loadBuildingPhotos(Context context) { + // Direct way: Make a TDB-backed Jena model in the named directory. + String directory = "/data/data/net.cbaines.suma/databases"; + Model model = TDBFactory.createModel(directory); - inputStream = context.getAssets().open("building_estates.csv"); - bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + Log.i(TAG, "Created the model"); - try { - String def = bufferedReader.readLine(); - // Log.i(TAG, "Reading the definition " + def); + // write it to standard out + StringWriter sw = new StringWriter(); + model.write(new PrintWriter(sw)); + Log.v(TAG, sw.toString()); - while ((strLine = bufferedReader.readLine()) != null) { - // Log.i(TAG, "Data: " + strLine); - if (strLine.startsWith("\"")) { - String[] quoteBits = strLine.split("\""); - // Log.i(TAG, "QuoteBits " + quoteBits[0] + " | " + quoteBits[1]); - String[] dataBits = quoteBits[2].split(","); - // Log.i(TAG, "dataBits " + dataBits[0] + " | " + dataBits[1]); + Log.i(TAG, "Finished the first output"); - if (buildingPoints.get(dataBits[1]) == null) { - // Log.w(TAG, "Building " + dataBits[1] + " has a null point"); - continue; - } + if (model.isEmpty()) { - Building bdg = new Building(dataBits[1], buildingPoints.get(dataBits[1]), dataBits[3].equals("R"), - quoteBits[0]); - /* - * Polygon poly = buildingPolys.get(dataBits[1]); - * - * if (poly != null) { bdg.outline = poly; // Log.i(TAG, "Adding building " + key + " " + - * bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6() + " " + poly); } else { // - * Log.i(TAG, "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + - * bdg.point.getLongitudeE6()); } - */ + Log.i(TAG, "Model is empty"); - // Log.i(TAG, "Creating building " + bdg.id + " " + bdg.name + " " + bdg.point + " " + - // bdg.residential + " " + bdg.outline); + // use the FileManager to find the input file + InputStream in; + try { - buildingDao.create(bdg); + String[] datasets = { "photos.rdf", "places.rdf" }; - } else { + for (String dataset : datasets) { + + in = context.getAssets().open(dataset); + + if (in == null) { + throw new IllegalArgumentException(dataset + " not found"); + } - String[] dataBits = strLine.split(","); + // read the RDF/XML file + model.read(in, null); - if (buildingPoints.get(dataBits[1]) == null) { - // Log.w(TAG, "Building " + dataBits[1] + " has a null point"); - continue; - } + Log.i(TAG, "Finished the read of " + dataset); - Building bdg = new Building(dataBits[1], buildingPoints.get(dataBits[1]), dataBits[3].equals("R"), - dataBits[0]); - /* - * Polygon poly = buildingPolys.get(dataBits[1]); - * - * if (poly != null) { bdg.outline = poly; // Log.i(TAG, "Adding building " + key + " " + - * bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6() + " " + poly); } else { // - * Log.i(TAG, "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + - * bdg.point.getLongitudeE6()); } - */ + } - // Log.i(TAG, "Creating building " + bdg.id + " " + bdg.name + " " + bdg.point + " " + - // bdg.residential + " " + bdg.outline); + // write it to standard out + sw = new StringWriter(); + model.write(new PrintWriter(sw)); + Log.i(TAG, sw.toString()); - buildingDao.create(bdg); + Log.i(TAG, "Finished the second output"); + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } - } - bufferedReader.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + model.close(); - /* - * for (Iterator iter = buildingPoints.keySet().iterator(); iter.hasNext();) { String key = iter.next(); - * - * Building bdg = new Building(key, buildingPoints.get(key), false); Polygon poly = buildingPolys.get(key); - * - * if (poly != null) { bdg.outline = poly; // Log.i(TAG, "Adding building " + key + " " + - * bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6() + " " + poly); } else { // Log.i(TAG, - * "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6()); } - * - * buildingDao.create(bdg); } - */ - - } - - public static void loadBusData(Context context, boolean onlyUniLink) throws SQLException, IOException { - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - - Dao busStopDao = helper.getBusStopDao(); - Dao busRouteDao = helper.getBusRouteDao(); - Dao routeStopsDao = helper.getRouteStopsDao(); - - TableUtils.clearTable(helper.getConnectionSource(), BusStop.class); - TableUtils.clearTable(helper.getConnectionSource(), BusRoute.class); - TableUtils.clearTable(helper.getConnectionSource(), RouteStops.class); - - Log.i(TAG, "Loading busstops from csv"); - - InputStream inputStream = context.getAssets().open("bus_stops.csv"); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); - String strLine = ""; - - try { - String def = bufferedReader.readLine(); - // Log.i(TAG, "Reading the definition " +def ); - - while ((strLine = bufferedReader.readLine()) != null) { - // Log.i(TAG, "Data: " + strLine); - String[] dataBits = strLine.split(","); - - String[] quBitsLat = dataBits[3].substring(1, dataBits[3].length() - 1).split(" "); - String[] quBitsLng = dataBits[4].substring(1, dataBits[4].length() - 1).split(" "); - - // Log.i(TAG, "Whole " + dataBits[3] + " First bit " + quBitsLat[0] + " last bit " + quBitsLat[1]); - double lat = Double.valueOf(quBitsLat[0]) - + Double.valueOf(quBitsLat[1].substring(0, quBitsLat[1].length() - 1)) / 60d; - // Log.i(TAG, "Whole " + dataBits[4] + " First bit " + quBitsLng[0] + " last bit " + quBitsLng[1]); - double lng = Double.valueOf(quBitsLng[0]) - + Double.valueOf(quBitsLng[1].substring(0, quBitsLng[1].length() - 1)) / 60d; - GeoPoint point = new GeoPoint((int) (lat * 1e6), (int) (lng * -1e6)); - // Log.i(TAG, "Lat " + point.getLatitudeE6() + " lng " + point.getLongitudeE6()); - - busStopDao.create(new BusStop(dataBits[0].replace("\"", ""), dataBits[1].replace("\"", ""), dataBits[2] - .replace("\"", ""), point)); - - } - - bufferedReader.close(); - } catch (IOException e) { - Log.e(TAG, "Line: " + strLine); - e.printStackTrace(); + Log.i(TAG, "Closed the model"); } - Log.i(TAG, "Finished loading busstops, now loading routes"); + public static void loadBusData(Context context, boolean onlyUniLink) throws SQLException, IOException { + DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - inputStream = context.getAssets().open("routes.csv"); - bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + Dao busStopDao = helper.getBusStopDao(); + Dao busRouteDao = helper.getBusRouteDao(); + Dao routeStopsDao = helper.getRouteStopsDao(); - try { - String def = bufferedReader.readLine(); - // Log.i(TAG, "Reading the definition " + def); + TableUtils.clearTable(helper.getConnectionSource(), BusStop.class); + TableUtils.clearTable(helper.getConnectionSource(), BusRoute.class); + TableUtils.clearTable(helper.getConnectionSource(), RouteStops.class); - while ((strLine = bufferedReader.readLine()) != null) { - // Log.i(TAG, "Data: " + strLine); - String[] dataBits = strLine.split(","); + Log.i(TAG, "Loading busstops from csv"); - BusRoute route; + InputStream inputStream = context.getAssets().open("bus_stops.csv"); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String strLine = ""; - boolean uniLink; - int id = Integer.parseInt(dataBits[0]); - if (id == 326 || id == 468 || id == 327 || id == 329 || id == 354) { - uniLink = true; - } else { - uniLink = false; - } + try { + String def = bufferedReader.readLine(); + // Log.i(TAG, "Reading the definition " +def ); + + while ((strLine = bufferedReader.readLine()) != null) { + // Log.i(TAG, "Data: " + strLine); + String[] dataBits = strLine.split(","); + + String[] quBitsLat = dataBits[3].substring(1, dataBits[3].length() - 1).split(" "); + String[] quBitsLng = dataBits[4].substring(1, dataBits[4].length() - 1).split(" "); + + // Log.i(TAG, "Whole " + dataBits[3] + " First bit " + + // quBitsLat[0] + " last bit " + quBitsLat[1]); + double lat = Double.valueOf(quBitsLat[0]) + + Double.valueOf(quBitsLat[1].substring(0, quBitsLat[1].length() - 1)) / 60d; + // Log.i(TAG, "Whole " + dataBits[4] + " First bit " + + // quBitsLng[0] + " last bit " + quBitsLng[1]); + double lng = Double.valueOf(quBitsLng[0]) + + Double.valueOf(quBitsLng[1].substring(0, quBitsLng[1].length() - 1)) / 60d; + GeoPoint point = new GeoPoint((int) (lat * 1e6), (int) (lng * -1e6)); + // Log.i(TAG, "Lat " + point.getLatitudeE6() + " lng " + + // point.getLongitudeE6()); + + busStopDao.create(new BusStop(dataBits[0].replace("\"", ""), dataBits[1].replace("\"", ""), dataBits[2] + .replace("\"", ""), point)); + + } - route = new BusRoute(id, dataBits[1], dataBits[2].replace("\"", ""), uniLink); - - if (id == 326) { // U1 - route.forwardDirection = "A"; - route.reverseDirection = "C"; - } else if (id == 329) { // U2 - route.forwardDirection = "B"; - route.reverseDirection = "C"; - } else if (id == 327) { // U6 - route.forwardDirection = "H"; - route.reverseDirection = "C"; + bufferedReader.close(); + } catch (IOException e) { + Log.e(TAG, "Line: " + strLine); + e.printStackTrace(); } - // Log.i(TAG, "Loaded route " + route.id + " " + route.code + " " + route.label); - busRouteDao.create(route); + Log.i(TAG, "Finished loading busstops, now loading routes"); - } + inputStream = context.getAssets().open("routes.csv"); + bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); - bufferedReader.close(); - } catch (IOException e) { - Log.e(TAG, "Line: " + strLine); - e.printStackTrace(); - } + try { + String def = bufferedReader.readLine(); + // Log.i(TAG, "Reading the definition " + def); - Log.i(TAG, "Finished loading routes, now loading routestops"); + while ((strLine = bufferedReader.readLine()) != null) { + // Log.i(TAG, "Data: " + strLine); + String[] dataBits = strLine.split(","); - inputStream = context.getAssets().open("routestops.csv"); - bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + BusRoute route; - try { - String def = bufferedReader.readLine(); - // Log.i(TAG, "Reading the definition " + def); + boolean uniLink; + int id = Integer.parseInt(dataBits[0]); + if (id == 326 || id == 468 || id == 327 || id == 329 || id == 354) { + uniLink = true; + } else { + uniLink = false; + } - while ((strLine = bufferedReader.readLine()) != null) { - // Log.i(TAG, "Data: " + strLine); - String[] dataBits = strLine.split(","); + route = new BusRoute(id, dataBits[1], dataBits[2].replace("\"", ""), uniLink); - BusStop busStop = busStopDao.queryForId(dataBits[2]); - if (busStop != null) { - // Log.i(TAG, "Found stop " + stop.id); - } else { - Log.w(TAG, "No stop found for " + dataBits[2]); - continue; - } + if (id == 326) { // U1 + route.forwardDirection = "A"; + route.reverseDirection = "C"; + } else if (id == 329) { // U2 + route.forwardDirection = "B"; + route.reverseDirection = "C"; + } else if (id == 327) { // U6 + route.forwardDirection = "H"; + route.reverseDirection = "C"; + } - BusRoute busRoute = busRouteDao.queryForId(Integer.parseInt(dataBits[0])); - if (busRoute != null) { - // Log.i(TAG, "Found route " + route.id); - } else { - Log.w(TAG, "No route found for " + dataBits[0]); - continue; - } + // Log.i(TAG, "Loaded route " + route.id + " " + route.code + + // " " + route.label); + busRouteDao.create(route); - int sequence = Integer.parseInt(dataBits[1]); - Log.i(TAG, "Creating RouteStop " + busStop.id + " " + busRoute.code + " " + sequence); - - routeStopsDao.create(new RouteStops(busStop, busRoute, sequence)); - - if (busRoute.id == 326) { // U1 - busStop.routes = (byte) (busStop.routes | 1); - busStop.uniLink = true; - } else if (busRoute.id == 468) { // U1N - busStop.routes = (byte) (busStop.routes | (1 << 1)); - busStop.uniLink = true; - } else if (busRoute.id == 329) { // U2 - busStop.routes = (byte) (busStop.routes | (1 << 2)); - busStop.uniLink = true; - } else if (busRoute.id == 327) { // U6 - busStop.routes = (byte) (busStop.routes | (1 << 3)); - busStop.uniLink = true; - } else if (busRoute.id == 354) { // U9 - busStop.routes = (byte) (busStop.routes | (1 << 4)); - busStop.uniLink = true; - } else { - busStop.routes = 0; + } + + bufferedReader.close(); + } catch (IOException e) { + Log.e(TAG, "Line: " + strLine); + e.printStackTrace(); } - // Log.v(TAG, "Stop routes " + busStop.routes); - busStopDao.update(busStop); + Log.i(TAG, "Finished loading routes, now loading routestops"); + + inputStream = context.getAssets().open("routestops.csv"); + bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + + try { + String def = bufferedReader.readLine(); + // Log.i(TAG, "Reading the definition " + def); + + while ((strLine = bufferedReader.readLine()) != null) { + // Log.i(TAG, "Data: " + strLine); + String[] dataBits = strLine.split(","); + + BusStop busStop = busStopDao.queryForId(dataBits[2]); + if (busStop != null) { + // Log.i(TAG, "Found stop " + stop.id); + } else { + Log.w(TAG, "No stop found for " + dataBits[2]); + continue; + } + + BusRoute busRoute = busRouteDao.queryForId(Integer.parseInt(dataBits[0])); + if (busRoute != null) { + // Log.i(TAG, "Found route " + route.id); + } else { + Log.w(TAG, "No route found for " + dataBits[0]); + continue; + } + + int sequence = Integer.parseInt(dataBits[1]); + Log.i(TAG, "Creating RouteStop " + busStop.id + " " + busRoute.code + " " + sequence); + + routeStopsDao.create(new RouteStops(busStop, busRoute, sequence)); + + if (busRoute.id == 326) { // U1 + busStop.routes = (byte) (busStop.routes | 1); + busStop.uniLink = true; + } else if (busRoute.id == 468) { // U1N + busStop.routes = (byte) (busStop.routes | (1 << 1)); + busStop.uniLink = true; + } else if (busRoute.id == 329) { // U2 + busStop.routes = (byte) (busStop.routes | (1 << 2)); + busStop.uniLink = true; + } else if (busRoute.id == 327) { // U6 + busStop.routes = (byte) (busStop.routes | (1 << 3)); + busStop.uniLink = true; + } else if (busRoute.id == 354) { // U9 + busStop.routes = (byte) (busStop.routes | (1 << 4)); + busStop.uniLink = true; + } else { + busStop.routes = 0; + } + + // Log.v(TAG, "Stop routes " + busStop.routes); + busStopDao.update(busStop); - } + } - bufferedReader.close(); - } catch (IOException e) { - Log.e(TAG, "Line: " + strLine); - e.printStackTrace(); + bufferedReader.close(); + } catch (IOException e) { + Log.e(TAG, "Line: " + strLine); + e.printStackTrace(); + } + + /* + * for (Iterator busStopIter = busStopDao.iterator(); + * busStopIter.hasNext();) { BusStop stop = busStopIter.next(); // + * Log.i(TAG, "Looking at stop " + stop.id); + * + * + * QueryBuilder routeStopsQueryBuilder = + * routeStopsDao.queryBuilder(); + * routeStopsQueryBuilder.where().eq(columnName, value) + * + * DeleteBuilder deleteBuilder = + * busStopDao.deleteBuilder(); // only delete the rows where password is + * null deleteBuilder.where().in(RouteStops.STOP_ID_FIELD_NAME, objects) + * accountDao.delete(deleteBuilder.prepare()); + * + * + * QueryBuilder routeStopsQueryBuilder = + * routeStopsDao.queryBuilder(); + * routeStopsQueryBuilder.setCountOf(true); + * routeStopsQueryBuilder.where().eq(RouteStops.STOP_ID_FIELD_NAME, + * stop); + * + * PreparedQuery routeStopsPreparedQuery = + * routeStopsQueryBuilder.prepare(); List routeStops = + * routeStopsDao.query(routeStopsPreparedQuery); // long num = + * routeStopsDao.query(routeStopsPreparedQuery).size(); // Log.i(TAG, + * "Number is " + num); + * + * stop.uniLink = false; for (RouteStops routeStop : routeStops) { if + * (routeStop.busRoute.uniLink) { stop.uniLink = true; } } + * busStopDao.update(stop); } + */ + + Log.i(TAG, "Finished loading bus data"); } - /* - * for (Iterator busStopIter = busStopDao.iterator(); busStopIter.hasNext();) { BusStop stop = - * busStopIter.next(); // Log.i(TAG, "Looking at stop " + stop.id); - * - * - * QueryBuilder routeStopsQueryBuilder = routeStopsDao.queryBuilder(); - * routeStopsQueryBuilder.where().eq(columnName, value) - * - * DeleteBuilder deleteBuilder = busStopDao.deleteBuilder(); // only delete the rows where - * password is null deleteBuilder.where().in(RouteStops.STOP_ID_FIELD_NAME, objects) - * accountDao.delete(deleteBuilder.prepare()); - * - * - * QueryBuilder routeStopsQueryBuilder = routeStopsDao.queryBuilder(); - * routeStopsQueryBuilder.setCountOf(true); routeStopsQueryBuilder.where().eq(RouteStops.STOP_ID_FIELD_NAME, - * stop); - * - * PreparedQuery routeStopsPreparedQuery = routeStopsQueryBuilder.prepare(); List - * routeStops = routeStopsDao.query(routeStopsPreparedQuery); // long num = - * routeStopsDao.query(routeStopsPreparedQuery).size(); // Log.i(TAG, "Number is " + num); - * - * stop.uniLink = false; for (RouteStops routeStop : routeStops) { if (routeStop.busRoute.uniLink) { - * stop.uniLink = true; } } busStopDao.update(stop); } - */ - - Log.i(TAG, "Finished loading bus data"); - } - - public static void loadSiteData(Context context) throws SQLException, IOException { - Log.i(TAG, "Begining loading site data"); - - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - - TableUtils.clearTable(helper.getConnectionSource(), Site.class); - - Dao siteDao = helper.getSiteDao(); - - InputStream inputStream = context.getAssets().open("sites.csv"); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); - String strLine = null; - - try { - String def = bufferedReader.readLine(); - // Log.i(TAG, "Reading the site definition " + def); - - while ((strLine = bufferedReader.readLine()) != null) { - // Log.i(TAG, "Site Data: " + strLine); - String[] dataBits = strLine.split(","); - - GeoPoint point = null; - if (dataBits[2].length() > 1 && dataBits[3].length() > 1) { - point = Util.csLatLongToGeoPoint(dataBits[2], dataBits[3]); - } else { - point = new GeoPoint(0, 0); - } + public static void loadSiteData(Context context) throws SQLException, IOException { + Log.i(TAG, "Begining loading site data"); - Polygon poly = Util.csPolygonToPolygon(strLine.split("\"")[1]); - // Log.i(TAG, "Polygon: " + poly); + DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - siteDao.create(new Site(dataBits[0], dataBits[1], point, poly)); - } + TableUtils.clearTable(helper.getConnectionSource(), Site.class); - bufferedReader.close(); - } catch (Exception e) { - // TODO Auto-generated catch block - Log.e(TAG, "Site Line: " + strLine); - e.printStackTrace(); - } + Dao siteDao = helper.getSiteDao(); - Log.i(TAG, "Loaded sites from csv"); - } - - private static Stop getStop(Context context, JSONObject stopObj, Set routes, BusStop busStop) - throws SQLException, JSONException { - - if (helper == null) - helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - if (busRouteDao == null) - busRouteDao = helper.getBusRouteDao(); - Dao routeStopsDao = null; - if (routeStopsDao == null) - routeStopsDao = helper.getRouteStopsDao(); - if (busDao == null) - busDao = helper.getBusDao(); - if (busStopDao == null) - busStopDao = helper.getBusStopDao(); - - String time = stopObj.getString("time"); - - GregorianCalendar calender = new GregorianCalendar(); - boolean live = true; - if (!time.equals("Due")) { - - // Log.v(TAG, "Time: " + time + " current time " + calender.getTime()); - - if (time.contains(":")) { - String[] minAndHour = time.split(":"); - calender.set(Calendar.HOUR_OF_DAY, Integer.parseInt(minAndHour[0])); - calender.set(Calendar.MINUTE, Integer.parseInt(minAndHour[1])); - live = false; - } else { - // Log.i(TAG, "Parsing " + time.substring(0, time.length() - 1) + " for min"); - calender.add(Calendar.MINUTE, Integer.parseInt(time.substring(0, time.length() - 1))); - } - - // Log.v(TAG, "Date: " + calender.getTime()); - } + InputStream inputStream = context.getAssets().open("sites.csv"); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String strLine = null; - String name = stopObj.getString("name"); + try { + String def = bufferedReader.readLine(); + // Log.i(TAG, "Reading the site definition " + def); - BusRoute route = null; - String dir = ""; + while ((strLine = bufferedReader.readLine()) != null) { + // Log.i(TAG, "Site Data: " + strLine); + String[] dataBits = strLine.split(","); - for (BusRoute tempRoute : routes) { - if (name.contains("U")) { - if (name.equals("U1N")) { - if (tempRoute.code.equals(name)) { - route = tempRoute; - dir = null; - } - } else { - if (tempRoute == null) { - Log.e(TAG, "tempRoute == null"); - } - if (tempRoute.code == null) { - Log.e(TAG, "tempRoute.code == null"); - } - if (tempRoute.code.equals(name.substring(0, 2))) { - route = tempRoute; - if (route.forwardDirection.equals(name.substring(2))) { - dir = route.forwardDirection; - } else if (route.reverseDirection.equals(name.substring(2))) { - dir = route.reverseDirection; - } else { - Log.e(TAG, "Error detecting direction for " + name); - dir = null; - return null; + GeoPoint point = null; + if (dataBits[2].length() > 1 && dataBits[3].length() > 1) { + point = Util.csLatLongToGeoPoint(dataBits[2], dataBits[3]); + } else { + point = new GeoPoint(0, 0); + } + + Polygon poly = Util.csPolygonToPolygon(strLine.split("\"")[1]); + // Log.i(TAG, "Polygon: " + poly); + + siteDao.create(new Site(dataBits[0], dataBits[1], point, poly)); } - } - } - } else { - if (tempRoute.code.equals(name)) { - route = tempRoute; - dir = null; + + bufferedReader.close(); + } catch (Exception e) { + // TODO Auto-generated catch block + Log.e(TAG, "Site Line: " + strLine); + e.printStackTrace(); } - } - } - if (route == null) { - Log.e(TAG, "Route not found (route == null) " + name); - return null; + Log.i(TAG, "Loaded sites from csv"); } - if (dir != null && dir.equals("")) { - Log.e(TAG, "Error detecting direction for " + name); - return null; - } + private static Stop getStop(Context context, JSONObject stopObj, Set routes, BusStop busStop) + throws SQLException, JSONException { + + if (helper == null) + helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + if (busRouteDao == null) + busRouteDao = helper.getBusRouteDao(); + Dao routeStopsDao = null; + if (routeStopsDao == null) + routeStopsDao = helper.getRouteStopsDao(); + if (busDao == null) + busDao = helper.getBusDao(); + if (busStopDao == null) + busStopDao = helper.getBusStopDao(); + + String time = stopObj.getString("time"); + + GregorianCalendar calender = new GregorianCalendar(); + boolean live = true; + if (!time.equals("Due")) { + + // Log.v(TAG, "Time: " + time + " current time " + + // calender.getTime()); + + if (time.contains(":")) { + String[] minAndHour = time.split(":"); + calender.set(Calendar.HOUR_OF_DAY, Integer.parseInt(minAndHour[0])); + calender.set(Calendar.MINUTE, Integer.parseInt(minAndHour[1])); + live = false; + } else { + // Log.i(TAG, "Parsing " + time.substring(0, time.length() - 1) + // + " for min"); + calender.add(Calendar.MINUTE, Integer.parseInt(time.substring(0, time.length() - 1))); + } - String destString = stopObj.getString("dest"); - BusStop destStop = null; - - if (destString.equals("Central Station")) { - destStop = busStopDao.queryForId("SN120520"); - } else if (destString.equals("Civic Centre")) { - destStop = busStopDao.queryForId("SN120527"); - } else if (destString.equals("City DG4")) { - destStop = busStopDao.queryForId("HAA13579"); - } else if (destString.equals("Airport")) { - destStop = busStopDao.queryForId("HA030184"); - } else if (destString.equals("City, Town Quay")) { - destStop = busStopDao.queryForId("SNA13766"); - } else if (destString.equals("City Centre")) { - destStop = busStopDao.queryForId("SNA13766"); - } else if (destString.equals("Dock Gate 4")) { - destStop = busStopDao.queryForId("MG1031"); - } else if (destString.equals("Eastleigh")) { - destStop = busStopDao.queryForId("HA030212"); - } else if (destString.equals("Crematorium")) { - destStop = busStopDao.queryForId("SN121009"); - } else if (destString.equals("General Hosp")) { - destStop = busStopDao.queryForId("SNA19482"); - } else if (destString.equals("Wessex Lane")) { - destStop = busStopDao.queryForId("SNA19780"); - } else { - Log.e(TAG, "Unknown end dest " + destString + " for route " + route.code); - } + // Log.v(TAG, "Date: " + calender.getTime()); + } - if (destStop != null) { - - QueryBuilder routeStopsQueryBuilder = routeStopsDao.queryBuilder(); - routeStopsQueryBuilder.where().eq(RouteStops.ROUTE_ID_FIELD_NAME, route.id).and() - .eq(RouteStops.STOP_ID_FIELD_NAME, destStop.id); - PreparedQuery routeStopsPreparedQuery = routeStopsQueryBuilder.prepare(); - - List routeStops = routeStopsDao.query(routeStopsPreparedQuery); - if (routeStops.size() > 0) { - Log.i(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " - + route.code); - } else { - Log.w(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " - + route.code); - } - } + String name = stopObj.getString("name"); + + BusRoute route = null; + String dir = ""; + + for (BusRoute tempRoute : routes) { + if (name.contains("U")) { + if (name.equals("U1N")) { + if (tempRoute.code.equals(name)) { + route = tempRoute; + dir = null; + } + } else { + if (tempRoute == null) { + Log.e(TAG, "tempRoute == null"); + } + if (tempRoute.code == null) { + Log.e(TAG, "tempRoute.code == null"); + } + if (tempRoute.code.equals(name.substring(0, 2))) { + route = tempRoute; + if (route.forwardDirection.equals(name.substring(2))) { + dir = route.forwardDirection; + } else if (route.reverseDirection.equals(name.substring(2))) { + dir = route.reverseDirection; + } else { + Log.e(TAG, "Error detecting direction for " + name); + dir = null; + return null; + } + } + } + } else { + if (tempRoute.code.equals(name)) { + route = tempRoute; + dir = null; + } + } + } - Date now = new Date(System.currentTimeMillis()); - - String busID = null; - Stop stop; - Bus bus; - if (stopObj.has("vehicle")) { - busID = stopObj.getString("vehicle"); - - QueryBuilder busQueryBuilder = busDao.queryBuilder(); - busQueryBuilder.where().eq(Bus.ID_FIELD_NAME, busID); - PreparedQuery busPreparedQuery = busQueryBuilder.prepare(); - - bus = busDao.queryForFirst(busPreparedQuery); - - if (bus == null) { - bus = new Bus(busID, route, dir); - bus.destination = destStop; - busDao.create(bus); - } else { - bus.destination = destStop; - bus.route = route; - bus.direction = dir; - busDao.update(bus); - } - - } else { - bus = new Bus(null, route, dir); - busDao.create(bus); - } + if (route == null) { + Log.e(TAG, "Route not found (route == null) " + name); + return null; + } - stop = new Stop(bus, busStop, calender.getTime(), now, live); + if (dir != null && dir.equals("")) { + Log.e(TAG, "Error detecting direction for " + name); + return null; + } + + String destString = stopObj.getString("dest"); + BusStop destStop = null; + + if (destString.equals("Central Station")) { + destStop = busStopDao.queryForId("SN120520"); + } else if (destString.equals("Civic Centre")) { + destStop = busStopDao.queryForId("SN120527"); + } else if (destString.equals("City DG4")) { + destStop = busStopDao.queryForId("HAA13579"); + } else if (destString.equals("Airport")) { + destStop = busStopDao.queryForId("HA030184"); + } else if (destString.equals("City, Town Quay")) { + destStop = busStopDao.queryForId("SNA13766"); + } else if (destString.equals("City Centre")) { + destStop = busStopDao.queryForId("SNA13766"); + } else if (destString.equals("Dock Gate 4")) { + destStop = busStopDao.queryForId("MG1031"); + } else if (destString.equals("Eastleigh")) { + destStop = busStopDao.queryForId("HA030212"); + } else if (destString.equals("Crematorium")) { + destStop = busStopDao.queryForId("SN121009"); + } else if (destString.equals("General Hosp")) { + destStop = busStopDao.queryForId("SNA19482"); + } else if (destString.equals("Wessex Lane")) { + destStop = busStopDao.queryForId("SNA19780"); + } else { + Log.e(TAG, "Unknown end dest " + destString + " for route " + route.code); + } - return stop; - } + if (destStop != null) { - public static Timetable getTimetable(Context context, String busStop, boolean keepUniLink, boolean keepNonUniLink) - throws SQLException, ClientProtocolException, IOException, JSONException { + QueryBuilder routeStopsQueryBuilder = routeStopsDao.queryBuilder(); + routeStopsQueryBuilder.where().eq(RouteStops.ROUTE_ID_FIELD_NAME, route.id).and() + .eq(RouteStops.STOP_ID_FIELD_NAME, destStop.id); + PreparedQuery routeStopsPreparedQuery = routeStopsQueryBuilder.prepare(); + + List routeStops = routeStopsDao.query(routeStopsPreparedQuery); + if (routeStops.size() > 0) { + Log.i(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + + route.code); + } else { + Log.w(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + + route.code); + } + } - if (helper == null) - helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - if (busRouteDao == null) - busRouteDao = helper.getBusRouteDao(); - if (busStopDao == null) - busStopDao = helper.getBusStopDao(); + Date now = new Date(System.currentTimeMillis()); - Timetable timetable = new Timetable(); + String busID = null; + Stop stop; + Bus bus; + if (stopObj.has("vehicle")) { + busID = stopObj.getString("vehicle"); - String file = getFileFromServer(busStopUrl + busStop + ".json"); + QueryBuilder busQueryBuilder = busDao.queryBuilder(); + busQueryBuilder.where().eq(Bus.ID_FIELD_NAME, busID); + PreparedQuery busPreparedQuery = busQueryBuilder.prepare(); - JSONObject data = new JSONObject(file); - JSONArray stopsArray = data.getJSONArray("stops"); - JSONObject routesObject = data.getJSONObject("routes"); + bus = busDao.queryForFirst(busPreparedQuery); - HashSet busRoutes = new HashSet(); - for (Iterator keyIter = routesObject.keys(); keyIter.hasNext();) { - String key = keyIter.next(); + if (bus == null) { + bus = new Bus(busID, route, dir); + bus.destination = destStop; + busDao.create(bus); + } else { + bus.destination = destStop; + bus.route = route; + bus.direction = dir; + busDao.update(bus); + } - Log.v(TAG, "Route Key: " + key); + } else { + bus = new Bus(null, route, dir); + busDao.create(bus); + } - BusRoute route = busRouteDao.queryForId(Integer.parseInt(key.substring(key.length() - 3, key.length()))); + stop = new Stop(bus, busStop, calender.getTime(), now, live); - if (route != null) { - busRoutes.add(route); - } else { - throw new RuntimeException("Route not found " + key.substring(key.length() - 3, key.length()) + " " - + key); - } + return stop; } - Log.i(TAG, "Number of entries " + data.length()); + public static Timetable getTimetable(Context context, String busStop, boolean keepUniLink, boolean keepNonUniLink) + throws SQLException, ClientProtocolException, IOException, JSONException { - Log.i(TAG, "Stops: " + data.getJSONArray("stops")); + if (helper == null) + helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + if (busRouteDao == null) + busRouteDao = helper.getBusRouteDao(); + if (busStopDao == null) + busStopDao = helper.getBusStopDao(); - for (int stopNum = 0; stopNum < stopsArray.length(); stopNum++) { - JSONObject stopObj = stopsArray.getJSONObject(stopNum); + Timetable timetable = new Timetable(); - if (!keepNonUniLink && !stopObj.getString("name").startsWith("U")) { - Log.v(TAG, "Skipping non uni-link stop " + stopObj.getString("name")); - continue; - } + String file = getFileFromServer(busStopUrl + busStop + ".json"); - if (!keepUniLink && stopObj.getString("name").startsWith("U")) { - Log.v(TAG, "Skipping uni-link stop " + stopObj.getString("name")); - continue; - } + JSONObject data = new JSONObject(file); + JSONArray stopsArray = data.getJSONArray("stops"); + JSONObject routesObject = data.getJSONObject("routes"); - BusStop busStopObj = busStopDao.queryForId(busStop); - if (busStopObj == null) { - Log.e(TAG, "BusStopObj == null"); - } + HashSet busRoutes = new HashSet(); + for (Iterator keyIter = routesObject.keys(); keyIter.hasNext();) { + String key = keyIter.next(); - Stop stop = getStop(context, stopObj, busRoutes, busStopObj); + Log.v(TAG, "Route Key: " + key); - if (stop == null) { - Log.w(TAG, "Null stop, skiping"); - continue; - } + BusRoute route = busRouteDao.queryForId(Integer.parseInt(key.substring(key.length() - 3, key.length()))); - Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id + " at " - + stop.arivalTime); + if (route != null) { + busRoutes.add(route); + } else { + throw new RuntimeException("Route not found " + key.substring(key.length() - 3, key.length()) + " " + + key); + } + } - timetable.add(stop); - } + Log.i(TAG, "Number of entries " + data.length()); - timetable.fetchTime = new Date(System.currentTimeMillis()); - return timetable; - } + Log.i(TAG, "Stops: " + data.getJSONArray("stops")); - public static Timetable getTimetable(Context context, Bus bus, BusStop startStop, int num) throws SQLException, - ClientProtocolException, IOException, JSONException { + for (int stopNum = 0; stopNum < stopsArray.length(); stopNum++) { + JSONObject stopObj = stopsArray.getJSONObject(stopNum); - if (helper == null) - helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - if (busRouteDao == null) - busRouteDao = helper.getBusRouteDao(); - if (busStopDao == null) - busStopDao = helper.getBusStopDao(); + if (!keepNonUniLink && !stopObj.getString("name").startsWith("U")) { + Log.v(TAG, "Skipping non uni-link stop " + stopObj.getString("name")); + continue; + } - Timetable timetable = new Timetable(); + if (!keepUniLink && stopObj.getString("name").startsWith("U")) { + Log.v(TAG, "Skipping uni-link stop " + stopObj.getString("name")); + continue; + } - List busStops = new ArrayList(num); - busStops.add(startStop); + BusStop busStopObj = busStopDao.queryForId(busStop); + if (busStopObj == null) { + Log.e(TAG, "BusStopObj == null"); + } + + Stop stop = getStop(context, stopObj, busRoutes, busStopObj); - BusRoute route = bus.route; + if (stop == null) { + Log.w(TAG, "Null stop, skiping"); + continue; + } - for (int i = 0; i < num; i++) { - BusStop nextStop = route.moveInRoute(context, busStops.get(i), bus.direction, 1); + Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id + " at " + + stop.arivalTime); - if (nextStop != null) { - busStops.add(nextStop); - } else { - Log.e(TAG, "nextStop is null"); - } + timetable.add(stop); + } + + timetable.fetchTime = new Date(System.currentTimeMillis()); + return timetable; } - for (BusStop busStop : busStops) { + public static Timetable getTimetable(Context context, Bus bus, BusStop startStop, int num) throws SQLException, + ClientProtocolException, IOException, JSONException { + + if (helper == null) + helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + if (busRouteDao == null) + busRouteDao = helper.getBusRouteDao(); + if (busStopDao == null) + busStopDao = helper.getBusStopDao(); + + Timetable timetable = new Timetable(); + + List busStops = new ArrayList(num); + busStops.add(startStop); + + BusRoute route = bus.route; - String file = getFileFromServer(busStopUrl + busStop.id + ".json"); + for (int i = 0; i < num; i++) { + BusStop nextStop = route.moveInRoute(context, busStops.get(i), bus.direction, 1); - JSONObject data = new JSONObject(file); - JSONArray stopsArray = data.getJSONArray("stops"); + if (nextStop != null) { + busStops.add(nextStop); + } else { + Log.e(TAG, "nextStop is null"); + } + } + + for (BusStop busStop : busStops) { - HashSet busRoutes = new HashSet(); - busRoutes.add(bus.route); + String file = getFileFromServer(busStopUrl + busStop.id + ".json"); - Log.v(TAG, "Number of entries " + data.length()); + JSONObject data = new JSONObject(file); + JSONArray stopsArray = data.getJSONArray("stops"); - Log.v(TAG, "Stops: " + data.getJSONArray("stops")); + HashSet busRoutes = new HashSet(); + busRoutes.add(bus.route); - for (int stopNum = 0; stopNum < stopsArray.length(); stopNum++) { - JSONObject stopObj = stopsArray.getJSONObject(stopNum); + Log.v(TAG, "Number of entries " + data.length()); - if (stopObj.getString("vehicle").equals(bus.id)) { + Log.v(TAG, "Stops: " + data.getJSONArray("stops")); - Stop stop = getStop(context, stopObj, busRoutes, busStop); + for (int stopNum = 0; stopNum < stopsArray.length(); stopNum++) { + JSONObject stopObj = stopsArray.getJSONObject(stopNum); - if (stop == null) { - Log.w(TAG, "Null stop, skiping"); - continue; - } + if (stopObj.getString("vehicle").equals(bus.id)) { - Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id - + " at " + stop.arivalTime); + Stop stop = getStop(context, stopObj, busRoutes, busStop); - timetable.add(stop); + if (stop == null) { + Log.w(TAG, "Null stop, skiping"); + continue; + } + Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id + + " at " + stop.arivalTime); + + timetable.add(stop); + + } + } } - } - } - timetable.fetchTime = new Date(System.currentTimeMillis()); + timetable.fetchTime = new Date(System.currentTimeMillis()); - return timetable; - } + return timetable; + } - public static Stop getStop(Context context, Bus bus, BusStop busStop) throws SQLException, ClientProtocolException, - IOException, JSONException { + public static Stop getStop(Context context, Bus bus, BusStop busStop) throws SQLException, ClientProtocolException, + IOException, JSONException { - if (helper == null) - helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - if (busRouteDao == null) - busRouteDao = helper.getBusRouteDao(); - if (busStopDao == null) - busStopDao = helper.getBusStopDao(); + if (helper == null) + helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + if (busRouteDao == null) + busRouteDao = helper.getBusRouteDao(); + if (busStopDao == null) + busStopDao = helper.getBusStopDao(); - String file = getFileFromServer(busStopUrl + busStop.id + ".json"); + String file = getFileFromServer(busStopUrl + busStop.id + ".json"); - JSONObject data = new JSONObject(file); - JSONArray stopsArray = data.getJSONArray("stops"); + JSONObject data = new JSONObject(file); + JSONArray stopsArray = data.getJSONArray("stops"); - HashSet busRoutes = new HashSet(); - busRouteDao.refresh(bus.route); - busRoutes.add(bus.route); + HashSet busRoutes = new HashSet(); + busRouteDao.refresh(bus.route); + busRoutes.add(bus.route); - Stop stop = null; + Stop stop = null; - // Log.v(TAG, "Number of entries " + data.length()); + // Log.v(TAG, "Number of entries " + data.length()); - // Log.v(TAG, "Stops: " + data.getJSONArray("stops")); + // Log.v(TAG, "Stops: " + data.getJSONArray("stops")); - for (int stopNum = 0; stopNum < stopsArray.length(); stopNum++) { - JSONObject stopObj = stopsArray.getJSONObject(stopNum); + for (int stopNum = 0; stopNum < stopsArray.length(); stopNum++) { + JSONObject stopObj = stopsArray.getJSONObject(stopNum); - // Log.v(TAG, "stopObj: " + stopObj); - if (stopObj.has("vehicle") && stopObj.getString("vehicle").equals(bus.id)) { + // Log.v(TAG, "stopObj: " + stopObj); + if (stopObj.has("vehicle") && stopObj.getString("vehicle").equals(bus.id)) { - stop = getStop(context, stopObj, busRoutes, busStop); - break; + stop = getStop(context, stopObj, busRoutes, busStop); + break; - // Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id + " at " - // + stop.arivalTime); - } + // Log.v(TAG, "Found stop for a unidentified " + + // stop.bus.toString() + " at " + stop.busStop.id + " at " + // + stop.arivalTime); + } + } + + return stop; } - return stop; - } + static PathOverlay getRoutePath(InputStream routeResource, int colour, ResourceProxy resProxy) { + PathOverlay data = null; - static PathOverlay getRoutePath(InputStream routeResource, int colour, ResourceProxy resProxy) { - PathOverlay data = null; + // sax stuff + try { + SAXParserFactory spf = SAXParserFactory.newInstance(); + SAXParser sp = spf.newSAXParser(); - // sax stuff - try { - SAXParserFactory spf = SAXParserFactory.newInstance(); - SAXParser sp = spf.newSAXParser(); + XMLReader xr = sp.getXMLReader(); - XMLReader xr = sp.getXMLReader(); + DataHandler dataHandler = new DataHandler(colour, resProxy); + xr.setContentHandler(dataHandler); - DataHandler dataHandler = new DataHandler(colour, resProxy); - xr.setContentHandler(dataHandler); + xr.parse(new InputSource(routeResource)); - xr.parse(new InputSource(routeResource)); + data = dataHandler.getData(); - data = dataHandler.getData(); + } catch (ParserConfigurationException pce) { + Log.e("SAX XML", "sax parse error", pce); + } catch (SAXException se) { + Log.e("SAX XML", "sax error", se); + } catch (IOException ioe) { + Log.e("SAX XML", "sax parse io error", ioe); + } - } catch (ParserConfigurationException pce) { - Log.e("SAX XML", "sax parse error", pce); - } catch (SAXException se) { - Log.e("SAX XML", "sax error", se); - } catch (IOException ioe) { - Log.e("SAX XML", "sax parse io error", ioe); + return data; } - return data; - } - - public static String getFileFromServer(String request) throws ClientProtocolException, IOException { - StringBuilder builder = new StringBuilder(); - HttpClient client = new DefaultHttpClient(); - HttpGet httpGet = new HttpGet(request); - Log.v("Util.getFileFromServer", "Request used: " + request); - - HttpResponse response = client.execute(httpGet); - StatusLine statusLine = response.getStatusLine(); - int statusCode = statusLine.getStatusCode(); - if (statusCode == 200) { - HttpEntity entity = response.getEntity(); - InputStream content = entity.getContent(); - BufferedReader reader = new BufferedReader(new InputStreamReader(content)); - String line; - while ((line = reader.readLine()) != null) { - builder.append(line); - } - } else { - Log.e("", "Failed to download file"); + public static String getFileFromServer(String request) throws ClientProtocolException, IOException { + StringBuilder builder = new StringBuilder(); + HttpClient client = new DefaultHttpClient(); + HttpGet httpGet = new HttpGet(request); + Log.v("Util.getFileFromServer", "Request used: " + request); + + HttpResponse response = client.execute(httpGet); + StatusLine statusLine = response.getStatusLine(); + int statusCode = statusLine.getStatusCode(); + if (statusCode == 200) { + HttpEntity entity = response.getEntity(); + InputStream content = entity.getContent(); + BufferedReader reader = new BufferedReader(new InputStreamReader(content)); + String line; + while ((line = reader.readLine()) != null) { + builder.append(line); + } + } else { + Log.e("", "Failed to download file"); + } + + return builder.toString(); } - return builder.toString(); - } - - public static void routeMovementTest(Context context) throws SQLException { - - Dao routeStopsDao = null; - - if (helper == null) - helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - if (routeStopsDao == null) - routeStopsDao = helper.getRouteStopsDao(); - if (busRouteDao == null) - busRouteDao = helper.getBusRouteDao(); - if (busStopDao == null) - busStopDao = helper.getBusStopDao(); - - for (BusRoute busRoute : busRouteDao) { - if (!busRoute.code.startsWith("U") || busRoute.code.equals("U9")) { - continue; - } - List routeStops = routeStopsDao.queryForEq(RouteStops.ROUTE_ID_FIELD_NAME, busRoute.id); - - ArrayList directions = new ArrayList(); - if (busRoute.forwardDirection != null) { - directions.add(busRoute.forwardDirection); - } - if (busRoute.reverseDirection != null) { - directions.add(busRoute.reverseDirection); - } - if (directions.size() == 0) { - directions.add(null); - } - - BusStop startBusStop = null; - - for (int moveAmount = 1; moveAmount >= -1; moveAmount = moveAmount - 2) { - for (String direction : directions) { - for (int busStop = 0; busStop < routeStops.size() && busStop >= 0; busStop = busStop + moveAmount) { - // if (routeStops.get(busStop).stop.equals(startBusStop)) - // continue; - startBusStop = routeStops.get(busStop).busStop; - busStopDao.refresh(startBusStop); - - BusStop predictedNextStop = busRoute.moveInRoute(context, startBusStop, direction, moveAmount); - - BusStop nextStop; - if (busStop == routeStops.size() - 1) { - nextStop = routeStops.get(0).busStop; - } else { - nextStop = routeStops.get(busStop + 1).busStop; + public static void routeMovementTest(Context context) throws SQLException { + + Dao routeStopsDao = null; + + if (helper == null) + helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); + if (routeStopsDao == null) + routeStopsDao = helper.getRouteStopsDao(); + if (busRouteDao == null) + busRouteDao = helper.getBusRouteDao(); + if (busStopDao == null) + busStopDao = helper.getBusStopDao(); + + for (BusRoute busRoute : busRouteDao) { + if (!busRoute.code.startsWith("U") || busRoute.code.equals("U9")) { + continue; } - busStopDao.refresh(nextStop); + List routeStops = routeStopsDao.queryForEq(RouteStops.ROUTE_ID_FIELD_NAME, busRoute.id); - if (!nextStop.equals(predictedNextStop) && !startBusStop.equals(nextStop)) { - Log.e(TAG, "predicted: " + predictedNextStop + " next: " + nextStop); - Log.e(TAG, startBusStop.id + " " + nextStop.id); - return; + ArrayList directions = new ArrayList(); + if (busRoute.forwardDirection != null) { + directions.add(busRoute.forwardDirection); + } + if (busRoute.reverseDirection != null) { + directions.add(busRoute.reverseDirection); + } + if (directions.size() == 0) { + directions.add(null); + } + + BusStop startBusStop = null; + + for (int moveAmount = 1; moveAmount >= -1; moveAmount = moveAmount - 2) { + for (String direction : directions) { + for (int busStop = 0; busStop < routeStops.size() && busStop >= 0; busStop = busStop + moveAmount) { + // if + // (routeStops.get(busStop).stop.equals(startBusStop)) + // continue; + startBusStop = routeStops.get(busStop).busStop; + busStopDao.refresh(startBusStop); + + BusStop predictedNextStop = busRoute.moveInRoute(context, startBusStop, direction, moveAmount); + + BusStop nextStop; + if (busStop == routeStops.size() - 1) { + nextStop = routeStops.get(0).busStop; + } else { + nextStop = routeStops.get(busStop + 1).busStop; + } + busStopDao.refresh(nextStop); + + if (!nextStop.equals(predictedNextStop) && !startBusStop.equals(nextStop)) { + Log.e(TAG, "predicted: " + predictedNextStop + " next: " + nextStop); + Log.e(TAG, startBusStop.id + " " + nextStop.id); + return; + } + } + } } - } } - } - } - } + } } diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index cad7567..ff61c4e 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -71,1243 +71,1272 @@ import com.j256.ormlite.dao.Dao; * */ public class MapActivity extends OrmLiteBaseActivity implements MapViewConstants, Runnable, - RouteColorConstants, OnItemClickListener, OnItemLongClickListener, OnSharedPreferenceChangeListener, - Preferences { + RouteColorConstants, OnItemClickListener, OnItemLongClickListener, OnSharedPreferenceChangeListener, + Preferences { - /** - * Enable to use the database in the assets folder, if its not enabled, the database is built from the csv files in - * the assets folder - */ - private boolean useBundledDatabase = true; - - private MapView mapView; - private MapController mapController; - private ResourceProxy mResourceProxy; - - private long startTime; - - static final int VIEW_DIALOG_ID = 0; - static final int FAVOURITE_DIALOG_ID = 1; - private POIDialog favDialog; - - private HashMap overlays = new HashMap(); - private HashMap pastOverlays; - - // Overlays - - // -- Building Overlays - static final String BUILDING_OVERLAYS = "buildingOverlays:"; - - // ---- Residential Building Overlay - private static final String RESIDENTIAL_BUILDING_OVERLAY = "residentialBuildingOverlay"; - private BuildingNumOverlay residentialBuildingOverlay; - static final boolean RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT = true; - private static final int RESIDENTIAL_BUILDING_OVERLAY_RANK = 6; - - // ---- Non-Residential Building Overlay - private static final String NON_RESIDENTIAL_BUILDING_OVERLAY = "nonResidentialBuildingOverlay"; - private BuildingNumOverlay nonResidentialBuildingOverlay; - static final boolean NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT = true; - private static final int NON_RESIDENTIAL_BUILDING_OVERLAY_RANK = 5; - - static final String[] BUILDING_TYPES = { RESIDENTIAL_BUILDING_OVERLAY, NON_RESIDENTIAL_BUILDING_OVERLAY }; - - // -- Bus Stop Overlays - static final String BUS_STOP_OVERLAYS = "busStopOverlays:"; - - // ---- Uni-Link Bus Stop Overlay - private static final String UNI_LINK_BUS_STOP_OVERLAY = "uniLinkBusStopOverlay"; - private BusStopOverlay uniLinkBusStopOverlay; - static final boolean UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT = true; - private static final int UNI_LINK_BUS_STOP_OVERLAY_RANK = 3; + /** + * Enable to use the database in the assets folder, if its not enabled, the + * database is built from the csv files in the assets folder + */ + private boolean useBundledDatabase = true; - // ---- Non Uni-Link Bus Stop Overlay - private BusStopOverlay nonUniLinkBusStopOverlay; - private static final int NON_UNI_LINK_BUS_STOP_OVERLAY_RANK = 4; + private MapView mapView; + private MapController mapController; + private ResourceProxy mResourceProxy; - // -- Site Overlays - static final String[] SITE_NAMES = { "Highfield Campus", "Boldrewood Campus", "Avenue Campus", - "Winchester School of Art", "The University of Southampton Science Park", - "National Oceanography Centre Campus", "Boat House", "Southampton General Hospital", - "Royal South Hants Hospital", "Belgrave Industrial Site", "Highfield Hall", "Glen Eyre Hall", - "South Hill Hall", "Chamberlain Hall", "Hartley Grove", "Bencraft Hall", "Connaught Hall", - "Montefiore Hall", "Stoneham Hall", "Erasmus Park" }; + private long startTime; - private static final String SITE_OVERLAYS = "siteOverlays:"; - private HashMap siteOverlays = new HashMap(21); - static final boolean SITE_OVERLAYS_ENABLED_BY_DEFAULT = false; - private static final int SITE_OVERLAYS_RANK = 8; + static final int VIEW_DIALOG_ID = 0; + static final int FAVOURITE_DIALOG_ID = 1; + private POIDialog favDialog; - // -- Route Overlays - private static final String BUS_ROUTE_OVERLAYS = "routeOverlays:"; - private HashMap busRouteOverlays = new HashMap(5); - static final boolean BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT = true; - private static final int BUS_ROUTE_OVERLAYS_RANK = 7; + private HashMap overlays = new HashMap(); + private HashMap pastOverlays; - // -- Other - static final String OTHER_OVERLAYS = "otherOverlay:"; + // Overlays - // ---- Scale Bar Overlay - private static final String SCALE_BAR_OVERLAY = "scaleBarOverlay"; - private ScaleBarOverlay scaleBarOverlay; - static final boolean SCALE_BAR_OVERLAY_ENABLED_BY_DEFAULT = true; - private static final int SCALE_BAR_OVERLAY_RANK = 1; + // -- Building Overlays + static final String BUILDING_OVERLAYS = "buildingOverlays:"; - // ---- My Location Overlay - private static final String MY_LOCATION_OVERLAY = "myLocationOverlay"; - private static final String MY_LOCATION_OVERLAY_COMPASS = "myLocationOverlayCompass"; - private MyLocationOverlay myLocationOverlay; - static final boolean MY_LOCATION_OVERLAY_ENABLED_BY_DEFAULT = true; - static final boolean MY_LOCATION_OVERLAY_COMPASS_ENABLED_BY_DEFAULT = true; - private static final int MY_LOCATION_OVERLAY_RANK = 2; + // ---- Residential Building Overlay + private static final String RESIDENTIAL_BUILDING_OVERLAY = "residentialBuildingOverlay"; + private BuildingNumOverlay residentialBuildingOverlay; + static final boolean RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT = true; + private static final int RESIDENTIAL_BUILDING_OVERLAY_RANK = 6; - static final String[] OTHER_OVERLAY_NAMES = { SCALE_BAR_OVERLAY, MY_LOCATION_OVERLAY, MY_LOCATION_OVERLAY_COMPASS }; + // ---- Non-Residential Building Overlay + private static final String NON_RESIDENTIAL_BUILDING_OVERLAY = "nonResidentialBuildingOverlay"; + private BuildingNumOverlay nonResidentialBuildingOverlay; + static final boolean NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT = true; + private static final int NON_RESIDENTIAL_BUILDING_OVERLAY_RANK = 5; - // Other bits + static final String[] BUILDING_TYPES = { RESIDENTIAL_BUILDING_OVERLAY, NON_RESIDENTIAL_BUILDING_OVERLAY }; - // Uni-Link routes - static final String[] UNI_LINK_ROUTES = { "U1", "U1N", "U2", "U6", "U9" }; + // -- Bus Stop Overlays + static final String BUS_STOP_OVERLAYS = "busStopOverlays:"; - static final String[] PREFERENCES_GROUPS = { BUS_STOP_OVERLAYS, BUS_ROUTE_OVERLAYS, BUILDING_OVERLAYS, - SITE_OVERLAYS, OTHER_OVERLAYS }; + // ---- Uni-Link Bus Stop Overlay + private static final String UNI_LINK_BUS_STOP_OVERLAY = "uniLinkBusStopOverlay"; + private BusStopOverlay uniLinkBusStopOverlay; + static final boolean UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT = true; + private static final int UNI_LINK_BUS_STOP_OVERLAY_RANK = 3; - static final String[][] PREFERENCES_CHILDREN = { UNI_LINK_ROUTES, UNI_LINK_ROUTES, BUILDING_TYPES, SITE_NAMES, - OTHER_OVERLAY_NAMES }; + // ---- Non Uni-Link Bus Stop Overlay + private BusStopOverlay nonUniLinkBusStopOverlay; + private static final int NON_UNI_LINK_BUS_STOP_OVERLAY_RANK = 4; - /** - * The toast for this activity, storing the toast centrally allows it to be changed quickly, instead of a queue - * building up - */ - Toast activityToast; + // -- Site Overlays + static final String[] SITE_NAMES = { "Highfield Campus", "Boldrewood Campus", "Avenue Campus", + "Winchester School of Art", "The University of Southampton Science Park", + "National Oceanography Centre Campus", "Boat House", "Southampton General Hospital", + "Royal South Hants Hospital", "Belgrave Industrial Site", "Highfield Hall", "Glen Eyre Hall", + "South Hill Hall", "Chamberlain Hall", "Hartley Grove", "Bencraft Hall", "Connaught Hall", + "Montefiore Hall", "Stoneham Hall", "Erasmus Park" }; - private MapActivity instance; + private static final String SITE_OVERLAYS = "siteOverlays:"; + private HashMap siteOverlays = new HashMap(21); + static final boolean SITE_OVERLAYS_ENABLED_BY_DEFAULT = false; + private static final int SITE_OVERLAYS_RANK = 8; - private static final String TAG = "SUM"; + // -- Route Overlays + private static final String BUS_ROUTE_OVERLAYS = "routeOverlays:"; + private HashMap busRouteOverlays = new HashMap(5); + static final boolean BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT = true; + private static final int BUS_ROUTE_OVERLAYS_RANK = 7; - @SuppressWarnings("unchecked") - public void onCreate(Bundle savedInstanceState) { - startTime = System.currentTimeMillis(); + // -- Other + static final String OTHER_OVERLAYS = "otherOverlay:"; - super.onCreate(savedInstanceState); + // ---- Scale Bar Overlay + private static final String SCALE_BAR_OVERLAY = "scaleBarOverlay"; + private ScaleBarOverlay scaleBarOverlay; + static final boolean SCALE_BAR_OVERLAY_ENABLED_BY_DEFAULT = true; + private static final int SCALE_BAR_OVERLAY_RANK = 1; - instance = this; + // ---- My Location Overlay + private static final String MY_LOCATION_OVERLAY = "myLocationOverlay"; + private static final String MY_LOCATION_OVERLAY_COMPASS = "myLocationOverlayCompass"; + private MyLocationOverlay myLocationOverlay; + static final boolean MY_LOCATION_OVERLAY_ENABLED_BY_DEFAULT = true; + static final boolean MY_LOCATION_OVERLAY_COMPASS_ENABLED_BY_DEFAULT = true; + private static final int MY_LOCATION_OVERLAY_RANK = 2; - Thread databaseThread = new Thread(this); // Start the database thread - databaseThread.start(); + static final String[] OTHER_OVERLAY_NAMES = { SCALE_BAR_OVERLAY, MY_LOCATION_OVERLAY, MY_LOCATION_OVERLAY_COMPASS }; - setContentView(R.layout.main); + // Other bits - Log.i(TAG, "Finished setting content view " + (System.currentTimeMillis() - startTime)); + // Uni-Link routes + static final String[] UNI_LINK_ROUTES = { "U1", "U1N", "U2", "U6", "U9" }; - mapView = (MapView) this.findViewById(R.id.mapview); - mapView.setTileSource(TileSourceFactory.MAPQUESTOSM); - mapView.setBuiltInZoomControls(true); - mapView.setMultiTouchControls(true); + static final String[] PREFERENCES_GROUPS = { BUS_STOP_OVERLAYS, BUS_ROUTE_OVERLAYS, BUILDING_OVERLAYS, + SITE_OVERLAYS, OTHER_OVERLAYS }; - pastOverlays = (HashMap) getLastNonConfigurationInstance(); + static final String[][] PREFERENCES_CHILDREN = { UNI_LINK_ROUTES, UNI_LINK_ROUTES, BUILDING_TYPES, SITE_NAMES, + OTHER_OVERLAY_NAMES }; - /* - * SensorManager mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); This code in the - * following constructor causes problems in some emulators, disable sensors to fix. + /** + * The toast for this activity, storing the toast centrally allows it to be + * changed quickly, instead of a queue building up */ - Log.i(TAG, "Starting creating myLocationOverlay"); - myLocationOverlay = new MyLocationOverlay(instance, mapView); - Log.i(TAG, "Finished creating myLocationOverlay"); + Toast activityToast; - while (databaseThread.isAlive()) { - Thread.yield(); - } + private MapActivity instance; - new Thread(new Runnable() { - public void run() { - Thread.currentThread().setPriority(Thread.MAX_PRIORITY); - try { - showOverlays(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - }).start(); - - Log.i(TAG, "Started loading thread " + (System.currentTimeMillis() - startTime)); - - mapController = mapView.getController(); - mResourceProxy = new DefaultResourceProxyImpl(getApplicationContext()); - - GeoPoint userLocation = null; + private static final String TAG = "SUM"; - Bundle extras = getIntent().getExtras(); - if (extras != null && extras.containsKey("poiPoint")) { - String poiPoint = getIntent().getExtras().getString("poiPoint"); - Log.i(TAG, "poiPoint " + poiPoint); + @SuppressWarnings("unchecked") + public void onCreate(Bundle savedInstanceState) { + startTime = System.currentTimeMillis(); - String[] bits = poiPoint.split(","); - - userLocation = new GeoPoint(Double.valueOf(bits[0]), Double.valueOf(bits[1])); - mapController.setZoom(20); - - } else { - userLocation = myLocationOverlay.getMyLocation(); - if (userLocation == null) { - userLocation = new GeoPoint(50935551, -1393488); // ECS - } - mapController.setZoom(15); - } + super.onCreate(savedInstanceState); - mapController.setCenter(userLocation); - - Log.i(TAG, "Finished onCreate " + (System.currentTimeMillis() - startTime)); - } - - public void onResume() { - super.onResume(); - Log.i(TAG, "OnResume"); - if (myLocationOverlay != null) { - final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); - final SharedPreferences activityPrefs = getPreferences(0); - - if (activityPrefs.getBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY_COMPASS, false)) { - myLocationOverlay.enableCompass(); - } else { - myLocationOverlay.disableCompass(); - } - - if (activityPrefs.getBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY, false) - && sharedPrefs.getBoolean(GPS_ENABLED, false)) { - myLocationOverlay.enableMyLocation(); - } else { - myLocationOverlay.disableMyLocation(); - } - - sharedPrefs.registerOnSharedPreferenceChangeListener(this); - activityPrefs.registerOnSharedPreferenceChangeListener(this); - } - } - - public void onPause() { - super.onResume(); - Log.i(TAG, "OnPause"); - if (myLocationOverlay != null) { - myLocationOverlay.disableMyLocation(); - myLocationOverlay.disableCompass(); - } - } + instance = this; - public void finish() { - super.finish(); - } + Thread databaseThread = new Thread(this); // Start the database thread + databaseThread.start(); - @Override - public Object onRetainNonConfigurationInstance() { - return overlays; - } + setContentView(R.layout.main); - public void run() { - Log.i(TAG, "Begining loading database " + (System.currentTimeMillis() - startTime)); + Log.i(TAG, "Finished setting content view " + (System.currentTimeMillis() - startTime)); - DatabaseHelper helper = getHelper(); - Log.i(TAG, "Got the helper at " + (System.currentTimeMillis() - startTime)); + mapView = (MapView) this.findViewById(R.id.mapview); + mapView.setTileSource(TileSourceFactory.MAPQUESTOSM); + mapView.setBuiltInZoomControls(true); + mapView.setMultiTouchControls(true); - boolean dbExist = helper.checkDataBase(); - Log.i(TAG, "Finished checking the database at " + (System.currentTimeMillis() - startTime)); + pastOverlays = (HashMap) getLastNonConfigurationInstance(); - if (dbExist) { - // do nothing - database already exist - } else { + /* + * SensorManager mSensorManager = (SensorManager) + * getSystemService(Context.SENSOR_SERVICE); This code in the following + * constructor causes problems in some emulators, disable sensors to + * fix. + */ + Log.i(TAG, "Starting creating myLocationOverlay"); + myLocationOverlay = new MyLocationOverlay(instance, mapView); + Log.i(TAG, "Finished creating myLocationOverlay"); - if (useBundledDatabase) { - try { - // By calling this method and empty database will be created into the default system path - // of your application so we are gonna be able to overwrite that database with our database. - Log.i(TAG, "GetReadableDatabase"); - helper.getWritableDatabase().close(); - - helper.copyDataBase(); - Log.i(TAG, "Out of copy database"); - } catch (IOException ioe) { - throw new Error("Unable to create database"); + while (databaseThread.isAlive()) { + Thread.yield(); } - } else { - Thread buildingThread = null; - Thread busStopThread = null; - Thread siteThread = null; - - Log.i(TAG, "Begining loading databases " + (System.currentTimeMillis() - startTime)); - try { - Dao buildingDao; - - buildingDao = helper.getBuildingDao(); - long buildingCount = buildingDao.countOf(); - Log.i(TAG, "Building count " + buildingCount); - if (buildingCount < 260) { - buildingThread = new Thread(new Runnable() { - public void run() { + new Thread(new Runnable() { + public void run() { + Thread.currentThread().setPriority(Thread.MAX_PRIORITY); try { - DataManager.loadBuildings(instance); - Log.i(TAG, "Loaded building database " + (System.currentTimeMillis() - startTime)); + showOverlays(); } catch (SQLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); + e.printStackTrace(); } - } - }); - - buildingThread.start(); - } - - Dao busStopDao = helper.getBusStopDao(); - Dao busRouteDao = helper.getBusRouteDao(); - Dao routeStopsDao = helper.getRouteStopsDao(); - - long busStopCount = busStopDao.countOf(); - long busRouteCount = busRouteDao.countOf(); - long routeStopsCount = routeStopsDao.countOf(); - - Log.i(TAG, "BusStop count " + busStopCount); - Log.i(TAG, "BusRoute count " + busRouteCount); - Log.i(TAG, "RouteStops count " + routeStopsCount); - if (busStopCount < 217 || busRouteCount < 5 || routeStopsCount < 327) { - busStopThread = new Thread(new Runnable() { - public void run() { - try { - DataManager.loadBusData(instance, true); - Log.i(TAG, "Loaded bus stop database " + (System.currentTimeMillis() - startTime)); - } catch (SQLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - }); - - busStopThread.start(); - } + } + }).start(); - Dao siteDao = helper.getSiteDao(); + Log.i(TAG, "Started loading thread " + (System.currentTimeMillis() - startTime)); - long siteCount = siteDao.countOf(); - Log.i(TAG, "Sites count " + siteCount); - if (siteCount < 21) { - siteThread = new Thread(new Runnable() { - public void run() { - try { - DataManager.loadSiteData(instance); - Log.i(TAG, "Loaded site database " + (System.currentTimeMillis() - startTime)); - } catch (SQLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - }); + mapController = mapView.getController(); + mResourceProxy = new DefaultResourceProxyImpl(getApplicationContext()); - siteThread.start(); - } + GeoPoint userLocation = null; - while (true) { - if ((buildingThread == null || !buildingThread.isAlive()) - && (busStopThread == null || !busStopThread.isAlive()) - && (siteThread == null || !siteThread.isAlive())) - break; + Bundle extras = getIntent().getExtras(); + if (extras != null && extras.containsKey("poiPoint")) { + String poiPoint = getIntent().getExtras().getString("poiPoint"); + Log.i(TAG, "poiPoint " + poiPoint); - Thread.yield(); - } + String[] bits = poiPoint.split(","); - Log.i(TAG, "Finished loading databases " + (System.currentTimeMillis() - startTime)); + userLocation = new GeoPoint(Double.valueOf(bits[0]), Double.valueOf(bits[1])); + mapController.setZoom(20); - } catch (SQLException e1) { - e1.printStackTrace(); + } else { + userLocation = myLocationOverlay.getMyLocation(); + if (userLocation == null) { + userLocation = new GeoPoint(50935551, -1393488); // ECS + } + mapController.setZoom(15); } - } - - } - Log.i(TAG, "Begining setting up the static values " + (System.currentTimeMillis() - startTime)); + mapController.setCenter(userLocation); - Log.i(TAG, "Finished the database thread " + (System.currentTimeMillis() - startTime)); - } + Log.i(TAG, "Finished onCreate " + (System.currentTimeMillis() - startTime)); - private void showOverlays() throws SQLException { - Log.i(TAG, "Began showing overlays at " + (System.currentTimeMillis() - startTime)); - - if (pastOverlays != null) { - Log.i(TAG, "Able to recover some/all of the overlays from a previous activity"); - } else { - Log.i(TAG, "Unable to recover overlays"); + new Thread() { + public void run() { + DataManager.loadBuildingPhotos(instance); + } + }.start(); } - final SharedPreferences activityPrefs = getPreferences(0); + public void onResume() { + super.onResume(); + Log.i(TAG, "OnResume"); + if (myLocationOverlay != null) { + final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + final SharedPreferences activityPrefs = getPreferences(0); - showUtilityOverlays(); + if (activityPrefs.getBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY_COMPASS, false)) { + myLocationOverlay.enableCompass(); + } else { + myLocationOverlay.disableCompass(); + } - showUniLinkBusStopOverlay(); + if (activityPrefs.getBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY, false) + && sharedPrefs.getBoolean(GPS_ENABLED, false)) { + myLocationOverlay.enableMyLocation(); + } else { + myLocationOverlay.disableMyLocation(); + } - showNonUniLinkBusStopOverlay(); + sharedPrefs.registerOnSharedPreferenceChangeListener(this); + activityPrefs.registerOnSharedPreferenceChangeListener(this); + } + } - if (activityPrefs.getBoolean(BUILDING_OVERLAYS + RESIDENTIAL_BUILDING_OVERLAY, - RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUILDING_OVERLAYS + NON_RESIDENTIAL_BUILDING_OVERLAY, - NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)) { - showBuildingOverlays(); + public void onPause() { + super.onResume(); + Log.i(TAG, "OnPause"); + if (myLocationOverlay != null) { + myLocationOverlay.disableMyLocation(); + myLocationOverlay.disableCompass(); + } } - Log.i(TAG, "Begining to show the route overlays at " + (System.currentTimeMillis() - startTime)); - for (BusRoute busRoute : getHelper().getBusRouteDao()) { - if (!busRoute.uniLink) { - Log.v(TAG, "Bus route " + busRoute.code + "(" + busRoute.id + ") is not unilink"); - continue; - } - Log.v(TAG, "Looking at showing " + busRoute.code + " route overlay"); - if (activityPrefs.getBoolean(BUS_ROUTE_OVERLAYS + busRoute.code, BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)) { - showRouteOverlay(busRoute); - } + public void finish() { + super.finish(); } - Log.i(TAG, "Finished loading routes " + (System.currentTimeMillis() - startTime)); - - Log.i(TAG, "Begining to show the site overlays at " + (System.currentTimeMillis() - startTime)); - try { - for (Site site : getHelper().getSiteDao()) { - Log.v(TAG, "Looking at showing " + site.name + " site overlay"); - if (activityPrefs.getBoolean(SITE_OVERLAYS + site.name, SITE_OVERLAYS_ENABLED_BY_DEFAULT)) { - showSiteOverlay(site); - } - } - } catch (SQLException e) { - e.printStackTrace(); + + @Override + public Object onRetainNonConfigurationInstance() { + return overlays; } - Log.i(TAG, "Finished showing the site overlays " + (System.currentTimeMillis() - startTime)); - Log.i(TAG, "Finished showing all the overlays " + (System.currentTimeMillis() - startTime)); - } + public void run() { + Log.i(TAG, "Begining loading database " + (System.currentTimeMillis() - startTime)); - private void showUtilityOverlays() { - new Thread(new Runnable() { - public void run() { - Log.i(TAG, "Begining showing the utility overlays " + (System.currentTimeMillis() - startTime)); + DatabaseHelper helper = getHelper(); + Log.i(TAG, "Got the helper at " + (System.currentTimeMillis() - startTime)); - final SharedPreferences activityPrefs = getPreferences(0); - final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); + boolean dbExist = helper.checkDataBase(); + Log.i(TAG, "Finished checking the database at " + (System.currentTimeMillis() - startTime)); - if (scaleBarOverlay != null) { - Log.v(TAG, "ScaleBarOverlay is already created"); + if (dbExist) { + // do nothing - database already exist } else { - if (pastOverlays != null - && (scaleBarOverlay = (ScaleBarOverlay) pastOverlays.get(SCALE_BAR_OVERLAY)) != null) { - Log.i(TAG, "Finished restoring utility overlays " + (System.currentTimeMillis() - startTime)); - } else { - scaleBarOverlay = new ScaleBarOverlay(instance); - } - overlays.put(SCALE_BAR_OVERLAY, scaleBarOverlay); + if (useBundledDatabase) { + try { + // By calling this method and empty database will be created + // into the default system path + // of your application so we are gonna be able to overwrite + // that database with our database. + Log.i(TAG, "GetReadableDatabase"); + helper.getWritableDatabase().close(); + + helper.copyDataBase(); + Log.i(TAG, "Out of copy database"); + } catch (IOException ioe) { + throw new Error("Unable to create database"); + } + } else { + Thread buildingThread = null; + Thread busStopThread = null; + Thread siteThread = null; - synchronized (mapView.getOverlays()) { - mapView.getOverlays().add(scaleBarOverlay); - mapView.getOverlays().add(myLocationOverlay); - Collections.sort(mapView.getOverlays(), comparator); - } + Log.i(TAG, "Begining loading databases " + (System.currentTimeMillis() - startTime)); + try { + Dao buildingDao; + + buildingDao = helper.getBuildingDao(); + + long buildingCount = buildingDao.countOf(); + Log.i(TAG, "Building count " + buildingCount); + if (buildingCount < 260) { + buildingThread = new Thread(new Runnable() { + public void run() { + try { + DataManager.loadBuildings(instance); + Log.i(TAG, "Loaded building database " + (System.currentTimeMillis() - startTime)); + } catch (SQLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + }); + + buildingThread.start(); + } + + Dao busStopDao = helper.getBusStopDao(); + Dao busRouteDao = helper.getBusRouteDao(); + Dao routeStopsDao = helper.getRouteStopsDao(); + + long busStopCount = busStopDao.countOf(); + long busRouteCount = busRouteDao.countOf(); + long routeStopsCount = routeStopsDao.countOf(); + + Log.i(TAG, "BusStop count " + busStopCount); + Log.i(TAG, "BusRoute count " + busRouteCount); + Log.i(TAG, "RouteStops count " + routeStopsCount); + if (busStopCount < 217 || busRouteCount < 5 || routeStopsCount < 327) { + busStopThread = new Thread(new Runnable() { + public void run() { + try { + DataManager.loadBusData(instance, true); + Log.i(TAG, "Loaded bus stop database " + (System.currentTimeMillis() - startTime)); + } catch (SQLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + }); + + busStopThread.start(); + } + + Dao siteDao = helper.getSiteDao(); + + long siteCount = siteDao.countOf(); + Log.i(TAG, "Sites count " + siteCount); + if (siteCount < 21) { + siteThread = new Thread(new Runnable() { + public void run() { + try { + DataManager.loadSiteData(instance); + Log.i(TAG, "Loaded site database " + (System.currentTimeMillis() - startTime)); + } catch (SQLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + }); + + siteThread.start(); + } + + while (true) { + if ((buildingThread == null || !buildingThread.isAlive()) + && (busStopThread == null || !busStopThread.isAlive()) + && (siteThread == null || !siteThread.isAlive())) + break; + + Thread.yield(); + } + + Log.i(TAG, "Finished loading databases " + (System.currentTimeMillis() - startTime)); + + } catch (SQLException e1) { + e1.printStackTrace(); + } + } } - scaleBarOverlay.setEnabled(activityPrefs.getBoolean(OTHER_OVERLAYS + SCALE_BAR_OVERLAY, - SCALE_BAR_OVERLAY_ENABLED_BY_DEFAULT)); - - mapView.postInvalidate(); - - Log.i(TAG, "Finished showing utility overlays " + (System.currentTimeMillis() - startTime)); - } - }).start(); - } + Log.i(TAG, "Begining setting up the static values " + (System.currentTimeMillis() - startTime)); - private void showRouteOverlay(final BusRoute route) { - new Thread(new Runnable() { - public void run() { - Log.i(TAG, "Begining showing route " + route.code + " overlay at " - + (System.currentTimeMillis() - startTime)); + Log.i(TAG, "Finished the database thread " + (System.currentTimeMillis() - startTime)); + } - final SharedPreferences activityPrefs = getPreferences(0); - final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); + private void showOverlays() throws SQLException { + Log.i(TAG, "Began showing overlays at " + (System.currentTimeMillis() - startTime)); - PathOverlay routeOverlay; - if ((routeOverlay = busRouteOverlays.get(route)) != null) { - Log.v(TAG, route.code + " route overlay already existed"); + if (pastOverlays != null) { + Log.i(TAG, "Able to recover some/all of the overlays from a previous activity"); } else { - if (pastOverlays != null - && (routeOverlay = (PathOverlay) pastOverlays.get(BUS_ROUTE_OVERLAYS + route.code)) != null) { - Log.v(TAG, "Restored " + route.code + " route overlay"); - if (route.code.equals("U1")) { - PathOverlay routeOverlayU1E = (PathOverlay) pastOverlays.get(BUS_ROUTE_OVERLAYS + "U1E"); - overlays.put(BUS_ROUTE_OVERLAYS + "U1E", routeOverlayU1E); - } - } else { - InputStream resource = null; - int colour = 0; - if (route.code.equals("U1")) { - resource = getResources().openRawResource(R.raw.u1); - colour = U1; - - // TODO Is this a route like U1N or, something else, this hack works somewhat for now? - PathOverlay routeOverlayU1E = DataManager.getRoutePath( - getResources().openRawResource(R.raw.u1e), colour, mResourceProxy); - routeOverlayU1E.getPaint().setAntiAlias(true); - routeOverlayU1E.getPaint().setAlpha(145); - routeOverlayU1E.getPaint().setStrokeWidth(12); - routeOverlayU1E.getPaint().setPathEffect(new DashPathEffect(new float[] { 20, 16 }, 0)); - routeOverlayU1E.setEnabled(activityPrefs.getBoolean("Bus Routes:" + route.code, true)); - - busRouteOverlays.put(new BusRoute(1000, "U1E", "U1E Route Label", true), routeOverlayU1E); - overlays.put(BUS_ROUTE_OVERLAYS + route.code + "E", routeOverlayU1E); - } else if (route.code.equals("U1N")) { - resource = getResources().openRawResource(R.raw.u1n); - colour = U1N; - } else if (route.code.equals("U2")) { - resource = getResources().openRawResource(R.raw.u2); - colour = U2; - } else if (route.code.equals("U6")) { - resource = getResources().openRawResource(R.raw.u6); - colour = U6; - } else if (route.code.equals("U9")) { - resource = getResources().openRawResource(R.raw.u9); - colour = U9; - } else { - Log.w(TAG, "Wierd route " + route); - } + Log.i(TAG, "Unable to recover overlays"); + } - routeOverlay = DataManager.getRoutePath(resource, colour, mResourceProxy); + final SharedPreferences activityPrefs = getPreferences(0); - Log.v(TAG, "Path overlay has " + routeOverlay.getNumberOfPoints() + " points"); + showUtilityOverlays(); - routeOverlay.getPaint().setAntiAlias(true); - routeOverlay.getPaint().setAlpha(145); - routeOverlay.getPaint().setStrokeWidth(12); - } + showUniLinkBusStopOverlay(); - busRouteOverlays.put(route, routeOverlay); - overlays.put(BUS_ROUTE_OVERLAYS + route.code, routeOverlay); + showNonUniLinkBusStopOverlay(); - synchronized (mapView.getOverlays()) { - mapView.getOverlays().add(routeOverlay); - Collections.sort(mapView.getOverlays(), comparator); - } + if (activityPrefs.getBoolean(BUILDING_OVERLAYS + RESIDENTIAL_BUILDING_OVERLAY, + RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUILDING_OVERLAYS + NON_RESIDENTIAL_BUILDING_OVERLAY, + NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)) { + showBuildingOverlays(); + } + Log.i(TAG, "Begining to show the route overlays at " + (System.currentTimeMillis() - startTime)); + for (BusRoute busRoute : getHelper().getBusRouteDao()) { + if (!busRoute.uniLink) { + Log.v(TAG, "Bus route " + busRoute.code + "(" + busRoute.id + ") is not unilink"); + continue; + } + Log.v(TAG, "Looking at showing " + busRoute.code + " route overlay"); + if (activityPrefs.getBoolean(BUS_ROUTE_OVERLAYS + busRoute.code, BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)) { + showRouteOverlay(busRoute); + } } + Log.i(TAG, "Finished loading routes " + (System.currentTimeMillis() - startTime)); - routeOverlay.setEnabled(activityPrefs.getBoolean(BUS_ROUTE_OVERLAYS + route.code, - BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)); - if (route.code.equals("U1")) { - overlays.get(BUS_ROUTE_OVERLAYS + "U1E").setEnabled( - activityPrefs.getBoolean(BUS_ROUTE_OVERLAYS + "U1", BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)); + Log.i(TAG, "Begining to show the site overlays at " + (System.currentTimeMillis() - startTime)); + try { + for (Site site : getHelper().getSiteDao()) { + Log.v(TAG, "Looking at showing " + site.name + " site overlay"); + if (activityPrefs.getBoolean(SITE_OVERLAYS + site.name, SITE_OVERLAYS_ENABLED_BY_DEFAULT)) { + showSiteOverlay(site); + } + } + } catch (SQLException e) { + e.printStackTrace(); } + Log.i(TAG, "Finished showing the site overlays " + (System.currentTimeMillis() - startTime)); - mapView.postInvalidate(); + Log.i(TAG, "Finished showing all the overlays " + (System.currentTimeMillis() - startTime)); + } - Log.i(TAG, "Finished showing route " + route.code + " overlay at " - + (System.currentTimeMillis() - startTime)); - } - }).start(); - } + private void showUtilityOverlays() { + new Thread(new Runnable() { + public void run() { + Log.i(TAG, "Begining showing the utility overlays " + (System.currentTimeMillis() - startTime)); - private void showSiteOverlay(final Site site) { + final SharedPreferences activityPrefs = getPreferences(0); + final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); - new Thread(new Runnable() { - public void run() { - Log.i(TAG, "Begining showing site " + site.name + " overlay at " - + (System.currentTimeMillis() - startTime)); + if (scaleBarOverlay != null) { + Log.v(TAG, "ScaleBarOverlay is already created"); + } else { + if (pastOverlays != null + && (scaleBarOverlay = (ScaleBarOverlay) pastOverlays.get(SCALE_BAR_OVERLAY)) != null) { + Log.i(TAG, "Finished restoring utility overlays " + (System.currentTimeMillis() - startTime)); + } else { + scaleBarOverlay = new ScaleBarOverlay(instance); + } - final SharedPreferences activityPrefs = getPreferences(0); - final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); + overlays.put(SCALE_BAR_OVERLAY, scaleBarOverlay); - PathOverlay siteOverlay; - if ((siteOverlay = siteOverlays.get(site)) != null) { + synchronized (mapView.getOverlays()) { + mapView.getOverlays().add(scaleBarOverlay); + mapView.getOverlays().add(myLocationOverlay); + Collections.sort(mapView.getOverlays(), comparator); + } - } else { - if (pastOverlays != null - && (siteOverlay = (PathOverlay) pastOverlays.get(SITE_OVERLAYS + site.name)) != null) { - Log.i(TAG, "Restored " + site.name + " site overlay"); - } else { - - siteOverlay = new PathOverlay(Color.BLUE, instance); - Paint paint = siteOverlay.getPaint(); - paint.setAntiAlias(true); - paint.setStrokeWidth(1.5f); - for (int i = 0; i < site.outline.points.length; i++) { - siteOverlay.addPoint(site.outline.points[i]); - } - siteOverlay.addPoint(site.outline.points[0]); - - } + } - siteOverlays.put(site, siteOverlay); - overlays.put(SITE_OVERLAYS + site.name, siteOverlay); + scaleBarOverlay.setEnabled(activityPrefs.getBoolean(OTHER_OVERLAYS + SCALE_BAR_OVERLAY, + SCALE_BAR_OVERLAY_ENABLED_BY_DEFAULT)); - Log.v(TAG, "Applyed the site overlay, now sorting them"); + mapView.postInvalidate(); - synchronized (mapView.getOverlays()) { - mapView.getOverlays().add(siteOverlay); - Collections.sort(mapView.getOverlays(), comparator); - } - } + Log.i(TAG, "Finished showing utility overlays " + (System.currentTimeMillis() - startTime)); + } + }).start(); + } - siteOverlay.setEnabled(activityPrefs.getBoolean(SITE_OVERLAYS + site.name, - SITE_OVERLAYS_ENABLED_BY_DEFAULT)); + private void showRouteOverlay(final BusRoute route) { + new Thread(new Runnable() { + public void run() { + Log.i(TAG, "Begining showing route " + route.code + " overlay at " + + (System.currentTimeMillis() - startTime)); - mapView.postInvalidate(); + final SharedPreferences activityPrefs = getPreferences(0); + final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); - Log.i(TAG, "Finished showing site " + site.name + " overlay at " - + (System.currentTimeMillis() - startTime)); - } - }).start(); - } + PathOverlay routeOverlay; + if ((routeOverlay = busRouteOverlays.get(route)) != null) { + Log.v(TAG, route.code + " route overlay already existed"); + } else { + if (pastOverlays != null + && (routeOverlay = (PathOverlay) pastOverlays.get(BUS_ROUTE_OVERLAYS + route.code)) != null) { + Log.v(TAG, "Restored " + route.code + " route overlay"); + if (route.code.equals("U1")) { + PathOverlay routeOverlayU1E = (PathOverlay) pastOverlays.get(BUS_ROUTE_OVERLAYS + "U1E"); + overlays.put(BUS_ROUTE_OVERLAYS + "U1E", routeOverlayU1E); + } + } else { + InputStream resource = null; + int colour = 0; + if (route.code.equals("U1")) { + resource = getResources().openRawResource(R.raw.u1); + colour = U1; + + // TODO Is this a route like U1N or, something else, + // this hack works somewhat for now? + PathOverlay routeOverlayU1E = DataManager.getRoutePath( + getResources().openRawResource(R.raw.u1e), colour, mResourceProxy); + routeOverlayU1E.getPaint().setAntiAlias(true); + routeOverlayU1E.getPaint().setAlpha(145); + routeOverlayU1E.getPaint().setStrokeWidth(12); + routeOverlayU1E.getPaint().setPathEffect(new DashPathEffect(new float[] { 20, 16 }, 0)); + routeOverlayU1E.setEnabled(activityPrefs.getBoolean("Bus Routes:" + route.code, true)); + + busRouteOverlays.put(new BusRoute(1000, "U1E", "U1E Route Label", true), routeOverlayU1E); + overlays.put(BUS_ROUTE_OVERLAYS + route.code + "E", routeOverlayU1E); + } else if (route.code.equals("U1N")) { + resource = getResources().openRawResource(R.raw.u1n); + colour = U1N; + } else if (route.code.equals("U2")) { + resource = getResources().openRawResource(R.raw.u2); + colour = U2; + } else if (route.code.equals("U6")) { + resource = getResources().openRawResource(R.raw.u6); + colour = U6; + } else if (route.code.equals("U9")) { + resource = getResources().openRawResource(R.raw.u9); + colour = U9; + } else { + Log.w(TAG, "Wierd route " + route); + } + + routeOverlay = DataManager.getRoutePath(resource, colour, mResourceProxy); + + Log.v(TAG, "Path overlay has " + routeOverlay.getNumberOfPoints() + " points"); + + routeOverlay.getPaint().setAntiAlias(true); + routeOverlay.getPaint().setAlpha(145); + routeOverlay.getPaint().setStrokeWidth(12); + } + + busRouteOverlays.put(route, routeOverlay); + overlays.put(BUS_ROUTE_OVERLAYS + route.code, routeOverlay); + + synchronized (mapView.getOverlays()) { + mapView.getOverlays().add(routeOverlay); + Collections.sort(mapView.getOverlays(), comparator); + } - private void showBuildingOverlays() { - new Thread(new Runnable() { - public void run() { - Log.i(TAG, "Begining showing building overlays at " + (System.currentTimeMillis() - startTime)); + } - final SharedPreferences activityPrefs = getPreferences(0); - final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); + routeOverlay.setEnabled(activityPrefs.getBoolean(BUS_ROUTE_OVERLAYS + route.code, + BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)); + if (route.code.equals("U1")) { + overlays.get(BUS_ROUTE_OVERLAYS + "U1E").setEnabled( + activityPrefs.getBoolean(BUS_ROUTE_OVERLAYS + "U1", BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)); + } - if (residentialBuildingOverlay != null) { + mapView.postInvalidate(); - } else { - if (pastOverlays != null - && (residentialBuildingOverlay = (BuildingNumOverlay) pastOverlays - .get(RESIDENTIAL_BUILDING_OVERLAY)) != null) { - nonResidentialBuildingOverlay = (BuildingNumOverlay) pastOverlays - .get(NON_RESIDENTIAL_BUILDING_OVERLAY); - - Log.i(TAG, "Restored building overlays"); - } else { - try { + Log.i(TAG, "Finished showing route " + route.code + " overlay at " + + (System.currentTimeMillis() - startTime)); + } + }).start(); + } - Log.v(TAG, "Begining the creation of the building overlays"); + private void showSiteOverlay(final Site site) { - ArrayList residentialBuildings = new ArrayList(); - ArrayList nonResidentialBuildings = new ArrayList(); + new Thread(new Runnable() { + public void run() { + Log.i(TAG, "Begining showing site " + site.name + " overlay at " + + (System.currentTimeMillis() - startTime)); - Dao buildingDao; + final SharedPreferences activityPrefs = getPreferences(0); + final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); - buildingDao = getHelper().getBuildingDao(); + PathOverlay siteOverlay; + if ((siteOverlay = siteOverlays.get(site)) != null) { - for (Building building : buildingDao) { - if (building.residential == true) { - if (building.favourite) { - residentialBuildings.add(building); - } else { - residentialBuildings.add(0, building); - } } else { - if (building.favourite) { - nonResidentialBuildings.add(building); - } else { - nonResidentialBuildings.add(0, building); - } + if (pastOverlays != null + && (siteOverlay = (PathOverlay) pastOverlays.get(SITE_OVERLAYS + site.name)) != null) { + Log.i(TAG, "Restored " + site.name + " site overlay"); + } else { + + siteOverlay = new PathOverlay(Color.BLUE, instance); + Paint paint = siteOverlay.getPaint(); + paint.setAntiAlias(true); + paint.setStrokeWidth(1.5f); + for (int i = 0; i < site.outline.points.length; i++) { + siteOverlay.addPoint(site.outline.points[i]); + } + siteOverlay.addPoint(site.outline.points[0]); + + } + + siteOverlays.put(site, siteOverlay); + overlays.put(SITE_OVERLAYS + site.name, siteOverlay); + + Log.v(TAG, "Applyed the site overlay, now sorting them"); + + synchronized (mapView.getOverlays()) { + mapView.getOverlays().add(siteOverlay); + Collections.sort(mapView.getOverlays(), comparator); + } } - } - residentialBuildingOverlay = new BuildingNumOverlay(instance, residentialBuildings); - nonResidentialBuildingOverlay = new BuildingNumOverlay(instance, nonResidentialBuildings); + siteOverlay.setEnabled(activityPrefs.getBoolean(SITE_OVERLAYS + site.name, + SITE_OVERLAYS_ENABLED_BY_DEFAULT)); - Log.v(TAG, "Applyed the site overlay, now sorting them"); + mapView.postInvalidate(); - } catch (SQLException e) { - e.printStackTrace(); + Log.i(TAG, "Finished showing site " + site.name + " overlay at " + + (System.currentTimeMillis() - startTime)); } - } + }).start(); + } - overlays.put(RESIDENTIAL_BUILDING_OVERLAY, residentialBuildingOverlay); - overlays.put(NON_RESIDENTIAL_BUILDING_OVERLAY, nonResidentialBuildingOverlay); + private void showBuildingOverlays() { + new Thread(new Runnable() { + public void run() { + Log.i(TAG, "Begining showing building overlays at " + (System.currentTimeMillis() - startTime)); - synchronized (mapView.getOverlays()) { - mapView.getOverlays().add(residentialBuildingOverlay); - mapView.getOverlays().add(nonResidentialBuildingOverlay); - Collections.sort(mapView.getOverlays(), comparator); - } - } + final SharedPreferences activityPrefs = getPreferences(0); + final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); - residentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS - + RESIDENTIAL_BUILDING_OVERLAY, RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); - nonResidentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS - + NON_RESIDENTIAL_BUILDING_OVERLAY, NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); + if (residentialBuildingOverlay != null) { - mapView.postInvalidate(); + } else { + if (pastOverlays != null + && (residentialBuildingOverlay = (BuildingNumOverlay) pastOverlays + .get(RESIDENTIAL_BUILDING_OVERLAY)) != null) { + nonResidentialBuildingOverlay = (BuildingNumOverlay) pastOverlays + .get(NON_RESIDENTIAL_BUILDING_OVERLAY); + + Log.i(TAG, "Restored building overlays"); + } else { + try { + + Log.v(TAG, "Begining the creation of the building overlays"); + + ArrayList residentialBuildings = new ArrayList(); + ArrayList nonResidentialBuildings = new ArrayList(); + + Dao buildingDao; + + buildingDao = getHelper().getBuildingDao(); + + for (Building building : buildingDao) { + if (building.residential == true) { + if (building.favourite) { + residentialBuildings.add(building); + } else { + residentialBuildings.add(0, building); + } + } else { + if (building.favourite) { + nonResidentialBuildings.add(building); + } else { + nonResidentialBuildings.add(0, building); + } + } + } + + residentialBuildingOverlay = new BuildingNumOverlay(instance, residentialBuildings); + nonResidentialBuildingOverlay = new BuildingNumOverlay(instance, nonResidentialBuildings); + + Log.v(TAG, "Applyed the site overlay, now sorting them"); + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + overlays.put(RESIDENTIAL_BUILDING_OVERLAY, residentialBuildingOverlay); + overlays.put(NON_RESIDENTIAL_BUILDING_OVERLAY, nonResidentialBuildingOverlay); + + synchronized (mapView.getOverlays()) { + mapView.getOverlays().add(residentialBuildingOverlay); + mapView.getOverlays().add(nonResidentialBuildingOverlay); + Collections.sort(mapView.getOverlays(), comparator); + } + } - Log.i(TAG, "Finished showing building overlays at " + (System.currentTimeMillis() - startTime)); - } - }).start(); - } + residentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS + + RESIDENTIAL_BUILDING_OVERLAY, RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); + nonResidentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS + + NON_RESIDENTIAL_BUILDING_OVERLAY, NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); - private void showUniLinkBusStopOverlay() { - new Thread(new Runnable() { - public void run() { - Log.i(TAG, "Begining showing bus stop overlays at " + (System.currentTimeMillis() - startTime)); + mapView.postInvalidate(); - final SharedPreferences activityPrefs = getPreferences(0); - final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); - - if (uniLinkBusStopOverlay != null) { - if (!activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { - Log.i(TAG, "Uni-Link bus stop overlay not needed"); - overlays.remove(UNI_LINK_BUS_STOP_OVERLAY); - - synchronized (mapView.getOverlays()) { - mapView.getOverlays().remove(uniLinkBusStopOverlay); - Collections.sort(mapView.getOverlays(), comparator); + Log.i(TAG, "Finished showing building overlays at " + (System.currentTimeMillis() - startTime)); } + }).start(); + } - uniLinkBusStopOverlay = null; - } else { - uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - } - } else { - if (activityPrefs - .getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { - if (pastOverlays != null - && (uniLinkBusStopOverlay = (BusStopOverlay) pastOverlays - .get(UNI_LINK_BUS_STOP_OVERLAY)) != null) { - Log.i(TAG, "Restored Uni-Link bus stop overlay"); - } else { - - try { - List busStops; - Log.v(TAG, "Begin fetching BusStops at " + (System.currentTimeMillis() - startTime)); - - busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, true); + private void showUniLinkBusStopOverlay() { + new Thread(new Runnable() { + public void run() { + Log.i(TAG, "Begining showing bus stop overlays at " + (System.currentTimeMillis() - startTime)); + + final SharedPreferences activityPrefs = getPreferences(0); + final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); + + if (uniLinkBusStopOverlay != null) { + if (!activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { + Log.i(TAG, "Uni-Link bus stop overlay not needed"); + overlays.remove(UNI_LINK_BUS_STOP_OVERLAY); + + synchronized (mapView.getOverlays()) { + mapView.getOverlays().remove(uniLinkBusStopOverlay); + Collections.sort(mapView.getOverlays(), comparator); + } + + uniLinkBusStopOverlay = null; + } else { + uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + } + } else { + if (activityPrefs + .getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { + if (pastOverlays != null + && (uniLinkBusStopOverlay = (BusStopOverlay) pastOverlays + .get(UNI_LINK_BUS_STOP_OVERLAY)) != null) { + Log.i(TAG, "Restored Uni-Link bus stop overlay"); + } else { + + try { + List busStops; + Log.v(TAG, "Begin fetching BusStops at " + (System.currentTimeMillis() - startTime)); + + busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, true); + + Log.v(TAG, "Finished fetching BusStops at " + (System.currentTimeMillis() - startTime)); + + uniLinkBusStopOverlay = new BusStopOverlay(instance, busStops); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", + UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + + overlays.put(UNI_LINK_BUS_STOP_OVERLAY, uniLinkBusStopOverlay); + + Log.v(TAG, "Applyed the site overlay, now sorting them"); + + synchronized (mapView.getOverlays()) { + mapView.getOverlays().add(uniLinkBusStopOverlay); + Collections.sort(mapView.getOverlays(), comparator); + } + } + } - Log.v(TAG, "Finished fetching BusStops at " + (System.currentTimeMillis() - startTime)); + mapView.postInvalidate(); - uniLinkBusStopOverlay = new BusStopOverlay(instance, busStops); - } catch (SQLException e) { - e.printStackTrace(); - } + Log.i(TAG, "Finished showing bus stop overlays at " + (System.currentTimeMillis() - startTime)); } + }).start(); + } - uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - - overlays.put(UNI_LINK_BUS_STOP_OVERLAY, uniLinkBusStopOverlay); + private void showNonUniLinkBusStopOverlay() { + new Thread(new Runnable() { + public void run() { + Log.i(TAG, "Begining showing non uni link bus stop overlays at " + + (System.currentTimeMillis() - startTime)); + + // final SharedPreferences activityPrefs = getPreferences(0); + final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(instance); + final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); + + if (nonUniLinkBusStopOverlay != null) { + nonUniLinkBusStopOverlay.setEnabled(sharedPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS_OVERLAY, + NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + + Log.i(TAG, + "nonUniLinkBusStopOverlay enabled ? " + + sharedPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS_OVERLAY, + NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + } else if (sharedPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS_OVERLAY, + NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { + if (pastOverlays != null + && (nonUniLinkBusStopOverlay = (BusStopOverlay) pastOverlays + .get(NON_UNI_LINK_BUS_STOPS_OVERLAY)) != null) { + Log.i(TAG, "Restored non Uni-Link bus stop overlays"); + } else { + try { + List busStops; + Log.v(TAG, "Begin fetching non Uni-Link BusStops at " + + (System.currentTimeMillis() - startTime)); + + busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, false); + + Log.v(TAG, + "Finished fetching " + busStops.size() + " non Uni-Link BusStops at " + + (System.currentTimeMillis() - startTime)); + + nonUniLinkBusStopOverlay = new BusStopOverlay(instance, busStops); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + overlays.put(NON_UNI_LINK_BUS_STOPS_OVERLAY, nonUniLinkBusStopOverlay); + + Log.v(TAG, "Applyed the site overlay, now sorting them"); + + synchronized (mapView.getOverlays()) { + mapView.getOverlays().add(nonUniLinkBusStopOverlay); + Collections.sort(mapView.getOverlays(), comparator); + } + } - Log.v(TAG, "Applyed the site overlay, now sorting them"); + if (nonUniLinkBusStopOverlay != null) { - synchronized (mapView.getOverlays()) { - mapView.getOverlays().add(uniLinkBusStopOverlay); - Collections.sort(mapView.getOverlays(), comparator); - } - } - } + } - mapView.postInvalidate(); - - Log.i(TAG, "Finished showing bus stop overlays at " + (System.currentTimeMillis() - startTime)); - } - }).start(); - } - - private void showNonUniLinkBusStopOverlay() { - new Thread(new Runnable() { - public void run() { - Log.i(TAG, "Begining showing non uni link bus stop overlays at " - + (System.currentTimeMillis() - startTime)); - - // final SharedPreferences activityPrefs = getPreferences(0); - final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(instance); - final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); - - if (nonUniLinkBusStopOverlay != null) { - nonUniLinkBusStopOverlay.setEnabled(sharedPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS_OVERLAY, - NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - - Log.i(TAG, - "nonUniLinkBusStopOverlay enabled ? " - + sharedPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS_OVERLAY, - NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - } else if (sharedPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS_OVERLAY, - NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { - if (pastOverlays != null - && (nonUniLinkBusStopOverlay = (BusStopOverlay) pastOverlays - .get(NON_UNI_LINK_BUS_STOPS_OVERLAY)) != null) { - Log.i(TAG, "Restored non Uni-Link bus stop overlays"); - } else { - try { - List busStops; - Log.v(TAG, "Begin fetching non Uni-Link BusStops at " - + (System.currentTimeMillis() - startTime)); + mapView.postInvalidate(); - busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, false); + Log.i(TAG, "Finished showing non Uni-Link bus stop overlays at " + + (System.currentTimeMillis() - startTime)); + } + }).start(); + } - Log.v(TAG, - "Finished fetching " + busStops.size() + " non Uni-Link BusStops at " - + (System.currentTimeMillis() - startTime)); + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.map_menu, menu); + return true; + } - nonUniLinkBusStopOverlay = new BusStopOverlay(instance, busStops); - } catch (SQLException e) { - e.printStackTrace(); + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle item selection + switch (item.getItemId()) { + case R.id.menu_find: + Intent i = new Intent(MapActivity.this, FindActivity.class); + startActivityForResult(i, 0); + return true; + case R.id.menu_preferences: + Intent settingsActivity = new Intent(getBaseContext(), PreferencesActivity.class); + startActivity(settingsActivity); + return true; + case R.id.menu_find_my_location: + final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + if (sharedPrefs.getBoolean("GPSEnabled", false)) { + GeoPoint userLocation = myLocationOverlay.getMyLocation(); + if (userLocation != null) { + Log.i(TAG, "Found user location, scrolling to " + userLocation); + mapController.animateTo(userLocation); + myLocationOverlay.enableFollowLocation(); + } + } else { + DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case DialogInterface.BUTTON_POSITIVE: + Editor editor = sharedPrefs.edit(); + editor.putBoolean("GPSEnabled", true); + editor.commit(); + break; + + case DialogInterface.BUTTON_NEGATIVE: + // No button clicked + break; + } + } + }; + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage("GPS is not enabled, do you wish to enable it?") + .setPositiveButton("Yes", dialogClickListener).setNegativeButton("No", dialogClickListener) + .show(); } - } - overlays.put(NON_UNI_LINK_BUS_STOPS_OVERLAY, nonUniLinkBusStopOverlay); + return true; + case R.id.menu_view: + Log.i(TAG, "Showing view dialog"); + showDialog(VIEW_DIALOG_ID); + return false; + case R.id.menu_favourites: + Log.i(TAG, "Showing favourite dialog"); + + showDialog(FAVOURITE_DIALOG_ID); + if (favDialog == null) { + Log.e(TAG, "Very wierd, just tried to launch the favourite's dialog, but its null?"); + return false; + } - Log.v(TAG, "Applyed the site overlay, now sorting them"); + refreshFavouriteDialog(); - synchronized (mapView.getOverlays()) { - mapView.getOverlays().add(nonUniLinkBusStopOverlay); - Collections.sort(mapView.getOverlays(), comparator); - } + return false; + case R.id.menu_about: + Intent aboutIntent = new Intent(MapActivity.this, AboutActivity.class); + startActivityForResult(aboutIntent, 0); + return true; + default: + Log.e(TAG, "No known menu option selected"); + return super.onOptionsItemSelected(item); } + } - if (nonUniLinkBusStopOverlay != null) { + private void refreshFavouriteDialog() { + ArrayList newFavouriteItems = new ArrayList(); + try { + Dao buildingDao = getHelper().getBuildingDao(); + Dao busStopDao = getHelper().getBusStopDao(); + + newFavouriteItems.addAll(buildingDao.queryForEq(POI.FAVOURITE_FIELD_NAME, true)); + newFavouriteItems.addAll(busStopDao.queryForEq(POI.FAVOURITE_FIELD_NAME, true)); + } catch (SQLException e) { + e.printStackTrace(); } - mapView.postInvalidate(); - - Log.i(TAG, "Finished showing non Uni-Link bus stop overlays at " - + (System.currentTimeMillis() - startTime)); - } - }).start(); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.map_menu, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle item selection - switch (item.getItemId()) { - case R.id.menu_find: - Intent i = new Intent(MapActivity.this, FindActivity.class); - startActivityForResult(i, 0); - return true; - case R.id.menu_preferences: - Intent settingsActivity = new Intent(getBaseContext(), PreferencesActivity.class); - startActivity(settingsActivity); - return true; - case R.id.menu_find_my_location: - final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); - if (sharedPrefs.getBoolean("GPSEnabled", false)) { - GeoPoint userLocation = myLocationOverlay.getMyLocation(); - if (userLocation != null) { - Log.i(TAG, "Found user location, scrolling to " + userLocation); - mapController.animateTo(userLocation); - myLocationOverlay.enableFollowLocation(); + Log.i(TAG, "There are " + newFavouriteItems.size() + " favourites"); + if (newFavouriteItems.size() == 0) { + Log.i(TAG, "Favourite dialog has no favourites, displaying message"); + favDialog.setMessage(getResources().getString(R.string.favourites_dialog_message)); + favDialog.setItems(null); + } else { + favDialog.setMessage(""); + favDialog.setItems(newFavouriteItems); } - } else { - DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - switch (which) { - case DialogInterface.BUTTON_POSITIVE: - Editor editor = sharedPrefs.edit(); - editor.putBoolean("GPSEnabled", true); - editor.commit(); - break; - - case DialogInterface.BUTTON_NEGATIVE: - // No button clicked - break; - } - } - }; - - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage("GPS is not enabled, do you wish to enable it?") - .setPositiveButton("Yes", dialogClickListener).setNegativeButton("No", dialogClickListener) - .show(); - } - - return true; - case R.id.menu_view: - Log.i(TAG, "Showing view dialog"); - showDialog(VIEW_DIALOG_ID); - return false; - case R.id.menu_favourites: - Log.i(TAG, "Showing favourite dialog"); - - showDialog(FAVOURITE_DIALOG_ID); - if (favDialog == null) { - Log.e(TAG, "Very wierd, just tried to launch the favourite's dialog, but its null?"); - return false; - } - - refreshFavouriteDialog(); - - return false; - case R.id.menu_about: - Intent aboutIntent = new Intent(MapActivity.this, AboutActivity.class); - startActivityForResult(aboutIntent, 0); - return true; - default: - Log.e(TAG, "No known menu option selected"); - return super.onOptionsItemSelected(item); } - } - - private void refreshFavouriteDialog() { - ArrayList newFavouriteItems = new ArrayList(); - try { - Dao buildingDao = getHelper().getBuildingDao(); - Dao busStopDao = getHelper().getBusStopDao(); - - newFavouriteItems.addAll(buildingDao.queryForEq(POI.FAVOURITE_FIELD_NAME, true)); - newFavouriteItems.addAll(busStopDao.queryForEq(POI.FAVOURITE_FIELD_NAME, true)); - } catch (SQLException e) { - e.printStackTrace(); + @Override + public boolean onSearchRequested() { + Intent i = new Intent(MapActivity.this, FindActivity.class); + startActivityForResult(i, 0); + return false; } - Log.i(TAG, "There are " + newFavouriteItems.size() + " favourites"); - if (newFavouriteItems.size() == 0) { - Log.i(TAG, "Favourite dialog has no favourites, displaying message"); - favDialog.setMessage(getResources().getString(R.string.favourites_dialog_message)); - favDialog.setItems(null); - } else { - favDialog.setMessage(""); - favDialog.setItems(newFavouriteItems); - } - } - - @Override - public boolean onSearchRequested() { - Intent i = new Intent(MapActivity.this, FindActivity.class); - startActivityForResult(i, 0); - return false; - } - - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - Log.i(TAG, "Got activity result"); - if (resultCode == RESULT_OK) { - - POI poi = null; - Bundle bundle = data.getExtras(); - if (bundle == null) { - Log.i(TAG, "Bundle is null"); - } else { - String poiId = (String) bundle.get("poi"); - if (poiId != null) { - Log.i(TAG, "Got id " + poiId); - try { - poi = getHelper().getBuildingDao().queryForId(poiId); - if (poi == null) { - poi = getHelper().getBusStopDao().queryForId(poiId); - } - } catch (SQLException e) { - e.printStackTrace(); - } - - if (poi == null) { - Log.e(TAG, "Could not find poi " + poiId + " in onActivityResult"); - } else { - if (myLocationOverlay != null) { - // It could be null if it has not been enabled - myLocationOverlay.disableFollowLocation(); - } - mapController.setZoom(20); - mapController.setCenter(poi.point); + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + Log.i(TAG, "Got activity result"); + if (resultCode == RESULT_OK) { - } - } else { - Log.i(TAG, "Got null poi id"); + POI poi = null; + Bundle bundle = data.getExtras(); + if (bundle == null) { + Log.i(TAG, "Bundle is null"); + } else { + String poiId = (String) bundle.get("poi"); + if (poiId != null) { + Log.i(TAG, "Got id " + poiId); + try { + poi = getHelper().getBuildingDao().queryForId(poiId); + if (poi == null) { + poi = getHelper().getBusStopDao().queryForId(poiId); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + if (poi == null) { + Log.e(TAG, "Could not find poi " + poiId + " in onActivityResult"); + } else { + if (myLocationOverlay != null) { + // It could be null if it has not been enabled + myLocationOverlay.disableFollowLocation(); + } + mapController.setZoom(20); + mapController.setCenter(poi.point); + + } + } else { + Log.i(TAG, "Got null poi id"); - // mapController.setZoom(15); - // mapController.setCenter(new GeoPoint(50935551, -1393488)); - } + // mapController.setZoom(15); + // mapController.setCenter(new GeoPoint(50935551, + // -1393488)); + } - // This handles the possible change in favourite state caused by the user within the BusTimeActivity - try { - String busStopID = bundle.getString("busStopChanged"); - if (busStopID != null && busStopID.length() != 0) { - Log.v(TAG, "Got a busStop id back from the BusTimeActivity " + busStopID); - BusStop busStop = getHelper().getBusStopDao().queryForId(busStopID); - - if (busStop.uniLink) { - uniLinkBusStopOverlay.refresh(busStop); // This does not invalidate the map, but it seems to - // make the changes appear - } else { - nonUniLinkBusStopOverlay.refresh(busStop); // This does not invalidate the map, but it seems - // to - // make the changes appear + // This handles the possible change in favourite state caused by + // the user within the BusTimeActivity + try { + String busStopID = bundle.getString("busStopChanged"); + if (busStopID != null && busStopID.length() != 0) { + Log.v(TAG, "Got a busStop id back from the BusTimeActivity " + busStopID); + BusStop busStop = getHelper().getBusStopDao().queryForId(busStopID); + + if (busStop.uniLink) { + uniLinkBusStopOverlay.refresh(busStop); // This does + // not + // invalidate + // the map, + // but it + // seems to + // make the changes appear + } else { + nonUniLinkBusStopOverlay.refresh(busStop); // This + // does + // not + // invalidate + // the + // map, + // but + // it + // seems + // to + // make the changes appear + } + } + } catch (SQLException e) { + e.printStackTrace(); + } + + if (favDialog != null) { + refreshFavouriteDialog(); + } } - } - } catch (SQLException e) { - e.printStackTrace(); } - if (favDialog != null) { - refreshFavouriteDialog(); - } - } } - } - - /* - * public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { - * - * mapView.post(new Runnable() { public void run() { // updateEnabledOverlays(); TODO Fix whatever this did? - * mapView.invalidate(); } }); - * - * return true; } - */ - - protected Dialog onCreateDialog(int id) { - switch (id) { - case VIEW_DIALOG_ID: - ViewDialog viewDialog = new ViewDialog(instance); - return viewDialog; - case FAVOURITE_DIALOG_ID: - favDialog = new POIDialog(instance); - favDialog.setOnItemClickListener(this); - favDialog.setOnItemLongClickListener(this); - favDialog.setTitle(R.string.favourites_dialog_title); - return favDialog; + /* + * public boolean onChildClick(ExpandableListView parent, View v, int + * groupPosition, int childPosition, long id) { + * + * mapView.post(new Runnable() { public void run() { // + * updateEnabledOverlays(); TODO Fix whatever this did? + * mapView.invalidate(); } }); + * + * return true; } + */ + + protected Dialog onCreateDialog(int id) { + switch (id) { + case VIEW_DIALOG_ID: + ViewDialog viewDialog = new ViewDialog(instance); + return viewDialog; + case FAVOURITE_DIALOG_ID: + favDialog = new POIDialog(instance); + favDialog.setOnItemClickListener(this); + favDialog.setOnItemLongClickListener(this); + favDialog.setTitle(R.string.favourites_dialog_title); + return favDialog; + } + return null; } - return null; - } - public void onItemClick(AdapterView parent, View view, int position, long id) { - Log.i(TAG, "OnItemClick pos " + position + " id " + id); + public void onItemClick(AdapterView parent, View view, int position, long id) { + Log.i(TAG, "OnItemClick pos " + position + " id " + id); - String poiId = favDialog.adapter.getItemStringId(position); + String poiId = favDialog.adapter.getItemStringId(position); - Log.i(TAG, "POI " + poiId + " selected"); + Log.i(TAG, "POI " + poiId + " selected"); - POI poi = null; + POI poi = null; - if (poiId != null) { - Log.i(TAG, "Got id " + poiId); - try { - poi = getHelper().getBuildingDao().queryForId(poiId); - if (poi == null) { - poi = getHelper().getBusStopDao().queryForId(poiId); - } - } catch (SQLException e) { - e.printStackTrace(); - } + if (poiId != null) { + Log.i(TAG, "Got id " + poiId); + try { + poi = getHelper().getBuildingDao().queryForId(poiId); + if (poi == null) { + poi = getHelper().getBusStopDao().queryForId(poiId); + } + } catch (SQLException e) { + e.printStackTrace(); + } - if (poi == null) { - Log.e(TAG, "Could not find poi " + poiId + " in onActivityResult"); - } else { - if (myLocationOverlay != null) { - myLocationOverlay.disableFollowLocation(); - } - mapController.setZoom(20); - mapController.setCenter(poi.point); + if (poi == null) { + Log.e(TAG, "Could not find poi " + poiId + " in onActivityResult"); + } else { + if (myLocationOverlay != null) { + myLocationOverlay.disableFollowLocation(); + } + mapController.setZoom(20); + mapController.setCenter(poi.point); - favDialog.dismiss(); + favDialog.dismiss(); + + } + } else { + Log.i(TAG, "Got null poi id"); - } - } else { - Log.i(TAG, "Got null poi id"); + // mapController.setZoom(15); + // mapController.setCenter(new GeoPoint(50935551, -1393488)); + } - // mapController.setZoom(15); - // mapController.setCenter(new GeoPoint(50935551, -1393488)); } - } + /** + * Long click on a item in the favourites menu + */ + public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { + + Log.i(TAG, "OnItemClick pos " + position + " id " + id); - /** - * Long click on a item in the favourites menu - */ - public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { + String poiId = favDialog.adapter.getItemStringId(position); - Log.i(TAG, "OnItemClick pos " + position + " id " + id); + Log.i(TAG, "POI " + poiId + " selected"); - String poiId = favDialog.adapter.getItemStringId(position); + POI poi = null; - Log.i(TAG, "POI " + poiId + " selected"); + if (poiId != null) { + Log.i(TAG, "Got id " + poiId); + try { + poi = getHelper().getBuildingDao().queryForId(poiId); + if (poi == null) { + poi = getHelper().getBusStopDao().queryForId(poiId); + } + } catch (SQLException e) { + e.printStackTrace(); + } - POI poi = null; + if (poi == null) { + Log.e(TAG, "Could not find poi " + poiId + " in onActivityResult"); + } else { + if (poi.type == POI.BUS_STOP) { + BusStop busStop = (BusStop) poi; - if (poiId != null) { - Log.i(TAG, "Got id " + poiId); - try { - poi = getHelper().getBuildingDao().queryForId(poiId); - if (poi == null) { - poi = getHelper().getBusStopDao().queryForId(poiId); - } - } catch (SQLException e) { - e.printStackTrace(); - } + Log.i(TAG, "Pressed " + busStop.id); - if (poi == null) { - Log.e(TAG, "Could not find poi " + poiId + " in onActivityResult"); - } else { - if (poi.type == POI.BUS_STOP) { - BusStop busStop = (BusStop) poi; + Intent i = new Intent(this, BusStopActivity.class); + i.putExtra("busStopID", busStop.id); + i.putExtra("busStopName", busStop.description); + startActivityForResult(i, 0); - Log.i(TAG, "Pressed " + busStop.id); + return true; - Intent i = new Intent(this, BusStopActivity.class); - i.putExtra("busStopID", busStop.id); - i.putExtra("busStopName", busStop.description); - startActivityForResult(i, 0); + } else { - return true; + myLocationOverlay.disableFollowLocation(); + mapController.setZoom(20); + mapController.setCenter(poi.point); + favDialog.dismiss(); + favDialog = null; + } + } } else { + Log.i(TAG, "Got null poi id"); - myLocationOverlay.disableFollowLocation(); - mapController.setZoom(20); - mapController.setCenter(poi.point); - - favDialog.dismiss(); - favDialog = null; + // mapController.setZoom(15); + // mapController.setCenter(new GeoPoint(50935551, -1393488)); } - } - } else { - Log.i(TAG, "Got null poi id"); - // mapController.setZoom(15); - // mapController.setCenter(new GeoPoint(50935551, -1393488)); + return true; } - return true; - } + private class OverlayRankComparator implements Comparator { + // private final SharedPreferences prefs; - private class OverlayRankComparator implements Comparator { - // private final SharedPreferences prefs; + OverlayRankComparator(SharedPreferences prefs) { + // this.prefs = prefs; + } - OverlayRankComparator(SharedPreferences prefs) { - // this.prefs = prefs; - } + public int compare(Overlay arg0, Overlay arg1) { + return getRank(arg1) - getRank(arg0); + } - public int compare(Overlay arg0, Overlay arg1) { - return getRank(arg1) - getRank(arg0); + private final int getRank(Overlay overlay) { // TODO: Dont hardcode the + // rank values + if (overlay == scaleBarOverlay) { + return SCALE_BAR_OVERLAY_RANK; + } else if (overlay == myLocationOverlay) { + return MY_LOCATION_OVERLAY_RANK; + } else if (overlay == uniLinkBusStopOverlay) { + return UNI_LINK_BUS_STOP_OVERLAY_RANK; + } else if (overlay == nonUniLinkBusStopOverlay) { + return NON_UNI_LINK_BUS_STOP_OVERLAY_RANK; + } else if (overlay.equals(residentialBuildingOverlay)) { + return RESIDENTIAL_BUILDING_OVERLAY_RANK; + } else if (overlay.equals(nonResidentialBuildingOverlay)) { + return NON_RESIDENTIAL_BUILDING_OVERLAY_RANK; + } else if (siteOverlays != null && siteOverlays.values().contains(overlay)) { + return SITE_OVERLAYS_RANK; + } else if (busRouteOverlays != null && busRouteOverlays.values().contains(overlay)) { + return BUS_ROUTE_OVERLAYS_RANK; + } else { + Log.e(TAG, "Trying to rank unknown overlay " + overlay); + return -1; + } + } } - private final int getRank(Overlay overlay) { // TODO: Dont hardcode the rank values - if (overlay == scaleBarOverlay) { - return SCALE_BAR_OVERLAY_RANK; - } else if (overlay == myLocationOverlay) { - return MY_LOCATION_OVERLAY_RANK; - } else if (overlay == uniLinkBusStopOverlay) { - return UNI_LINK_BUS_STOP_OVERLAY_RANK; - } else if (overlay == nonUniLinkBusStopOverlay) { - return NON_UNI_LINK_BUS_STOP_OVERLAY_RANK; - } else if (overlay.equals(residentialBuildingOverlay)) { - return RESIDENTIAL_BUILDING_OVERLAY_RANK; - } else if (overlay.equals(nonResidentialBuildingOverlay)) { - return NON_RESIDENTIAL_BUILDING_OVERLAY_RANK; - } else if (siteOverlays != null && siteOverlays.values().contains(overlay)) { - return SITE_OVERLAYS_RANK; - } else if (busRouteOverlays != null && busRouteOverlays.values().contains(overlay)) { - return BUS_ROUTE_OVERLAYS_RANK; - } else { - Log.e(TAG, "Trying to rank unknown overlay " + overlay); - return -1; - } - } - } - - /** - * Handles all changes in preferences - */ - public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { - Log.v(TAG, "Got shared prefs changed event for key " + key); - - // Shared Preferences - if (key.equals(GPS_ENABLED)) { - final SharedPreferences activityPrefs = getPreferences(0); - - if (activityPrefs.getBoolean("Other:Compass", false) && prefs.getBoolean("GPSEnabled", false)) { - myLocationOverlay.enableMyLocation(); - } else { - myLocationOverlay.disableMyLocation(); - } - } else if (key.equals(NON_UNI_LINK_BUS_TIMES)) { - // Noting to do here atm - } else if (key.equals(UNI_LINK_BUS_TIMES)) { - // Noting to do here atm - } else if (key.startsWith(BUS_STOP_OVERLAYS)) { - showUniLinkBusStopOverlay(); - } else if (key.equals(NON_UNI_LINK_BUS_STOPS_OVERLAY)) { - showNonUniLinkBusStopOverlay(); - } else if (key.startsWith(BUS_ROUTE_OVERLAYS)) { - try { - String routeName = key.substring(BUS_ROUTE_OVERLAYS.length(), key.length()); - for (BusRoute route : getHelper().getBusRouteDao()) { - Log.v(TAG, route.code + " " + routeName); - if (route.code.equals(routeName)) { - showRouteOverlay(route); - } - } - } catch (SQLException e) { - e.printStackTrace(); - } - } else if (key.startsWith(BUILDING_OVERLAYS)) { - showBuildingOverlays(); - } else if (key.startsWith(SITE_OVERLAYS)) { - String siteName = key.substring(SITE_OVERLAYS.length(), key.length()); - try { - for (Site site : getHelper().getSiteDao()) { - if (site.name.equals(siteName)) { - showSiteOverlay(site); - } - } - } catch (SQLException e) { - e.printStackTrace(); - } - } else if (key.startsWith(OTHER_OVERLAYS)) { - if (key.substring(OTHER_OVERLAYS.length(), key.length()).equals(SCALE_BAR_OVERLAY)) { - showUtilityOverlays(); - } else if (key.substring(OTHER_OVERLAYS.length(), key.length()).equals(MY_LOCATION_OVERLAY_COMPASS)) { - if (prefs.getBoolean(key, MY_LOCATION_OVERLAY_COMPASS_ENABLED_BY_DEFAULT)) { - myLocationOverlay.enableCompass(); - } else { - myLocationOverlay.disableCompass(); - } - } else if (key.substring(OTHER_OVERLAYS.length(), key.length()).equals(MY_LOCATION_OVERLAY)) { - final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + /** + * Handles all changes in preferences + */ + public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { + Log.v(TAG, "Got shared prefs changed event for key " + key); + + // Shared Preferences + if (key.equals(GPS_ENABLED)) { + final SharedPreferences activityPrefs = getPreferences(0); + + if (activityPrefs.getBoolean("Other:Compass", false) && prefs.getBoolean("GPSEnabled", false)) { + myLocationOverlay.enableMyLocation(); + } else { + myLocationOverlay.disableMyLocation(); + } + } else if (key.equals(NON_UNI_LINK_BUS_TIMES)) { + // Noting to do here atm + } else if (key.equals(UNI_LINK_BUS_TIMES)) { + // Noting to do here atm + } else if (key.startsWith(BUS_STOP_OVERLAYS)) { + showUniLinkBusStopOverlay(); + } else if (key.equals(NON_UNI_LINK_BUS_STOPS_OVERLAY)) { + showNonUniLinkBusStopOverlay(); + } else if (key.startsWith(BUS_ROUTE_OVERLAYS)) { + try { + String routeName = key.substring(BUS_ROUTE_OVERLAYS.length(), key.length()); + for (BusRoute route : getHelper().getBusRouteDao()) { + Log.v(TAG, route.code + " " + routeName); + if (route.code.equals(routeName)) { + showRouteOverlay(route); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } + } else if (key.startsWith(BUILDING_OVERLAYS)) { + showBuildingOverlays(); + } else if (key.startsWith(SITE_OVERLAYS)) { + String siteName = key.substring(SITE_OVERLAYS.length(), key.length()); + try { + for (Site site : getHelper().getSiteDao()) { + if (site.name.equals(siteName)) { + showSiteOverlay(site); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } + } else if (key.startsWith(OTHER_OVERLAYS)) { + if (key.substring(OTHER_OVERLAYS.length(), key.length()).equals(SCALE_BAR_OVERLAY)) { + showUtilityOverlays(); + } else if (key.substring(OTHER_OVERLAYS.length(), key.length()).equals(MY_LOCATION_OVERLAY_COMPASS)) { + if (prefs.getBoolean(key, MY_LOCATION_OVERLAY_COMPASS_ENABLED_BY_DEFAULT)) { + myLocationOverlay.enableCompass(); + } else { + myLocationOverlay.disableCompass(); + } + } else if (key.substring(OTHER_OVERLAYS.length(), key.length()).equals(MY_LOCATION_OVERLAY)) { + final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); - if (prefs.getBoolean(key, MY_LOCATION_OVERLAY_ENABLED_BY_DEFAULT) - && sharedPrefs.getBoolean(GPS_ENABLED, GPS_ENABLED_BY_DEFAULT)) { - myLocationOverlay.enableMyLocation(); + if (prefs.getBoolean(key, MY_LOCATION_OVERLAY_ENABLED_BY_DEFAULT) + && sharedPrefs.getBoolean(GPS_ENABLED, GPS_ENABLED_BY_DEFAULT)) { + myLocationOverlay.enableMyLocation(); + } else { + myLocationOverlay.disableMyLocation(); + } + } else { + Log.e(TAG, "Unhandled preference key " + key); + } } else { - myLocationOverlay.disableMyLocation(); + Log.e(TAG, "Unhandled preference key " + key); } - } else { - Log.e(TAG, "Unhandled preference key " + key); - } - } else { - Log.e(TAG, "Unhandled preference key " + key); } - } } -- cgit v1.2.3 From b88f5cabd4cf4876c3e5ba32acb2a7e59dd03edc Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 24 Feb 2012 22:35:05 +0000 Subject: Fix for bug with bus stops. --- assets/data.db | Bin 492544 -> 492544 bytes src/net/cbaines/suma/DataManager.java | 8 ++++---- src/net/cbaines/suma/MapActivity.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/data.db b/assets/data.db index a128ffd..c8bcc9e 100644 Binary files a/assets/data.db and b/assets/data.db differ diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index 56dac5c..b4a0e3d 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -60,9 +60,7 @@ import org.xml.sax.XMLReader; import android.content.Context; import android.util.Log; -import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.tdb.TDBFactory; import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.dao.Dao; @@ -421,8 +419,10 @@ public class DataManager { } else if (busRoute.id == 354) { // U9 busStop.routes = (byte) (busStop.routes | (1 << 4)); busStop.uniLink = true; - } else { - busStop.routes = 0; + } + + if ((busStop.routes != 0) != busStop.uniLink || busStop.id.equals("SN120553")) { + Log.e(TAG, busStop.id + " " + busStop.routes + " " + busStop.uniLink); } // Log.v(TAG, "Stop routes " + busStop.routes); diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index ff61c4e..334f4d2 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -78,7 +78,7 @@ public class MapActivity extends OrmLiteBaseActivity implements * Enable to use the database in the assets folder, if its not enabled, the * database is built from the csv files in the assets folder */ - private boolean useBundledDatabase = true; + private boolean useBundledDatabase = false; private MapView mapView; private MapController mapController; -- cgit v1.2.3 From 731a2b26410f6fa6427acdf675376742793c6332 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 26 Feb 2012 17:09:58 +0000 Subject: Optimised the custom overlays. --- libs/androjena_0.5.jar | Bin 2026332 -> 0 bytes libs/arqoid_0.5.jar | Bin 1673754 -> 0 bytes libs/icu4j-3.4.5.jar | Bin 3241046 -> 0 bytes libs/iri-0.8.jar | Bin 151589 -> 0 bytes libs/lucenoid_3.0.2.jar | Bin 1070153 -> 0 bytes libs/tdboid_0.4.jar | Bin 766853 -> 0 bytes res/layout/building_activity.xml | 4 +- src/net/cbaines/suma/BuildingActivity.java | 120 +++++++------- src/net/cbaines/suma/BuildingNumOverlay.java | 92 ++++------- src/net/cbaines/suma/BusStopActivity.java | 35 ++-- src/net/cbaines/suma/BusStopOverlay.java | 109 ++++--------- src/net/cbaines/suma/DataManager.java | 62 ------- src/net/cbaines/suma/MapActivity.java | 195 ++++++++--------------- src/net/cbaines/suma/POI.java | 3 - src/net/cbaines/suma/POIFavouriteComparator.java | 32 ++-- src/net/cbaines/suma/Preferences.java | 2 + 16 files changed, 237 insertions(+), 417 deletions(-) delete mode 100644 libs/androjena_0.5.jar delete mode 100644 libs/arqoid_0.5.jar delete mode 100644 libs/icu4j-3.4.5.jar delete mode 100644 libs/iri-0.8.jar delete mode 100644 libs/lucenoid_3.0.2.jar delete mode 100644 libs/tdboid_0.4.jar diff --git a/libs/androjena_0.5.jar b/libs/androjena_0.5.jar deleted file mode 100644 index f630089..0000000 Binary files a/libs/androjena_0.5.jar and /dev/null differ diff --git a/libs/arqoid_0.5.jar b/libs/arqoid_0.5.jar deleted file mode 100644 index 9ce294b..0000000 Binary files a/libs/arqoid_0.5.jar and /dev/null differ diff --git a/libs/icu4j-3.4.5.jar b/libs/icu4j-3.4.5.jar deleted file mode 100644 index cf19021..0000000 Binary files a/libs/icu4j-3.4.5.jar and /dev/null differ diff --git a/libs/iri-0.8.jar b/libs/iri-0.8.jar deleted file mode 100644 index f096c68..0000000 Binary files a/libs/iri-0.8.jar and /dev/null differ diff --git a/libs/lucenoid_3.0.2.jar b/libs/lucenoid_3.0.2.jar deleted file mode 100644 index 6822c23..0000000 Binary files a/libs/lucenoid_3.0.2.jar and /dev/null differ diff --git a/libs/tdboid_0.4.jar b/libs/tdboid_0.4.jar deleted file mode 100644 index 34f94b2..0000000 Binary files a/libs/tdboid_0.4.jar and /dev/null differ diff --git a/res/layout/building_activity.xml b/res/layout/building_activity.xml index 4a465ee..a76ad53 100644 --- a/res/layout/building_activity.xml +++ b/res/layout/building_activity.xml @@ -32,8 +32,8 @@ \ No newline at end of file diff --git a/src/net/cbaines/suma/BuildingActivity.java b/src/net/cbaines/suma/BuildingActivity.java index 930c2d1..45babbc 100644 --- a/src/net/cbaines/suma/BuildingActivity.java +++ b/src/net/cbaines/suma/BuildingActivity.java @@ -23,38 +23,30 @@ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; -import java.util.Iterator; +import java.sql.SQLException; import android.content.Context; +import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.Log; +import android.view.Display; import android.view.View; +import android.view.WindowManager; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageButton; +import android.widget.ImageView.ScaleType; import android.widget.TextView; -import com.hp.hpl.jena.query.Query; -import com.hp.hpl.jena.query.QueryExecution; -import com.hp.hpl.jena.query.QueryExecutionFactory; -import com.hp.hpl.jena.query.QueryFactory; -import com.hp.hpl.jena.query.QuerySolution; -import com.hp.hpl.jena.query.ResultSet; -import com.hp.hpl.jena.rdf.model.Literal; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.RDFNode; -import com.hp.hpl.jena.rdf.model.Resource; -import com.hp.hpl.jena.tdb.TDBFactory; import com.j256.ormlite.android.apptools.OrmLiteBaseActivity; +import com.j256.ormlite.dao.Dao; -public class BuildingActivity extends OrmLiteBaseActivity implements OnCheckedChangeListener { +public class BuildingActivity extends OrmLiteBaseActivity implements OnCheckedChangeListener, Preferences { final static String TAG = "BusTimeActivity"; - private boolean dataChanged; - private Context instance; private ImageButton imageButton; @@ -62,6 +54,8 @@ public class BuildingActivity extends OrmLiteBaseActivity implem private TextView buildingName; private TextView buildingID; + private Building building; + private CheckBox favouritesCheckBox; public void onCreate(Bundle savedInstanceState) { @@ -71,8 +65,10 @@ public class BuildingActivity extends OrmLiteBaseActivity implem String ID = getIntent().getExtras().getString("buildingID"); + final SharedPreferences favouritesPrefs = instance.getSharedPreferences(FAVOURITES_PREFERENCES, 0); + favouritesCheckBox = (CheckBox) findViewById(R.id.buildingActivityFavouriteCheckBox); - // favouritesCheckBox.setChecked(busStop.favourite); + favouritesCheckBox.setChecked(favouritesPrefs.getBoolean(ID, false)); favouritesCheckBox.setOnCheckedChangeListener(this); buildingName = (TextView) findViewById(R.id.buildingActivityName); @@ -80,17 +76,61 @@ public class BuildingActivity extends OrmLiteBaseActivity implem Log.i(TAG, "Building id " + ID); - buildingID.setText(ID); + try { + Dao buildingDao = getHelper().getBuildingDao(); + + building = buildingDao.queryForId(ID); + + buildingName.setText(building.name); + } catch (SQLException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + buildingID.setText(ID); try { - URL url = new URL("http://data.southampton.ac.uk/images/buildings/600/" + ID + ".jpg"); - InputStream is = (InputStream) url.getContent(); + /* First, get the Display from the WindowManager */ + Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); + + /* Now we can retrieve all display-related infos */ + int orientation = display.getOrientation(); + Log.i(TAG, "orientation " + orientation); + Log.i(TAG, "width " + display.getWidth() + " height " + display.getHeight()); + int width; + // if (orientation == 0) { + width = display.getWidth(); + // } else { + // width = display.getHeight(); + // } + + URL imageURL; + Log.i(TAG, "Screen width " + width); + if (width >= 1000) { + imageURL = new URL("http://data.southampton.ac.uk/images/buildings/1000/" + ID + ".jpg"); + } else if (width >= 800) { + imageURL = new URL("http://data.southampton.ac.uk/images/buildings/1000/" + ID + ".jpg"); + } else if (width >= 600) { + imageURL = new URL("http://data.southampton.ac.uk/images/buildings/600/" + ID + ".jpg"); + } else if (width >= 400) { + imageURL = new URL("http://data.southampton.ac.uk/images/buildings/600/" + ID + ".jpg"); + } else if (width >= 300) { + imageURL = new URL("http://data.southampton.ac.uk/images/buildings/300/" + ID + ".jpg"); + } else if (width >= 200) { + imageURL = new URL("http://data.southampton.ac.uk/images/buildings/200/" + ID + ".jpg"); + } else { + imageURL = new URL("http://data.southampton.ac.uk/images/buildings/100/" + ID + ".jpg"); + } + Log.i(TAG, "URL " + imageURL); + + InputStream is = (InputStream) imageURL.getContent(); Drawable image = Drawable.createFromStream(is, "src"); imageButton = new ImageButton(this); imageButton = (ImageButton) findViewById(R.id.buildingActivityImage); imageButton.setImageDrawable(image); + imageButton.setScaleType(ScaleType.CENTER_INSIDE); imageButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -105,51 +145,18 @@ public class BuildingActivity extends OrmLiteBaseActivity implem e.printStackTrace(); } - String directory = "/data/data/net.cbaines.suma/databases"; - Model model = TDBFactory.createModel(directory); - - String queryString = ID; - Query query = QueryFactory.create(queryString); - QueryExecution qexec = QueryExecutionFactory.create(query, model); - try { - ResultSet results = qexec.execSelect(); - for (; results.hasNext();) { - QuerySolution soln = results.nextSolution(); - - Log.i(TAG, "solution " + soln.toString()); - - for (Iterator iter = soln.varNames(); iter.hasNext();) { - Log.i(TAG, "solnVarName " + iter.next()); - } - - // RDFNode x = soln.get("varName"); // Get a result variable by - // name. - // Resource r = soln.getResource("VarR"); // Get a result - // variable - // - must be a resource - // Literal l = soln.getLiteral("VarL"); // Get a result variable - // - - // must be a literal - } - } finally { - qexec.close(); - } - } public void onResume() { super.onResume(); - } public void onPause() { - super.onPause(); } public void finish() { setResult(RESULT_OK, getIntent()); - super.finish(); } @@ -158,9 +165,14 @@ public class BuildingActivity extends OrmLiteBaseActivity implem return null; } - public void onCheckedChanged(CompoundButton arg0, boolean arg1) { - // TODO Auto-generated method stub + public void onCheckedChanged(CompoundButton button, boolean checked) { + SharedPreferences favouritesPreferences = getSharedPreferences(FAVOURITES_PREFERENCES, 0); + if (checked) { + favouritesPreferences.edit().putBoolean(building.id, true).commit(); + } else { + favouritesPreferences.edit().remove(building.id).commit(); + } } } diff --git a/src/net/cbaines/suma/BuildingNumOverlay.java b/src/net/cbaines/suma/BuildingNumOverlay.java index 74688a0..887f8b7 100644 --- a/src/net/cbaines/suma/BuildingNumOverlay.java +++ b/src/net/cbaines/suma/BuildingNumOverlay.java @@ -31,6 +31,8 @@ import org.osmdroid.views.overlay.Overlay; import android.app.Activity; import android.content.Intent; +import android.content.SharedPreferences; +import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; @@ -42,10 +44,7 @@ import android.util.Log; import android.view.MotionEvent; import android.widget.Toast; -import com.j256.ormlite.android.apptools.OpenHelperManager; -import com.j256.ormlite.dao.Dao; - -public class BuildingNumOverlay extends Overlay { +public class BuildingNumOverlay extends Overlay implements Preferences, OnSharedPreferenceChangeListener { private ArrayList buildings; @@ -64,8 +63,6 @@ public class BuildingNumOverlay extends Overlay { private final MapActivity context; - private Dao buildingDao; - private float userScale = 1f; public BuildingNumOverlay(MapActivity context, List buildings) throws SQLException { @@ -76,8 +73,8 @@ public class BuildingNumOverlay extends Overlay { marker = context.getResources().getDrawable(R.drawable.building); favMarker = context.getResources().getDrawable(R.drawable.building_fav); - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - buildingDao = helper.getBuildingDao(); + final SharedPreferences favouritesPrefs = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0); + favouritesPrefs.registerOnSharedPreferenceChangeListener(this); paint = new Paint(); paint.setColor(Color.BLACK); @@ -91,33 +88,24 @@ public class BuildingNumOverlay extends Overlay { } /** - * Draw a marker on each of our items. populate() must have been called - * first.
+ * Draw a marker on each of our items. populate() must have been called first.
*
- * The marker will be drawn twice for each Item in the Overlay--once in the - * shadow phase, skewed and darkened, then again in the non-shadow phase. - * The bottom-center of the marker will be aligned with the geographical - * coordinates of the Item.
+ * The marker will be drawn twice for each Item in the Overlay--once in the shadow phase, skewed and darkened, then again in + * the non-shadow phase. The bottom-center of the marker will be aligned with the geographical coordinates of the Item.
*
- * The order of drawing may be changed by overriding the getIndexToDraw(int) - * method. An item may provide an alternate marker via its - * OverlayItem.getMarker(int) method. If that method returns null, the - * default marker is used.
+ * The order of drawing may be changed by overriding the getIndexToDraw(int) method. An item may provide an alternate marker + * via its OverlayItem.getMarker(int) method. If that method returns null, the default marker is used.
*
- * The focused item is always drawn last, which puts it visually on top of - * the other items.
+ * The focused item is always drawn last, which puts it visually on top of the other items.
* * @param canvas - * the Canvas upon which to draw. Note that this may already have - * a transformation applied, so be sure to leave it the way you - * found it + * the Canvas upon which to draw. Note that this may already have a transformation applied, so be sure to leave it + * the way you found it * @param mapView - * the MapView that requested the draw. Use - * MapView.getProjection() to convert between on-screen pixels - * and latitude/longitude pairs + * the MapView that requested the draw. Use MapView.getProjection() to convert between on-screen pixels and + * latitude/longitude pairs * @param shadow - * if true, draw the shadow layer. If false, draw the overlay - * contents. + * if true, draw the shadow layer. If false, draw the overlay contents. */ @Override public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) { @@ -138,9 +126,10 @@ public class BuildingNumOverlay extends Overlay { marker.setBounds(mRect); favMarker.setBounds(mRect); + final SharedPreferences favouritesPrefs = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0); + /* - * Draw in backward cycle, so the items with the least index are on the - * front. + * Draw in backward cycle, so the items with the least index are on the front. */ for (Iterator buildingIter = buildings.iterator(); buildingIter.hasNext();) { final Building building = buildingIter.next(); @@ -148,9 +137,12 @@ public class BuildingNumOverlay extends Overlay { // Log.i(TAG, "Looking at drawing stop " + stop.id); pj.toMapPixels(building.point, mCurScreenCoords); + if (!pj.getBoundingBox().increaseByScale(1.2f).contains(building.point)) { + continue; + } // draw it - if (building.favourite) { + if (favouritesPrefs.getBoolean(building.id, false)) { Overlay.drawAt(canvas, favMarker, mCurScreenCoords.x, mCurScreenCoords.y, false); } else { Overlay.drawAt(canvas, marker, mCurScreenCoords.x, mCurScreenCoords.y, false); @@ -208,8 +200,7 @@ public class BuildingNumOverlay extends Overlay { Log.v(TAG, "building Pressed " + building.id); if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, building.name + " (" + building.id + ")", - Toast.LENGTH_SHORT); + context.activityToast = Toast.makeText(context, building.name + " (" + building.id + ")", Toast.LENGTH_SHORT); } else { context.activityToast.setDuration(Toast.LENGTH_SHORT); context.activityToast.setText(building.name + " (" + building.id + ")"); @@ -252,12 +243,13 @@ public class BuildingNumOverlay extends Overlay { } else { Log.v(TAG, "building Pressed " + building.id); - if (building.favourite) { - building.favourite = false; + final SharedPreferences favouritesPrefs = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0); + + if (favouritesPrefs.getBoolean(building.id, false)) { + favouritesPrefs.edit().remove(building.id).commit(); if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, building.id + " removed from favourites", - Toast.LENGTH_SHORT); + context.activityToast = Toast.makeText(context, building.id + " removed from favourites", Toast.LENGTH_SHORT); } else { context.activityToast.setDuration(Toast.LENGTH_SHORT); context.activityToast.setText(building.id + " removed from favourites"); @@ -266,25 +258,16 @@ public class BuildingNumOverlay extends Overlay { } else { if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, building.id + " made a favourite", - Toast.LENGTH_SHORT); + context.activityToast = Toast.makeText(context, building.id + " made a favourite", Toast.LENGTH_SHORT); } else { context.activityToast.setDuration(Toast.LENGTH_SHORT); context.activityToast.setText(building.id + " made a favourite"); } context.activityToast.show(); - building.favourite = true; + favouritesPrefs.edit().putBoolean(building.id, true).commit(); } - try { - buildingDao.update(building); - } catch (SQLException e) { - e.printStackTrace(); - } - - Collections.sort(buildings, new POIFavouriteComparator()); - mapView.invalidate(); return true; @@ -313,17 +296,10 @@ public class BuildingNumOverlay extends Overlay { return null; } - public void refresh() { - for (int i = 0; i < buildings.size(); i++) { - refresh(buildings.get(i)); - } - } + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { + Log.i(TAG, "Got a favourites change in the BuildingNumOverlay for key " + key); - public void refresh(Building building) { - if (building.favourite) { - buildings.remove(building); - buildings.add(building); - } + Collections.sort(buildings, new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0))); } } diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java index 0d4dea4..bc8e22e 100644 --- a/src/net/cbaines/suma/BusStopActivity.java +++ b/src/net/cbaines/suma/BusStopActivity.java @@ -59,13 +59,11 @@ import com.j256.ormlite.dao.Dao; import com.j256.ormlite.stmt.PreparedQuery; import com.j256.ormlite.stmt.QueryBuilder; -public class BusStopActivity extends OrmLiteBaseActivity implements OnCheckedChangeListener, - Preferences, OnItemClickListener { +public class BusStopActivity extends OrmLiteBaseActivity implements OnCheckedChangeListener, Preferences, + OnItemClickListener { final static String TAG = "BusTimeActivity"; - private boolean dataChanged; - private ListView busTimeList; private TextView busName; private TextView busID; @@ -110,6 +108,8 @@ public class BusStopActivity extends OrmLiteBaseActivity impleme final DatabaseHelper helper = getHelper(); + SharedPreferences favouritesPreferences = getSharedPreferences(FAVOURITES_PREFERENCES, 0); + instance = this; busStopID = getIntent().getExtras().getString("busStopID"); @@ -184,7 +184,7 @@ public class BusStopActivity extends OrmLiteBaseActivity impleme busStop = busStopDao.queryForId(busStopID); busFavourite = (CheckBox) findViewById(R.id.favouriteCheckBox); - busFavourite.setChecked(busStop.favourite); + busFavourite.setChecked(favouritesPreferences.getBoolean(busStop.id, false)); busFavourite.setOnCheckedChangeListener(this); } catch (SQLException e) { @@ -257,23 +257,18 @@ public class BusStopActivity extends OrmLiteBaseActivity impleme } public void finish() { - if (dataChanged) { - getIntent().putExtra("busStopChanged", busStopID); - } - setResult(RESULT_OK, getIntent()); - super.finish(); } public void onCheckedChanged(CompoundButton button, boolean checked) { if (button.equals(busFavourite)) { - busStop.favourite = checked; - try { - busStopDao.update(busStop); - dataChanged = true; - } catch (SQLException e) { - e.printStackTrace(); + SharedPreferences favouritesPreferences = getSharedPreferences(FAVOURITES_PREFERENCES, 0); + + if (checked) { + favouritesPreferences.edit().putBoolean(busStop.id, true).commit(); + } else { + favouritesPreferences.edit().remove(busStop.id).commit(); } } else { Log.i(TAG, "Route radio button made " + checked); @@ -300,10 +295,10 @@ public class BusStopActivity extends OrmLiteBaseActivity impleme try { final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(instance); - newTimetable = DataManager.getTimetable(instance, busStopID, sharedPrefs.getBoolean( - MapActivity.UNI_LINK_BUS_TIMES, MapActivity.UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT), sharedPrefs - .getBoolean(MapActivity.NON_UNI_LINK_BUS_TIMES, - MapActivity.NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)); + newTimetable = DataManager + .getTimetable(instance, busStopID, sharedPrefs.getBoolean(MapActivity.UNI_LINK_BUS_TIMES, + MapActivity.UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT), sharedPrefs.getBoolean( + MapActivity.NON_UNI_LINK_BUS_TIMES, MapActivity.NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)); } catch (SQLException e) { errorMessage = "Error message regarding SQL?"; e.printStackTrace(); diff --git a/src/net/cbaines/suma/BusStopOverlay.java b/src/net/cbaines/suma/BusStopOverlay.java index 060ad47..176bd4f 100644 --- a/src/net/cbaines/suma/BusStopOverlay.java +++ b/src/net/cbaines/suma/BusStopOverlay.java @@ -29,6 +29,7 @@ import org.osmdroid.views.overlay.Overlay; import android.app.Activity; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.Style; @@ -39,10 +40,7 @@ import android.util.Log; import android.view.MotionEvent; import android.widget.Toast; -import com.j256.ormlite.android.apptools.OpenHelperManager; -import com.j256.ormlite.dao.Dao; - -public class BusStopOverlay extends Overlay implements RouteColorConstants { +public class BusStopOverlay extends Overlay implements RouteColorConstants, Preferences { List busStops; @@ -61,8 +59,6 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { private final MapActivity context; - private Dao busStopDao; - private float userScale = 1f; private boolean[] routes = new boolean[5]; @@ -75,9 +71,6 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { marker = context.getResources().getDrawable(R.drawable.busstop); favMarker = context.getResources().getDrawable(R.drawable.busstop_fav); - DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); - busStopDao = helper.getBusStopDao(); - paint = new Paint(); paint.setStyle(Style.FILL); paint.setStrokeWidth(6); @@ -96,7 +89,7 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { return; } - float scale = mScale * userScale; + final float scale = mScale * userScale; final Projection pj = mapView.getProjection(); @@ -108,14 +101,20 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { marker.setBounds(mRect); favMarker.setBounds(mRect); + final SharedPreferences favouritesPreferences = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0); + /* - * Draw in backward cycle, so the items with the least index are on the - * front. + * Draw in backward cycle, so the items with the least index are on the front. */ for (int stopNum = 0; stopNum < busStops.size(); stopNum++) { BusStop stop = busStops.get(stopNum); + pj.toMapPixels(stop.point, mCurScreenCoords); + if (!pj.getBoundingBox().increaseByScale(1.2f).contains(stop.point)) { + continue; + } + byte routeNum = 0; final byte stopRoutes = stop.routes; @@ -137,9 +136,7 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { } - pj.toMapPixels(stop.point, mCurScreenCoords); - - if (stop.favourite) { + if (favouritesPreferences.getBoolean(stop.id, false)) { Overlay.drawAt(canvas, favMarker, mCurScreenCoords.x, mCurScreenCoords.y, false); } else { Overlay.drawAt(canvas, marker, mCurScreenCoords.x, mCurScreenCoords.y, false); @@ -148,12 +145,13 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { if (stop.uniLink) { int makersPlaced = 0; + + final float rectLeft = mCurScreenCoords.x + (8.8f * scale); + final float rectRight = rectLeft + (int) (8 * scale); + int yOfsetPerMarker = (int) (10 * scale); int markerYSize = (int) (8 * scale); - float rectLeft = mCurScreenCoords.x + (8.8f * scale); - float rectRight = rectLeft + markerYSize; - if (routeNum == 5) { markerYSize = (int) (5 * scale); yOfsetPerMarker = (int) (7 * scale); @@ -165,12 +163,6 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { for (int i = 0; i < 5; i++) { if ((stopRoutes & (1 << i)) != 0) { - // Log.i(TAG, "Route " + route + " is " + - // routes.get(route)); - - // Log.i(TAG, "Index is " + busRoutes.indexOf(route) + - // " busRoutes " + busRoutes); - if (i == 0) { paint.setColor(U1); } else if (i == 1) { @@ -185,9 +177,9 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { Log.e(TAG, "Unknown route code"); } - canvas.drawRect(rectLeft, mCurScreenCoords.y - + ((yOfsetPerMarker * makersPlaced) - (45 * scale)), rectRight, mCurScreenCoords.y - + (yOfsetPerMarker * makersPlaced) - ((45 * scale) - markerYSize), paint); + canvas.drawRect(rectLeft, mCurScreenCoords.y + ((yOfsetPerMarker * makersPlaced) - (45 * scale)), + rectRight, mCurScreenCoords.y + (yOfsetPerMarker * makersPlaced) - ((45 * scale) - markerYSize), + paint); makersPlaced++; } @@ -208,8 +200,8 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { Log.i(TAG, "busStop Pressed " + busStop.id); if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, busStop.description + " (" + busStop.id + ")", - Toast.LENGTH_SHORT); + context.activityToast = Toast + .makeText(context, busStop.description + " (" + busStop.id + ")", Toast.LENGTH_SHORT); } else { context.activityToast.setDuration(Toast.LENGTH_SHORT); context.activityToast.setText(busStop.description + " (" + busStop.id + ")"); @@ -251,12 +243,13 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { } else { Log.i(TAG, "Pressed " + busStop.id); - if (busStop.favourite) { - busStop.favourite = false; + SharedPreferences favouritesPreferences = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0); + + if (favouritesPreferences.getBoolean(busStop.id, false)) { + favouritesPreferences.edit().putBoolean(busStop.id, false).commit(); if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, busStop.id + " removed from favourites", - Toast.LENGTH_SHORT); + context.activityToast = Toast.makeText(context, busStop.id + " removed from favourites", Toast.LENGTH_SHORT); } else { context.activityToast.setDuration(Toast.LENGTH_SHORT); context.activityToast.setText(busStop.id + " removed from favourites"); @@ -264,62 +257,22 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { context.activityToast.show(); } else { if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, busStop.id + " made a favourite", - Toast.LENGTH_SHORT); + context.activityToast = Toast.makeText(context, busStop.id + " made a favourite", Toast.LENGTH_SHORT); } else { context.activityToast.setDuration(Toast.LENGTH_SHORT); context.activityToast.setText(busStop.id + " made a favourite"); } context.activityToast.show(); - busStop.favourite = true; + favouritesPreferences.edit().putBoolean(busStop.id, true).commit(); } - try { - busStopDao.update(busStop); - } catch (SQLException e) { - e.printStackTrace(); - } - - Collections.sort(busStops, new POIFavouriteComparator()); - mapView.invalidate(); return true; } } - public void refresh() { - try { - for (int i = 0; i < busStops.size(); i++) { - BusStop busStop = busStops.get(i); - busStopDao.refresh(busStop); - if (busStop.favourite) { - busStops.remove(i); - busStops.add(busStop); - } else { - busStops.set(i, busStop); - } - } - } catch (SQLException e) { - e.printStackTrace(); - } - } - - /** - * Replaces any bus stops that equal the argument in the overlay with the - * argument - * - * @param busStop - */ - public void refresh(BusStop busStop) { - for (int i = 0; i < busStops.size(); i++) { - if (busStop.equals(busStops.get(i))) { - busStops.set(i, busStop); - } - } - } - private BusStop getSelectedItem(final MotionEvent event, final MapView mapView) { final Projection pj = mapView.getProjection(); final int eventX = (int) event.getX(); @@ -354,4 +307,10 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants { return null; } + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { + Log.i(TAG, "Got a favourites change in the BuildingNumOverlay for key " + key); + + Collections.sort(busStops, new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0))); + } + } diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index b4a0e3d..fbede76 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -23,8 +23,6 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.io.StringWriter; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; @@ -60,8 +58,6 @@ import org.xml.sax.XMLReader; import android.content.Context; import android.util.Log; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.tdb.TDBFactory; import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.dao.Dao; import com.j256.ormlite.stmt.PreparedQuery; @@ -213,64 +209,6 @@ public class DataManager { } - public static void loadBuildingPhotos(Context context) { - // Direct way: Make a TDB-backed Jena model in the named directory. - String directory = "/data/data/net.cbaines.suma/databases"; - Model model = TDBFactory.createModel(directory); - - Log.i(TAG, "Created the model"); - - // write it to standard out - StringWriter sw = new StringWriter(); - model.write(new PrintWriter(sw)); - Log.v(TAG, sw.toString()); - - Log.i(TAG, "Finished the first output"); - - if (model.isEmpty()) { - - Log.i(TAG, "Model is empty"); - - // use the FileManager to find the input file - InputStream in; - try { - - String[] datasets = { "photos.rdf", "places.rdf" }; - - for (String dataset : datasets) { - - in = context.getAssets().open(dataset); - - if (in == null) { - throw new IllegalArgumentException(dataset + " not found"); - } - - // read the RDF/XML file - model.read(in, null); - - Log.i(TAG, "Finished the read of " + dataset); - - } - - // write it to standard out - sw = new StringWriter(); - model.write(new PrintWriter(sw)); - Log.i(TAG, sw.toString()); - - Log.i(TAG, "Finished the second output"); - - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - model.close(); - - Log.i(TAG, "Closed the model"); - } - public static void loadBusData(Context context, boolean onlyUniLink) throws SQLException, IOException { DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index 334f4d2..33b12cd 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -70,9 +70,8 @@ import com.j256.ormlite.dao.Dao; * @author Christopher Baines * */ -public class MapActivity extends OrmLiteBaseActivity implements MapViewConstants, Runnable, - RouteColorConstants, OnItemClickListener, OnItemLongClickListener, OnSharedPreferenceChangeListener, - Preferences { +public class MapActivity extends OrmLiteBaseActivity implements MapViewConstants, Runnable, RouteColorConstants, + OnItemClickListener, OnItemLongClickListener, OnSharedPreferenceChangeListener, Preferences { /** * Enable to use the database in the assets folder, if its not enabled, the @@ -126,11 +125,10 @@ public class MapActivity extends OrmLiteBaseActivity implements private static final int NON_UNI_LINK_BUS_STOP_OVERLAY_RANK = 4; // -- Site Overlays - static final String[] SITE_NAMES = { "Highfield Campus", "Boldrewood Campus", "Avenue Campus", - "Winchester School of Art", "The University of Southampton Science Park", - "National Oceanography Centre Campus", "Boat House", "Southampton General Hospital", - "Royal South Hants Hospital", "Belgrave Industrial Site", "Highfield Hall", "Glen Eyre Hall", - "South Hill Hall", "Chamberlain Hall", "Hartley Grove", "Bencraft Hall", "Connaught Hall", + static final String[] SITE_NAMES = { "Highfield Campus", "Boldrewood Campus", "Avenue Campus", "Winchester School of Art", + "The University of Southampton Science Park", "National Oceanography Centre Campus", "Boat House", + "Southampton General Hospital", "Royal South Hants Hospital", "Belgrave Industrial Site", "Highfield Hall", + "Glen Eyre Hall", "South Hill Hall", "Chamberlain Hall", "Hartley Grove", "Bencraft Hall", "Connaught Hall", "Montefiore Hall", "Stoneham Hall", "Erasmus Park" }; private static final String SITE_OVERLAYS = "siteOverlays:"; @@ -168,8 +166,8 @@ public class MapActivity extends OrmLiteBaseActivity implements // Uni-Link routes static final String[] UNI_LINK_ROUTES = { "U1", "U1N", "U2", "U6", "U9" }; - static final String[] PREFERENCES_GROUPS = { BUS_STOP_OVERLAYS, BUS_ROUTE_OVERLAYS, BUILDING_OVERLAYS, - SITE_OVERLAYS, OTHER_OVERLAYS }; + static final String[] PREFERENCES_GROUPS = { BUS_STOP_OVERLAYS, BUS_ROUTE_OVERLAYS, BUILDING_OVERLAYS, SITE_OVERLAYS, + OTHER_OVERLAYS }; static final String[][] PREFERENCES_CHILDREN = { UNI_LINK_ROUTES, UNI_LINK_ROUTES, BUILDING_TYPES, SITE_NAMES, OTHER_OVERLAY_NAMES }; @@ -259,12 +257,6 @@ public class MapActivity extends OrmLiteBaseActivity implements mapController.setCenter(userLocation); Log.i(TAG, "Finished onCreate " + (System.currentTimeMillis() - startTime)); - - new Thread() { - public void run() { - DataManager.loadBuildingPhotos(instance); - } - }.start(); } public void onResume() { @@ -503,8 +495,7 @@ public class MapActivity extends OrmLiteBaseActivity implements if (scaleBarOverlay != null) { Log.v(TAG, "ScaleBarOverlay is already created"); } else { - if (pastOverlays != null - && (scaleBarOverlay = (ScaleBarOverlay) pastOverlays.get(SCALE_BAR_OVERLAY)) != null) { + if (pastOverlays != null && (scaleBarOverlay = (ScaleBarOverlay) pastOverlays.get(SCALE_BAR_OVERLAY)) != null) { Log.i(TAG, "Finished restoring utility overlays " + (System.currentTimeMillis() - startTime)); } else { scaleBarOverlay = new ScaleBarOverlay(instance); @@ -533,8 +524,7 @@ public class MapActivity extends OrmLiteBaseActivity implements private void showRouteOverlay(final BusRoute route) { new Thread(new Runnable() { public void run() { - Log.i(TAG, "Begining showing route " + route.code + " overlay at " - + (System.currentTimeMillis() - startTime)); + Log.i(TAG, "Begining showing route " + route.code + " overlay at " + (System.currentTimeMillis() - startTime)); final SharedPreferences activityPrefs = getPreferences(0); final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); @@ -559,8 +549,8 @@ public class MapActivity extends OrmLiteBaseActivity implements // TODO Is this a route like U1N or, something else, // this hack works somewhat for now? - PathOverlay routeOverlayU1E = DataManager.getRoutePath( - getResources().openRawResource(R.raw.u1e), colour, mResourceProxy); + PathOverlay routeOverlayU1E = DataManager.getRoutePath(getResources().openRawResource(R.raw.u1e), + colour, mResourceProxy); routeOverlayU1E.getPaint().setAntiAlias(true); routeOverlayU1E.getPaint().setAlpha(145); routeOverlayU1E.getPaint().setStrokeWidth(12); @@ -613,8 +603,7 @@ public class MapActivity extends OrmLiteBaseActivity implements mapView.postInvalidate(); - Log.i(TAG, "Finished showing route " + route.code + " overlay at " - + (System.currentTimeMillis() - startTime)); + Log.i(TAG, "Finished showing route " + route.code + " overlay at " + (System.currentTimeMillis() - startTime)); } }).start(); } @@ -623,8 +612,7 @@ public class MapActivity extends OrmLiteBaseActivity implements new Thread(new Runnable() { public void run() { - Log.i(TAG, "Begining showing site " + site.name + " overlay at " - + (System.currentTimeMillis() - startTime)); + Log.i(TAG, "Begining showing site " + site.name + " overlay at " + (System.currentTimeMillis() - startTime)); final SharedPreferences activityPrefs = getPreferences(0); final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); @@ -633,8 +621,7 @@ public class MapActivity extends OrmLiteBaseActivity implements if ((siteOverlay = siteOverlays.get(site)) != null) { } else { - if (pastOverlays != null - && (siteOverlay = (PathOverlay) pastOverlays.get(SITE_OVERLAYS + site.name)) != null) { + if (pastOverlays != null && (siteOverlay = (PathOverlay) pastOverlays.get(SITE_OVERLAYS + site.name)) != null) { Log.i(TAG, "Restored " + site.name + " site overlay"); } else { @@ -660,13 +647,11 @@ public class MapActivity extends OrmLiteBaseActivity implements } } - siteOverlay.setEnabled(activityPrefs.getBoolean(SITE_OVERLAYS + site.name, - SITE_OVERLAYS_ENABLED_BY_DEFAULT)); + siteOverlay.setEnabled(activityPrefs.getBoolean(SITE_OVERLAYS + site.name, SITE_OVERLAYS_ENABLED_BY_DEFAULT)); mapView.postInvalidate(); - Log.i(TAG, "Finished showing site " + site.name + " overlay at " - + (System.currentTimeMillis() - startTime)); + Log.i(TAG, "Finished showing site " + site.name + " overlay at " + (System.currentTimeMillis() - startTime)); } }).start(); } @@ -683,10 +668,8 @@ public class MapActivity extends OrmLiteBaseActivity implements } else { if (pastOverlays != null - && (residentialBuildingOverlay = (BuildingNumOverlay) pastOverlays - .get(RESIDENTIAL_BUILDING_OVERLAY)) != null) { - nonResidentialBuildingOverlay = (BuildingNumOverlay) pastOverlays - .get(NON_RESIDENTIAL_BUILDING_OVERLAY); + && (residentialBuildingOverlay = (BuildingNumOverlay) pastOverlays.get(RESIDENTIAL_BUILDING_OVERLAY)) != null) { + nonResidentialBuildingOverlay = (BuildingNumOverlay) pastOverlays.get(NON_RESIDENTIAL_BUILDING_OVERLAY); Log.i(TAG, "Restored building overlays"); } else { @@ -701,15 +684,17 @@ public class MapActivity extends OrmLiteBaseActivity implements buildingDao = getHelper().getBuildingDao(); + final SharedPreferences favouritesPrefs = getSharedPreferences(FAVOURITES_PREFERENCES, 0); + for (Building building : buildingDao) { if (building.residential == true) { - if (building.favourite) { + if (favouritesPrefs.getBoolean(building.id, false)) { residentialBuildings.add(building); } else { residentialBuildings.add(0, building); } } else { - if (building.favourite) { + if (favouritesPrefs.getBoolean(building.id, false)) { nonResidentialBuildings.add(building); } else { nonResidentialBuildings.add(0, building); @@ -737,8 +722,8 @@ public class MapActivity extends OrmLiteBaseActivity implements } } - residentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS - + RESIDENTIAL_BUILDING_OVERLAY, RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); + residentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS + RESIDENTIAL_BUILDING_OVERLAY, + RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); nonResidentialBuildingOverlay.setEnabled(activityPrefs.getBoolean(BUILDING_OVERLAYS + NON_RESIDENTIAL_BUILDING_OVERLAY, NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); @@ -758,16 +743,11 @@ public class MapActivity extends OrmLiteBaseActivity implements final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0)); if (uniLinkBusStopOverlay != null) { - if (!activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { + if (!activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + && !activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { Log.i(TAG, "Uni-Link bus stop overlay not needed"); overlays.remove(UNI_LINK_BUS_STOP_OVERLAY); @@ -778,31 +758,25 @@ public class MapActivity extends OrmLiteBaseActivity implements uniLinkBusStopOverlay = null; } else { - uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(0, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(1, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(2, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(3, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(4, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); } } else { - if (activityPrefs - .getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) - || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { + if (activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT) + || activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { if (pastOverlays != null - && (uniLinkBusStopOverlay = (BusStopOverlay) pastOverlays - .get(UNI_LINK_BUS_STOP_OVERLAY)) != null) { + && (uniLinkBusStopOverlay = (BusStopOverlay) pastOverlays.get(UNI_LINK_BUS_STOP_OVERLAY)) != null) { Log.i(TAG, "Restored Uni-Link bus stop overlay"); } else { @@ -820,16 +794,16 @@ public class MapActivity extends OrmLiteBaseActivity implements } } - uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", - UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(0, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(1, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(2, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(3, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + uniLinkBusStopOverlay.setRoutes(4, + activityPrefs.getBoolean(BUS_STOP_OVERLAYS + "U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); overlays.put(UNI_LINK_BUS_STOP_OVERLAY, uniLinkBusStopOverlay); @@ -852,8 +826,7 @@ public class MapActivity extends OrmLiteBaseActivity implements private void showNonUniLinkBusStopOverlay() { new Thread(new Runnable() { public void run() { - Log.i(TAG, "Begining showing non uni link bus stop overlays at " - + (System.currentTimeMillis() - startTime)); + Log.i(TAG, "Begining showing non uni link bus stop overlays at " + (System.currentTimeMillis() - startTime)); // final SharedPreferences activityPrefs = getPreferences(0); final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(instance); @@ -870,14 +843,12 @@ public class MapActivity extends OrmLiteBaseActivity implements } else if (sharedPrefs.getBoolean(NON_UNI_LINK_BUS_STOPS_OVERLAY, NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)) { if (pastOverlays != null - && (nonUniLinkBusStopOverlay = (BusStopOverlay) pastOverlays - .get(NON_UNI_LINK_BUS_STOPS_OVERLAY)) != null) { + && (nonUniLinkBusStopOverlay = (BusStopOverlay) pastOverlays.get(NON_UNI_LINK_BUS_STOPS_OVERLAY)) != null) { Log.i(TAG, "Restored non Uni-Link bus stop overlays"); } else { try { List busStops; - Log.v(TAG, "Begin fetching non Uni-Link BusStops at " - + (System.currentTimeMillis() - startTime)); + Log.v(TAG, "Begin fetching non Uni-Link BusStops at " + (System.currentTimeMillis() - startTime)); busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, false); @@ -907,8 +878,7 @@ public class MapActivity extends OrmLiteBaseActivity implements mapView.postInvalidate(); - Log.i(TAG, "Finished showing non Uni-Link bus stop overlays at " - + (System.currentTimeMillis() - startTime)); + Log.i(TAG, "Finished showing non Uni-Link bus stop overlays at " + (System.currentTimeMillis() - startTime)); } }).start(); } @@ -959,9 +929,8 @@ public class MapActivity extends OrmLiteBaseActivity implements }; AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage("GPS is not enabled, do you wish to enable it?") - .setPositiveButton("Yes", dialogClickListener).setNegativeButton("No", dialogClickListener) - .show(); + builder.setMessage("GPS is not enabled, do you wish to enable it?").setPositiveButton("Yes", dialogClickListener) + .setNegativeButton("No", dialogClickListener).show(); } return true; @@ -1056,49 +1025,13 @@ public class MapActivity extends OrmLiteBaseActivity implements } } else { Log.i(TAG, "Got null poi id"); - - // mapController.setZoom(15); - // mapController.setCenter(new GeoPoint(50935551, - // -1393488)); - } - - // This handles the possible change in favourite state caused by - // the user within the BusTimeActivity - try { - String busStopID = bundle.getString("busStopChanged"); - if (busStopID != null && busStopID.length() != 0) { - Log.v(TAG, "Got a busStop id back from the BusTimeActivity " + busStopID); - BusStop busStop = getHelper().getBusStopDao().queryForId(busStopID); - - if (busStop.uniLink) { - uniLinkBusStopOverlay.refresh(busStop); // This does - // not - // invalidate - // the map, - // but it - // seems to - // make the changes appear - } else { - nonUniLinkBusStopOverlay.refresh(busStop); // This - // does - // not - // invalidate - // the - // map, - // but - // it - // seems - // to - // make the changes appear - } - } - } catch (SQLException e) { - e.printStackTrace(); } if (favDialog != null) { refreshFavouriteDialog(); } + + mapView.invalidate(); } } diff --git a/src/net/cbaines/suma/POI.java b/src/net/cbaines/suma/POI.java index 244198d..e815731 100644 --- a/src/net/cbaines/suma/POI.java +++ b/src/net/cbaines/suma/POI.java @@ -48,9 +48,6 @@ public abstract class POI { @DatabaseField(id = true) public String id; - @DatabaseField(canBeNull = false) - public boolean favourite; // This field is not assessed by equals - public int distTo = -1; // Used by the comparator to store distances, then later by the gui to display them. public String type; diff --git a/src/net/cbaines/suma/POIFavouriteComparator.java b/src/net/cbaines/suma/POIFavouriteComparator.java index 94148d4..341ff4c 100644 --- a/src/net/cbaines/suma/POIFavouriteComparator.java +++ b/src/net/cbaines/suma/POIFavouriteComparator.java @@ -21,20 +21,28 @@ package net.cbaines.suma; import java.util.Comparator; +import android.content.SharedPreferences; + public class POIFavouriteComparator implements Comparator { - public int compare(POI poi1, POI poi2) { - if (poi1.favourite) { - if (poi2.favourite) { - return 0; - } else { - return 1; - } - } else if (poi2.favourite) { - return -1; - } else { - return 0; + SharedPreferences favourites; + + POIFavouriteComparator(SharedPreferences favourites) { + this.favourites = favourites; + } + + public int compare(POI poi1, POI poi2) { + if (favourites.getBoolean(poi1.id, false)) { + if (favourites.getBoolean(poi2.id, false)) { + return 0; + } else { + return 1; + } + } else if (favourites.getBoolean(poi2.id, false)) { + return -1; + } else { + return 0; + } } - } } diff --git a/src/net/cbaines/suma/Preferences.java b/src/net/cbaines/suma/Preferences.java index a978dd9..84e1d27 100644 --- a/src/net/cbaines/suma/Preferences.java +++ b/src/net/cbaines/suma/Preferences.java @@ -10,4 +10,6 @@ public interface Preferences { static final boolean NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT = false; static final String NON_UNI_LINK_BUS_STOPS_OVERLAY = "nonUniLinkBusStops"; static final boolean NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT = false; + + static final String FAVOURITES_PREFERENCES = "favourites"; } -- cgit v1.2.3 From 81c21ccf040f6c050525de99a8a8078bd8ef03ac Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 26 Feb 2012 18:16:40 +0000 Subject: Move to version 0.4 --- AndroidManifest.xml | 4 ++-- gen/net/cbaines/suma/R.java | 1 + res/layout/building_activity.xml | 3 ++- res/values/strings.xml | 1 + src/net/cbaines/suma/BuildingActivity.java | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3a93397..6355013 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="7" + android:versionName="0.4 (alpha)" > diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java index 3c3078e..06657e6 100644 --- a/gen/net/cbaines/suma/R.java +++ b/gen/net/cbaines/suma/R.java @@ -183,6 +183,7 @@ public final class R { public static final int about_version_summary=0x7f070036; public static final int app_name=0x7f070004; public static final int bitcoin_error_message=0x7f07001b; + public static final int buildingImageDescription=0x7f07004f; public static final int building_non_residential=0x7f070007; public static final int building_residential=0x7f070006; public static final int bustimes_favourite_checkbox_label=0x7f07002e; diff --git a/res/layout/building_activity.xml b/res/layout/building_activity.xml index a76ad53..6ed937f 100644 --- a/res/layout/building_activity.xml +++ b/res/layout/building_activity.xml @@ -34,6 +34,7 @@ android:id="@+id/buildingActivityImage" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:background="@null" /> + android:background="@null" + android:contentDescription="@string/buildingImageDescription" /> \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index c602a26..e95a802 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -127,5 +127,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< Using the ORMLite library. Donate Make a personal donation to the developer through Bitcoin. + Image of the Building \ No newline at end of file diff --git a/src/net/cbaines/suma/BuildingActivity.java b/src/net/cbaines/suma/BuildingActivity.java index 45babbc..6b03164 100644 --- a/src/net/cbaines/suma/BuildingActivity.java +++ b/src/net/cbaines/suma/BuildingActivity.java @@ -72,7 +72,7 @@ public class BuildingActivity extends OrmLiteBaseActivity implem favouritesCheckBox.setOnCheckedChangeListener(this); buildingName = (TextView) findViewById(R.id.buildingActivityName); - buildingID = (TextView) findViewById(R.id.buildingActivityName); + buildingID = (TextView) findViewById(R.id.buildingActivityID); Log.i(TAG, "Building id " + ID); -- cgit v1.2.3 From b640f758e603305a3c32c283c9237dbe47f2cdee Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 26 Feb 2012 19:48:31 +0000 Subject: Fixed another bug to do with a unreactive bus stop, improved the U1 route overlay. --- assets/data.db | Bin 492544 -> 490496 bytes res/raw/u1.gpx | 78 +++++++++++++++++---- res/values/strings.xml | 2 +- src/net/cbaines/suma/BusStopOverlay.java | 4 +- src/net/cbaines/suma/DataManager.java | 112 +++++++++++-------------------- src/net/cbaines/suma/DatabaseHelper.java | 2 +- src/net/cbaines/suma/MapActivity.java | 27 ++++---- 7 files changed, 122 insertions(+), 103 deletions(-) diff --git a/assets/data.db b/assets/data.db index c8bcc9e..a423ad8 100644 Binary files a/assets/data.db and b/assets/data.db differ diff --git a/res/raw/u1.gpx b/res/raw/u1.gpx index f4a2959..9c6b8b1 100644 --- a/res/raw/u1.gpx +++ b/res/raw/u1.gpx @@ -6,11 +6,7 @@ chrisb8 - - 2012 - http://creativecommons.org/licenses/by-sa/2.5 - - + @@ -707,30 +703,84 @@ - + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index e95a802..6333664 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -102,7 +102,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< About Version - 0.3 (alpha) + 0.4 (alpha) Copyright © 2012, Christopher Baines License diff --git a/src/net/cbaines/suma/BusStopOverlay.java b/src/net/cbaines/suma/BusStopOverlay.java index 176bd4f..7894be2 100644 --- a/src/net/cbaines/suma/BusStopOverlay.java +++ b/src/net/cbaines/suma/BusStopOverlay.java @@ -274,6 +274,8 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants, Pref } private BusStop getSelectedItem(final MotionEvent event, final MapView mapView) { + Log.i(TAG, "Getting selected item"); + final Projection pj = mapView.getProjection(); final int eventX = (int) event.getX(); final int eventY = (int) event.getY(); @@ -281,7 +283,7 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants, Pref /* These objects are created to avoid construct new ones every cycle. */ pj.fromMapPixels(eventX, eventY, mTouchScreenPoint); - for (int i = busStops.size() - 1; i > 0; i--) { + for (int i = busStops.size() - 1; i >= 0; i--) { BusStop busStop = busStops.get(i); pj.toPixels(busStop.point, mItemPoint); diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index fbede76..2234328 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -137,13 +137,9 @@ public class DataManager { /* * Polygon poly = buildingPolys.get(dataBits[1]); * - * if (poly != null) { bdg.outline = poly; // Log.i(TAG, - * "Adding building " + key + " " + - * bdg.point.getLatitudeE6() + " " + - * bdg.point.getLongitudeE6() + " " + poly); } else { // - * Log.i(TAG, "Adding building " + key + " " + - * bdg.point.getLatitudeE6() + " " + - * bdg.point.getLongitudeE6()); } + * if (poly != null) { bdg.outline = poly; // Log.i(TAG, "Adding building " + key + " " + + * bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6() + " " + poly); } else { // Log.i(TAG, + * "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6()); } */ // Log.i(TAG, "Creating building " + bdg.id + " " + bdg.name @@ -167,13 +163,9 @@ public class DataManager { /* * Polygon poly = buildingPolys.get(dataBits[1]); * - * if (poly != null) { bdg.outline = poly; // Log.i(TAG, - * "Adding building " + key + " " + - * bdg.point.getLatitudeE6() + " " + - * bdg.point.getLongitudeE6() + " " + poly); } else { // - * Log.i(TAG, "Adding building " + key + " " + - * bdg.point.getLatitudeE6() + " " + - * bdg.point.getLongitudeE6()); } + * if (poly != null) { bdg.outline = poly; // Log.i(TAG, "Adding building " + key + " " + + * bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6() + " " + poly); } else { // Log.i(TAG, + * "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6()); } */ // Log.i(TAG, "Creating building " + bdg.id + " " + bdg.name @@ -192,17 +184,13 @@ public class DataManager { } /* - * for (Iterator iter = buildingPoints.keySet().iterator(); - * iter.hasNext();) { String key = iter.next(); + * for (Iterator iter = buildingPoints.keySet().iterator(); iter.hasNext();) { String key = iter.next(); * - * Building bdg = new Building(key, buildingPoints.get(key), false); - * Polygon poly = buildingPolys.get(key); + * Building bdg = new Building(key, buildingPoints.get(key), false); Polygon poly = buildingPolys.get(key); * - * if (poly != null) { bdg.outline = poly; // Log.i(TAG, - * "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + - * bdg.point.getLongitudeE6() + " " + poly); } else { // Log.i(TAG, - * "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + - * bdg.point.getLongitudeE6()); } + * if (poly != null) { bdg.outline = poly; // Log.i(TAG, "Adding building " + key + " " + bdg.point.getLatitudeE6() + " " + * + bdg.point.getLongitudeE6() + " " + poly); } else { // Log.i(TAG, "Adding building " + key + " " + + * bdg.point.getLatitudeE6() + " " + bdg.point.getLongitudeE6()); } * * buildingDao.create(bdg); } */ @@ -239,18 +227,18 @@ public class DataManager { // Log.i(TAG, "Whole " + dataBits[3] + " First bit " + // quBitsLat[0] + " last bit " + quBitsLat[1]); - double lat = Double.valueOf(quBitsLat[0]) - + Double.valueOf(quBitsLat[1].substring(0, quBitsLat[1].length() - 1)) / 60d; + double lat = Double.valueOf(quBitsLat[0]) + Double.valueOf(quBitsLat[1].substring(0, quBitsLat[1].length() - 1)) + / 60d; // Log.i(TAG, "Whole " + dataBits[4] + " First bit " + // quBitsLng[0] + " last bit " + quBitsLng[1]); - double lng = Double.valueOf(quBitsLng[0]) - + Double.valueOf(quBitsLng[1].substring(0, quBitsLng[1].length() - 1)) / 60d; + double lng = Double.valueOf(quBitsLng[0]) + Double.valueOf(quBitsLng[1].substring(0, quBitsLng[1].length() - 1)) + / 60d; GeoPoint point = new GeoPoint((int) (lat * 1e6), (int) (lng * -1e6)); // Log.i(TAG, "Lat " + point.getLatitudeE6() + " lng " + // point.getLongitudeE6()); - busStopDao.create(new BusStop(dataBits[0].replace("\"", ""), dataBits[1].replace("\"", ""), dataBits[2] - .replace("\"", ""), point)); + busStopDao.create(new BusStop(dataBits[0].replace("\"", ""), dataBits[1].replace("\"", ""), dataBits[2].replace( + "\"", ""), point)); } @@ -359,10 +347,6 @@ public class DataManager { busStop.uniLink = true; } - if ((busStop.routes != 0) != busStop.uniLink || busStop.id.equals("SN120553")) { - Log.e(TAG, busStop.id + " " + busStop.routes + " " + busStop.uniLink); - } - // Log.v(TAG, "Stop routes " + busStop.routes); busStopDao.update(busStop); @@ -375,36 +359,26 @@ public class DataManager { } /* - * for (Iterator busStopIter = busStopDao.iterator(); - * busStopIter.hasNext();) { BusStop stop = busStopIter.next(); // - * Log.i(TAG, "Looking at stop " + stop.id); + * for (Iterator busStopIter = busStopDao.iterator(); busStopIter.hasNext();) { BusStop stop = + * busStopIter.next(); // Log.i(TAG, "Looking at stop " + stop.id); * * - * QueryBuilder routeStopsQueryBuilder = - * routeStopsDao.queryBuilder(); + * QueryBuilder routeStopsQueryBuilder = routeStopsDao.queryBuilder(); * routeStopsQueryBuilder.where().eq(columnName, value) * - * DeleteBuilder deleteBuilder = - * busStopDao.deleteBuilder(); // only delete the rows where password is - * null deleteBuilder.where().in(RouteStops.STOP_ID_FIELD_NAME, objects) - * accountDao.delete(deleteBuilder.prepare()); + * DeleteBuilder deleteBuilder = busStopDao.deleteBuilder(); // only delete the rows where password is + * null deleteBuilder.where().in(RouteStops.STOP_ID_FIELD_NAME, objects) accountDao.delete(deleteBuilder.prepare()); * * - * QueryBuilder routeStopsQueryBuilder = - * routeStopsDao.queryBuilder(); - * routeStopsQueryBuilder.setCountOf(true); - * routeStopsQueryBuilder.where().eq(RouteStops.STOP_ID_FIELD_NAME, - * stop); + * QueryBuilder routeStopsQueryBuilder = routeStopsDao.queryBuilder(); + * routeStopsQueryBuilder.setCountOf(true); routeStopsQueryBuilder.where().eq(RouteStops.STOP_ID_FIELD_NAME, stop); * - * PreparedQuery routeStopsPreparedQuery = - * routeStopsQueryBuilder.prepare(); List routeStops = - * routeStopsDao.query(routeStopsPreparedQuery); // long num = - * routeStopsDao.query(routeStopsPreparedQuery).size(); // Log.i(TAG, - * "Number is " + num); + * PreparedQuery routeStopsPreparedQuery = routeStopsQueryBuilder.prepare(); List routeStops = + * routeStopsDao.query(routeStopsPreparedQuery); // long num = routeStopsDao.query(routeStopsPreparedQuery).size(); // + * Log.i(TAG, "Number is " + num); * - * stop.uniLink = false; for (RouteStops routeStop : routeStops) { if - * (routeStop.busRoute.uniLink) { stop.uniLink = true; } } - * busStopDao.update(stop); } + * stop.uniLink = false; for (RouteStops routeStop : routeStops) { if (routeStop.busRoute.uniLink) { stop.uniLink = true; + * } } busStopDao.update(stop); } */ Log.i(TAG, "Finished loading bus data"); @@ -454,8 +428,8 @@ public class DataManager { Log.i(TAG, "Loaded sites from csv"); } - private static Stop getStop(Context context, JSONObject stopObj, Set routes, BusStop busStop) - throws SQLException, JSONException { + private static Stop getStop(Context context, JSONObject stopObj, Set routes, BusStop busStop) throws SQLException, + JSONException { if (helper == null) helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); @@ -504,13 +478,12 @@ public class DataManager { route = tempRoute; dir = null; } - } else { - if (tempRoute == null) { - Log.e(TAG, "tempRoute == null"); - } - if (tempRoute.code == null) { - Log.e(TAG, "tempRoute.code == null"); + } else if (name.equals("U1E")) { + if (tempRoute.code.equals("U1")) { + route = tempRoute; + dir = "E"; } + } else { if (tempRoute.code.equals(name.substring(0, 2))) { route = tempRoute; if (route.forwardDirection.equals(name.substring(2))) { @@ -580,11 +553,9 @@ public class DataManager { List routeStops = routeStopsDao.query(routeStopsPreparedQuery); if (routeStops.size() > 0) { - Log.i(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " - + route.code); + Log.i(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + route.code); } else { - Log.w(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " - + route.code); + Log.w(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + route.code); } } @@ -652,8 +623,7 @@ public class DataManager { if (route != null) { busRoutes.add(route); } else { - throw new RuntimeException("Route not found " + key.substring(key.length() - 3, key.length()) + " " - + key); + throw new RuntimeException("Route not found " + key.substring(key.length() - 3, key.length()) + " " + key); } } @@ -749,8 +719,8 @@ public class DataManager { continue; } - Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id - + " at " + stop.arivalTime); + Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id + " at " + + stop.arivalTime); timetable.add(stop); diff --git a/src/net/cbaines/suma/DatabaseHelper.java b/src/net/cbaines/suma/DatabaseHelper.java index 2d8f9d2..4563d7c 100644 --- a/src/net/cbaines/suma/DatabaseHelper.java +++ b/src/net/cbaines/suma/DatabaseHelper.java @@ -40,7 +40,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { private static final String DATABASE_PATH = "/data/data/net.cbaines.suma/databases/"; private static final String DATABASE_NAME = "data.db"; - private static final int DATABASE_VERSION = 39; + private static final int DATABASE_VERSION = 40; private static final String TAG = "DatabaseHelper"; diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index 33b12cd..14a1dd4 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -74,10 +74,10 @@ public class MapActivity extends OrmLiteBaseActivity implements OnItemClickListener, OnItemLongClickListener, OnSharedPreferenceChangeListener, Preferences { /** - * Enable to use the database in the assets folder, if its not enabled, the - * database is built from the csv files in the assets folder + * Enable to use the database in the assets folder, if its not enabled, the database is built from the csv files in the assets + * folder */ - private boolean useBundledDatabase = false; + private boolean useBundledDatabase = true; private MapView mapView; private MapController mapController; @@ -173,8 +173,7 @@ public class MapActivity extends OrmLiteBaseActivity implements OTHER_OVERLAY_NAMES }; /** - * The toast for this activity, storing the toast centrally allows it to be - * changed quickly, instead of a queue building up + * The toast for this activity, storing the toast centrally allows it to be changed quickly, instead of a queue building up */ Toast activityToast; @@ -205,10 +204,8 @@ public class MapActivity extends OrmLiteBaseActivity implements pastOverlays = (HashMap) getLastNonConfigurationInstance(); /* - * SensorManager mSensorManager = (SensorManager) - * getSystemService(Context.SENSOR_SERVICE); This code in the following - * constructor causes problems in some emulators, disable sensors to - * fix. + * SensorManager mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); This code in the following + * constructor causes problems in some emulators, disable sensors to fix. */ Log.i(TAG, "Starting creating myLocationOverlay"); myLocationOverlay = new MyLocationOverlay(instance, mapView); @@ -555,10 +552,12 @@ public class MapActivity extends OrmLiteBaseActivity implements routeOverlayU1E.getPaint().setAlpha(145); routeOverlayU1E.getPaint().setStrokeWidth(12); routeOverlayU1E.getPaint().setPathEffect(new DashPathEffect(new float[] { 20, 16 }, 0)); - routeOverlayU1E.setEnabled(activityPrefs.getBoolean("Bus Routes:" + route.code, true)); busRouteOverlays.put(new BusRoute(1000, "U1E", "U1E Route Label", true), routeOverlayU1E); - overlays.put(BUS_ROUTE_OVERLAYS + route.code + "E", routeOverlayU1E); + overlays.put(BUS_ROUTE_OVERLAYS + "U1E", routeOverlayU1E); + synchronized (mapView.getOverlays()) { + mapView.getOverlays().add(routeOverlayU1E); + } } else if (route.code.equals("U1N")) { resource = getResources().openRawResource(R.raw.u1n); colour = U1N; @@ -1038,11 +1037,9 @@ public class MapActivity extends OrmLiteBaseActivity implements } /* - * public boolean onChildClick(ExpandableListView parent, View v, int - * groupPosition, int childPosition, long id) { + * public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { * - * mapView.post(new Runnable() { public void run() { // - * updateEnabledOverlays(); TODO Fix whatever this did? + * mapView.post(new Runnable() { public void run() { // updateEnabledOverlays(); TODO Fix whatever this did? * mapView.invalidate(); } }); * * return true; } -- cgit v1.2.3 From 9b09f1286a8a003f0d24f745f648748cd3c2f2e2 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 26 Feb 2012 23:21:13 +0000 Subject: More bug fixes, with the location overlay. --- src/net/cbaines/suma/BuildingNumOverlay.java | 2 + src/net/cbaines/suma/BusStopOverlay.java | 4 +- src/net/cbaines/suma/MapActivity.java | 43 ++- src/net/cbaines/suma/POI.java | 1 - src/net/cbaines/suma/ViewDialog.java | 422 ++++++++++++++------------- 5 files changed, 252 insertions(+), 220 deletions(-) diff --git a/src/net/cbaines/suma/BuildingNumOverlay.java b/src/net/cbaines/suma/BuildingNumOverlay.java index 887f8b7..cc20003 100644 --- a/src/net/cbaines/suma/BuildingNumOverlay.java +++ b/src/net/cbaines/suma/BuildingNumOverlay.java @@ -268,6 +268,8 @@ public class BuildingNumOverlay extends Overlay implements Preferences, OnShared favouritesPrefs.edit().putBoolean(building.id, true).commit(); } + Collections.sort(buildings, new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0))); + mapView.invalidate(); return true; diff --git a/src/net/cbaines/suma/BusStopOverlay.java b/src/net/cbaines/suma/BusStopOverlay.java index 7894be2..4705d1d 100644 --- a/src/net/cbaines/suma/BusStopOverlay.java +++ b/src/net/cbaines/suma/BusStopOverlay.java @@ -246,7 +246,7 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants, Pref SharedPreferences favouritesPreferences = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0); if (favouritesPreferences.getBoolean(busStop.id, false)) { - favouritesPreferences.edit().putBoolean(busStop.id, false).commit(); + favouritesPreferences.edit().remove(busStop.id).commit(); if (context.activityToast == null) { context.activityToast = Toast.makeText(context, busStop.id + " removed from favourites", Toast.LENGTH_SHORT); @@ -267,6 +267,8 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants, Pref favouritesPreferences.edit().putBoolean(busStop.id, true).commit(); } + Collections.sort(busStops, new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0))); + mapView.invalidate(); return true; diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index 14a1dd4..07806fa 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -159,7 +159,7 @@ public class MapActivity extends OrmLiteBaseActivity implements static final boolean MY_LOCATION_OVERLAY_COMPASS_ENABLED_BY_DEFAULT = true; private static final int MY_LOCATION_OVERLAY_RANK = 2; - static final String[] OTHER_OVERLAY_NAMES = { SCALE_BAR_OVERLAY, MY_LOCATION_OVERLAY, MY_LOCATION_OVERLAY_COMPASS }; + static final String[] OTHER_OVERLAY_NAMES = { SCALE_BAR_OVERLAY, MY_LOCATION_OVERLAY_COMPASS, MY_LOCATION_OVERLAY }; // Other bits @@ -209,6 +209,7 @@ public class MapActivity extends OrmLiteBaseActivity implements */ Log.i(TAG, "Starting creating myLocationOverlay"); myLocationOverlay = new MyLocationOverlay(instance, mapView); + myLocationOverlay.setEnabled(true); Log.i(TAG, "Finished creating myLocationOverlay"); while (databaseThread.isAlive()) { @@ -263,14 +264,15 @@ public class MapActivity extends OrmLiteBaseActivity implements final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); final SharedPreferences activityPrefs = getPreferences(0); - if (activityPrefs.getBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY_COMPASS, false)) { + if (activityPrefs.getBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY_COMPASS, + MY_LOCATION_OVERLAY_COMPASS_ENABLED_BY_DEFAULT)) { myLocationOverlay.enableCompass(); } else { myLocationOverlay.disableCompass(); } - if (activityPrefs.getBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY, false) - && sharedPrefs.getBoolean(GPS_ENABLED, false)) { + if (activityPrefs.getBoolean(OTHER_OVERLAYS + MY_LOCATION_OVERLAY, MY_LOCATION_OVERLAY_ENABLED_BY_DEFAULT) + && sharedPrefs.getBoolean(GPS_ENABLED, GPS_ENABLED_BY_DEFAULT)) { myLocationOverlay.enableMyLocation(); } else { myLocationOverlay.disableMyLocation(); @@ -683,7 +685,7 @@ public class MapActivity extends OrmLiteBaseActivity implements buildingDao = getHelper().getBuildingDao(); - final SharedPreferences favouritesPrefs = getSharedPreferences(FAVOURITES_PREFERENCES, 0); + final SharedPreferences favouritesPrefs = getSharedPreferences(FAVOURITES_PREFERENCES, MODE_PRIVATE); for (Building building : buildingDao) { if (building.residential == true) { @@ -903,8 +905,10 @@ public class MapActivity extends OrmLiteBaseActivity implements return true; case R.id.menu_find_my_location: final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); - if (sharedPrefs.getBoolean("GPSEnabled", false)) { + if (sharedPrefs.getBoolean(GPS_ENABLED, GPS_ENABLED_BY_DEFAULT)) { + myLocationOverlay.enableMyLocation(); GeoPoint userLocation = myLocationOverlay.getMyLocation(); + sharedPrefs.edit().putBoolean(MY_LOCATION_OVERLAY, true).commit(); if (userLocation != null) { Log.i(TAG, "Found user location, scrolling to " + userLocation); mapController.animateTo(userLocation); @@ -916,8 +920,17 @@ public class MapActivity extends OrmLiteBaseActivity implements switch (which) { case DialogInterface.BUTTON_POSITIVE: Editor editor = sharedPrefs.edit(); - editor.putBoolean("GPSEnabled", true); + editor.putBoolean(GPS_ENABLED, true); editor.commit(); + + myLocationOverlay.enableMyLocation(); + GeoPoint userLocation = myLocationOverlay.getMyLocation(); + sharedPrefs.edit().putBoolean(MY_LOCATION_OVERLAY, true).commit(); + if (userLocation != null) { + Log.i(TAG, "Found user location, scrolling to " + userLocation); + mapController.animateTo(userLocation); + myLocationOverlay.enableFollowLocation(); + } break; case DialogInterface.BUTTON_NEGATIVE: @@ -966,8 +979,18 @@ public class MapActivity extends OrmLiteBaseActivity implements Dao buildingDao = getHelper().getBuildingDao(); Dao busStopDao = getHelper().getBusStopDao(); - newFavouriteItems.addAll(buildingDao.queryForEq(POI.FAVOURITE_FIELD_NAME, true)); - newFavouriteItems.addAll(busStopDao.queryForEq(POI.FAVOURITE_FIELD_NAME, true)); + final SharedPreferences favouritesPrefs = getSharedPreferences(FAVOURITES_PREFERENCES, MODE_PRIVATE); + for (String id : favouritesPrefs.getAll().keySet()) { + Building building; + BusStop busStop; + if ((building = buildingDao.queryForId(id)) != null) { + newFavouriteItems.add(building); + } else if ((busStop = busStopDao.queryForId(id)) != null) { + newFavouriteItems.add(busStop); + } else { + Log.e(TAG, "Item in favourites " + id + " cannot be found"); + } + } } catch (SQLException e) { e.printStackTrace(); } @@ -1253,6 +1276,7 @@ public class MapActivity extends OrmLiteBaseActivity implements } else { myLocationOverlay.disableCompass(); } + mapView.invalidate(); } else if (key.substring(OTHER_OVERLAYS.length(), key.length()).equals(MY_LOCATION_OVERLAY)) { final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); @@ -1262,6 +1286,7 @@ public class MapActivity extends OrmLiteBaseActivity implements } else { myLocationOverlay.disableMyLocation(); } + mapView.invalidate(); } else { Log.e(TAG, "Unhandled preference key " + key); } diff --git a/src/net/cbaines/suma/POI.java b/src/net/cbaines/suma/POI.java index e815731..485845c 100644 --- a/src/net/cbaines/suma/POI.java +++ b/src/net/cbaines/suma/POI.java @@ -32,7 +32,6 @@ public abstract class POI { public static final String ID_FIELD_NAME = "id"; public static final String POINT_FIELD_NAME = "point"; - public static final String FAVOURITE_FIELD_NAME = "favourite"; POI() { } diff --git a/src/net/cbaines/suma/ViewDialog.java b/src/net/cbaines/suma/ViewDialog.java index 432fec1..e97cbdf 100644 --- a/src/net/cbaines/suma/ViewDialog.java +++ b/src/net/cbaines/suma/ViewDialog.java @@ -36,239 +36,243 @@ import android.widget.TextView; class ViewDialog extends Dialog implements OnChildClickListener { - private final ExpandableListView epView; - - private static final String TAG = "ViewDialog"; - - private final MyExpandableListAdapter mAdapter; - - private OnChildClickListener listener; - - private String[] busRoutes; - private String[] buildingTypes; - private String[] other; - private String[] groupHeadings; - private String[] siteNames; - - protected MapActivity context; - - public ViewDialog(MapActivity context) { - super(context); - - this.context = context; - - busRoutes = context.getResources().getStringArray(R.array.uniLinkBusRoutes); - buildingTypes = context.getResources().getStringArray(R.array.buildingTypes); - other = context.getResources().getStringArray(R.array.utilityOverlays); - groupHeadings = context.getResources().getStringArray(R.array.preferencesHeadings); - siteNames = MapActivity.SITE_NAMES; // TODO: Temp hack, should be included in the strings res for translation - // purposes? - - setContentView(R.layout.view_dialog); - setTitle("Select the map elements to display"); - - WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); - lp.copyFrom(this.getWindow().getAttributes()); - lp.width = WindowManager.LayoutParams.FILL_PARENT; - lp.height = WindowManager.LayoutParams.FILL_PARENT; - - this.getWindow().setAttributes(lp); - - epView = (ExpandableListView) findViewById(R.id.view_list); - mAdapter = new MyExpandableListAdapter(context); - epView.setAdapter(mAdapter); - epView.setOnChildClickListener(this); - - } - - public void setOnItemClickListener(OnChildClickListener onChildClickListener) { - Log.i(TAG, "Listener set for dialog"); - listener = onChildClickListener; - } - - class MyExpandableListAdapter extends BaseExpandableListAdapter implements Preferences { - - private LayoutInflater inflater; - - private static final String TAG = "MyExpandableListAdapter"; - - // Bus Stops - // |_ U1 - // |_ U1N - // |_ U2 - // |_ U6 - // |_ U9 - // Bus Routes - // |_ U1 - // |_ U1N - // |_ U2 - // |_ U6 - // |_ U9 - // Buildings - // |_ Residential - // |_ Non-Residential - // Site Outlines - // |_ Highfield Campus - // |_ Boldrewood Campus - // |_ Avenue Campus - // |_ Winchester School of Art - // |_ The University of Southampton Science Park - // |_ National Oceanography Centre Campus - // |_ Boat House - // |_ Southampton General Hospital - // |_ Royal South Hants Hospital - // |_ Belgrave Industrial Site - // |_ Highfield Hall - // |_ Glen Eyre Hall - // |_ South Hill Hall - // |_ Chamberlain Hall - // |_ Hartley Grove - // |_ Bencraft Hall - // |_ Connaught Hall - // |_ Montefiore Hall - // |_ Stoneham Hall - // |_ Erasmus Park - // Other - // |_ Scale Bar - // |_ Compass - // |_ My Location - - MyExpandableListAdapter(Context context) { - inflater = LayoutInflater.from(context); - } + private final ExpandableListView epView; + + private static final String TAG = "ViewDialog"; + + private final MyExpandableListAdapter mAdapter; + + private OnChildClickListener listener; + + private String[] busRoutes; + private String[] buildingTypes; + private String[] other; + private String[] groupHeadings; + private String[] siteNames; + + protected MapActivity context; + + public ViewDialog(MapActivity context) { + super(context); + + this.context = context; + + busRoutes = context.getResources().getStringArray(R.array.uniLinkBusRoutes); + buildingTypes = context.getResources().getStringArray(R.array.buildingTypes); + other = context.getResources().getStringArray(R.array.utilityOverlays); + groupHeadings = context.getResources().getStringArray(R.array.preferencesHeadings); + siteNames = MapActivity.SITE_NAMES; // TODO: Temp hack, should be included in the strings res for translation + // purposes? + + setContentView(R.layout.view_dialog); + setTitle("Select the map elements to display"); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(this.getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.FILL_PARENT; + lp.height = WindowManager.LayoutParams.FILL_PARENT; + + this.getWindow().setAttributes(lp); + + epView = (ExpandableListView) findViewById(R.id.view_list); + mAdapter = new MyExpandableListAdapter(context); + epView.setAdapter(mAdapter); + epView.setOnChildClickListener(this); - public Object getChild(int groupPosition, int childPosition) { - if (groupPosition == 0 || groupPosition == 1) { - return busRoutes[childPosition]; - } else if (groupPosition == 2) { - return buildingTypes[childPosition]; - } else if (groupPosition == 3) { - return siteNames[childPosition]; - } else if (groupPosition == 4) { - return other[childPosition]; - } else { - Log.e(TAG, "Unrecognised groupPosition " + groupPosition); - return null; - } } - public long getChildId(int groupPosition, int childPosition) { - return groupPosition * 50 + childPosition; + public void setOnItemClickListener(OnChildClickListener onChildClickListener) { + Log.i(TAG, "Listener set for dialog"); + listener = onChildClickListener; } - public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, - ViewGroup parent) { - View v = null; - if (convertView != null) - v = convertView; - else - v = inflater.inflate(R.layout.view_child_row, parent, false); - String c = (String) getChild(groupPosition, childPosition); - TextView childName = (TextView) v.findViewById(R.id.childname); - if (childName != null) - childName.setText(c); - CheckBox cb = (CheckBox) v.findViewById(R.id.check1); - cb.setClickable(false); - cb.setFocusable(false); - if (context == null) { - Log.e(TAG, "context == null"); - } - SharedPreferences activityPrefs = context.getPreferences(0); - - String str = MapActivity.PREFERENCES_GROUPS[groupPosition] - + MapActivity.PREFERENCES_CHILDREN[groupPosition][childPosition]; - - if (groupPosition == 0) { - cb.setChecked(activityPrefs.getBoolean(str, MapActivity.UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); - } else if (groupPosition == 1) { - cb.setChecked(activityPrefs.getBoolean(str, MapActivity.BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)); - } else if (groupPosition == 2) { - if (childPosition == 0) { - cb.setChecked(activityPrefs.getBoolean(str, - MapActivity.RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); - } else { - cb.setChecked(activityPrefs.getBoolean(str, - MapActivity.NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); + class MyExpandableListAdapter extends BaseExpandableListAdapter implements Preferences { + + private LayoutInflater inflater; + + private static final String TAG = "MyExpandableListAdapter"; + + // Bus Stops + // |_ U1 + // |_ U1N + // |_ U2 + // |_ U6 + // |_ U9 + // Bus Routes + // |_ U1 + // |_ U1N + // |_ U2 + // |_ U6 + // |_ U9 + // Buildings + // |_ Residential + // |_ Non-Residential + // Site Outlines + // |_ Highfield Campus + // |_ Boldrewood Campus + // |_ Avenue Campus + // |_ Winchester School of Art + // |_ The University of Southampton Science Park + // |_ National Oceanography Centre Campus + // |_ Boat House + // |_ Southampton General Hospital + // |_ Royal South Hants Hospital + // |_ Belgrave Industrial Site + // |_ Highfield Hall + // |_ Glen Eyre Hall + // |_ South Hill Hall + // |_ Chamberlain Hall + // |_ Hartley Grove + // |_ Bencraft Hall + // |_ Connaught Hall + // |_ Montefiore Hall + // |_ Stoneham Hall + // |_ Erasmus Park + // Other + // |_ Scale Bar + // |_ Compass + // |_ My Location + + MyExpandableListAdapter(Context context) { + inflater = LayoutInflater.from(context); } - } else if (groupPosition == 3) { - cb.setChecked(activityPrefs.getBoolean(str, MapActivity.SITE_OVERLAYS_ENABLED_BY_DEFAULT)); - } else if (groupPosition == 4) { - cb.setChecked(activityPrefs.getBoolean(str, MapActivity.SCALE_BAR_OVERLAY_ENABLED_BY_DEFAULT)); - } - return v; - } - public int getChildrenCount(int groupPosition) { - if (groupPosition == 0 || groupPosition == 1) { - return busRoutes.length; - } else if (groupPosition == 2) { - return buildingTypes.length; - } else if (groupPosition == 3) { - return siteNames.length; - } else if (groupPosition == 4) { - return other.length; - } - return 0; - } + public Object getChild(int groupPosition, int childPosition) { + if (groupPosition == 0 || groupPosition == 1) { + return busRoutes[childPosition]; + } else if (groupPosition == 2) { + return buildingTypes[childPosition]; + } else if (groupPosition == 3) { + return siteNames[childPosition]; + } else if (groupPosition == 4) { + return other[childPosition]; + } else { + Log.e(TAG, "Unrecognised groupPosition " + groupPosition); + return null; + } + } - public Object getGroup(int groupPosition) { - return groupHeadings[groupPosition]; - } + public long getChildId(int groupPosition, int childPosition) { + return groupPosition * 50 + childPosition; + } - public int getGroupCount() { - return groupHeadings.length; - } + public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { + View v = null; + if (convertView != null) + v = convertView; + else + v = inflater.inflate(R.layout.view_child_row, parent, false); + String c = (String) getChild(groupPosition, childPosition); + TextView childName = (TextView) v.findViewById(R.id.childname); + if (childName != null) + childName.setText(c); + CheckBox cb = (CheckBox) v.findViewById(R.id.check1); + cb.setClickable(false); + cb.setFocusable(false); + if (context == null) { + Log.e(TAG, "context == null"); + } + SharedPreferences activityPrefs = context.getPreferences(0); + + String str = MapActivity.PREFERENCES_GROUPS[groupPosition] + + MapActivity.PREFERENCES_CHILDREN[groupPosition][childPosition]; + + if (groupPosition == 0) { + cb.setChecked(activityPrefs.getBoolean(str, MapActivity.UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT)); + } else if (groupPosition == 1) { + cb.setChecked(activityPrefs.getBoolean(str, MapActivity.BUS_ROUTE_OVERLAYS_ENABLED_BY_DEFAULT)); + } else if (groupPosition == 2) { + if (childPosition == 0) { + cb.setChecked(activityPrefs.getBoolean(str, MapActivity.RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); + } else { + cb.setChecked(activityPrefs.getBoolean(str, MapActivity.NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT)); + } + } else if (groupPosition == 3) { + cb.setChecked(activityPrefs.getBoolean(str, MapActivity.SITE_OVERLAYS_ENABLED_BY_DEFAULT)); + } else if (groupPosition == 4) { + if (childPosition == 0) { + cb.setChecked(activityPrefs.getBoolean(str, MapActivity.SCALE_BAR_OVERLAY_ENABLED_BY_DEFAULT)); + } else if (childPosition == 1) { + cb.setChecked(activityPrefs.getBoolean(str, MapActivity.MY_LOCATION_OVERLAY_COMPASS_ENABLED_BY_DEFAULT)); + } else if (childPosition == 2) { + cb.setChecked(activityPrefs.getBoolean(str, MapActivity.MY_LOCATION_OVERLAY_ENABLED_BY_DEFAULT)); + } + } + return v; + } - public long getGroupId(int groupPosition) { - return groupPosition * 5; - } + public int getChildrenCount(int groupPosition) { + if (groupPosition == 0 || groupPosition == 1) { + return busRoutes.length; + } else if (groupPosition == 2) { + return buildingTypes.length; + } else if (groupPosition == 3) { + return siteNames.length; + } else if (groupPosition == 4) { + return other.length; + } + return 0; + } - public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { - View v = null; - if (convertView != null) - v = convertView; - else - v = inflater.inflate(R.layout.view_group_row, parent, false); - String gt = (String) getGroup(groupPosition); - TextView colorGroup = (TextView) v.findViewById(R.id.childname); - if (gt != null) - colorGroup.setText(gt); - return v; - } + public Object getGroup(int groupPosition) { + return groupHeadings[groupPosition]; + } - public boolean hasStableIds() { - return true; - } + public int getGroupCount() { + return groupHeadings.length; + } + + public long getGroupId(int groupPosition) { + return groupPosition * 5; + } + + public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { + View v = null; + if (convertView != null) + v = convertView; + else + v = inflater.inflate(R.layout.view_group_row, parent, false); + String gt = (String) getGroup(groupPosition); + TextView colorGroup = (TextView) v.findViewById(R.id.childname); + if (gt != null) + colorGroup.setText(gt); + return v; + } + + public boolean hasStableIds() { + return true; + } + + public boolean isChildSelectable(int groupPosition, int childPosition) { + return true; + } - public boolean isChildSelectable(int groupPosition, int childPosition) { - return true; } - } + public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { + Log.i(TAG, "Got view dialog click at " + groupPosition + ":" + childPosition); - public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { - Log.i(TAG, "Got view dialog click at " + groupPosition + ":" + childPosition); + SharedPreferences activityPrefs = context.getPreferences(0); - SharedPreferences activityPrefs = context.getPreferences(0); + Editor editor = activityPrefs.edit(); - Editor editor = activityPrefs.edit(); + CheckBox cb = (CheckBox) v.findViewById(R.id.check1); - CheckBox cb = (CheckBox) v.findViewById(R.id.check1); + String str = MapActivity.PREFERENCES_GROUPS[groupPosition] + + MapActivity.PREFERENCES_CHILDREN[groupPosition][childPosition]; - String str = MapActivity.PREFERENCES_GROUPS[groupPosition] - + MapActivity.PREFERENCES_CHILDREN[groupPosition][childPosition]; + Log.i(TAG, "Putting " + str + " to " + (!cb.isChecked())); + editor.putBoolean(str, !cb.isChecked()); - editor.putBoolean(str, !cb.isChecked()); + editor.commit(); - editor.commit(); + mAdapter.notifyDataSetInvalidated(); - mAdapter.notifyDataSetInvalidated(); + if (listener != null) { + listener.onChildClick(parent, v, groupPosition, childPosition, id); + } - if (listener != null) { - listener.onChildClick(parent, v, groupPosition, childPosition, id); + return true; } - return true; - } - } \ No newline at end of file -- cgit v1.2.3