Left side countries roundabout

This commit is contained in:
Victor Shcherb 2012-06-24 11:42:23 +02:00
parent fff6be1a17
commit c0e72be99b
2 changed files with 30 additions and 14 deletions

View file

@ -502,23 +502,24 @@ public class MapInfoLayer extends OsmandMapLayer {
// final int exits = 5;
// i++;
// if (i % (l + exits) >= l ) {
// nextTurnInfo.turnType = TurnType.valueOf("EXIT" + (i % (l + exits) - l + 1));
// nextTurnInfo.turnType = TurnType.valueOf("EXIT" + (i % (l + exits) - l + 1), true);
// nextTurnInfo.exitOut = (i % (l + exits) - l + 1)+"";
// float a = 180 - (i % (l + exits) - l + 1) * 50;
// nextTurnInfo.turnType.setTurnAngle(a < 0 ? a + 360 : a);
// } else {
// nextTurnInfo.turnType = TurnType.valueOf(TurnType.predefinedTypes[i % (TurnType.predefinedTypes.length + exits)]);
// nextTurnInfo.turnType = TurnType.valueOf(TurnType.predefinedTypes[i % (TurnType.predefinedTypes.length + exits)], true);
// nextTurnInfo.exitOut = "";
// }
// nextTurnInfo.turnImminent = (nextTurnInfo.turnImminent + 1) % 3;
// nextTurnInfo.nextTurnDirection = 580;
// TurnPathHelper.calcTurnPath(nextTurnInfo.pathForTurn, nextTurnInfo.turnType,nextTurnInfo.pathTransform);
showMiniMap = true;
// TurnPathHelper.calcTurnPath(nextTurnInfo.pathForTurn, nexsweepAngletTurnInfo.turnType,nextTurnInfo.pathTransform);
// showMiniMap = true;
view.refreshMap();
}
});
// initial state
nextTurnInfo.setVisibility(View.GONE);
// nextTurnInfo.setVisibility(View.GONE);
return nextTurnInfo;
}
@ -576,6 +577,7 @@ public class MapInfoLayer extends OsmandMapLayer {
};
nextTurnInfo.setOnClickListener(new View.OnClickListener() {
// int i = 0;
// boolean leftSide = false;
@Override
public void onClick(View v) {
// for test rendering purposes
@ -583,12 +585,12 @@ public class MapInfoLayer extends OsmandMapLayer {
// final int exits = 5;
// i++;
// if (i % (l + exits) >= l ) {
// nextTurnInfo.turnType = TurnType.valueOf("EXIT" + (i % (l + exits) - l + 1));
// float a = 180 - (i % (l + exits) - l + 1) * 50;
// nextTurnInfo.turnType = TurnType.valueOf("EXIT" + (i % (l + exits) - l + 1), leftSide);
// float a = leftSide? -180 + (i % (l + exits) - l + 1) * 50: 180 - (i % (l + exits) - l + 1) * 50;
// nextTurnInfo.turnType.setTurnAngle(a < 0 ? a + 360 : a);
// nextTurnInfo.exitOut = (i % (l + exits) - l + 1)+"";
// } else {
// nextTurnInfo.turnType = TurnType.valueOf(TurnType.predefinedTypes[i % (TurnType.predefinedTypes.length + exits)]);
// nextTurnInfo.turnType = TurnType.valueOf(TurnType.predefinedTypes[i % (TurnType.predefinedTypes.length + exits)], leftSide);
// nextTurnInfo.exitOut = "";
// }
// nextTurnInfo.turnImminent = (nextTurnInfo.turnImminent + 1) % 3;

View file

@ -157,18 +157,27 @@ public class TurnPathHelper {
} else if (t > 160 && t < 170) {
t = 160;
}
boolean leftSide = turnType.isLeftSide();
float sweepAngle = (t - 360) - 180;
if (sweepAngle < -360) {
sweepAngle += 360;
}
if(leftSide && sweepAngle < 0) {
sweepAngle += 360;
}
float r1 = ha / 3f - 1;
float r2 = r1 - 9;
float angleToRot = 0.3f;
float angleToRot = leftSide ? -0.3f : 0.3f;
int cx = wa / 2 ;
int cy = ha / 2 - 2;
pathForTurn.moveTo(cx, ha - 1);
pathForTurn.lineTo(cx, cy + r1);
if (leftSide) {
pathForTurn.moveTo(cx - 8, ha - 1);
pathForTurn.lineTo(cx - 8, cy + r1);
} else {
pathForTurn.moveTo(cx, ha - 1);
pathForTurn.lineTo(cx, cy + r1);
}
RectF r = new RectF(cx - r1, cy - r1, cx + r1, cy + r1);
int out = turnType.getExitOut();
@ -177,8 +186,8 @@ public class TurnPathHelper {
}
float prev = 90;
float init = 90;
float step = sweepAngle / out;
boolean leftSide = turnType.isLeftSide();
for (int i = 1; i <= out; i++) {
float to = step * i;
if (i == out) {
@ -206,8 +215,13 @@ public class TurnPathHelper {
r.set(cx - r2, cy - r2, cx + r2, cy + r2);
pathForTurn.arcTo(r, 360 + sweepAngle + 90, -sweepAngle);
pathForTurn.lineTo(cx - 8, cy + r2);
pathForTurn.lineTo(cx - 8, ha - 1);
if (leftSide) {
pathForTurn.lineTo(cx, cy + r2);
pathForTurn.lineTo(cx, ha - 1);
} else {
pathForTurn.lineTo(cx - 8, cy + r2);
pathForTurn.lineTo(cx - 8, ha - 1);
}
pathForTurn.close();
}
pathForTurn.close();