remove tilesChanged parameter of RenderLayer.update as there is no more global tile layer

- fix PathOverlay update
This commit is contained in:
Hannes Janetzek
2013-04-28 06:04:56 +02:00
parent 28ecec811a
commit 8bea920253
12 changed files with 49 additions and 100 deletions

View File

@@ -242,7 +242,6 @@ public class GLRenderer implements GLSurfaceView.Renderer {
| GLES20.GL_DEPTH_BUFFER_BIT
| GLES20.GL_STENCIL_BUFFER_BIT);
boolean tilesChanged = false;
boolean positionChanged = false;
// get current MapPosition, set mBoxCoords (mapping of screen to model
@@ -269,7 +268,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
RenderLayer[] overlays = mMapView.getLayerManager().getRenderLayers();
for (int i = 0, n = overlays.length; i < n; i++)
overlays[i].update(mMapPosition, positionChanged, tilesChanged, mMatrices);
overlays[i].update(mMapPosition, positionChanged, mMatrices);
/* draw layers */
for (int i = 0, n = overlays.length; i < n; i++) {

View File

@@ -38,33 +38,30 @@ public abstract class RenderLayer {
// /////////////// called from GLRender Thread ////////////////////////
/**
* called 1. by GLRenderer. Set 'newData' true when 'compile()' should be
* called
* before next 'render()'
* Called first by GLRenderer: Set 'newData' true when 'compile()' should be
* called before next 'render()'
*
* @param curPos TODO
* @param positionChanged
* true when MapPosition has changed
* @param tilesChanged
* true when current tiles changed
* @param matrices TODO
*/
public abstract void update(MapPosition curPos, boolean positionChanged, boolean tilesChanged,
public abstract void update(MapPosition curPos, boolean positionChanged,
Matrices matrices);
/**
* called 2. compile everything for drawing
* 2: Compile everything for drawing
* Set 'isReady' true when things are ready for 'render()'
*/
public abstract void compile();
/**
* called 3. draw overlay
* 3: Draw layer
*
* @param pos
* current MapPosition
* Current MapPosition
* @param m
* current render matrices + matrix for temporary use
* Current render matrices + matrix for temporary use
*/
public abstract void render(MapPosition pos, Matrices m);

View File

@@ -116,8 +116,7 @@ public class AtlasTest extends BasicOverlay {
boolean initial = true;
@Override
public void update(MapPosition pos, boolean positionChanged,
boolean tilesChanged, Matrices m) {
public void update(MapPosition pos, boolean changed, Matrices m) {
if (initial) {
mMapPosition.copy(pos);

View File

@@ -55,7 +55,7 @@ public class CustomOverlay extends RenderLayer {
// ---------- everything below runs in GLRender Thread ----------
@Override
public void update(MapPosition curPos, boolean positionChanged, boolean tilesChanged, Matrices matrices) {
public void update(MapPosition pos, boolean changed, Matrices matrices) {
if (!mInitialized) {
if (!init())
return;
@@ -66,7 +66,7 @@ public class CustomOverlay extends RenderLayer {
newData = true;
// fix current MapPosition
mMapPosition.copy(curPos);
mMapPosition.copy(pos);
}
}

View File

@@ -21,13 +21,12 @@ import java.nio.ShortBuffer;
import org.oscim.core.MapPosition;
import org.oscim.core.Tile;
import org.oscim.layers.tile.MapTile;
import org.oscim.layers.tile.MapTile;
import org.oscim.layers.tile.TileRenderLayer;
import org.oscim.layers.tile.TileSet;
import org.oscim.renderer.GLRenderer;
import org.oscim.renderer.RenderLayer;
import org.oscim.renderer.GLRenderer.Matrices;
import org.oscim.renderer.GLState;
import org.oscim.renderer.RenderLayer;
import org.oscim.renderer.layer.ExtrusionLayer;
import org.oscim.utils.GlUtils;
import org.oscim.view.MapView;
@@ -66,8 +65,7 @@ public class ExtrusionOverlay extends RenderLayer {
private int mTileCnt;
@Override
public void update(MapPosition curPos, boolean positionChanged,
boolean tilesChanged, Matrices matrices) {
public void update(MapPosition pos, boolean changed, Matrices matrices) {
mMapView.getMapViewPosition().getMapPosition(mMapPosition);
@@ -103,7 +101,7 @@ public class ExtrusionOverlay extends RenderLayer {
MapTile[] tiles = mTileSet.tiles;
// FIXME just release tiles in this case
if (mAlpha == 0 || curPos.zoomLevel < 16) {
if (mAlpha == 0 || pos.zoomLevel < 16) {
isReady = false;
return;
}
@@ -113,7 +111,7 @@ public class ExtrusionOverlay extends RenderLayer {
mTiles = new MapTile[mTileSet.cnt * 4];
ExtrusionLayer el;
if (curPos.zoomLevel >= 17) {
if (pos.zoomLevel >= 17) {
for (int i = 0; i < mTileSet.cnt; i++) {
if (!tiles[i].isVisible)
continue;
@@ -139,7 +137,7 @@ public class ExtrusionOverlay extends RenderLayer {
if (el.compiled)
mTiles[ready++] = tiles[i];
}
} else if (curPos.zoomLevel == 16) {
} else if (pos.zoomLevel == 16) {
for (int i = 0; i < mTileSet.cnt; i++) {
if (!tiles[i].isVisible)
continue;

View File

@@ -104,8 +104,7 @@ public class GridOverlay extends BasicOverlay {
private int mCurZ = -1;
@Override
public synchronized void update(MapPosition curPos, boolean positionChanged,
boolean tilesChanged, Matrices matrices) {
public synchronized void update(MapPosition curPos, boolean changed, Matrices m) {
int z = 1 << curPos.zoomLevel;
int x = (int) (curPos.x * z);

View File

@@ -122,7 +122,7 @@ public class TestOverlay extends BasicOverlay {
@Override
public synchronized void update(MapPosition curPos, boolean positionChanged,
boolean tilesChanged, Matrices matrices) {
Matrices matrices) {
// keep position constant (or update layer relative to new position)
//mMapPosition.copy(curPos);

View File

@@ -678,7 +678,7 @@ private final static String TAG = TextOverlay.class.getName();
@Override
public synchronized void update(MapPosition curPos, boolean positionChanged,
boolean tilesChanged, Matrices matrices) {
Matrices matrices) {
if (mNextLayer != null) {
// keep text layer, not recrating its canvas each time
@@ -703,7 +703,7 @@ private final static String TAG = TextOverlay.class.getName();
this.newData = true;
if (!(positionChanged || tilesChanged))
if (!positionChanged)
return;
}

View File

@@ -1,45 +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.renderer.overlays;
import org.oscim.core.MapPosition;
import org.oscim.renderer.RenderLayer;
import org.oscim.renderer.GLRenderer.Matrices;
import org.oscim.view.MapView;
public class ViewOverlay extends RenderLayer {
public ViewOverlay(MapView mapView) {
super(mapView);
}
@Override
public void update(MapPosition curPos, boolean positionChanged, boolean tilesChanged,
Matrices matrices) {
}
@Override
public void compile() {
}
@Override
public void render(MapPosition pos, Matrices m) {
}
}