/appquest-treasure-map

Android AppQuest Treasure Map application for the App Quest 2016.

Primary LanguageJavaMIT LicenseMIT

AppQuest Treasure Map

HSR

About

AppQuest Treasure Map is the 3. application for the App Quest 2016 Treasure Hunt. The application must be able to display OpenStreetMaps and save coordinates of some locations. At the Treasure Hunt the goal will be to save coordinates of multiple posts.

General

AppQuest Repository AppQuest 2016
Application Requirements http://appquest.hsr.ch/2016/schatzkarte
Minimum API Level API level 23 (Marshmallow)
Development Environment Android Studio

Example

AppQuest Treasure Map

Links

Given code snippets

osm.java

map = (MapView) findViewById(R.id.map /*eure ID der Map View */);
map.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);

map.setMultiTouchControls(true);
map.setBuiltInZoomControls(true);

IMapController controller = map.getController();
controller.setZoom(18);

// Die TileSource beschreibt die Eigenschaften der Kacheln die wir anzeigen
XYTileSource treasureMapTileSource = new XYTileSource("mbtiles", 1, 20, 256, ".png", "http://example.org/");

File file = new File(Environment.getExternalStorageDirectory() /* entspricht /sdcard/ */, "hsr.mbtiles");

/* Das verwenden von mbtiles ist leider ein wenig aufwändig, wir müssen
 * unsere XYTileSource in verschiedene Klassen 'verpacken' um sie dann
 * als TilesOverlay über der Grundkarte anzuzeigen.
 */
MapTileModuleProviderBase treasureMapModuleProvider = new MapTileFileArchiveProvider(new SimpleRegisterReceiver(this), 
		treasureMapTileSource, new IArchiveFile[] { MBTilesFileArchive.getDatabaseFileArchive(file) });

MapTileProviderBase treasureMapProvider = new MapTileProviderArray(treasureMapTileSource, null,
		new MapTileModuleProviderBase[] { treasureMapModuleProvider });

TilesOverlay treasureMapTilesOverlay = new TilesOverlay(treasureMapProvider, getBaseContext());
treasureMapTilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);

// Jetzt können wir den Overlay zu unserer Karte hinzufügen:
map.getOverlays().add(treasureMapTilesOverlay);

AppQuest Logbuch format

{
  "task": "Schatzkarte",
  "points": [
    {"lat": $lat1, "lon": $lon1},
    {"lat": $lat2, "lon": $lon2}
  ]
}

License

MIT License