refactor: move AndroidGLRenderer into GLView

- remove unused class
This commit is contained in:
Hannes Janetzek 2013-09-03 05:27:30 +02:00
parent 4bc048dba2
commit eee41e093c
3 changed files with 28 additions and 113 deletions

View File

@ -1,47 +0,0 @@
/*
* Copyright 2013 Hannes Janetzek
*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.oscim.android;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import org.oscim.renderer.GLRenderer;
import org.oscim.view.Map;
import android.opengl.GLSurfaceView;
public class AndroidGLRenderer extends GLRenderer implements GLSurfaceView.Renderer{
public AndroidGLRenderer(Map map) {
super(map);
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
super.onSurfaceCreated();
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
super.onSurfaceChanged(width, height);
}
@Override
public void onDrawFrame(GL10 gl) {
super.onDrawFrame();
}
}

View File

@ -1,58 +0,0 @@
/*
* Copyright 2013 Hannes Janetzek
*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.oscim.android;
//public class AndroidGraphics {
//
// public static OverlayMarker makeMarker(Resources res, int id, HotspotPlace place) {
//
// // if (place == null)
// // place = HotspotPlace.CENTER;
// //
// //Drawable drawable = ;
// //
// // return new OverlayMarker(drawableToBitmap(drawable), place);
// return makeMarker(res.getDrawable(id), place);
// }
//
// public static OverlayMarker makeMarker(Drawable drawable, HotspotPlace place) {
//
// if (place == null)
// place = HotspotPlace.CENTER;
//
// //Drawable drawable = res.getDrawable(id);
//
// return new OverlayMarker(drawableToBitmap(drawable), place);
// }
//
//
// public static Bitmap drawableToBitmap(Drawable drawable) {
// if (drawable instanceof BitmapDrawable) {
// return ((BitmapDrawable) drawable).getBitmap();
// }
//
// android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap(
// drawable.getIntrinsicWidth(),
// drawable.getIntrinsicHeight(),
// Config.ARGB_8888);
//
// android.graphics.Canvas canvas = new android.graphics.Canvas(bitmap);
// drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
// drawable.draw(canvas);
//
// return bitmap;
// }
//}

View File

@ -14,6 +14,9 @@
*/ */
package org.oscim.android; package org.oscim.android;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import org.oscim.view.Map; import org.oscim.view.Map;
import android.content.Context; import android.content.Context;
@ -21,21 +24,38 @@ import android.opengl.GLSurfaceView;
public class GLView extends GLSurfaceView { public class GLView extends GLSurfaceView {
Map mMap; class GLRenderer extends org.oscim.renderer.GLRenderer implements GLSurfaceView.Renderer{
private final AndroidGLRenderer mRenderer;
public GLRenderer(Map map) {
super(map);
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
super.onSurfaceCreated();
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
super.onSurfaceChanged(width, height);
}
@Override
public void onDrawFrame(GL10 gl) {
super.onDrawFrame();
}
}
public GLView(Context context, Map map) { public GLView(Context context, Map map) {
super(context); super(context);
mMap = map;
// Log.d(TAG, "init GLSurfaceLayer");
setEGLConfigChooser(new GlConfigChooser()); setEGLConfigChooser(new GlConfigChooser());
setEGLContextClientVersion(2); setEGLContextClientVersion(2);
setDebugFlags(DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS); setDebugFlags(DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS);
mRenderer = new AndroidGLRenderer(mMap); setRenderer(new GLRenderer(map));
setRenderer(mRenderer);
//if (!MapView.debugFrameTime) setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
} }
} }