From c0369236d2b0a2695127d875882d2c1ac9a12882 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Sat, 24 May 2014 23:07:47 +0200 Subject: [PATCH] start: add tilegridlayer to menu --- vtm-android-example/res/menu/theme_menu.xml | 7 +++++++ vtm-android-example/res/values/strings.xml | 1 + .../org/oscim/android/test/BaseMapActivity.java | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/vtm-android-example/res/menu/theme_menu.xml b/vtm-android-example/res/menu/theme_menu.xml index 1b9c509f..cd0d2bbf 100644 --- a/vtm-android-example/res/menu/theme_menu.xml +++ b/vtm-android-example/res/menu/theme_menu.xml @@ -27,4 +27,11 @@ + + + \ No newline at end of file diff --git a/vtm-android-example/res/values/strings.xml b/vtm-android-example/res/values/strings.xml index 3fd3af84..05d94a5d 100644 --- a/vtm-android-example/res/values/strings.xml +++ b/vtm-android-example/res/values/strings.xml @@ -15,5 +15,6 @@ Area Outline Controls + Gridlayer \ No newline at end of file diff --git a/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java b/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java index 8f74553f..5d0511c4 100644 --- a/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java @@ -20,6 +20,7 @@ import org.oscim.android.MapActivity; import org.oscim.android.MapView; import org.oscim.android.cache.TileCache; import org.oscim.core.MapPosition; +import org.oscim.layers.TileGridLayer; import org.oscim.layers.tile.vector.VectorTileLayer; import org.oscim.theme.VtmThemes; import org.oscim.tiling.TileSource; @@ -36,6 +37,7 @@ public class BaseMapActivity extends MapActivity { MapView mMapView; VectorTileLayer mBaseLayer; TileSource mTileSource; + TileGridLayer mGridLayer; private TileCache mCache; @@ -105,6 +107,20 @@ public class BaseMapActivity extends MapActivity { mMap.setTheme(VtmThemes.NEWTRON); item.setChecked(true); return true; + + case R.id.gridlayer: + if (item.isChecked()) { + item.setChecked(false); + mMap.layers().remove(mGridLayer); + } else { + item.setChecked(true); + if (mGridLayer == null) + mGridLayer = new TileGridLayer(mMap); + + mMap.layers().add(mGridLayer); + } + mMap.updateMap(true); + return true; } return false;