GDX samples: remember map position (#569)

This commit is contained in:
Gustl22
2018-08-25 15:42:02 +02:00
committed by Emux
parent 278ef523b8
commit f3f629779f
2 changed files with 28 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright 2016-2017 devemux86
* Copyright 2018 Gustl22
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -16,11 +17,13 @@
*/
package org.oscim.test.gdx.poi3d;
import org.oscim.core.MapPosition;
import org.oscim.gdx.GdxMapApp;
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.renderer.MapRenderer;
import org.oscim.test.MapPreferences;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.TileSource;
import org.oscim.tiling.source.OkHttpEngine;
@@ -32,8 +35,6 @@ public class Gdx3DTest extends GdxMapApp {
public void createLayers() {
MapRenderer.setBackgroundColor(0xff888888);
mMap.setMapPosition(53.1, 8.8, 1 << 15);
TileSource ts = OSciMap4TileSource.builder()
.httpFactory(new OkHttpEngine.OkHttpFactory())
.build();
@@ -57,6 +58,18 @@ public class Gdx3DTest extends GdxMapApp {
mMap.layers().add(new Poi3DLayer(mMap, mMapLayer));
mMap.layers().add(new LabelLayer(mMap, mMapLayer));
MapPosition pos = MapPreferences.getMapPosition();
if (pos != null)
mMap.setMapPosition(pos);
else
mMap.setMapPosition(53.1, 8.8, 1 << 15);
}
@Override
public void dispose() {
MapPreferences.saveMapPosition(mMap.getMapPosition());
super.dispose();
}
public static void main(String[] args) {