Implement some fixes

git-svn-id: https://osmand.googlecode.com/svn/trunk@375 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-07-20 12:28:33 +00:00
parent 95e7d9be61
commit e1607267f4
7 changed files with 32 additions and 3 deletions

View file

@ -16,7 +16,8 @@ public class ToDoConstants {
// Improvement : show favorites on the map?
// Improvement : progress while loading tiles
// Improvement : download with wget
// Improvement : download with wget or multi downloader
// Improvement : use NameFinder for search POI/address near location
// Imrpovement : show vehicle for calculating route
// Improvement : show detailed route on the map with turns and show route information directly (like in gmaps)

View file

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.osmand" android:versionName="0.2.3" android:versionCode="6">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="false" android:name=".activities.OsmandApplication" android:description="@string/app_description">
android:debuggable="true" android:name=".activities.OsmandApplication" android:description="@string/app_description">
<activity android:name=".activities.MainMenuActivity"
android:label="@string/app_name">
<intent-filter>

View file

@ -127,7 +127,7 @@ public class ResourceManager {
return getTileImageForMap(file, map, x, y, zoom, loadFromInternetIfNeeded, true, true);
}
public synchronized void tileDownloaded(DownloadRequest request){
public void tileDownloaded(DownloadRequest request){
if(request instanceof TileLoadDownloadRequest){
TileLoadDownloadRequest req = ((TileLoadDownloadRequest) request);
imagesOnFS.put(req.tileId, Boolean.TRUE);

View file

@ -5,6 +5,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.commons.logging.Log;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
@ -18,6 +20,8 @@ public class SQLiteTileSource implements ITileSource {
public static final String EXT = ".sqlitedb"; //$NON-NLS-1$
private static final Log log = LogUtil.getLog(SQLiteTileSource.class);
private ITileSource base;
private String name;
private SQLiteDatabase db;
@ -122,9 +126,13 @@ public class SQLiteTileSource implements ITileSource {
if(db == null){
return false;
}
long time = System.currentTimeMillis();
Cursor cursor = db.rawQuery("SELECT 1 FROM tiles WHERE x = ? AND y = ? AND z = ?", new String[] {x+"", y+"",(17 - zoom)+""}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
boolean e = cursor.moveToFirst();
cursor.close();
if (log.isDebugEnabled()) {
log.debug("Checking tile existance x = " + x + " y = " + y + " z = " + zoom + " for " + (System.currentTimeMillis() - time)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
return e;
}

View file

@ -1017,6 +1017,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
Intent intent = new Intent(MapActivity.this, SearchPoiFilterActivity.class);
intent.putExtra(SearchPoiFilterActivity.SEARCH_LAT, latitude);
intent.putExtra(SearchPoiFilterActivity.SEARCH_LON, longitude);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} else if(which == 2){
showRoute(latitude, longitude);

View file

@ -13,6 +13,8 @@ public class AnimateDraggingMapThread implements Runnable {
public void dragTo(float curX, float curY, float newX, float newY, boolean notify);
public void setLatLon(double latitude, double longitude, boolean notify);
public void zoomTo(float zoom, boolean notify);
@ -44,6 +46,8 @@ public class AnimateDraggingMapThread implements Runnable {
private int timeMove;
private float moveX;
private float moveY;
private double moveLat;
private double moveLon;
private volatile Thread currentThread = null;
private AnimateDraggingCallback callback = null;
@ -126,6 +130,7 @@ public class AnimateDraggingMapThread implements Runnable {
curY = newY;
if(curX == moveX && curY == moveY){
phaseOfMoving ++;
callback.setLatLon(moveLat, moveLon, notifyListener);
}
}
}
@ -185,6 +190,7 @@ public class AnimateDraggingMapThread implements Runnable {
public void startMoving(double curLat, double curLon, double finalLat, double finalLon, int curZoom, int endZoom, int tileSize, float rotate, boolean notifyListener){
stopAnimatingSync();
this.notifyListener = notifyListener;
curZ = curZoom;
intZ = curZoom;
@ -199,6 +205,8 @@ public class AnimateDraggingMapThread implements Runnable {
float rad = (float) Math.toRadians(rotate);
moveX = FloatMath.cos(rad) * mX - FloatMath.sin(rad) * mY;
moveY = FloatMath.sin(rad) * mX + FloatMath.cos(rad) * mY;
moveLat = finalLat;
moveLon = finalLon;
if(curZoom < intZ){
dirIntZ = 1;
} else {

View file

@ -639,6 +639,17 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
}
}
@Override
public void setLatLon(double latitude, double longitude, boolean notify) {
this.latitude = latitude;
this.longitude = longitude;
refreshMap();
if(locationListener != null && notify){
locationListener.locationChanged(latitude, longitude, this);
}
}
public void moveTo(float dx, float dy) {
float fy = calcDiffTileY(dx, dy);
float fx = calcDiffTileX(dx, dy);