From e6137163b92ebafef1ee88ca13534b5d53641d83 Mon Sep 17 00:00:00 2001 From: Emux Date: Fri, 2 Aug 2019 12:13:00 +0300 Subject: [PATCH] Update samples --- vtm-android-example/AndroidManifest.xml | 24 ----- .../test/AtlasMarkerOverlayActivity.java | 91 ----------------- .../android/test/AtlasThemeActivity.java | 37 ------- .../android/test/LayerGroupActivity.java | 80 --------------- .../oscim/android/test/LineTexActivity.java | 5 +- .../android/test/MapEventLayer2Activity.java | 32 ------ .../android/test/MultiMapViewActivity.java | 91 ----------------- .../android/test/OSciMapS3DBActivity.java | 72 -------------- .../android/test/POTTextureActivity.java | 36 ------- .../test/RotateMarkerOverlayActivity.java | 78 --------------- .../src/org/oscim/android/test/Samples.java | 20 +--- .../org/oscim/test/AtlasMarkerLayerTest.java | 99 ------------------- .../src/org/oscim/test/AtlasThemeTest.java | 31 ------ .../src/org/oscim/test/LineTexTest.java | 4 +- .../org/oscim/test/MapEventLayer2Test.java | 28 ------ .../src/org/oscim/test/OSciMapS3DBTest.java | 57 ----------- .../src/org/oscim/test/POTTextureTest.java | 33 ------- .../org/oscim/test/RotateMarkerLayerTest.java | 79 --------------- 18 files changed, 8 insertions(+), 889 deletions(-) delete mode 100644 vtm-android-example/src/org/oscim/android/test/AtlasMarkerOverlayActivity.java delete mode 100644 vtm-android-example/src/org/oscim/android/test/AtlasThemeActivity.java delete mode 100644 vtm-android-example/src/org/oscim/android/test/LayerGroupActivity.java delete mode 100644 vtm-android-example/src/org/oscim/android/test/MapEventLayer2Activity.java delete mode 100644 vtm-android-example/src/org/oscim/android/test/MultiMapViewActivity.java delete mode 100644 vtm-android-example/src/org/oscim/android/test/OSciMapS3DBActivity.java delete mode 100644 vtm-android-example/src/org/oscim/android/test/POTTextureActivity.java delete mode 100644 vtm-android-example/src/org/oscim/android/test/RotateMarkerOverlayActivity.java delete mode 100644 vtm-playground/src/org/oscim/test/AtlasMarkerLayerTest.java delete mode 100644 vtm-playground/src/org/oscim/test/AtlasThemeTest.java delete mode 100644 vtm-playground/src/org/oscim/test/MapEventLayer2Test.java delete mode 100644 vtm-playground/src/org/oscim/test/OSciMapS3DBTest.java delete mode 100644 vtm-playground/src/org/oscim/test/POTTextureTest.java delete mode 100644 vtm-playground/src/org/oscim/test/RotateMarkerLayerTest.java diff --git a/vtm-android-example/AndroidManifest.xml b/vtm-android-example/AndroidManifest.xml index 03c0762c..544e9a42 100644 --- a/vtm-android-example/AndroidManifest.xml +++ b/vtm-android-example/AndroidManifest.xml @@ -21,15 +21,9 @@ - - @@ -48,9 +42,6 @@ - @@ -60,9 +51,6 @@ - @@ -93,9 +81,6 @@ - @@ -105,9 +90,6 @@ - @@ -120,15 +102,9 @@ - - diff --git a/vtm-android-example/src/org/oscim/android/test/AtlasMarkerOverlayActivity.java b/vtm-android-example/src/org/oscim/android/test/AtlasMarkerOverlayActivity.java deleted file mode 100644 index f9a5c4f9..00000000 --- a/vtm-android-example/src/org/oscim/android/test/AtlasMarkerOverlayActivity.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2014 Hannes Janetzek - * Copyright 2016-2018 devemux86 - * Copyright 2017 Longri - * - * 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.backend.canvas.Bitmap; -import org.oscim.core.GeoPoint; -import org.oscim.layers.marker.ItemizedLayer; -import org.oscim.layers.marker.MarkerItem; -import org.oscim.layers.marker.MarkerSymbol; -import org.oscim.layers.marker.MarkerSymbol.HotspotPlace; -import org.oscim.layers.tile.bitmap.BitmapTileLayer; -import org.oscim.renderer.atlas.TextureAtlas; -import org.oscim.renderer.atlas.TextureRegion; -import org.oscim.tiling.TileSource; -import org.oscim.tiling.source.OkHttpEngine; -import org.oscim.tiling.source.bitmap.DefaultSources; -import org.oscim.utils.TextureAtlasUtils; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - -import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap; - -public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity { - - @Override - void createLayers() { - // Map events receiver - mMap.layers().add(new MapEventsReceiver(mMap)); - - TileSource tileSource = DefaultSources.OPENSTREETMAP - .httpFactory(new OkHttpEngine.OkHttpFactory()) - .build(); - mMap.layers().add(new BitmapTileLayer(mMap, tileSource)); - - Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi)); - Bitmap bitmapFocus = drawableToBitmap(getResources().getDrawable(R.drawable.marker_focus)); - - // Create Atlas from Bitmaps - java.util.Map inputMap = new LinkedHashMap<>(); - java.util.Map regionsMap = new LinkedHashMap<>(); - List atlasList = new ArrayList<>(); - - inputMap.put("poi", bitmapPoi); - inputMap.put("focus", bitmapFocus); - - // Bitmaps will never used any more - // With iOS we must flip the Y-Axis - TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false); - - MarkerSymbol symbol; - if (BILLBOARDS) - symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.BOTTOM_CENTER); - else - symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.CENTER, false); - - if (BILLBOARDS) - mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.BOTTOM_CENTER); - else - mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false); - - mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList(), symbol, this); - mMap.layers().add(mMarkerLayer); - - List pts = new ArrayList<>(); - - for (double lat = -90; lat <= 90; lat += 5) { - for (double lon = -180; lon <= 180; lon += 5) - pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon))); - } - - mMarkerLayer.addItems(pts); - } -} diff --git a/vtm-android-example/src/org/oscim/android/test/AtlasThemeActivity.java b/vtm-android-example/src/org/oscim/android/test/AtlasThemeActivity.java deleted file mode 100644 index c5188dc8..00000000 --- a/vtm-android-example/src/org/oscim/android/test/AtlasThemeActivity.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017 Longri - * Copyright 2017-2018 devemux86 - * - * 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 android.os.Bundle; - -import org.oscim.utils.Parameters; - -public class AtlasThemeActivity extends SimpleMapActivity { - - @Override - public void onCreate(Bundle savedInstanceState) { - Parameters.TEXTURE_ATLAS = true; - - super.onCreate(savedInstanceState); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - - Parameters.TEXTURE_ATLAS = false; - } -} diff --git a/vtm-android-example/src/org/oscim/android/test/LayerGroupActivity.java b/vtm-android-example/src/org/oscim/android/test/LayerGroupActivity.java deleted file mode 100644 index 038bb9e8..00000000 --- a/vtm-android-example/src/org/oscim/android/test/LayerGroupActivity.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2013 Hannes Janetzek - * Copyright 2016-2018 devemux86 - * Copyright 2016 Andrey Novikov - * - * 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 android.os.Bundle; - -import org.oscim.backend.CanvasAdapter; -import org.oscim.layers.tile.buildings.BuildingLayer; -import org.oscim.layers.tile.vector.labeling.LabelLayer; -import org.oscim.map.Layers; -import org.oscim.renderer.BitmapRenderer; -import org.oscim.renderer.GLViewport; -import org.oscim.scalebar.DefaultMapScaleBar; -import org.oscim.scalebar.ImperialUnitAdapter; -import org.oscim.scalebar.MapScaleBar; -import org.oscim.scalebar.MapScaleBarLayer; -import org.oscim.scalebar.MetricUnitAdapter; -import org.oscim.theme.VtmThemes; - -public class LayerGroupActivity extends BaseMapActivity { - - private static final int GROUP_3D_OBJECTS = 1; - private static final int GROUP_LABELS = 2; - private static final int GROUP_OVERLAYS = 3; - - private DefaultMapScaleBar mapScaleBar; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - Layers layers = mMap.layers(); - - layers.addGroup(GROUP_3D_OBJECTS); - layers.add(new BuildingLayer(mMap, mBaseLayer), GROUP_3D_OBJECTS); - - layers.addGroup(GROUP_LABELS); - layers.add(new LabelLayer(mMap, mBaseLayer), GROUP_LABELS); - - mapScaleBar = new DefaultMapScaleBar(mMap); - mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH); - mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE); - mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE); - mapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT); - - MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar); - BitmapRenderer renderer = mapScaleBarLayer.getRenderer(); - renderer.setPosition(GLViewport.Position.BOTTOM_LEFT); - renderer.setOffset(5 * CanvasAdapter.getScale(), 0); - - layers.addGroup(GROUP_OVERLAYS); - layers.add(mapScaleBarLayer, GROUP_OVERLAYS); - - mMap.setTheme(VtmThemes.DEFAULT); - } - - @Override - protected void onDestroy() { - if (mapScaleBar != null) - mapScaleBar.destroy(); - - super.onDestroy(); - } -} diff --git a/vtm-android-example/src/org/oscim/android/test/LineTexActivity.java b/vtm-android-example/src/org/oscim/android/test/LineTexActivity.java index f113a09d..3c842d61 100644 --- a/vtm-android-example/src/org/oscim/android/test/LineTexActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/LineTexActivity.java @@ -1,6 +1,6 @@ /* * Copyright 2014 Hannes Janetzek - * Copyright 2016-2018 devemux86 + * Copyright 2016-2019 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -18,7 +18,6 @@ package org.oscim.android.test; import android.os.Bundle; - import org.oscim.backend.CanvasAdapter; import org.oscim.backend.canvas.Color; import org.oscim.core.MapPosition; @@ -38,7 +37,7 @@ import java.util.List; */ public class LineTexActivity extends BitmapTileActivity { - private static final boolean ANIMATION = false; + private static final boolean ANIMATION = true; private List mPathLayers = new ArrayList<>(); diff --git a/vtm-android-example/src/org/oscim/android/test/MapEventLayer2Activity.java b/vtm-android-example/src/org/oscim/android/test/MapEventLayer2Activity.java deleted file mode 100644 index 6e4c17c9..00000000 --- a/vtm-android-example/src/org/oscim/android/test/MapEventLayer2Activity.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2016-2017 devemux86 - * - * 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.utils.Parameters; - -public class MapEventLayer2Activity extends MarkerOverlayActivity { - - public MapEventLayer2Activity() { - super(); - Parameters.MAP_EVENT_LAYER2 = true; - } - - @Override - protected void onDestroy() { - super.onDestroy(); - - Parameters.MAP_EVENT_LAYER2 = false; - } -} diff --git a/vtm-android-example/src/org/oscim/android/test/MultiMapViewActivity.java b/vtm-android-example/src/org/oscim/android/test/MultiMapViewActivity.java deleted file mode 100644 index 72ffb519..00000000 --- a/vtm-android-example/src/org/oscim/android/test/MultiMapViewActivity.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2016 Marvin W - * Copyright 2016-2017 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 android.app.Activity; -import android.os.Bundle; - -import org.oscim.android.MapPreferences; -import org.oscim.android.MapView; -import org.oscim.layers.tile.buildings.BuildingLayer; -import org.oscim.layers.tile.vector.VectorTileLayer; -import org.oscim.layers.tile.vector.labeling.LabelLayer; -import org.oscim.map.Map; -import org.oscim.theme.VtmThemes; -import org.oscim.tiling.TileSource; -import org.oscim.tiling.source.OkHttpEngine; -import org.oscim.tiling.source.oscimap4.OSciMap4TileSource; - -public class MultiMapViewActivity extends Activity { - private MapView mMapView1, mMapView2; - private MapPreferences mPrefs1, mPrefs2; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_map_multi); - - setTitle(getClass().getSimpleName()); - - // 1st map view - mMapView1 = (MapView) findViewById(R.id.mapView1); - Map map1 = mMapView1.map(); - mPrefs1 = new MapPreferences(MultiMapViewActivity.class.getName() + "1", this); - TileSource tileSource1 = OSciMap4TileSource.builder() - .httpFactory(new OkHttpEngine.OkHttpFactory()) - .build(); - VectorTileLayer baseLayer1 = map1.setBaseMap(tileSource1); - map1.layers().add(new BuildingLayer(map1, baseLayer1)); - map1.layers().add(new LabelLayer(map1, baseLayer1)); - map1.setTheme(VtmThemes.DEFAULT); - - // 2nd map view - mMapView2 = (MapView) findViewById(R.id.mapView2); - Map map2 = mMapView2.map(); - mPrefs2 = new MapPreferences(MultiMapViewActivity.class.getName() + "2", this); - TileSource tileSource2 = OSciMap4TileSource.builder() - .httpFactory(new OkHttpEngine.OkHttpFactory()) - .build(); - VectorTileLayer baseLayer2 = map2.setBaseMap(tileSource2); - map2.layers().add(new BuildingLayer(map2, baseLayer2)); - map2.layers().add(new LabelLayer(map2, baseLayer2)); - map2.setTheme(VtmThemes.DEFAULT); - } - - @Override - protected void onResume() { - super.onResume(); - - mPrefs1.load(mMapView1.map()); - mMapView1.onResume(); - - mPrefs2.load(mMapView2.map()); - mMapView2.onResume(); - } - - @Override - protected void onPause() { - super.onPause(); - - mMapView1.onPause(); - mPrefs1.save(mMapView1.map()); - - mMapView2.onPause(); - mPrefs2.save(mMapView2.map()); - } -} diff --git a/vtm-android-example/src/org/oscim/android/test/OSciMapS3DBActivity.java b/vtm-android-example/src/org/oscim/android/test/OSciMapS3DBActivity.java deleted file mode 100644 index bb8ad34a..00000000 --- a/vtm-android-example/src/org/oscim/android/test/OSciMapS3DBActivity.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2016-2017 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 android.os.Bundle; - -import org.oscim.android.cache.TileCache; -import org.oscim.layers.tile.TileLayer; -import org.oscim.layers.tile.buildings.S3DBTileLayer; -import org.oscim.layers.tile.vector.labeling.LabelLayer; -import org.oscim.theme.VtmThemes; -import org.oscim.tiling.TileSource; -import org.oscim.tiling.source.OkHttpEngine; -import org.oscim.tiling.source.oscimap4.OSciMap4TileSource; - -public class OSciMapS3DBActivity extends BaseMapActivity { - - TileCache mS3dbCache; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - mMap.setTheme(VtmThemes.DEFAULT); - - TileSource ts = OSciMap4TileSource.builder() - .httpFactory(new OkHttpEngine.OkHttpFactory()) - .url("http://opensciencemap.org/tiles/s3db") - .zoomMin(16) - .zoomMax(16) - .build(); - - if (USE_CACHE) { - mS3dbCache = new TileCache(this, null, "s3db.db"); - mS3dbCache.setCacheSize(512 * (1 << 10)); - ts.setCache(mS3dbCache); - } - TileLayer tl = new S3DBTileLayer(mMap, ts, true, false); - mMap.layers().add(tl); - mMap.layers().add(new LabelLayer(mMap, mBaseLayer)); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - - if (mS3dbCache != null) - 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/POTTextureActivity.java b/vtm-android-example/src/org/oscim/android/test/POTTextureActivity.java deleted file mode 100644 index bacb5ee0..00000000 --- a/vtm-android-example/src/org/oscim/android/test/POTTextureActivity.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017-2018 devemux86 - * - * 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 android.os.Bundle; - -import org.oscim.utils.Parameters; - -public class POTTextureActivity extends SimpleMapActivity { - - @Override - public void onCreate(Bundle savedInstanceState) { - Parameters.POT_TEXTURES = true; - - super.onCreate(savedInstanceState); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - - Parameters.POT_TEXTURES = false; - } -} diff --git a/vtm-android-example/src/org/oscim/android/test/RotateMarkerOverlayActivity.java b/vtm-android-example/src/org/oscim/android/test/RotateMarkerOverlayActivity.java deleted file mode 100644 index dd4a54ed..00000000 --- a/vtm-android-example/src/org/oscim/android/test/RotateMarkerOverlayActivity.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2014 Hannes Janetzek - * Copyright 2016-2017 devemux86 - * Copyright 2017 Longri - * - * 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 android.widget.Toast; - -import org.oscim.layers.marker.MarkerItem; - -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.atomic.AtomicInteger; - -public class RotateMarkerOverlayActivity extends MarkerOverlayActivity { - - private Timer timer; - private int markerCount = 0; - - private void itemEvent(final MarkerItem item) { - if (item.getMarker() == null) { - item.setMarker(mFocusMarker); - markerCount++; - final AtomicInteger rotValue = new AtomicInteger(0); - if (timer != null) - timer.cancel(); - timer = new Timer(); - TimerTask timerTask = new TimerTask() { - @Override - public void run() { - float value = (float) (rotValue.incrementAndGet() * 10); - item.setRotation(value); - if (rotValue.get() > 36) - rotValue.set(0); - mMarkerLayer.update(); - mMap.updateMap(true); - } - }; - timer.schedule(timerTask, 1000, 1000); - - } else { - item.setMarker(null); - markerCount--; - if (timer != null && markerCount == 0) - timer.cancel(); - } - } - - @Override - public boolean onItemSingleTapUp(int index, MarkerItem item) { - itemEvent(item); - - Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show(); - return true; - } - - @Override - public boolean onItemLongPress(int index, MarkerItem item) { - itemEvent(item); - - Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show(); - return true; - } -} diff --git a/vtm-android-example/src/org/oscim/android/test/Samples.java b/vtm-android-example/src/org/oscim/android/test/Samples.java index 113eebc5..49112bbe 100644 --- a/vtm-android-example/src/org/oscim/android/test/Samples.java +++ b/vtm-android-example/src/org/oscim/android/test/Samples.java @@ -90,10 +90,10 @@ public class Samples extends Activity { linearLayout.addView(createButton(MapsforgeActivity.class)); linearLayout.addView(createButton(MapilionMvtActivity.class)); /*linearLayout.addView(createButton(MapzenMvtActivity.class)); - linearLayout.addView(createButton(MapzenGeojsonActivity.class));*/ + linearLayout.addView(createButton(MapzenGeojsonActivity.class)); linearLayout.addView(createButton(NextzenMvtActivity.class)); linearLayout.addView(createButton(NextzenGeojsonActivity.class)); - linearLayout.addView(createButton(OpenMapTilesMvtActivity.class)); + linearLayout.addView(createButton(OpenMapTilesMvtActivity.class));*/ linearLayout.addView(createButton(GdxActivity.class)); linearLayout.addView(createLabel("Features")); @@ -110,8 +110,6 @@ public class Samples extends Activity { linearLayout.addView(createLabel("Vector Features")); linearLayout.addView(createButton(MapsforgeStyleActivity.class)); linearLayout.addView(createButton(MapsforgeS3DBActivity.class)); - linearLayout.addView(createButton(AtlasThemeActivity.class)); - linearLayout.addView(createButton(POTTextureActivity.class)); linearLayout.addView(createButton(ShadowActivity.class)); linearLayout.addView(createLabel("Raster Maps")); @@ -120,27 +118,17 @@ public class Samples extends Activity { linearLayout.addView(createLabel("Overlays")); linearLayout.addView(createButton(MarkerOverlayActivity.class)); - linearLayout.addView(createButton(RotateMarkerOverlayActivity.class)); - linearLayout.addView(createButton(AtlasMarkerOverlayActivity.class)); - linearLayout.addView(createButton(AtlasMultiTextureActivity.class)); - linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class)); linearLayout.addView(createButton(PathOverlayActivity.class)); linearLayout.addView(createButton(LineTexActivity.class)); linearLayout.addView(createButton(VectorLayerActivity.class)); - - linearLayout.addView(createLabel("User Interaction")); - linearLayout.addView(createButton(MapEventLayer2Activity.class)); - linearLayout.addView(createButton(LayerGroupActivity.class)); - - linearLayout.addView(createLabel("Dual Map Views")); - linearLayout.addView(createButton(MultiMapViewActivity.class)); + linearLayout.addView(createButton(AtlasMultiTextureActivity.class)); linearLayout.addView(createLabel("Experiments")); linearLayout.addView(createButton(ReverseGeocodeActivity.class)); - linearLayout.addView(createButton(OSciMapS3DBActivity.class)); linearLayout.addView(createButton(ThemeStylerActivity.class)); linearLayout.addView(createButton(JeoIndoorActivity.class)); linearLayout.addView(createButton(GdxPoi3DActivity.class)); linearLayout.addView(createButton(OverpassActivity.class)); + linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class)); } } diff --git a/vtm-playground/src/org/oscim/test/AtlasMarkerLayerTest.java b/vtm-playground/src/org/oscim/test/AtlasMarkerLayerTest.java deleted file mode 100644 index 964e632e..00000000 --- a/vtm-playground/src/org/oscim/test/AtlasMarkerLayerTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2016-2018 devemux86 - * Copyright 2017 Longri - * - * 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.test; - -import org.oscim.backend.CanvasAdapter; -import org.oscim.backend.canvas.Bitmap; -import org.oscim.core.GeoPoint; -import org.oscim.gdx.GdxMapApp; -import org.oscim.layers.marker.ItemizedLayer; -import org.oscim.layers.marker.MarkerItem; -import org.oscim.layers.marker.MarkerSymbol; -import org.oscim.layers.tile.bitmap.BitmapTileLayer; -import org.oscim.renderer.atlas.TextureAtlas; -import org.oscim.renderer.atlas.TextureRegion; -import org.oscim.tiling.TileSource; -import org.oscim.tiling.source.OkHttpEngine; -import org.oscim.tiling.source.bitmap.DefaultSources; -import org.oscim.utils.TextureAtlasUtils; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - -import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace; - -public class AtlasMarkerLayerTest extends MarkerLayerTest { - - @Override - public void createLayers() { - try { - // Map events receiver - mMap.layers().add(new MapEventsReceiver(mMap)); - - TileSource tileSource = DefaultSources.OPENSTREETMAP - .httpFactory(new OkHttpEngine.OkHttpFactory()) - .build(); - mMap.layers().add(new BitmapTileLayer(mMap, tileSource)); - - mMap.setMapPosition(0, 0, 1 << 2); - - Bitmap bitmapPoi = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_poi.png")); - Bitmap bitmapFocus = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_focus.png")); - - // Create Atlas from Bitmaps - java.util.Map inputMap = new LinkedHashMap<>(); - java.util.Map regionsMap = new LinkedHashMap<>(); - List atlasList = new ArrayList<>(); - - inputMap.put("poi", bitmapPoi); - inputMap.put("focus", bitmapFocus); - - // Bitmaps will never used any more - // With iOS we must flip the Y-Axis - TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false); - - MarkerSymbol symbol; - if (BILLBOARDS) - symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.BOTTOM_CENTER); - else - symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.CENTER, false); - - if (BILLBOARDS) - mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.BOTTOM_CENTER); - else - mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false); - - mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList(), symbol, this); - mMap.layers().add(mMarkerLayer); - - List pts = new ArrayList<>(); - for (double lat = -90; lat <= 90; lat += 5) { - for (double lon = -180; lon <= 180; lon += 5) - pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon))); - } - mMarkerLayer.addItems(pts); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public static void main(String[] args) { - GdxMapApp.init(); - GdxMapApp.run(new AtlasMarkerLayerTest()); - } -} diff --git a/vtm-playground/src/org/oscim/test/AtlasThemeTest.java b/vtm-playground/src/org/oscim/test/AtlasThemeTest.java deleted file mode 100644 index 6e9f59f3..00000000 --- a/vtm-playground/src/org/oscim/test/AtlasThemeTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017 Longri - * Copyright 2017 devemux86 - * - * 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.test; - -import org.oscim.gdx.GdxMapApp; -import org.oscim.utils.Parameters; - -public class AtlasThemeTest extends SimpleMapTest { - - private AtlasThemeTest() { - Parameters.TEXTURE_ATLAS = true; - } - - public static void main(String[] args) { - GdxMapApp.init(); - GdxMapApp.run(new AtlasThemeTest()); - } -} diff --git a/vtm-playground/src/org/oscim/test/LineTexTest.java b/vtm-playground/src/org/oscim/test/LineTexTest.java index b973e9c4..8e771a23 100644 --- a/vtm-playground/src/org/oscim/test/LineTexTest.java +++ b/vtm-playground/src/org/oscim/test/LineTexTest.java @@ -1,6 +1,6 @@ /* * Copyright 2014 Hannes Janetzek - * Copyright 2016-2018 devemux86 + * Copyright 2016-2019 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -38,7 +38,7 @@ import java.util.List; public class LineTexTest extends GdxMapApp { - private static final boolean ANIMATION = false; + private static final boolean ANIMATION = true; private List mPathLayers = new ArrayList<>(); private TextureItem tex; diff --git a/vtm-playground/src/org/oscim/test/MapEventLayer2Test.java b/vtm-playground/src/org/oscim/test/MapEventLayer2Test.java deleted file mode 100644 index 07c8c337..00000000 --- a/vtm-playground/src/org/oscim/test/MapEventLayer2Test.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2016-2017 devemux86 - * - * 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.test; - -import org.oscim.gdx.GdxMapApp; -import org.oscim.utils.Parameters; - -public class MapEventLayer2Test extends MarkerLayerTest { - - public static void main(String[] args) { - Parameters.MAP_EVENT_LAYER2 = true; - - GdxMapApp.init(); - GdxMapApp.run(new MapEventLayer2Test()); - } -} diff --git a/vtm-playground/src/org/oscim/test/OSciMapS3DBTest.java b/vtm-playground/src/org/oscim/test/OSciMapS3DBTest.java deleted file mode 100644 index 68791925..00000000 --- a/vtm-playground/src/org/oscim/test/OSciMapS3DBTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2016-2018 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.test; - -import org.oscim.gdx.GdxMapApp; -import org.oscim.layers.tile.buildings.S3DBTileLayer; -import org.oscim.layers.tile.vector.VectorTileLayer; -import org.oscim.layers.tile.vector.labeling.LabelLayer; -import org.oscim.theme.VtmThemes; -import org.oscim.tiling.TileSource; -import org.oscim.tiling.source.OkHttpEngine; -import org.oscim.tiling.source.oscimap4.OSciMap4TileSource; - -public class OSciMapS3DBTest extends GdxMapApp { - - @Override - public void createLayers() { - TileSource tileSource = OSciMap4TileSource.builder() - .httpFactory(new OkHttpEngine.OkHttpFactory()) - .build(); - VectorTileLayer l = mMap.setBaseMap(tileSource); - mMap.setTheme(VtmThemes.DEFAULT); - - TileSource ts = OSciMap4TileSource.builder() - .httpFactory(new OkHttpEngine.OkHttpFactory()) - .url("http://opensciencemap.org/tiles/s3db") - .zoomMin(16) - .zoomMax(16) - .build(); - - S3DBTileLayer tl = new S3DBTileLayer(mMap, ts); - mMap.layers().add(tl); - mMap.layers().add(new LabelLayer(mMap, l)); - - mMap.setMapPosition(53.08, 8.82, 1 << 17); - - } - - public static void main(String[] args) { - init(); - run(new OSciMapS3DBTest()); - } -} diff --git a/vtm-playground/src/org/oscim/test/POTTextureTest.java b/vtm-playground/src/org/oscim/test/POTTextureTest.java deleted file mode 100644 index bd7629aa..00000000 --- a/vtm-playground/src/org/oscim/test/POTTextureTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017 Longri - * Copyright 2017 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.test; - -import org.oscim.gdx.GdxMapApp; -import org.oscim.utils.Parameters; - -public class POTTextureTest extends SimpleMapTest { - - private POTTextureTest() { - Parameters.POT_TEXTURES = true; - } - - public static void main(String[] args) { - GdxMapApp.init(); - GdxMapApp.run(new POTTextureTest()); - } -} diff --git a/vtm-playground/src/org/oscim/test/RotateMarkerLayerTest.java b/vtm-playground/src/org/oscim/test/RotateMarkerLayerTest.java deleted file mode 100644 index 1515ceb7..00000000 --- a/vtm-playground/src/org/oscim/test/RotateMarkerLayerTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2016-2017 devemux86 - * Copyright 2017 Longri - * - * 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.test; - -import org.oscim.gdx.GdxMapApp; -import org.oscim.layers.marker.MarkerItem; - -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.atomic.AtomicInteger; - -public class RotateMarkerLayerTest extends MarkerLayerTest { - - private Timer timer; - private int markerCount = 0; - - private void itemEvent(final MarkerItem item) { - if (item.getMarker() == null) { - item.setMarker(mFocusMarker); - markerCount++; - final AtomicInteger rotValue = new AtomicInteger(0); - if (timer != null) - timer.cancel(); - timer = new Timer(); - TimerTask timerTask = new TimerTask() { - @Override - public void run() { - float value = (float) (rotValue.incrementAndGet() * 10); - item.setRotation(value); - if (rotValue.get() > 36) - rotValue.set(0); - mMarkerLayer.update(); - mMap.updateMap(true); - } - }; - timer.schedule(timerTask, 1000, 1000); - - } else { - item.setMarker(null); - markerCount--; - if (timer != null && markerCount == 0) - timer.cancel(); - } - } - - @Override - public boolean onItemSingleTapUp(int index, MarkerItem item) { - itemEvent(item); - - System.out.println("Marker tap " + item.getTitle()); - return true; - } - - @Override - public boolean onItemLongPress(int index, MarkerItem item) { - itemEvent(item); - - System.out.println("Marker long press " + item.getTitle()); - return true; - } - - public static void main(String[] args) { - GdxMapApp.init(); - GdxMapApp.run(new RotateMarkerLayerTest()); - } -}