An Action is the type of thing being performed at a coordinate:
Instruction.Departure
,
Instruction.Arrival
,
Instruction.Turn
, or
Instruction.TakeVortex
.
code snip:
Drawable setDirectionImage(Instruction instruction) {
if (instruction.action.getClass() == Instruction.Turn.class) {
Instruction.Turn turn = ((Instruction.Turn) instruction.action);
switch (turn.relativeBearing) {
case Left:
return getResources().getDrawable(R.drawable.turn_left);
case SlightLeft:
return getResources().getDrawable(R.drawable.slight_left);
case Right:
return getResources().getDrawable(R.drawable.turn_right);
case SlightRight:
return getResources().getDrawable(R.drawable.slight_right);
default:
return null;
}
} else if (instruction.action.getClass() == Instruction.Arrival.class
|| instruction.action.getClass() == Instruction.Departure.class) {
return getResources().getDrawable(R.drawable.location);
} else if (instruction.action.getClass() == Instruction.TakeVortex.class) {
Instruction.TakeVortex action = (Instruction.TakeVortex)instruction.action;
if (action.fromMap.getFloor() > action.toMap.getFloor()){
return getResources().getDrawable(R.drawable.elevator_down);
} else {
return getResources().getDrawable(R.drawable.elevator_up);
}
} else {
return getResources().getDrawable(R.drawable.location);
}
}