git-svn-id: https://osmand.googlecode.com/svn/trunk@421 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-08-01 21:11:10 +00:00
parent cf4323f56a
commit 2cc3eb1a41
9 changed files with 51 additions and 16 deletions

View file

@ -16,6 +16,11 @@ public class ToDoConstants {
// TODO BUGS Android // TODO BUGS Android
// ! 3. different screens better support // ! 3. different screens better support
// 5. add progress saving track from settings
// 6. Add car choose for show only route from point
// 7. Remove speed length arrow
// 8. Give message before 3km & take into account speed (to say faster)
// 9. Check again cancel route!
// Improvements // Improvements
// ! Download with wget // ! Download with wget

View file

@ -117,7 +117,7 @@ public class MainMenuActivity extends Activity {
text.append("\nVersion : ").append(Build.VERSION.RELEASE); //$NON-NLS-1$ text.append("\nVersion : ").append(Build.VERSION.RELEASE); //$NON-NLS-1$
text.append("\nApp Version : ").append(Version.APP_NAME_VERSION); //$NON-NLS-1$ text.append("\nApp Version : ").append(Version.APP_NAME_VERSION); //$NON-NLS-1$
try { try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageResourcePath(), 0); PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0);
if (info != null) { if (info != null) {
text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode); //$NON-NLS-1$ //$NON-NLS-2$ text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode); //$NON-NLS-1$ //$NON-NLS-2$
} }

View file

@ -114,6 +114,19 @@ public class RouteProvider {
i++; i++;
} }
} }
// Remove unnecessary go straight from CloudMade
if(directions != null){
for (int i = 1; i < directions.size() - 1; ) {
RouteDirectionInfo r = directions.get(i);
if(r.turnType.getValue().equals(TurnType.C)){
RouteDirectionInfo prev = directions.get(i-1);
prev.expectedTime += r.expectedTime;
directions.remove(i);
} else {
i++;
}
}
}
} }
listDistance = new int[locations.size()]; listDistance = new int[locations.size()];
@ -193,7 +206,7 @@ public class RouteProvider {
int minDistanceForTurn = 5; int minDistanceForTurn = 5;
if(mode == ApplicationMode.CAR){ if(mode == ApplicationMode.CAR){
speed = 15.3f; speed = 15.3f;
minDistanceForTurn = 25; minDistanceForTurn = 35;
} else if(mode == ApplicationMode.BICYCLE){ } else if(mode == ApplicationMode.BICYCLE){
speed = 5.5f; speed = 5.5f;
minDistanceForTurn = 12; minDistanceForTurn = 12;
@ -307,7 +320,7 @@ public class RouteProvider {
previousInfo.descriptionRoute += " " + MapUtils.getFormattedDistance(previousInfo.distance); //$NON-NLS-1$ previousInfo.descriptionRoute += " " + MapUtils.getFormattedDistance(previousInfo.distance); //$NON-NLS-1$
// add last direction go straight (to show arrow in screen after all turns) // add last direction go straight (to show arrow in screen after all turns)
if(previousInfo.distance > 350){ if(previousInfo.distance > 100){
RouteDirectionInfo info = new RouteDirectionInfo(); RouteDirectionInfo info = new RouteDirectionInfo();
info.expectedTime = 0; info.expectedTime = 0;
info.distance = 0; info.distance = 0;

View file

@ -380,7 +380,12 @@ public class RoutingHelper {
public List<RouteDirectionInfo> getRouteDirections(){ public List<RouteDirectionInfo> getRouteDirections(){
if(directionInfo != null && currentDirectionInfo < directionInfo.size()){ if(directionInfo != null && currentDirectionInfo < directionInfo.size()){
return directionInfo.subList(currentDirectionInfo, directionInfo.size()); if(currentDirectionInfo == 0){
return directionInfo;
}
if(currentDirectionInfo < directionInfo.size() - 1){
return directionInfo.subList(currentDirectionInfo + 1, directionInfo.size());
}
} }
return Collections.emptyList(); return Collections.emptyList();
} }

View file

@ -76,7 +76,7 @@ public class VoiceRouter {
} }
RouteDirectionInfo next = router.getNextRouteDirectionInfo(); RouteDirectionInfo next = router.getNextRouteDirectionInfo();
int dist = router.getDistanceToNextRouteDirection(); int dist = router.getDistanceToNextRouteDirection();
if(next == null && currentDirection > 0) { if((next == null || next.distance == 0) && currentDirection > 0) {
if(currentStatus == 0){ if(currentStatus == 0){
CommandBuilder play = getNewCommandPlayerToPlay(); CommandBuilder play = getNewCommandPlayerToPlay();
if(play != null){ if(play != null){
@ -127,15 +127,18 @@ public class VoiceRouter {
} }
if (nextNext != null && next.distance <= TURN_IN_DISTANCE) { if (nextNext != null && next.distance <= TURN_IN_DISTANCE) {
isplay = true;
String t2Param = getTurnType(nextNext.turnType); String t2Param = getTurnType(nextNext.turnType);
if (t2Param != null) { if (t2Param != null) {
play.then().turn(t2Param, next.distance); if(isplay) { play.then(); }
play.turn(t2Param, next.distance);
} else if (nextNext.turnType.isRoundAbout()) { } else if (nextNext.turnType.isRoundAbout()) {
play.then().roundAbout(next.distance, next.turnType.getTurnAngle(), next.turnType.getExitOut()); if(isplay) { play.then(); }
play.roundAbout(next.distance, nextNext.turnType.getTurnAngle(), nextNext.turnType.getExitOut());
} else if (nextNext.turnType.getValue().equals(TurnType.TU)) { } else if (nextNext.turnType.getValue().equals(TurnType.TU)) {
play.then().makeUT(next.distance); if(isplay) { play.then(); }
play.makeUT(next.distance);
} }
isplay = true;
} }
if(isplay){ if(isplay){
play.play(); play.play();
@ -160,7 +163,8 @@ public class VoiceRouter {
if (nextNext != null && next.distance <= TURN_DISTANCE) { if (nextNext != null && next.distance <= TURN_DISTANCE) {
TurnType t = nextNext.turnType; TurnType t = nextNext.turnType;
isPlay = true; isPlay = true;
if (next.turnType.getValue().equals(TurnType.C)) { if (next.turnType.getValue().equals(TurnType.C) &&
!TurnType.C.equals(t.getValue())) {
play.goAhead(dist); play.goAhead(dist);
} }
if (TurnType.TL.equals(t.getValue()) || TurnType.TSHL.equals(t.getValue()) || TurnType.TSLL.equals(t.getValue()) if (TurnType.TL.equals(t.getValue()) || TurnType.TSHL.equals(t.getValue()) || TurnType.TSLL.equals(t.getValue())
@ -219,6 +223,7 @@ public class VoiceRouter {
play.newRouteCalculated(router.getLeftDistance()).play(); play.newRouteCalculated(router.getLeftDistance()).play();
} }
currentDirection = router.currentDirectionInfo; currentDirection = router.currentDirectionInfo;
currentStatus = 0;
} }
public void arrivedDestinationPoint() { public void arrivedDestinationPoint() {

View file

@ -29,7 +29,7 @@ public class AnimateDraggingMapThread implements Runnable {
private float ay; private float ay;
private byte dirX; private byte dirX;
private byte dirY; private byte dirY;
private final float a = 0.001f; private final float a = 0.0014f;
private long time; private long time;
private volatile boolean stopped; private volatile boolean stopped;
@ -113,7 +113,7 @@ public class AnimateDraggingMapThread implements Runnable {
vy -= ay * dt; vy -= ay * dt;
curX = newX; curX = newX;
curY = newY; curY = newY;
conditionToCountinue = vx > 0 || vy > 0; conditionToCountinue = vx > 0.5 || vy > 0.5;
} else { } else {
if(phaseOfMoving == 0){ if(phaseOfMoving == 0){
curZ = newZ; curZ = newZ;

View file

@ -259,7 +259,7 @@ public class MapInfoLayer implements OsmandMapLayer {
MapUtils.getLongitudeFromTile(view.getFloatZoom(), tileNumberRight)); MapUtils.getLongitudeFromTile(view.getFloatZoom(), tileNumberRight));
dist *= screenPercent; dist *= screenPercent;
int baseDist = 50; int baseDist = 5;
byte pointer = 0; byte pointer = 0;
while (dist > baseDist) { while (dist > baseDist) {
if (pointer++ % 3 == 2) { if (pointer++ % 3 == 2) {

View file

@ -756,7 +756,11 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
@Override @Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if(Math.abs(e1.getX() - e2.getX()) + Math.abs(e1.getX() - e2.getX()) > 50){
animatedDraggingThread.startDragging(Math.abs(velocityX/1000), Math.abs(velocityY/1000), e1.getX(), e1.getY(), e2.getX(), e2.getY()); animatedDraggingThread.startDragging(Math.abs(velocityX/1000), Math.abs(velocityY/1000), e1.getX(), e1.getY(), e2.getX(), e2.getY());
} else {
onScroll(e1, e2, e1.getX() - e2.getX(), e1.getY() - e2.getY());
}
return true; return true;
} }

View file

@ -6,6 +6,7 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -333,7 +334,9 @@ public class CommandPlayer {
} }
} }
Struct struct = new Struct(name, list); Struct struct = new Struct(name, list);
log.debug("Adding command : " + name); //$NON-NLS-1$ if(log.isDebugEnabled()){
log.debug("Adding command : " + name + " " + Arrays.toString(args)); //$NON-NLS-1$ //$NON-NLS-2$
}
listStruct.add(struct); listStruct.add(struct);
return this; return this;
} }