fixme: debugging
This commit is contained in:
parent
96fa65fb65
commit
57a3cb7763
@ -2,29 +2,33 @@ package org.oscim.gdx;
|
|||||||
|
|
||||||
import org.oscim.backend.Log.Logger;
|
import org.oscim.backend.Log.Logger;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
|
|
||||||
public class GdxLog implements Logger {
|
public class GdxLog implements Logger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void d(String tag, String msg) {
|
public void d(String tag, String msg) {
|
||||||
Gdx.app.log(tag, msg);
|
//Gdx.app.log(tag, msg);
|
||||||
|
System.err.println(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void w(String tag, String msg) {
|
public void w(String tag, String msg) {
|
||||||
Gdx.app.log(tag, msg);
|
//Gdx.app.log(tag, msg);
|
||||||
|
System.err.println(msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void e(String tag, String msg) {
|
public void e(String tag, String msg) {
|
||||||
Gdx.app.log(tag, msg);
|
//Gdx.app.log(tag, msg);
|
||||||
|
System.err.println(msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void i(String tag, String msg) {
|
public void i(String tag, String msg) {
|
||||||
Gdx.app.log(tag, msg);
|
//Gdx.app.log(tag, msg);
|
||||||
|
System.err.println(msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,12 @@ package org.oscim.gdx;
|
|||||||
import org.oscim.backend.AssetAdapter;
|
import org.oscim.backend.AssetAdapter;
|
||||||
import org.oscim.backend.Log;
|
import org.oscim.backend.Log;
|
||||||
import org.oscim.backend.input.MotionEvent;
|
import org.oscim.backend.input.MotionEvent;
|
||||||
import org.oscim.layers.tile.vector.MapTileLayer;
|
import org.oscim.layers.overlay.GenericOverlay;
|
||||||
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
|
import org.oscim.layers.tile.bitmap.OpenStreetMapMapnik;
|
||||||
import org.oscim.renderer.GLRenderer;
|
import org.oscim.renderer.GLRenderer;
|
||||||
import org.oscim.renderer.GLState;
|
import org.oscim.renderer.GLState;
|
||||||
import org.oscim.theme.InternalRenderTheme;
|
import org.oscim.renderer.layers.GridRenderLayer;
|
||||||
import org.oscim.tilesource.TileSource;
|
|
||||||
import org.oscim.tilesource.oscimap4.OSciMap4TileSource;
|
|
||||||
import org.oscim.view.MapRenderCallback;
|
import org.oscim.view.MapRenderCallback;
|
||||||
import org.oscim.view.MapView;
|
import org.oscim.view.MapView;
|
||||||
import org.oscim.view.MapViewPosition;
|
import org.oscim.view.MapViewPosition;
|
||||||
@ -34,7 +34,7 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
|||||||
// Stage ui;
|
// Stage ui;
|
||||||
// Label fps;
|
// Label fps;
|
||||||
// BitmapFont font;
|
// BitmapFont font;
|
||||||
MapTileLayer mMapLayer;
|
// MapTileLayer mMapLayer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
@ -52,16 +52,17 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
|||||||
mWidth = w;
|
mWidth = w;
|
||||||
mHeight = h;
|
mHeight = h;
|
||||||
|
|
||||||
//TileSource tileSource = new OSciMap2TileSource();
|
// TileSource tileSource = new OSciMap2TileSource();
|
||||||
//tileSource.setOption("url", "http://city.informatik.uni-bremen.de/osci/map-live");
|
// tileSource.setOption("url",
|
||||||
TileSource tileSource = new OSciMap4TileSource();
|
// "http://city.informatik.uni-bremen.de/osci/map-live");
|
||||||
tileSource.setOption("url", "http://city.informatik.uni-bremen.de/osci/testing");
|
// TileSource tileSource = new OSciMap4TileSource();
|
||||||
|
// tileSource.setOption("url",
|
||||||
mMapLayer = mMapView.setBaseMap(tileSource);
|
// "http://city.informatik.uni-bremen.de/osci/testing");
|
||||||
mMapLayer.setRenderTheme(InternalRenderTheme.DEFAULT);
|
// mMapLayer = mMapView.setBaseMap(tileSource);
|
||||||
|
// mMapLayer.setRenderTheme(InternalRenderTheme.DEFAULT);
|
||||||
//mMapView.getLayerManager().add(new GenericOverlay(mMapView, new
|
mMapView.setBaseMap(new BitmapTileLayer(mMapView, OpenStreetMapMapnik.INSTANCE));
|
||||||
// GridRenderLayer(mMapView)));
|
mMapView.getLayerManager().add(new GenericOverlay(mMapView, new
|
||||||
|
GridRenderLayer(mMapView)));
|
||||||
|
|
||||||
mMapView.getMapViewPosition().setViewport(w, h);
|
mMapView.getMapViewPosition().setViewport(w, h);
|
||||||
|
|
||||||
@ -83,10 +84,11 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//private int fpsCnt = 0;
|
private int fpsCnt = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
|
//Log.d("yo", )
|
||||||
// GLState.enableVertexArrays(-1, -1);
|
// GLState.enableVertexArrays(-1, -1);
|
||||||
// GLState.blend(false);
|
// GLState.blend(false);
|
||||||
// GLState.test(false, false);
|
// GLState.test(false, false);
|
||||||
@ -96,11 +98,11 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
|||||||
// Gdx.gl20.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
// Gdx.gl20.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||||
// Gdx.gl20.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
// Gdx.gl20.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
// int f = Gdx.graphics.getFramesPerSecond();
|
int f = Gdx.graphics.getFramesPerSecond();
|
||||||
// if (f != fpsCnt) {
|
if (f != fpsCnt) {
|
||||||
// Log.d("fps", ">" + f);
|
Log.d("fps", ">" + f);
|
||||||
// fpsCnt = f;
|
fpsCnt = f;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// fps.setText("fps: " + Gdx.graphics.getFramesPerSecond());
|
// fps.setText("fps: " + Gdx.graphics.getFramesPerSecond());
|
||||||
// ui.draw();
|
// ui.draw();
|
||||||
@ -132,15 +134,15 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
|||||||
void redrawMapInternal(boolean forceRedraw) {
|
void redrawMapInternal(boolean forceRedraw) {
|
||||||
GLState.blend(false);
|
GLState.blend(false);
|
||||||
GLState.test(false, false);
|
GLState.test(false, false);
|
||||||
//if (forceRedraw && !mClearMap)
|
// if (forceRedraw && !mClearMap)
|
||||||
// Gdx.graphics.requestRendering();
|
// Gdx.graphics.requestRendering();
|
||||||
|
|
||||||
mMapView.updateLayers();
|
mMapView.updateLayers();
|
||||||
|
|
||||||
//if (mClearMap) {
|
// if (mClearMap) {
|
||||||
Gdx.graphics.requestRendering();
|
Gdx.graphics.requestRendering();
|
||||||
mClearMap = false;
|
mClearMap = false;
|
||||||
//}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean mClearMap;
|
private boolean mClearMap;
|
||||||
@ -243,34 +245,42 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
|||||||
@Override
|
@Override
|
||||||
public boolean keyDown(int keycode) {
|
public boolean keyDown(int keycode) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
//
|
|
||||||
// case Input.Keys.UP:
|
case Input.Keys.UP:
|
||||||
// mMapPosition.moveMap(0, -50);
|
mMapPosition.moveMap(0, -50);
|
||||||
// mMapView.redrawMap(true);
|
mMapView.updateMap(true);
|
||||||
// break;
|
break;
|
||||||
// case Input.Keys.DOWN:
|
case Input.Keys.DOWN:
|
||||||
// mMapPosition.moveMap(0, 50);
|
mMapPosition.moveMap(0, 50);
|
||||||
// mMapView.redrawMap(true);
|
mMapView.updateMap(true);
|
||||||
// break;
|
break;
|
||||||
// case Input.Keys.LEFT:
|
case Input.Keys.LEFT:
|
||||||
// mMapPosition.moveMap(-50, 0);
|
mMapPosition.moveMap(-50, 0);
|
||||||
// mMapView.redrawMap(true);
|
mMapView.updateMap(true);
|
||||||
// break;
|
break;
|
||||||
// case Input.Keys.RIGHT:
|
case Input.Keys.RIGHT:
|
||||||
// mMapPosition.moveMap(50, 0);
|
mMapPosition.moveMap(50, 0);
|
||||||
// mMapView.redrawMap(true);
|
mMapView.updateMap(true);
|
||||||
// break;
|
break;
|
||||||
//
|
case Input.Keys.M:
|
||||||
case Input.Keys.R:
|
mMapPosition.scaleMap(1.05f, 0, 0);
|
||||||
mMapLayer.setRenderTheme(InternalRenderTheme.DEFAULT);
|
mMapView.updateMap(true);
|
||||||
mMapView.updateMap(false);
|
break;
|
||||||
break;
|
case Input.Keys.N:
|
||||||
|
mMapPosition.scaleMap(0.95f, 0, 0);
|
||||||
case Input.Keys.T:
|
mMapView.updateMap(true);
|
||||||
mMapLayer.setRenderTheme(InternalRenderTheme.TRONRENDER);
|
|
||||||
mMapView.updateMap(false);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// case Input.Keys.R:
|
||||||
|
// mMapLayer.setRenderTheme(InternalRenderTheme.DEFAULT);
|
||||||
|
// mMapView.updateMap(false);
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case Input.Keys.T:
|
||||||
|
// mMapLayer.setRenderTheme(InternalRenderTheme.TRONRENDER);
|
||||||
|
// mMapView.updateMap(false);
|
||||||
|
// break;
|
||||||
|
//
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -287,11 +297,12 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||||
|
// if (button == Buttons.MIDDLE) {
|
||||||
|
// mActiveScale = true;
|
||||||
|
// // mActiveTilt = true;
|
||||||
|
// mPosY = screenY;
|
||||||
|
// } else
|
||||||
if (button == Buttons.MIDDLE) {
|
if (button == Buttons.MIDDLE) {
|
||||||
mActiveScale = true;
|
|
||||||
// mActiveTilt = true;
|
|
||||||
mPosY = screenY;
|
|
||||||
} else if (button == Buttons.RIGHT) {
|
|
||||||
mActiveRotate = true;
|
mActiveRotate = true;
|
||||||
mPosX = screenX;
|
mPosX = screenX;
|
||||||
mPosY = screenY;
|
mPosY = screenY;
|
||||||
@ -328,7 +339,7 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
|||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mActiveRotate || mActiveTilt)) {
|
if (!(mActiveRotate || mActiveTilt || mActiveScale)) {
|
||||||
int dx = screenX - mPosX;
|
int dx = screenX - mPosX;
|
||||||
int dy = screenY - mPosY;
|
int dy = screenY - mPosY;
|
||||||
if (Math.abs(dx) > 0 || Math.abs(dy) > 0) {
|
if (Math.abs(dx) > 0 || Math.abs(dy) > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user