Plot SIM_WARN flight events
This commit is contained in:
parent
0ffe0e03c0
commit
67f6aa191a
@ -15,7 +15,8 @@ import info.openrocket.core.simulation.FlightEvent;
|
||||
|
||||
public class EventGraphics {
|
||||
|
||||
static Color getEventColor(FlightEvent.Type type) {
|
||||
static Color getEventColor(FlightEvent event) {
|
||||
FlightEvent.Type type = event.getType();
|
||||
Color c = EVENT_COLORS.get(type);
|
||||
if (c != null)
|
||||
return c;
|
||||
@ -23,7 +24,6 @@ public class EventGraphics {
|
||||
}
|
||||
|
||||
static Image getEventImage(FlightEvent event) {
|
||||
|
||||
FlightEvent.Type type = event.getType();
|
||||
if (type == FlightEvent.Type.SIM_WARN) {
|
||||
return MESSAGE_IMAGES.get(((Warning) event.getData()).getPriority());
|
||||
@ -48,6 +48,7 @@ public class EventGraphics {
|
||||
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_WARN, new Color(127, 127, 0));
|
||||
EVENT_COLORS.put(FlightEvent.Type.SIM_ABORT, new Color(255, 0, 0));
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
|
||||
if (!typeSet.contains(type)) {
|
||||
text = text + ", " + type.toString();
|
||||
if (type.ordinal() > maxOrdinal) {
|
||||
color = EventGraphics.getEventColor(type);
|
||||
color = EventGraphics.getEventColor(info.event);
|
||||
image = EventGraphics.getEventImage(info.event);
|
||||
maxOrdinal = type.ordinal();
|
||||
}
|
||||
@ -199,7 +199,7 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
|
||||
}
|
||||
prevTime = t;
|
||||
text = type.toString();
|
||||
color = EventGraphics.getEventColor(type);
|
||||
color = EventGraphics.getEventColor(info.event);
|
||||
image = EventGraphics.getEventImage(info.event);
|
||||
typeSet.clear();
|
||||
typeSet.add(type);
|
||||
|
@ -32,6 +32,7 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
@ -48,6 +49,7 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
@ -62,6 +64,7 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
@ -76,6 +79,7 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.setEvent(FlightEvent.Type.RECOVERY_DEVICE_DEPLOYMENT, true);
|
||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
@ -91,6 +95,8 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
@ -102,6 +108,7 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.addPlotDataType(FlightDataType.TYPE_BASE_DRAG_COEFF, 0);
|
||||
config.addPlotDataType(FlightDataType.TYPE_PRESSURE_DRAG_COEFF, 0);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
@ -120,6 +127,7 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
@ -136,6 +144,7 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
@ -151,6 +160,7 @@ public class SimulationPlotConfiguration extends PlotConfiguration<FlightDataTyp
|
||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_WARN, true);
|
||||
config.setEvent(FlightEvent.Type.SIM_ABORT, true);
|
||||
configs.add(config);
|
||||
|
||||
|
@ -174,8 +174,7 @@ public class SimulationPlotPanel extends PlotPanel<FlightDataType, FlightDataBra
|
||||
col0.setPreferredWidth(w);
|
||||
col0.setMaxWidth(w);
|
||||
table.addMouseListener(new GUIUtil.BooleanTableClickListener(table));
|
||||
selectorPanel.add(new JScrollPane(table), "height 200px, width 200lp, grow 1, wrap rel");
|
||||
|
||||
selectorPanel.add(new JScrollPane(table), "width 200lp, grow 1, wrap rel");
|
||||
|
||||
//// All + None buttons
|
||||
JButton button = new JButton(trans.get("simplotpanel.but.All"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user