refactor VectorTileMap

This commit is contained in:
Hannes Janetzek
2012-06-19 04:45:43 +02:00
parent 40cadbe805
commit e7c5831302
45 changed files with 178 additions and 161 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.sfb.tilemap" package="org.mapsforge.tilemap"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="10" android:versionCode="10"
android:versionName="0.1" > android:versionName="0.1" >
@@ -17,15 +17,15 @@
<application <application
android:icon="@drawable/globe" android:icon="@drawable/globe"
android:label="@string/application_name" > android:label="@string/application_name" >
<activity android:name="de.sfb.tilemap.TileMap" > <activity android:name="org.mapsforge.tilemap.TileMap" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="de.sfb.tilemap.preferences.EditPreferences" /> <activity android:name="org.mapsforge.tilemap.preferences.EditPreferences" />
<activity android:name=".filepicker.FilePicker" /> <activity android:name="org.mapsforge.tilemap.filepicker.FilePicker" />
</application> </application>
</manifest> </manifest>

View File

@@ -1,5 +1,5 @@
/** Automatically generated file. DO NOT MODIFY */ /** Automatically generated file. DO NOT MODIFY */
package de.sfb.tilemap; package org.mapsforge.tilemap;
public final class BuildConfig { public final class BuildConfig {
public final static boolean DEBUG = true; public final static boolean DEBUG = true;

View File

@@ -5,7 +5,7 @@
* should not be modified by hand. * should not be modified by hand.
*/ */
package de.sfb.tilemap; package org.mapsforge.tilemap;
public final class R { public final class R {
public static final class array { public static final class array {

View File

@@ -17,9 +17,7 @@ package org.mapsforge.android;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import org.mapsforge.android.inputhandling.MapMover;
import org.mapsforge.android.inputhandling.TouchHandler; import org.mapsforge.android.inputhandling.TouchHandler;
import org.mapsforge.android.inputhandling.ZoomAnimator;
import org.mapsforge.android.mapgenerator.JobParameters; import org.mapsforge.android.mapgenerator.JobParameters;
import org.mapsforge.android.mapgenerator.JobQueue; import org.mapsforge.android.mapgenerator.JobQueue;
import org.mapsforge.android.mapgenerator.JobTheme; import org.mapsforge.android.mapgenerator.JobTheme;
@@ -33,15 +31,14 @@ import org.mapsforge.android.rendertheme.InternalRenderTheme;
import org.mapsforge.android.utils.GlConfigChooser; import org.mapsforge.android.utils.GlConfigChooser;
import org.mapsforge.core.GeoPoint; import org.mapsforge.core.GeoPoint;
import org.mapsforge.core.MapPosition; import org.mapsforge.core.MapPosition;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import org.mapsforge.mapdatabase.mapfile.MapDatabase; import org.mapsforge.database.mapfile.MapDatabase;
import android.content.Context; import android.content.Context;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
/** /**
@@ -70,14 +67,15 @@ public class MapView extends GLSurfaceView {
private static final float DEFAULT_TEXT_SCALE = 1; private static final float DEFAULT_TEXT_SCALE = 1;
private final MapController mMapController; private final MapController mMapController;
private final MapMover mMapMover; // private final MapMover mMapMover;
// private final ZoomAnimator mZoomAnimator;
private final MapScaleBar mMapScaleBar; private final MapScaleBar mMapScaleBar;
private final MapViewPosition mMapViewPosition; private final MapViewPosition mMapViewPosition;
private final MapZoomControls mMapZoomControls; private final MapZoomControls mMapZoomControls;
private final Projection mProjection; private final Projection mProjection;
private final TouchHandler mTouchEventHandler; private final TouchHandler mTouchEventHandler;
private final ZoomAnimator mZoomAnimator;
private IMapDatabase mMapDatabase; private IMapDatabase mMapDatabase;
private MapGenerator mMapGenerator; private MapGenerator mMapGenerator;
@@ -151,10 +149,10 @@ public class MapView extends GLSurfaceView {
mJobQueue = new JobQueue(this); mJobQueue = new JobQueue(this);
mMapWorker = new MapWorker(this); mMapWorker = new MapWorker(this);
mMapWorker.start(); mMapWorker.start();
mMapMover = new MapMover(this); // mMapMover = new MapMover(this);
mMapMover.start(); // mMapMover.start();
mZoomAnimator = new ZoomAnimator(this); // mZoomAnimator = new ZoomAnimator(this);
mZoomAnimator.start(); // mZoomAnimator.start();
setMapGeneratorInternal(mapGenerator); setMapGeneratorInternal(mapGenerator);
@@ -232,12 +230,12 @@ public class MapView extends GLSurfaceView {
return mMapGenerator; return mMapGenerator;
} }
/** // /**
* @return the MapMover which is used by this MapView. // * @return the MapMover which is used by this MapView.
*/ // */
public MapMover getMapMover() { // public MapMover getMapMover() {
return mMapMover; // return mMapMover;
} // }
/** /**
* @return the current position and zoom level of this MapView. * @return the current position and zoom level of this MapView.
@@ -267,32 +265,32 @@ public class MapView extends GLSurfaceView {
return mProjection; return mProjection;
} }
/** // /**
* @return true if the ZoomAnimator is currently running, false otherwise. // * @return true if the ZoomAnimator is currently running, false otherwise.
*/ // */
public boolean isZoomAnimatorRunning() { // public boolean isZoomAnimatorRunning() {
return mZoomAnimator.isExecuting(); // return mZoomAnimator.isExecuting();
} // }
@Override // @Override
public boolean onKeyDown(int keyCode, KeyEvent keyEvent) { // public boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
return mMapMover.onKeyDown(keyCode, keyEvent); // return mMapMover.onKeyDown(keyCode, keyEvent);
} // }
//
@Override // @Override
public boolean onKeyUp(int keyCode, KeyEvent keyEvent) { // public boolean onKeyUp(int keyCode, KeyEvent keyEvent) {
return mMapMover.onKeyUp(keyCode, keyEvent); // return mMapMover.onKeyUp(keyCode, keyEvent);
} // }
@Override @Override
public boolean onTouchEvent(MotionEvent motionEvent) { public boolean onTouchEvent(MotionEvent motionEvent) {
return mTouchEventHandler.handleMotionEvent(motionEvent); return mTouchEventHandler.handleMotionEvent(motionEvent);
} }
@Override // @Override
public boolean onTrackballEvent(MotionEvent motionEvent) { // public boolean onTrackballEvent(MotionEvent motionEvent) {
return mMapMover.onTrackballEvent(motionEvent); // return mMapMover.onTrackballEvent(motionEvent);
} // }
/** /**
* Calculates all necessary tiles and adds jobs accordingly. * Calculates all necessary tiles and adds jobs accordingly.
@@ -365,17 +363,16 @@ public class MapView extends GLSurfaceView {
return false; return false;
} }
mZoomAnimator.pause(); // mZoomAnimator.pause();
// mMapMover.pause();
mMapWorker.pause(); mMapWorker.pause();
mMapMover.pause(); // mZoomAnimator.awaitPausing();
mZoomAnimator.awaitPausing(); // mMapMover.awaitPausing();
mMapMover.awaitPausing();
mMapWorker.awaitPausing(); mMapWorker.awaitPausing();
mMapMover.stopMove(); // mZoomAnimator.proceed();
// mMapMover.stopMove();
mZoomAnimator.proceed(); // mMapMover.proceed();
mMapWorker.proceed(); mMapWorker.proceed();
mMapMover.proceed();
mMapDatabase.closeFile(); mMapDatabase.closeFile();
FileOpenResult fileOpenResult = mMapDatabase.openFile(new File(mapFile)); FileOpenResult fileOpenResult = mMapDatabase.openFile(new File(mapFile));
@@ -588,9 +585,9 @@ public class MapView extends GLSurfaceView {
} }
void destroy() { void destroy() {
mMapMover.interrupt(); // mMapMover.interrupt();
mMapWorker.interrupt(); mMapWorker.interrupt();
mZoomAnimator.interrupt(); // mZoomAnimator.interrupt();
try { try {
mMapWorker.join(); mMapWorker.join();
@@ -617,10 +614,9 @@ public class MapView extends GLSurfaceView {
boolean hasValidCenter() { boolean hasValidCenter() {
if (!mMapViewPosition.isValid()) { if (!mMapViewPosition.isValid()) {
return false; return false;
} else if (!mMapGenerator.requiresInternetConnection() && } else if (!mMapGenerator.requiresInternetConnection()
(!mMapDatabase.hasOpenFile() || && (!mMapDatabase.hasOpenFile() || !mMapDatabase.getMapFileInfo().boundingBox.contains(getMapPosition()
!mMapDatabase.getMapFileInfo().boundingBox .getMapCenter()))) {
.contains(getMapPosition().getMapCenter()))) {
return false; return false;
} }
@@ -635,16 +631,16 @@ public class MapView extends GLSurfaceView {
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
mMapWorker.pause(); mMapWorker.pause();
mMapMover.pause(); // mMapMover.pause();
mZoomAnimator.pause(); // mZoomAnimator.pause();
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
mMapWorker.proceed(); mMapWorker.proceed();
mMapMover.proceed(); // mMapMover.proceed();
mZoomAnimator.proceed(); // mZoomAnimator.proceed();
} }
/** /**

View File

@@ -33,9 +33,9 @@ import org.mapsforge.core.GeoPoint;
import org.mapsforge.core.SphericalMercator; import org.mapsforge.core.SphericalMercator;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;
import org.mapsforge.core.Tile; import org.mapsforge.core.Tile;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import org.mapsforge.mapdatabase.IMapDatabaseCallback; import org.mapsforge.database.IMapDatabaseCallback;
import org.mapsforge.mapdatabase.MapFileInfo; import org.mapsforge.database.MapFileInfo;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import android.graphics.Bitmap; import android.graphics.Bitmap;

View File

@@ -14,7 +14,7 @@
*/ */
package org.mapsforge.android.mapgenerator; package org.mapsforge.android.mapgenerator;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import android.util.AttributeSet; import android.util.AttributeSet;
@@ -33,7 +33,7 @@ public final class MapDatabaseFactory {
public static IMapDatabase createMapDatabase(AttributeSet attributeSet) { public static IMapDatabase createMapDatabase(AttributeSet attributeSet) {
String mapDatabaseName = attributeSet.getAttributeValue(null, MAP_DATABASE_ATTRIBUTE_NAME); String mapDatabaseName = attributeSet.getAttributeValue(null, MAP_DATABASE_ATTRIBUTE_NAME);
if (mapDatabaseName == null) { if (mapDatabaseName == null) {
return new org.mapsforge.mapdatabase.mapfile.MapDatabase(); return new org.mapsforge.database.mapfile.MapDatabase();
} }
MapDatabaseInternal mapDatabaseInternal = MapDatabaseInternal.valueOf(mapDatabaseName); MapDatabaseInternal mapDatabaseInternal = MapDatabaseInternal.valueOf(mapDatabaseName);
@@ -48,11 +48,11 @@ public final class MapDatabaseFactory {
public static IMapDatabase createMapDatabase(MapDatabaseInternal mapDatabaseInternal) { public static IMapDatabase createMapDatabase(MapDatabaseInternal mapDatabaseInternal) {
switch (mapDatabaseInternal) { switch (mapDatabaseInternal) {
case MAP_READER: case MAP_READER:
return new org.mapsforge.mapdatabase.mapfile.MapDatabase(); return new org.mapsforge.database.mapfile.MapDatabase();
case JSON_READER: case JSON_READER:
return new org.mapsforge.mapdatabase.json.MapDatabase(); return new org.mapsforge.database.json.MapDatabase();
case POSTGIS_READER: case POSTGIS_READER:
return new org.mapsforge.mapdatabase.postgis.MapDatabase(); return new org.mapsforge.database.postgis.MapDatabase();
} }

View File

@@ -17,7 +17,7 @@ package org.mapsforge.android.mapgenerator;
import org.mapsforge.android.MapRenderer; import org.mapsforge.android.MapRenderer;
import org.mapsforge.android.MapView; import org.mapsforge.android.MapView;
import org.mapsforge.core.GeoPoint; import org.mapsforge.core.GeoPoint;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
/** /**
* A MapGenerator provides map tiles either by downloading or rendering them. * A MapGenerator provides map tiles either by downloading or rendering them.

View File

@@ -385,7 +385,7 @@
stroke-linecap="butt" /> stroke-linecap="butt" />
</rule> </rule>
<rule e="way" k="*" v="track|footway|path|cycleway" zoom-min="16"> <rule e="way" k="*" v="track|footway|path|cycleway" zoom-min="16">
<line stroke="#c1bcb6" stroke-width="0.25" stroke-linecap="butt" /> <line stroke="#c1bcb6" stroke-width="0.2" stroke-linecap="butt" />
</rule> </rule>
</rule> </rule>

View File

@@ -33,10 +33,10 @@ import org.mapsforge.android.rendertheme.renderinstruction.Line;
import org.mapsforge.core.GeoPoint; import org.mapsforge.core.GeoPoint;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;
import org.mapsforge.core.Tile; import org.mapsforge.core.Tile;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import org.mapsforge.mapdatabase.IMapDatabaseCallback; import org.mapsforge.database.IMapDatabaseCallback;
import org.mapsforge.mapdatabase.MapFileInfo; import org.mapsforge.database.MapFileInfo;
import org.mapsforge.mapdatabase.mapfile.MapDatabase; import org.mapsforge.database.mapfile.MapDatabase;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import android.graphics.Bitmap; import android.graphics.Bitmap;

View File

@@ -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.mapsforge.mapdatabase; package org.mapsforge.database;
/** /**

View File

@@ -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.mapsforge.mapdatabase; package org.mapsforge.database;
import java.io.File; import java.io.File;

View File

@@ -12,10 +12,10 @@
* 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.mapsforge.mapdatabase; package org.mapsforge.database;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;
import org.mapsforge.mapdatabase.mapfile.MapDatabase; import org.mapsforge.database.mapfile.MapDatabase;
/** /**
* Callback methods which can be triggered from the {@link MapDatabase}. * Callback methods which can be triggered from the {@link MapDatabase}.

View File

@@ -12,11 +12,11 @@
* 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.mapsforge.mapdatabase; package org.mapsforge.database;
import org.mapsforge.core.BoundingBox; import org.mapsforge.core.BoundingBox;
import org.mapsforge.core.GeoPoint; import org.mapsforge.core.GeoPoint;
import org.mapsforge.mapdatabase.mapfile.MapDatabase; import org.mapsforge.database.mapfile.MapDatabase;
/** /**
* Contains the immutable metadata of a map file. * Contains the immutable metadata of a map file.

View File

@@ -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.mapsforge.mapdatabase.json; package org.mapsforge.database.json;
import java.io.File; import java.io.File;
@@ -20,10 +20,10 @@ import org.mapsforge.core.BoundingBox;
import org.mapsforge.core.MercatorProjection; import org.mapsforge.core.MercatorProjection;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;
import org.mapsforge.core.Tile; import org.mapsforge.core.Tile;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import org.mapsforge.mapdatabase.IMapDatabaseCallback; import org.mapsforge.database.IMapDatabaseCallback;
import org.mapsforge.mapdatabase.MapFileInfo; import org.mapsforge.database.MapFileInfo;
/** /**
* *

View File

@@ -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.mapsforge.mapdatabase.mapfile; package org.mapsforge.database.mapfile;
/** /**
* This utility class contains methods to convert byte arrays to numbers. * This utility class contains methods to convert byte arrays to numbers.

View File

@@ -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.mapsforge.mapdatabase.mapfile; package org.mapsforge.database.mapfile;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@@ -21,7 +21,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.mapsforge.core.LRUCache; import org.mapsforge.core.LRUCache;
import org.mapsforge.mapdatabase.mapfile.header.SubFileParameter; import org.mapsforge.database.mapfile.header.SubFileParameter;
/** /**
* A cache for database index blocks with a fixed size and LRU policy. * A cache for database index blocks with a fixed size and LRU policy.

View File

@@ -12,9 +12,9 @@
* 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.mapsforge.mapdatabase.mapfile; package org.mapsforge.database.mapfile;
import org.mapsforge.mapdatabase.mapfile.header.SubFileParameter; import org.mapsforge.database.mapfile.header.SubFileParameter;
/** /**
* An immutable container class which is the key for the index cache. * An immutable container class which is the key for the index cache.

View File

@@ -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.mapsforge.mapdatabase.mapfile; package org.mapsforge.database.mapfile;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@@ -23,12 +23,12 @@ import java.util.logging.Logger;
import org.mapsforge.core.MercatorProjection; import org.mapsforge.core.MercatorProjection;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;
import org.mapsforge.core.Tile; import org.mapsforge.core.Tile;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import org.mapsforge.mapdatabase.IMapDatabaseCallback; import org.mapsforge.database.IMapDatabaseCallback;
import org.mapsforge.mapdatabase.mapfile.header.MapFileHeader; import org.mapsforge.database.mapfile.header.MapFileHeader;
import org.mapsforge.mapdatabase.mapfile.header.MapFileInfo; import org.mapsforge.database.mapfile.header.MapFileInfo;
import org.mapsforge.mapdatabase.mapfile.header.SubFileParameter; import org.mapsforge.database.mapfile.header.SubFileParameter;
/** /**
* A class for reading binary map files. * A class for reading binary map files.
@@ -227,6 +227,9 @@ public class MapDatabase implements IMapDatabase {
*/ */
@Override @Override
public void executeQuery(Tile tile, IMapDatabaseCallback mapDatabaseCallback) { public void executeQuery(Tile tile, IMapDatabaseCallback mapDatabaseCallback) {
if (mMapFileHeader == null)
return;
if (mIntBuffer == null) if (mIntBuffer == null)
mIntBuffer = new int[MAXIMUM_WAY_NODES_SEQUENCE_LENGTH * 2]; mIntBuffer = new int[MAXIMUM_WAY_NODES_SEQUENCE_LENGTH * 2];

View File

@@ -12,10 +12,10 @@
* 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.mapsforge.mapdatabase.mapfile; package org.mapsforge.database.mapfile;
import org.mapsforge.core.Tile; import org.mapsforge.core.Tile;
import org.mapsforge.mapdatabase.mapfile.header.SubFileParameter; import org.mapsforge.database.mapfile.header.SubFileParameter;
final class QueryCalculations { final class QueryCalculations {
private static int getFirstLevelTileBitmask(Tile tile) { private static int getFirstLevelTileBitmask(Tile tile) {

View File

@@ -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.mapsforge.mapdatabase.mapfile; package org.mapsforge.database.mapfile;
class QueryParameters { class QueryParameters {
long fromBaseTileX; long fromBaseTileX;

View File

@@ -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.mapsforge.mapdatabase.mapfile; package org.mapsforge.database.mapfile;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;

View File

@@ -12,12 +12,12 @@
* 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.mapsforge.mapdatabase.mapfile.header; package org.mapsforge.database.mapfile.header;
import java.io.IOException; import java.io.IOException;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.mapsforge.mapdatabase.mapfile.ReadBuffer; import org.mapsforge.database.mapfile.ReadBuffer;
/** /**
* Reads and validates the header data from a binary map file. * Reads and validates the header data from a binary map file.

View File

@@ -12,17 +12,17 @@
* 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.mapsforge.mapdatabase.mapfile.header; package org.mapsforge.database.mapfile.header;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;
import org.mapsforge.mapdatabase.mapfile.MapDatabase; import org.mapsforge.database.mapfile.MapDatabase;
/** /**
* Contains the immutable metadata of a map file. * Contains the immutable metadata of a map file.
* *
* @see MapDatabase#getMapFileInfo() * @see MapDatabase#getMapFileInfo()
*/ */
public class MapFileInfo extends org.mapsforge.mapdatabase.MapFileInfo { public class MapFileInfo extends org.mapsforge.database.MapFileInfo {
/** /**
* True if the map file includes debug information, false otherwise. * True if the map file includes debug information, false otherwise.

View File

@@ -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.mapsforge.mapdatabase.mapfile.header; package org.mapsforge.database.mapfile.header;
import org.mapsforge.core.BoundingBox; import org.mapsforge.core.BoundingBox;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;

View File

@@ -12,11 +12,11 @@
* 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.mapsforge.mapdatabase.mapfile.header; package org.mapsforge.database.mapfile.header;
import org.mapsforge.core.GeoPoint; import org.mapsforge.core.GeoPoint;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.mapsforge.mapdatabase.mapfile.ReadBuffer; import org.mapsforge.database.mapfile.ReadBuffer;
final class OptionalFields { final class OptionalFields {
/** /**

View File

@@ -12,14 +12,14 @@
* 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.mapsforge.mapdatabase.mapfile.header; package org.mapsforge.database.mapfile.header;
import java.io.IOException; import java.io.IOException;
import org.mapsforge.core.BoundingBox; import org.mapsforge.core.BoundingBox;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.mapsforge.mapdatabase.mapfile.ReadBuffer; import org.mapsforge.database.mapfile.ReadBuffer;
final class RequiredFields { final class RequiredFields {
/** /**

View File

@@ -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.mapsforge.mapdatabase.mapfile.header; package org.mapsforge.database.mapfile.header;
import org.mapsforge.core.MercatorProjection; import org.mapsforge.core.MercatorProjection;

View File

@@ -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.mapsforge.mapdatabase.mapfile.header; package org.mapsforge.database.mapfile.header;
import org.mapsforge.core.BoundingBox; import org.mapsforge.core.BoundingBox;

View File

@@ -24,7 +24,7 @@
* $Id: Geometry.java 9324 2012-02-27 22:08:12Z pramsey $ * $Id: Geometry.java 9324 2012-02-27 22:08:12Z pramsey $
*/ */
package org.mapsforge.mapdatabase.postgis; package org.mapsforge.database.postgis;
import java.io.Serializable; import java.io.Serializable;

View File

@@ -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.mapsforge.mapdatabase.postgis; package org.mapsforge.database.postgis;
import java.io.File; import java.io.File;
import java.sql.Connection; import java.sql.Connection;
@@ -29,10 +29,10 @@ import org.mapsforge.core.GeoPoint;
import org.mapsforge.core.SphericalMercator; import org.mapsforge.core.SphericalMercator;
import org.mapsforge.core.Tag; import org.mapsforge.core.Tag;
import org.mapsforge.core.Tile; import org.mapsforge.core.Tile;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import org.mapsforge.mapdatabase.IMapDatabaseCallback; import org.mapsforge.database.IMapDatabaseCallback;
import org.mapsforge.mapdatabase.MapFileInfo; import org.mapsforge.database.MapFileInfo;
import org.postgresql.PGConnection; import org.postgresql.PGConnection;
/** /**

View File

@@ -19,7 +19,7 @@
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
package org.mapsforge.mapdatabase.postgis; package org.mapsforge.database.postgis;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -22,7 +22,7 @@
* $Id: ValueGetter.java 9324 2012-02-27 22:08:12Z pramsey $ * $Id: ValueGetter.java 9324 2012-02-27 22:08:12Z pramsey $
*/ */
package org.mapsforge.mapdatabase.postgis; package org.mapsforge.database.postgis;
abstract class ValueGetter { abstract class ValueGetter {
byte[] data; byte[] data;

View File

@@ -12,12 +12,12 @@
* 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 de.sfb.tilemap; package org.mapsforge.tilemap;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import android.content.res.Resources; import android.content.res.Resources;
import de.sfb.tilemap.R; import org.mapsforge.tilemap.R;
final class FileUtils { final class FileUtils {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.00 "); private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.00 ");

View File

@@ -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 de.sfb.tilemap; package org.mapsforge.tilemap;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;

View File

@@ -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 de.sfb.tilemap; package org.mapsforge.tilemap;
import org.mapsforge.core.GeoPoint; import org.mapsforge.core.GeoPoint;

View File

@@ -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 de.sfb.tilemap; package org.mapsforge.tilemap;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;

View File

@@ -1,4 +1,4 @@
package de.sfb.tilemap; package org.mapsforge.tilemap;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@@ -17,8 +17,13 @@ import org.mapsforge.android.rendertheme.InternalRenderTheme;
import org.mapsforge.android.utils.AndroidUtils; import org.mapsforge.android.utils.AndroidUtils;
import org.mapsforge.core.BoundingBox; import org.mapsforge.core.BoundingBox;
import org.mapsforge.core.GeoPoint; import org.mapsforge.core.GeoPoint;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import org.mapsforge.mapdatabase.MapFileInfo; import org.mapsforge.database.MapFileInfo;
import org.mapsforge.tilemap.filefilter.FilterByFileExtension;
import org.mapsforge.tilemap.filefilter.ValidMapFile;
import org.mapsforge.tilemap.filefilter.ValidRenderTheme;
import org.mapsforge.tilemap.filepicker.FilePicker;
import org.mapsforge.tilemap.preferences.EditPreferences;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@@ -46,12 +51,6 @@ import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import de.sfb.tilemap.R;
import de.sfb.tilemap.filefilter.FilterByFileExtension;
import de.sfb.tilemap.filefilter.ValidMapFile;
import de.sfb.tilemap.filefilter.ValidRenderTheme;
import de.sfb.tilemap.filepicker.FilePicker;
import de.sfb.tilemap.preferences.EditPreferences;
/** /**
* A map application which uses the features from the mapsforge map library. The map can be centered to the current * A map application which uses the features from the mapsforge map library. The map can be centered to the current
@@ -78,10 +77,12 @@ public class TileMap extends MapActivity {
private WakeLock wakeLock; private WakeLock wakeLock;
MapController mapController; MapController mapController;
MapView mapView; MapView mapView;
private Menu mMenu = null;
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.options_menu, menu); getMenuInflater().inflate(R.menu.options_menu, menu);
mMenu = menu;
return true; return true;
} }
@@ -99,11 +100,21 @@ public class TileMap extends MapActivity {
return true; return true;
case R.id.menu_position_my_location_enable: case R.id.menu_position_my_location_enable:
enableShowMyLocation(true); if (enableShowMyLocation(true)) {
mMenu.findItem(R.id.menu_position_my_location_enable).setVisible(false);
mMenu.findItem(R.id.menu_position_my_location_enable).setEnabled(false);
mMenu.findItem(R.id.menu_position_my_location_disable).setVisible(true);
mMenu.findItem(R.id.menu_position_my_location_disable).setEnabled(true);
}
return true; return true;
case R.id.menu_position_my_location_disable: case R.id.menu_position_my_location_disable:
disableShowMyLocation(); if (disableShowMyLocation()) {
mMenu.findItem(R.id.menu_position_my_location_enable).setVisible(true);
mMenu.findItem(R.id.menu_position_my_location_enable).setEnabled(true);
mMenu.findItem(R.id.menu_position_my_location_disable).setVisible(false);
mMenu.findItem(R.id.menu_position_my_location_disable).setEnabled(false);
}
return true; return true;
case R.id.menu_position_last_known: case R.id.menu_position_last_known:
@@ -202,21 +213,23 @@ public class TileMap extends MapActivity {
this.mapController = this.mapView.getController(); this.mapController = this.mapView.getController();
} }
private void enableShowMyLocation(boolean centerAtFirstFix) { private boolean enableShowMyLocation(boolean centerAtFirstFix) {
if (!this.showMyLocation) { if (!this.showMyLocation) {
Criteria criteria = new Criteria(); Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAccuracy(Criteria.ACCURACY_FINE);
String bestProvider = this.locationManager.getBestProvider(criteria, true); String bestProvider = this.locationManager.getBestProvider(criteria, true);
if (bestProvider == null) { if (bestProvider == null) {
showDialog(DIALOG_LOCATION_PROVIDER_DISABLED); showDialog(DIALOG_LOCATION_PROVIDER_DISABLED);
return; return false;
} }
this.showMyLocation = true; this.showMyLocation = true;
this.myLocationListener.setCenterAtFirstFix(centerAtFirstFix); this.myLocationListener.setCenterAtFirstFix(centerAtFirstFix);
this.locationManager.requestLocationUpdates(bestProvider, 1000, 0, this.myLocationListener); this.locationManager.requestLocationUpdates(bestProvider, 1000, 0, this.myLocationListener);
this.snapToLocationView.setVisibility(View.VISIBLE); this.snapToLocationView.setVisibility(View.VISIBLE);
return true;
} }
return false;
} }
private void gotoLastKnownPosition() { private void gotoLastKnownPosition() {
@@ -527,8 +540,10 @@ public class TileMap extends MapActivity {
/** /**
* Disables the "show my location" mode. * Disables the "show my location" mode.
*
* @return ...
*/ */
void disableShowMyLocation() { private boolean disableShowMyLocation() {
if (this.showMyLocation) { if (this.showMyLocation) {
this.showMyLocation = false; this.showMyLocation = false;
disableSnapToLocation(false); disableSnapToLocation(false);
@@ -540,7 +555,9 @@ public class TileMap extends MapActivity {
// this.itemizedOverlay = null; // this.itemizedOverlay = null;
// } // }
this.snapToLocationView.setVisibility(View.GONE); this.snapToLocationView.setVisibility(View.GONE);
return true;
} }
return false;
} }
/** /**

View File

@@ -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 de.sfb.tilemap.filefilter; package org.mapsforge.tilemap.filefilter;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;

View File

@@ -12,11 +12,11 @@
* 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 de.sfb.tilemap.filefilter; package org.mapsforge.tilemap.filefilter;
import java.io.FileFilter; import java.io.FileFilter;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
/** /**
* An extension of the {@link FileFilter} interface. * An extension of the {@link FileFilter} interface.

View File

@@ -12,13 +12,13 @@
* 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 de.sfb.tilemap.filefilter; package org.mapsforge.tilemap.filefilter;
import java.io.File; import java.io.File;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.mapsforge.mapdatabase.IMapDatabase; import org.mapsforge.database.IMapDatabase;
import org.mapsforge.mapdatabase.mapfile.MapDatabase; import org.mapsforge.database.mapfile.MapDatabase;
/** /**
* Accepts all valid map files. * Accepts all valid map files.

View File

@@ -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 de.sfb.tilemap.filefilter; package org.mapsforge.tilemap.filefilter;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@@ -23,7 +23,7 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
import org.mapsforge.android.rendertheme.RenderThemeHandler; import org.mapsforge.android.rendertheme.RenderThemeHandler;
import org.mapsforge.mapdatabase.FileOpenResult; import org.mapsforge.database.FileOpenResult;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;

View File

@@ -12,13 +12,15 @@
* 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 de.sfb.tilemap.filepicker; package org.mapsforge.tilemap.filepicker;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import org.mapsforge.tilemap.filefilter.ValidFileFilter;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@@ -31,8 +33,7 @@ import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.GridView; import android.widget.GridView;
import de.sfb.tilemap.R; import org.mapsforge.tilemap.R;
import de.sfb.tilemap.filefilter.ValidFileFilter;
/** /**
* A FilePicker displays the contents of directories. The user can navigate within the file system and select a single * A FilePicker displays the contents of directories. The user can navigate within the file system and select a single

View File

@@ -12,11 +12,11 @@
* 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 de.sfb.tilemap.filepicker; package org.mapsforge.tilemap.filepicker;
import java.io.File; import java.io.File;
import de.sfb.tilemap.R; import org.mapsforge.tilemap.R;
import android.content.Context; import android.content.Context;
import android.view.Gravity; import android.view.Gravity;

View File

@@ -12,13 +12,13 @@
* 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 de.sfb.tilemap.preferences; package org.mapsforge.tilemap.preferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.view.WindowManager; import android.view.WindowManager;
import de.sfb.tilemap.R; import org.mapsforge.tilemap.R;
/** /**
* Activity to edit the application preferences. * Activity to edit the application preferences.

View File

@@ -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 de.sfb.tilemap.preferences; package org.mapsforge.tilemap.preferences;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;