From 7a1d56d888f162604e1f9dd0dc54bd05cee02407 Mon Sep 17 00:00:00 2001 From: Emux Date: Sun, 3 Jul 2016 23:40:05 +0300 Subject: [PATCH] Samples: various improvements, #32 --- .../android/test/JeoIndoorMapActivity.java | 31 ++++++++++++++++--- .../android/test/MarkerOverlayActivity.java | 3 +- .../android/test/PathOverlayActivity.java | 8 +++-- .../oscim/android/test/S3DBMapActivity.java | 23 ++++++++++++++ .../android/test/VectorLayerMapActivity.java | 6 ++-- 5 files changed, 61 insertions(+), 10 deletions(-) diff --git a/vtm-android-example/src/org/oscim/android/test/JeoIndoorMapActivity.java b/vtm-android-example/src/org/oscim/android/test/JeoIndoorMapActivity.java index bfb75c27..7a048dcf 100644 --- a/vtm-android-example/src/org/oscim/android/test/JeoIndoorMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/JeoIndoorMapActivity.java @@ -1,3 +1,19 @@ +/* + * Copyright 2016 devemux86 + * + * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). + * + * This program is free software: you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with + * this program. If not, see . + */ package org.oscim.android.test; import java.io.IOException; @@ -62,12 +78,10 @@ public class JeoIndoorMapActivity extends BaseMapActivity { } }); + mMap.setTheme(VtmThemes.DEFAULT); + mMap.layers().add(new BuildingLayer(mMap, mBaseLayer)); mMap.layers().add(new LabelLayer(mMap, mBaseLayer)); - mMap.setTheme(VtmThemes.TRONRENDER); - - //mMap.setMapPosition(49.417, 8.673, 1 << 17); - mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); // mMap.layers().add(new TileGridLayer(mMap)); // String file = Environment.getExternalStorageDirectory().getAbsolutePath(); @@ -152,4 +166,13 @@ public class JeoIndoorMapActivity extends BaseMapActivity { protected void onStop() { super.onStop(); } + + @Override + protected void onResume() { + super.onResume(); + + /* ignore saved position */ + //mMap.setMapPosition(49.417, 8.673, 1 << 17); + mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); + } } diff --git a/vtm-android-example/src/org/oscim/android/test/MarkerOverlayActivity.java b/vtm-android-example/src/org/oscim/android/test/MarkerOverlayActivity.java index 043870da..db13468f 100644 --- a/vtm-android-example/src/org/oscim/android/test/MarkerOverlayActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/MarkerOverlayActivity.java @@ -1,5 +1,6 @@ /* * Copyright 2014 Hannes Janetzek + * Copyright 2016 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -89,9 +90,9 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity @Override protected void onResume() { super.onResume(); + /* ignore saved position */ mMap.setMapPosition(0, 0, 1 << 2); - mMapView.onResume(); } @Override diff --git a/vtm-android-example/src/org/oscim/android/test/PathOverlayActivity.java b/vtm-android-example/src/org/oscim/android/test/PathOverlayActivity.java index 985664ae..810d09cf 100644 --- a/vtm-android-example/src/org/oscim/android/test/PathOverlayActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/PathOverlayActivity.java @@ -1,5 +1,6 @@ /* * Copyright 2014 Hannes Janetzek + * Copyright 2016 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -16,6 +17,8 @@ */ package org.oscim.android.test; +import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER; + import java.util.ArrayList; import org.oscim.backend.canvas.Color; @@ -33,8 +36,7 @@ import android.os.Bundle; public class PathOverlayActivity extends BitmapTileMapActivity { public PathOverlayActivity() { - //super(STAMEN_TONER.build()); - super(null); + super(STAMEN_TONER.build()); } @Override @@ -67,9 +69,9 @@ public class PathOverlayActivity extends BitmapTileMapActivity { @Override protected void onResume() { super.onResume(); + /* ignore saved position */ mMap.setMapPosition(0, 0, 1 << 2); - mMapView.onResume(); } ArrayList mPathLayers = new ArrayList(); diff --git a/vtm-android-example/src/org/oscim/android/test/S3DBMapActivity.java b/vtm-android-example/src/org/oscim/android/test/S3DBMapActivity.java index 0e70b8cb..e25558a6 100644 --- a/vtm-android-example/src/org/oscim/android/test/S3DBMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/S3DBMapActivity.java @@ -1,3 +1,19 @@ +/* + * Copyright 2016 devemux86 + * + * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). + * + * This program is free software: you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with + * this program. If not, see . + */ package org.oscim.android.test; import org.oscim.android.cache.TileCache; @@ -44,4 +60,11 @@ public class S3DBMapActivity extends BaseMapActivity { mS3dbCache.dispose(); } + @Override + protected void onResume() { + super.onResume(); + + /* ignore saved position */ + mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); + } } diff --git a/vtm-android-example/src/org/oscim/android/test/VectorLayerMapActivity.java b/vtm-android-example/src/org/oscim/android/test/VectorLayerMapActivity.java index 4f7c486b..e832d65a 100644 --- a/vtm-android-example/src/org/oscim/android/test/VectorLayerMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/VectorLayerMapActivity.java @@ -1,5 +1,6 @@ /* * Copyright 2013 Hannes Janetzek + * Copyright 2016 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -13,7 +14,8 @@ * * You should have received a copy of the GNU Lesser General Public License along with * this program. If not, see . - */package org.oscim.android.test; + */ +package org.oscim.android.test; import org.oscim.backend.canvas.Color; import org.oscim.layers.TileGridLayer; @@ -31,7 +33,7 @@ public class VectorLayerMapActivity extends BaseMapActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mMap.setTheme(VtmThemes.NEWTRON); + mMap.setTheme(VtmThemes.DEFAULT); VectorLayer vectorLayer = new VectorLayer(mMap);