bugfix
git-svn-id: https://osmand.googlecode.com/svn/trunk@339 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
e0bd461066
commit
a12b75915e
5 changed files with 28 additions and 8 deletions
|
@ -499,17 +499,21 @@ public class RouteProvider {
|
|||
if(previous.routePointOffset > 0){
|
||||
float paz = res.get(previous.routePointOffset - 1).bearingTo(res.get(previous.routePointOffset));
|
||||
float caz;
|
||||
if(previous.turnType.isExit() && dirInfo.routePointOffset < res.size() - 1){
|
||||
if(previous.turnType.isRoundAbout() && dirInfo.routePointOffset < res.size() - 1){
|
||||
caz = res.get(dirInfo.routePointOffset).bearingTo(res.get(dirInfo.routePointOffset + 1));
|
||||
} else {
|
||||
caz = res.get(dirInfo.routePointOffset - 1).bearingTo(res.get(dirInfo.routePointOffset));
|
||||
}
|
||||
float angle = caz - paz + 60f; // that magic number helps to fix some errors
|
||||
float angle = caz - paz + 15;
|
||||
if(angle < 0){
|
||||
angle += 360;
|
||||
} else if(angle > 360){
|
||||
angle -= 360;
|
||||
}
|
||||
// that magic number helps to fix some errors for turn
|
||||
if(angle < 100){
|
||||
angle += 45;
|
||||
}
|
||||
|
||||
if(previous.turnType.getTurnAngle() < 0.5f){
|
||||
previous.turnType.setTurnAngle(angle);
|
||||
|
|
|
@ -528,7 +528,7 @@ public class RoutingHelper {
|
|||
public int getExitOut() {
|
||||
return exitOut;
|
||||
}
|
||||
public boolean isExit(){
|
||||
public boolean isRoundAbout(){
|
||||
return value.equals("EXIT"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,13 +43,15 @@ import com.osmand.voice.CommandPlayer.CommandBuilder;
|
|||
public class ShowRouteInfoActivity extends ListActivity {
|
||||
|
||||
|
||||
private RoutingHelper helper;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
ListView lv = new ListView(this);
|
||||
lv.setId(android.R.id.list);
|
||||
TextView header = new TextView(this);
|
||||
RoutingHelper helper = RoutingHelper.getInstance(this);
|
||||
helper = RoutingHelper.getInstance(this);
|
||||
Calendar c = Calendar.getInstance();
|
||||
int time = helper.getLeftTime() * 1000 - c.getTimeZone().getOffset(0);
|
||||
int dist = helper.getLeftDistance();
|
||||
|
@ -62,11 +64,9 @@ public class ShowRouteInfoActivity extends ListActivity {
|
|||
|
||||
public void onListItemClick(ListView parent, View v, int position, long id) {
|
||||
RouteDirectionInfo item = ((RouteInfoAdapter)getListAdapter()).getItem(position - 1);
|
||||
RoutingHelper inst = RoutingHelper.getInstance(this);
|
||||
Location loc = inst.getLocationFromRouteDirection(item);
|
||||
Location loc = helper.getLocationFromRouteDirection(item);
|
||||
CommandPlayer player = CommandPlayer.getInstance(this);
|
||||
if(player != null){
|
||||
// TODO temp solution roundabout
|
||||
CommandBuilder builder = player.newCommandBuilder();
|
||||
if(item.turnType.getValue() == TurnType.C){
|
||||
builder.goAhead(item.distance);
|
||||
|
@ -84,6 +84,8 @@ public class ShowRouteInfoActivity extends ListActivity {
|
|||
builder.turnSLRight(item.distance);
|
||||
} else if(item.turnType.getValue() == TurnType.TSHR) {
|
||||
builder.turnSHRight(item.distance);
|
||||
} else if(item.turnType.isRoundAbout()) {
|
||||
builder.roundAbout(item.distance, item.turnType.getExitOut());
|
||||
}
|
||||
builder.play();
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ public class MapInfoLayer implements OsmandMapLayer {
|
|||
pathForTurn.rQuadTo(0, -quadShiftX, quadShiftX, -quadShiftY);
|
||||
pathForTurn.rQuadTo(quadShiftX, 0, quadShiftX, quadShiftY);
|
||||
pathForTurn.rLineTo(0, h);
|
||||
} else if (turnType != null && turnType.isExit()) {
|
||||
} else if (turnType != null && turnType.isRoundAbout()) {
|
||||
float t = turnType.getTurnAngle();
|
||||
if (t >= 170 && t < 220) {
|
||||
t = 220;
|
||||
|
|
|
@ -243,7 +243,9 @@ public class CommandPlayer {
|
|||
protected static final String A_RIGHT_SL = "right_sl"; //$NON-NLS-1$
|
||||
|
||||
protected static final String С_PREPARE_TURN = "prepare_turn"; //$NON-NLS-1$
|
||||
protected static final String С_PREPARE_ROUNDABOUT = "prepare_roundabout"; //$NON-NLS-1$
|
||||
protected static final String С_PREPARE_MAKE_UT = "prepare_make_ut"; //$NON-NLS-1$
|
||||
protected static final String С_ROUNDABOUT = "roundabout"; //$NON-NLS-1$
|
||||
protected static final String С_GO_AHEAD = "go_ahead"; //$NON-NLS-1$
|
||||
protected static final String С_TURN = "turn"; //$NON-NLS-1$
|
||||
protected static final String С_MAKE_UT = "make_ut"; //$NON-NLS-1$
|
||||
|
@ -394,6 +396,18 @@ public class CommandPlayer {
|
|||
return addCommand(С_PREPARE_TURN, A_RIGHT_SH, dist);
|
||||
}
|
||||
|
||||
public CommandBuilder prepareRoundAbout(double dist){
|
||||
return addCommand(С_PREPARE_ROUNDABOUT, dist);
|
||||
}
|
||||
|
||||
public CommandBuilder roundAbout(double dist, int exit){
|
||||
return addCommand(С_ROUNDABOUT, dist, exit);
|
||||
}
|
||||
|
||||
public CommandBuilder roundAbout(int exit){
|
||||
return addCommand(С_ROUNDABOUT, exit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void play(){
|
||||
|
|
Loading…
Reference in a new issue