summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-10-08 11:46:38 -0600
committerKeith Packard <keithp@keithp.com>2011-10-08 11:46:38 -0600
commitcbf5a649c8b7101bef9d57e48e42ac775e758c79 (patch)
tree9ec33b829609c4d7fd75142fc35bff48bafd0b16
parentf9b0b7423c0640f729d61a91de6ff96ffe4b486e (diff)
altosui: Allow for multiple instances of each state in the graph
With the new boost re-detect code, we can get multiple instances of boost/fast/coast, so make sure each are displayed in the graph. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/AltosGraphTime.java31
-rw-r--r--altosui/AltosGraphUI.java6
2 files changed, 21 insertions, 16 deletions
diff --git a/altosui/AltosGraphTime.java b/altosui/AltosGraphTime.java
index ada6ef13..6a084b2c 100644
--- a/altosui/AltosGraphTime.java
+++ b/altosui/AltosGraphTime.java
@@ -4,6 +4,11 @@
package altosui;
+import java.lang.*;
+import java.io.*;
+import java.util.concurrent.*;
+import java.util.*;
+import java.text.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.HashMap;
@@ -98,9 +103,10 @@ class AltosGraphTime extends AltosGraph {
}
static class StateMarker implements Element {
- private double val = Double.NaN;
+ private LinkedList<Double> times = new LinkedList<Double>();
private String name;
private int state;
+ private int prev_state = Altos.ao_flight_startup;
StateMarker(int state, String name) {
this.state = state;
@@ -109,22 +115,19 @@ class AltosGraphTime extends AltosGraph {
public void attachGraph(AltosGraphTime g) { return; }
public void gotTimeData(double time, AltosDataPoint d) {
- if (Double.isNaN(val) || time < val) {
- if (d.state() == state) {
- val = time;
- }
- }
+ if (prev_state != state && d.state() == state)
+ times.add(time);
+ prev_state = d.state();
}
public void addToPlot(AltosGraphTime g, XYPlot plot) {
- if (Double.isNaN(val))
- return;
-
- ValueMarker m = new ValueMarker(val);
- m.setLabel(name);
- m.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
- m.setLabelTextAnchor(TextAnchor.TOP_LEFT);
- plot.addDomainMarker(m);
+ for (double time : times) {
+ ValueMarker m = new ValueMarker(time);
+ m.setLabel(name);
+ m.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
+ m.setLabelTextAnchor(TextAnchor.TOP_LEFT);
+ plot.addDomainMarker(m);
+ }
}
}
diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java
index be52bd4e..030bbc25 100644
--- a/altosui/AltosGraphUI.java
+++ b/altosui/AltosGraphUI.java
@@ -109,6 +109,8 @@ public class AltosGraphUI extends JFrame
protected AltosGraphTime myAltosGraphTime(String suffix) {
return (new AltosGraphTime("Overall " + suffix))
.addElement(e_boost)
+ .addElement(e_fast)
+ .addElement(e_coast)
.addElement(e_drogue)
.addElement(e_main)
.addElement(e_landed);
@@ -238,8 +240,8 @@ public class AltosGraphUI extends JFrame
{
ArrayList<AltosGraph> graph = new ArrayList<AltosGraph>();
graph.addAll((new OverallGraphs()).graphs());
- graph.addAll((new AscentGraphs()).graphs());
- graph.addAll((new DescentGraphs()).graphs());
+// graph.addAll((new AscentGraphs()).graphs());
+// graph.addAll((new DescentGraphs()).graphs());
if (which > 0) {
if (which >= graph.size()) {