GdxSpriteBatchTest: fix map position scale #337

This commit is contained in:
Emux 2017-04-15 12:37:30 +03:00
parent f0639972b4
commit 4bf27bc910

View File

@ -1,5 +1,6 @@
/* /*
* Copyright 2017 Gerber Lóránt Viktor * Copyright 2017 Gerber Lóránt Viktor
* Copyright 2017 devemux86
* *
* This program is free software: you can redistribute it and/or modify it under the * 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 * terms of the GNU Lesser General Public License as published by the Free Software
@ -25,7 +26,6 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.badlogic.gdx.utils.viewport.Viewport; import com.badlogic.gdx.utils.viewport.Viewport;
import org.oscim.backend.GL; import org.oscim.backend.GL;
import org.oscim.core.GeoPoint;
import org.oscim.core.Point; import org.oscim.core.Point;
import org.oscim.gdx.GdxMap; import org.oscim.gdx.GdxMap;
import org.oscim.gdx.GdxMapApp; import org.oscim.gdx.GdxMapApp;
@ -37,8 +37,9 @@ import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
import static org.oscim.backend.GLAdapter.gl; import static org.oscim.backend.GLAdapter.gl;
public class GdxSpriteBatchTest extends GdxMap { public class GdxSpriteBatchTest extends GdxMap {
private GeoPoint position = new GeoPoint(47.1970869, 18.4398422); private double latitude = 47.1970869;
private int mapScale = 2000 << 6; private double longitude = 18.4398422;
private double scale = 1 << 17;
private OrthographicCamera camera; private OrthographicCamera camera;
private Viewport viewport; private Viewport viewport;
@ -50,7 +51,7 @@ public class GdxSpriteBatchTest extends GdxMap {
protected void createLayers() { protected void createLayers() {
TileSource tileSource = new OSciMap4TileSource(); TileSource tileSource = new OSciMap4TileSource();
initDefaultLayers(tileSource, false, true, false); initDefaultLayers(tileSource, false, true, false);
mMap.setMapPosition(position.getLatitude(), position.getLongitude(), mapScale); mMap.setMapPosition(latitude, longitude, scale);
camera = new OrthographicCamera(); camera = new OrthographicCamera();
viewport = new ScreenViewport(camera); viewport = new ScreenViewport(camera);
@ -104,10 +105,8 @@ public class GdxSpriteBatchTest extends GdxMap {
spriteBatch.end(); spriteBatch.end();
// Fly over the city. // Fly over the city.
double lon = position.getLongitude(); longitude += 0.0001;
lon += 0.0001; mMap.setMapPosition(latitude, longitude, scale);
position = new GeoPoint(position.getLatitude(), lon);
mMap.setMapPosition(position.getLatitude(), position.getLongitude(), mapScale);
mMap.updateMap(true); mMap.updateMap(true);
} }