move TileGenerator from 'renderer' to 'generator' package
This commit is contained in:
parent
ac63a4cae1
commit
cfa56c00f6
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
|
* Copyright 2012, 2013 OpenScienceMap
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -14,7 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.generator;
|
package org.oscim.generator;
|
||||||
|
|
||||||
//import static org.oscim.view.mapgenerator.JobTile.LOADING;
|
import static org.oscim.generator.JobTile.STATE_LOADING;
|
||||||
|
import static org.oscim.generator.JobTile.STATE_NONE;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.PriorityQueue;
|
import java.util.PriorityQueue;
|
||||||
@ -41,8 +43,7 @@ public class JobQueue {
|
|||||||
|
|
||||||
for (int i = 0, n = tiles.size(); i < n; i++) {
|
for (int i = 0, n = tiles.size(); i < n; i++) {
|
||||||
JobTile tile = tiles.get(i);
|
JobTile tile = tiles.get(i);
|
||||||
//tile.isLoading = true;
|
tile.state = STATE_LOADING;
|
||||||
tile.state = JobTile.STATE_LOADING;
|
|
||||||
mPriorityQueue.offer(tile);
|
mPriorityQueue.offer(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,8 +54,7 @@ public class JobQueue {
|
|||||||
public synchronized void clear() {
|
public synchronized void clear() {
|
||||||
JobTile t;
|
JobTile t;
|
||||||
while ((t = mPriorityQueue.poll()) != null)
|
while ((t = mPriorityQueue.poll()) != null)
|
||||||
t.state = JobTile.STATE_NONE;
|
t.state = STATE_NONE;
|
||||||
//t.isLoading = false;
|
|
||||||
|
|
||||||
mPriorityQueue.clear();
|
mPriorityQueue.clear();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 Hannes Janetzek
|
* Copyright 2012, 2013 OpenScienceMap
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -19,21 +19,16 @@ import org.oscim.core.Tile;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Hannes Janetzek
|
||||||
*/
|
*/
|
||||||
public class JobTile extends Tile implements Comparable<JobTile> {
|
public class JobTile extends Tile implements Comparable<JobTile> {
|
||||||
private final static String TAG = JobTile.class.getName();
|
private final static String TAG = JobTile.class.getName();
|
||||||
// public final static int LOADING = 1;
|
|
||||||
// public final static int NEWDATA = 1 << 1;
|
|
||||||
// public final static int READY = 1 << 2;
|
|
||||||
// public final static int AVAILABLE = 1 << 1 | 1 << 2;
|
|
||||||
// public final static int CANCELED = 1 << 3;
|
|
||||||
// public int state;
|
|
||||||
|
|
||||||
public final static int STATE_NONE = 0;
|
public final static int STATE_NONE = 0;
|
||||||
public final static int STATE_LOADING = 1 << 0;
|
public final static int STATE_LOADING = 1 << 0;
|
||||||
public final static int STATE_NEW_DATA = 1 << 1;
|
public final static int STATE_NEW_DATA = 1 << 1;
|
||||||
public final static int STATE_READY = 1 << 2;
|
public final static int STATE_READY = 1 << 2;
|
||||||
|
public final static int STATE_ERROR = 1 << 3;
|
||||||
|
|
||||||
public void clearState() {
|
public void clearState() {
|
||||||
state = STATE_NONE;
|
state = STATE_NONE;
|
||||||
@ -46,14 +41,10 @@ public class JobTile extends Tile implements Comparable<JobTile> {
|
|||||||
state = STATE_LOADING;
|
state = STATE_LOADING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* tile is in JobQueue
|
|
||||||
*/
|
|
||||||
//public boolean isLoading;
|
|
||||||
public byte state;
|
public byte state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* distance from map center.
|
* distance from map center
|
||||||
*/
|
*/
|
||||||
public float distance;
|
public float distance;
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.generator;
|
package org.oscim.generator;
|
||||||
|
|
||||||
import org.oscim.renderer.TileGenerator;
|
|
||||||
import org.oscim.renderer.TileManager;
|
import org.oscim.renderer.TileManager;
|
||||||
import org.oscim.utils.PausableThread;
|
import org.oscim.utils.PausableThread;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* 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/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.oscim.renderer;
|
package org.oscim.generator;
|
||||||
|
|
||||||
import static org.oscim.generator.JobTile.STATE_NONE;
|
import static org.oscim.generator.JobTile.STATE_NONE;
|
||||||
|
|
||||||
@ -23,7 +23,8 @@ import org.oscim.core.WebMercator;
|
|||||||
import org.oscim.database.IMapDatabase;
|
import org.oscim.database.IMapDatabase;
|
||||||
import org.oscim.database.IMapDatabaseCallback;
|
import org.oscim.database.IMapDatabaseCallback;
|
||||||
import org.oscim.database.QueryResult;
|
import org.oscim.database.QueryResult;
|
||||||
import org.oscim.generator.JobTile;
|
import org.oscim.renderer.MapTile;
|
||||||
|
import org.oscim.renderer.WayDecorator;
|
||||||
import org.oscim.renderer.layer.Layer;
|
import org.oscim.renderer.layer.Layer;
|
||||||
import org.oscim.renderer.layer.Layers;
|
import org.oscim.renderer.layer.Layers;
|
||||||
import org.oscim.renderer.layer.LineLayer;
|
import org.oscim.renderer.layer.LineLayer;
|
||||||
@ -55,8 +56,8 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
|
|||||||
private static final double STROKE_INCREASE = Math.sqrt(2);
|
private static final double STROKE_INCREASE = Math.sqrt(2);
|
||||||
private static final byte LAYERS = 11;
|
private static final byte LAYERS = 11;
|
||||||
|
|
||||||
static final byte STROKE_MIN_ZOOM_LEVEL = 12;
|
public static final byte STROKE_MIN_ZOOM_LEVEL = 12;
|
||||||
static final byte STROKE_MAX_ZOOM_LEVEL = 17;
|
public static final byte STROKE_MAX_ZOOM_LEVEL = 17;
|
||||||
|
|
||||||
private static RenderTheme renderTheme;
|
private static RenderTheme renderTheme;
|
||||||
|
|
@ -233,8 +233,8 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
// use multiple buffers to avoid overwriting buffer while current
|
// use multiple buffers to avoid overwriting buffer while current
|
||||||
// data is uploaded (or rather the blocking which is probably done to
|
// data is uploaded (or rather the blocking which is probably done to
|
||||||
// avoid overwriting)
|
// avoid overwriting)
|
||||||
int curBuffer = uploadCnt % rotateBuffers;
|
int curBuffer = uploadCnt++ % rotateBuffers;
|
||||||
uploadCnt++;
|
//uploadCnt++;
|
||||||
|
|
||||||
ShortBuffer sbuf = shortBuffer[curBuffer];
|
ShortBuffer sbuf = shortBuffer[curBuffer];
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import static android.opengl.GLES20.glUseProgram;
|
|||||||
import static android.opengl.GLES20.glVertexAttribPointer;
|
import static android.opengl.GLES20.glVertexAttribPointer;
|
||||||
|
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
|
import org.oscim.generator.TileGenerator;
|
||||||
import org.oscim.renderer.layer.Layer;
|
import org.oscim.renderer.layer.Layer;
|
||||||
import org.oscim.renderer.layer.LineLayer;
|
import org.oscim.renderer.layer.LineLayer;
|
||||||
import org.oscim.theme.renderinstruction.Line;
|
import org.oscim.theme.renderinstruction.Line;
|
||||||
|
@ -32,7 +32,7 @@ public final class MapTile extends JobTile {
|
|||||||
* Tile data set by TileGenerator:
|
* Tile data set by TileGenerator:
|
||||||
*/
|
*/
|
||||||
public TextItem labels;
|
public TextItem labels;
|
||||||
Layers layers;
|
public Layers layers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tile has new data to upload to gl
|
* tile has new data to upload to gl
|
||||||
|
@ -37,15 +37,15 @@ import org.oscim.database.OpenResult;
|
|||||||
import org.oscim.generator.JobQueue;
|
import org.oscim.generator.JobQueue;
|
||||||
import org.oscim.generator.JobTile;
|
import org.oscim.generator.JobTile;
|
||||||
import org.oscim.generator.MapWorker;
|
import org.oscim.generator.MapWorker;
|
||||||
|
import org.oscim.generator.TileGenerator;
|
||||||
import org.oscim.overlay.GenericOverlay;
|
import org.oscim.overlay.GenericOverlay;
|
||||||
import org.oscim.overlay.LabelingOverlay;
|
import org.oscim.overlay.LabelingOverlay;
|
||||||
import org.oscim.overlay.Overlay;
|
import org.oscim.overlay.Overlay;
|
||||||
import org.oscim.overlay.OverlayManager;
|
import org.oscim.overlay.OverlayManager;
|
||||||
import org.oscim.renderer.GLRenderer;
|
import org.oscim.renderer.GLRenderer;
|
||||||
import org.oscim.renderer.GLView;
|
import org.oscim.renderer.GLView;
|
||||||
import org.oscim.renderer.TileGenerator;
|
|
||||||
import org.oscim.renderer.TileManager;
|
import org.oscim.renderer.TileManager;
|
||||||
import org.oscim.renderer.overlays.ModelOverlay;
|
import org.oscim.renderer.overlays.BuildingOverlay;
|
||||||
import org.oscim.theme.ExternalRenderTheme;
|
import org.oscim.theme.ExternalRenderTheme;
|
||||||
import org.oscim.theme.InternalRenderTheme;
|
import org.oscim.theme.InternalRenderTheme;
|
||||||
import org.oscim.theme.RenderTheme;
|
import org.oscim.theme.RenderTheme;
|
||||||
@ -186,7 +186,7 @@ public class MapView extends RelativeLayout {
|
|||||||
|
|
||||||
mOverlayManager.add(new LabelingOverlay(this));
|
mOverlayManager.add(new LabelingOverlay(this));
|
||||||
//mOverlayManager.add(new GenericOverlay(this, new GridOverlay(this)));
|
//mOverlayManager.add(new GenericOverlay(this, new GridOverlay(this)));
|
||||||
mOverlayManager.add(new GenericOverlay(this, new ModelOverlay(this)));
|
mOverlayManager.add(new GenericOverlay(this, new BuildingOverlay(this)));
|
||||||
|
|
||||||
// mOverlayManager.add(new GenericOverlay(this, new TestOverlay(this)));
|
// mOverlayManager.add(new GenericOverlay(this, new TestOverlay(this)));
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.view;
|
package org.oscim.view;
|
||||||
|
|
||||||
import org.oscim.renderer.TileGenerator;
|
import org.oscim.generator.TileGenerator;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user