fix segv... set initial map position when not in config

This commit is contained in:
Hannes Janetzek 2012-09-11 15:46:44 +02:00
parent 53636cff30
commit ab69675d69
3 changed files with 18 additions and 9 deletions

View File

@ -179,6 +179,7 @@ public class MapView extends GLSurfaceView {
}
setMapFile("default");
initMapStartPosition();
mapActivity.registerMapView(this);
@ -204,11 +205,19 @@ public class MapView extends GLSurfaceView {
GeoPoint startPoint = getStartPoint();
if (startPoint != null) {
mMapViewPosition.setMapCenter(startPoint);
}
Log.d(TAG, "got start");
Byte startZoomLevel = getStartZoomLevel();
if (startZoomLevel != null) {
mMapViewPosition.setZoomLevel(startZoomLevel.byteValue());
Log.d(TAG, "got zoom");
} else
mMapViewPosition.setZoomLevel((byte) 2);
}
else {
startPoint = new GeoPoint(0, 0);
mMapViewPosition.setMapCenter(startPoint);
mMapViewPosition.setZoomLevel((byte) 4);
}
}

View File

@ -777,8 +777,8 @@ public class MapRenderer implements org.mapsforge.android.IMapRenderer {
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
String ext = GLES20.glGetString(GLES20.GL_EXTENSIONS);
Log.d(TAG, "Extensions: " + ext);
// String ext = GLES20.glGetString(GLES20.GL_EXTENSIONS);
// Log.d(TAG, "Extensions: " + ext);
shortBuffer = new ShortBuffer[rotateBuffers];

View File

@ -77,9 +77,9 @@ public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser {
// configurations are considered to be "better" and returned first.
// You need to explicitly filter the data returned by eglChooseConfig!
for (int i = 0; i < configs.length; ++i) {
Log.i(TAG, printConfig(egl, display, configs[i]));
}
// for (int i = 0; i < configs.length; ++i) {
// Log.i(TAG, printConfig(egl, display, configs[i]));
// }
// int index = -1;
// for (int i = 0; i < configs.length; ++i) {