Assign priorities to event images and colors based on ordinal of event types (higher ordinal means higher priority)

This commit is contained in:
JoePfeiffer 2024-01-02 08:05:17 -07:00
parent c1b76be844
commit eb4b02bda4
2 changed files with 9 additions and 3 deletions

View File

@ -40,6 +40,8 @@ public class EventGraphics {
EVENT_COLORS.put(FlightEvent.Type.GROUND_HIT, new Color(0, 0, 0));
EVENT_COLORS.put(FlightEvent.Type.SIMULATION_END, new Color(128, 0, 0));
EVENT_COLORS.put(FlightEvent.Type.TUMBLE, new Color(196, 0, 255));
EVENT_COLORS.put(FlightEvent.Type.EXCEPTION, new Color(255, 0, 0));
EVENT_COLORS.put(FlightEvent.Type.SIM_ABORT, new Color(255, 0, 0));
}
private static final Map<FlightEvent.Type, Image> EVENT_IMAGES = new HashMap<FlightEvent.Type, Image>();

View File

@ -444,6 +444,7 @@ public class SimulationPlot {
String text = null;
Color color = null;
Image image = null;
int maxOrdinal = -1;
for (EventDisplayInfo info : eventList) {
if (branch >= 0 && branch != info.stage) {
continue;
@ -451,12 +452,14 @@ public class SimulationPlot {
double t = info.time;
FlightEvent.Type type = info.event.getType();
if (Math.abs(t - prevTime) <= 0.05) {
if (!typeSet.contains(type)) {
text = text + ", " + type.toString();
color = EventGraphics.getEventColor(type);
image = EventGraphics.getEventImage(type);
if (type.ordinal() > maxOrdinal) {
color = EventGraphics.getEventColor(type);
image = EventGraphics.getEventImage(type);
maxOrdinal = type.ordinal();
}
typeSet.add(type);
}
@ -473,6 +476,7 @@ public class SimulationPlot {
image = EventGraphics.getEventImage(type);
typeSet.clear();
typeSet.add(type);
maxOrdinal = type.ordinal();
}
}