rename MapGenerator -> TileGenerator

This commit is contained in:
Hannes Janetzek 2012-09-18 15:42:24 +02:00
parent a1317a9de5
commit 28cc35a32d
7 changed files with 37 additions and 65 deletions

View File

@ -25,8 +25,8 @@ public final class MapDatabaseFactory {
/**
* @param attributeSet
* A collection of attributes which includes the desired MapGenerator.
* @return a new MapGenerator instance.
* A collection of attributes which includes the desired MapDatabase.
* @return a new MapDatabase instance.
*/
public static IMapDatabase createMapDatabase(AttributeSet attributeSet) {
String mapDatabaseName = attributeSet.getAttributeValue(null,
@ -53,7 +53,7 @@ public final class MapDatabaseFactory {
/**
* @param mapDatabase
* the internal MapDatabase implementation.
* @return a new MapGenerator instance.
* @return a new MapDatabase instance.
*/
public static IMapDatabase createMapDatabase(MapDatabases mapDatabase) {
switch (mapDatabase) {

View File

@ -1,30 +0,0 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* 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.view;
/**
* Enumeration of all internal MapGenerator implementations.
*/
public enum MapRenderers {
/**
* texture renderer.
*/
SW_RENDERER,
/**
* opengl renderer.
*/
GL_RENDERER
}

View File

@ -38,7 +38,7 @@ import org.oscim.theme.Theme;
import org.oscim.view.generator.JobQueue;
import org.oscim.view.generator.JobTile;
import org.oscim.view.generator.MapWorker;
import org.oscim.view.renderer.MapGenerator;
import org.oscim.view.renderer.TileGenerator;
import org.oscim.view.renderer.MapRenderer;
import org.xml.sax.SAXException;
@ -156,13 +156,13 @@ public class MapView extends FrameLayout {
mapDatabase = MapDatabaseFactory.createMapDatabase(mapDatabaseType);
}
MapGenerator mapGenerator = new MapGenerator(this);
mapGenerator.setMapDatabase(mapDatabase);
TileGenerator tileGenerator = new TileGenerator(this);
tileGenerator.setMapDatabase(mapDatabase);
if (i == 0)
mMapDatabase = mapDatabase;
mMapWorkers[i] = new MapWorker(i, mJobQueue, mapGenerator, mMapRenderer);
mMapWorkers[i] = new MapWorker(i, mJobQueue, tileGenerator, mMapRenderer);
mMapWorkers[i].start();
}
@ -188,6 +188,8 @@ public class MapView extends FrameLayout {
mMapZoomControls = new MapZoomControls(mapActivity, this);
mMapZoomControls.setShowMapZoomControls(true);
enableRotation = true;
}
/**
@ -263,8 +265,8 @@ public class MapView extends FrameLayout {
for (MapWorker mapWorker : mMapWorkers) {
MapGenerator mapGenerator = mapWorker.getMapGenerator();
IMapDatabase mapDatabase = mapGenerator.getMapDatabase();
TileGenerator tileGenerator = mapWorker.getMapGenerator();
IMapDatabase mapDatabase = tileGenerator.getMapDatabase();
mapDatabase.close();
openResult = mapDatabase.open(null);
@ -322,7 +324,7 @@ public class MapView extends FrameLayout {
if (mDebugDatabase)
return;
MapGenerator mapGenerator;
TileGenerator tileGenerator;
Log.i(TAG, "setMapDatabase " + mapDatabaseType.name());
@ -334,9 +336,9 @@ public class MapView extends FrameLayout {
mapWorkersPause(true);
for (MapWorker mapWorker : mMapWorkers) {
mapGenerator = mapWorker.getMapGenerator();
tileGenerator = mapWorker.getMapGenerator();
mapGenerator.setMapDatabase(MapDatabaseFactory
tileGenerator.setMapDatabase(MapDatabaseFactory
.createMapDatabase(mapDatabaseType));
}

View File

@ -14,7 +14,7 @@
*/
package org.oscim.view;
import org.oscim.view.renderer.MapGenerator;
import org.oscim.view.renderer.TileGenerator;
import android.content.Context;
import android.os.Handler;
@ -220,7 +220,7 @@ public class MapZoomControls {
/**
* Sets the maximum zoom level of the map.
* <p>
* The maximum possible zoom level of the MapView depends also on the current {@link MapGenerator}. For example,
* The maximum possible zoom level of the MapView depends also on the current {@link TileGenerator}. For example,
* downloading map tiles may only be possible up to a certain zoom level. Setting a higher maximum zoom level has no
* effect in this case.
*

View File

@ -15,7 +15,7 @@
package org.oscim.view.generator;
import org.oscim.utils.PausableThread;
import org.oscim.view.renderer.MapGenerator;
import org.oscim.view.renderer.TileGenerator;
import org.oscim.view.renderer.MapRenderer;
/**
@ -25,7 +25,7 @@ import org.oscim.view.renderer.MapRenderer;
public class MapWorker extends PausableThread {
private final String THREAD_NAME;
private final JobQueue mJobQueue;
private final MapGenerator mMapGenerator;
private final TileGenerator mMapGenerator;
private final MapRenderer mMapRenderer;
// private final int mPrio;
@ -33,23 +33,23 @@ public class MapWorker extends PausableThread {
/**
* @param id
* thread id
* @param mapGenerator
* @param tileGenerator
* ...
* @param mapRenderer
* ...
*/
public MapWorker(int id, JobQueue jobQueue, MapGenerator mapGenerator,
public MapWorker(int id, JobQueue jobQueue, TileGenerator tileGenerator,
MapRenderer mapRenderer) {
super();
mJobQueue = jobQueue;
mMapGenerator = mapGenerator;
mMapGenerator = tileGenerator;
mMapRenderer = mapRenderer;
THREAD_NAME = "MapWorker" + id;
// mPrio = Math.max(Thread.MIN_PRIORITY + id, Thread.NORM_PRIORITY - 1);
}
public MapGenerator getMapGenerator() {
public TileGenerator getMapGenerator() {
return mMapGenerator;
}

View File

@ -31,7 +31,7 @@ class MapTile extends JobTile {
TextTexture texture;
/**
* Tile data set by MapGenerator:
* Tile data set by TileGenerator:
*/
LineLayer lineLayers;
PolygonLayer polygonLayers;

View File

@ -39,9 +39,9 @@ import android.util.Log;
/**
*
*/
public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
private static String TAG = MapGenerator.class.getName();
private static String TAG = TileGenerator.class.getName();
private static final double PI180 = (Math.PI / 180) / 1000000.0;
private static final double PIx4 = Math.PI * 4;
@ -88,8 +88,8 @@ public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
private final Tag[] debugTagWay = { new Tag("debug", "way") };
private final Tag[] debugTagArea = { new Tag("debug", "area") };
private final float[] debugBoxCoords = { 0, 0, 0, Tile.TILE_SIZE,
Tile.TILE_SIZE, Tile.TILE_SIZE, Tile.TILE_SIZE, 0 };
private final short[] debugBoxIndex = { 8 };
Tile.TILE_SIZE, Tile.TILE_SIZE, Tile.TILE_SIZE, 0, 0, 0 };
private final short[] debugBoxIndex = { 10 };
private float mProjectionScaleFactor;
@ -97,7 +97,7 @@ public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
* @param mapView
* the MapView
*/
public MapGenerator(MapView mapView) {
public TileGenerator(MapView mapView) {
Log.d(TAG, "init DatabaseRenderer");
mMapView = mapView;
}
@ -161,7 +161,7 @@ public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
// Log.d(TAG, "renderPointOfInterest: " + mTagName);
// mNodeRenderInstructions =
MapGenerator.renderTheme.matchNode(this, tags, mCurrentTile.zoomLevel);
TileGenerator.renderTheme.matchNode(this, tags, mCurrentTile.zoomLevel);
}
@Override
@ -205,7 +205,7 @@ public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
// mRenderInstructions[i].renderWay(this, tags);
// }
mRenderInstructions = MapGenerator.renderTheme.matchWay(this, tags,
mRenderInstructions = TileGenerator.renderTheme.matchWay(this, tags,
(byte) (mCurrentTile.zoomLevel + 0),
closed, true);
@ -221,10 +221,10 @@ public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
mTagName = new Tag("name", tags[0].key + ":" + tags[0].value, false);
if (closed) {
mRenderInstructions = MapGenerator.renderTheme.matchWay(this, debugTagArea,
mRenderInstructions = TileGenerator.renderTheme.matchWay(this, debugTagArea,
(byte) 0, true, true);
} else {
mRenderInstructions = MapGenerator.renderTheme.matchWay(this, debugTagWay,
mRenderInstructions = TileGenerator.renderTheme.matchWay(this, debugTagWay,
(byte) 0, true, true);
}
}
@ -438,7 +438,7 @@ public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
return false;
}
mLevels = MapGenerator.renderTheme.getLevels();
mLevels = TileGenerator.renderTheme.getLevels();
// limit stroke scale at z=17
if (tile.zoomLevel < STROKE_MAX_ZOOM_LEVEL)
@ -471,12 +471,12 @@ public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
+ tile.toString(), false);
mPoiX = Tile.TILE_SIZE >> 1;
mPoiY = 10;
MapGenerator.renderTheme.matchNode(this, debugTagWay, (byte) 0);
TileGenerator.renderTheme.matchNode(this, debugTagWay, (byte) 0);
mIndices = debugBoxIndex;
mCoords = debugBoxCoords;
mDrawingLayer = 10 * mLevels;
MapGenerator.renderTheme.matchWay(this, debugTagBox, (byte) 0, false, true);
TileGenerator.renderTheme.matchWay(this, debugTagBox, (byte) 0, false, true);
}
tile.lineLayers = mLineLayers;
@ -530,13 +530,13 @@ public class MapGenerator implements IRenderCallback, IMapDatabaseCallback {
}
public void setRenderTheme(RenderTheme theme) {
MapGenerator.renderTheme = theme;
TileGenerator.renderTheme = theme;
}
@Override
public boolean checkWay(Tag[] tags, boolean closed) {
mRenderInstructions = MapGenerator.renderTheme.matchWay(this, tags,
mRenderInstructions = TileGenerator.renderTheme.matchWay(this, tags,
(byte) (mCurrentTile.zoomLevel + 0), closed, false);
return mRenderInstructions != null;