diff options
| -rw-r--r-- | altosuilib/AltosCSVUI.java | 10 | ||||
| -rw-r--r-- | altosuilib/AltosDataChooser.java | 2 | ||||
| -rw-r--r-- | altosuilib/AltosFlightStatsTable.java | 10 | ||||
| -rw-r--r-- | altosuilib/AltosGraph.java | 16 | ||||
| -rw-r--r-- | altosuilib/AltosGraphNew.java | 138 | ||||
| -rw-r--r-- | altosuilib/AltosInfoTable.java | 14 | ||||
| -rw-r--r-- | altosuilib/AltosScanUI.java | 8 | ||||
| -rw-r--r-- | altosuilib/AltosUIAxis.java | 14 | ||||
| -rw-r--r-- | altosuilib/AltosUIFlightSeries.java | 91 | ||||
| -rw-r--r-- | altosuilib/AltosUIGraphNew.java | 7 | ||||
| -rw-r--r-- | altosuilib/AltosUIMap.java | 8 | ||||
| -rw-r--r-- | altosuilib/AltosUITimeSeries.java | 75 | ||||
| -rw-r--r-- | altosuilib/Makefile.am | 3 | 
13 files changed, 293 insertions, 103 deletions
| diff --git a/altosuilib/AltosCSVUI.java b/altosuilib/AltosCSVUI.java index 1b769740..49d6ea68 100644 --- a/altosuilib/AltosCSVUI.java +++ b/altosuilib/AltosCSVUI.java @@ -31,7 +31,8 @@ public class AltosCSVUI  	JFileChooser		csv_chooser;  	JPanel			accessory;  	JComboBox<String>	combo_box; -	Iterable<AltosState>	states; +	AltosFlightSeries	series; +	AltosCalData		cal_data;  	AltosWriter		writer;  	static String[]		combo_box_items = { "Comma Separated Values (.CSV)", "Googleearth Data (.KML)" }; @@ -55,8 +56,9 @@ public class AltosCSVUI  			set_default_file();  	} -	public AltosCSVUI(JFrame frame, AltosStateIterable states, File source_file) { -		this.states = states; +	public AltosCSVUI(JFrame frame, AltosFlightSeries series, AltosCalData cal_data, File source_file) { +		this.series = series; +		this.cal_data = cal_data;  		csv_chooser = new JFileChooser(source_file);  		accessory = new JPanel(); @@ -91,7 +93,7 @@ public class AltosCSVUI  					writer = new AltosCSV(file);  				else  					writer = new AltosKML(file); -				writer.write(states); +				writer.write(series);  				writer.close();  			} catch (FileNotFoundException ee) {  				JOptionPane.showMessageDialog(frame, diff --git a/altosuilib/AltosDataChooser.java b/altosuilib/AltosDataChooser.java index a8c74926..c6d53a31 100644 --- a/altosuilib/AltosDataChooser.java +++ b/altosuilib/AltosDataChooser.java @@ -36,7 +36,7 @@ public class AltosDataChooser extends JFileChooser {  		return file;  	} -	public AltosStateIterable runDialog() { +	public AltosRecordSet runDialog() {  		int	ret;  		ret = showOpenDialog(frame); diff --git a/altosuilib/AltosFlightStatsTable.java b/altosuilib/AltosFlightStatsTable.java index 2f46f231..8a104a3c 100644 --- a/altosuilib/AltosFlightStatsTable.java +++ b/altosuilib/AltosFlightStatsTable.java @@ -116,10 +116,12 @@ public class AltosFlightStatsTable extends JComponent implements AltosFontListen  				       String.format("%5.0f m", stats.max_gps_height),  				       String.format("%5.0f ft", AltosConvert.meters_to_feet(stats.max_gps_height)));  		} -		new FlightStat(layout, y++, "Maximum speed", -			       String.format("%5.0f m/s", stats.max_speed), -			       String.format("%5.0f fps", AltosConvert.mps_to_fps(stats.max_speed)), -			       String.format("Mach %4.1f", AltosConvert.meters_to_mach(stats.max_speed))); +		if (stats.max_speed != AltosLib.MISSING) { +			new FlightStat(layout, y++, "Maximum speed", +				       String.format("%5.0f m/s", stats.max_speed), +				       String.format("%5.0f fps", AltosConvert.mps_to_fps(stats.max_speed)), +				       String.format("Mach %4.1f", AltosConvert.meters_to_mach(stats.max_speed))); +		}  		if (stats.max_acceleration != AltosLib.MISSING)  			new FlightStat(layout, y++, "Maximum boost acceleration",  				       String.format("%5.0f m/s²", stats.max_acceleration), diff --git a/altosuilib/AltosGraph.java b/altosuilib/AltosGraph.java index 880fc8a2..987c461e 100644 --- a/altosuilib/AltosGraph.java +++ b/altosuilib/AltosGraph.java @@ -163,8 +163,6 @@ public class AltosGraph extends AltosUIGraph {  	static final private Color mag_z_color = new Color(0, 0, 128);  	static final private Color orient_color = new Color(31, 31, 31); -	static AltosVoltage voltage_units = new AltosVoltage(); -	static AltosPressure pressure_units = new AltosPressure();  	static AltosNsat nsat_units = new AltosNsat();  	static AltosDbm dbm_units = new AltosDbm();  	static AltosRotationRate gyro_units = new AltosRotationRate(); @@ -181,10 +179,10 @@ public class AltosGraph extends AltosUIGraph {  		super(enable);  		height_axis = newAxis("Height", AltosConvert.height, height_color); -		pressure_axis = newAxis("Pressure", pressure_units, pressure_color, 0); +		pressure_axis = newAxis("Pressure", AltosConvert.pressure, pressure_color, 0);  		speed_axis = newAxis("Speed", AltosConvert.speed, speed_color);  		accel_axis = newAxis("Acceleration", AltosConvert.accel, accel_color); -		voltage_axis = newAxis("Voltage", voltage_units, voltage_color); +		voltage_axis = newAxis("Voltage", AltosConvert.voltage, voltage_color);  		temperature_axis = newAxis("Temperature", AltosConvert.temperature, temperature_color, 0);  		nsat_axis = newAxis("Satellites", nsat_units, gps_nsat_color,  				    AltosUIAxis.axis_include_zero | AltosUIAxis.axis_integer); @@ -208,7 +206,7 @@ public class AltosGraph extends AltosUIGraph {  				  height_axis);  			addSeries("Pressure",  				  AltosGraphDataPoint.data_pressure, -				  pressure_units, +				  AltosConvert.pressure,  				  pressure_color,  				  false,  				  pressure_axis); @@ -321,7 +319,7 @@ public class AltosGraph extends AltosUIGraph {  		if (stats.has_battery)  			addSeries("Battery Voltage",  				  AltosGraphDataPoint.data_battery_voltage, -				  voltage_units, +				  AltosConvert.voltage,  				  battery_voltage_color,  				  false,  				  voltage_axis); @@ -335,13 +333,13 @@ public class AltosGraph extends AltosUIGraph {  				  temperature_axis);  			addSeries("Drogue Voltage",  				  AltosGraphDataPoint.data_drogue_voltage, -				  voltage_units, +				  AltosConvert.voltage,  				  drogue_voltage_color,  				  false,  				  voltage_axis);  			addSeries("Main Voltage",  				  AltosGraphDataPoint.data_main_voltage, -				  voltage_units, +				  AltosConvert.voltage,  				  main_voltage_color,  				  false,  				  voltage_axis); @@ -416,7 +414,7 @@ public class AltosGraph extends AltosUIGraph {  			for (int i = 0; i < stats.num_ignitor; i++)  				addSeries(AltosLib.ignitor_name(i),  					  AltosGraphDataPoint.data_ignitor_0 + i, -					  voltage_units, +					  AltosConvert.voltage,  					  main_voltage_color,  					  false,  					  voltage_axis); diff --git a/altosuilib/AltosGraphNew.java b/altosuilib/AltosGraphNew.java index 2c01c466..dc5b7e47 100644 --- a/altosuilib/AltosGraphNew.java +++ b/altosuilib/AltosGraphNew.java @@ -38,13 +38,16 @@ import org.jfree.data.*;  public class AltosGraphNew extends AltosUIGraphNew {  	static final private Color height_color = new Color(194,31,31); +	static final private Color kalman_height_color = new Color(255,0,0);  	static final private Color gps_height_color = new Color(150,31,31);  	static final private Color pressure_color = new Color (225,31,31);  	static final private Color range_color = new Color(100, 31, 31);  	static final private Color distance_color = new Color(100, 31, 194);  	static final private Color speed_color = new Color(31,194,31); +	static final private Color kalman_speed_color = new Color(0,255,0);  	static final private Color thrust_color = new Color(31,194,31);  	static final private Color accel_color = new Color(31,31,194); +	static final private Color kalman_accel_color = new Color(0,0,255);  	static final private Color voltage_color = new Color(194, 194, 31);  	static final private Color battery_voltage_color = new Color(194, 194, 31);  	static final private Color drogue_voltage_color = new Color(150, 150, 31); @@ -54,6 +57,7 @@ public class AltosGraphNew extends AltosUIGraphNew {  	static final private Color gps_nsat_view_color = new Color (150, 31, 150);  	static final private Color gps_course_color = new Color (100, 31, 112);  	static final private Color gps_ground_speed_color = new Color (31, 112, 100); +	static final private Color gps_speed_color = new Color (31, 112, 100);  	static final private Color gps_climb_rate_color = new Color (31, 31, 112);  	static final private Color gps_pdop_color = new Color(50, 194, 0);  	static final private Color gps_hdop_color = new Color(50, 0, 194); @@ -72,15 +76,19 @@ public class AltosGraphNew extends AltosUIGraphNew {  	static final private Color mag_z_color = new Color(0, 0, 128);  	static final private Color orient_color = new Color(31, 31, 31); -	static AltosNsat nsat_units = new AltosNsat(); -	static AltosDbm dbm_units = new AltosDbm(); +//	static AltosNsat nsat_units = new AltosNsat(); +	static AltosUnits nsat_units = null; +//	static AltosDbm dbm_units = new AltosDbm(); +	static AltosUnits dbm_units = null;  	static AltosOrient orient_units = new AltosOrient(); -	static AltosMagUnits mag_units = new AltosMagUnits(); -	static AltosDopUnits dop_units = new AltosDopUnits(); +//	static AltosMagUnits mag_units = new AltosMagUnits(); +	static AltosUnits mag_units = null; +//	static AltosDopUnits dop_units = new AltosDopUnits(); +	static AltosUnits dop_units = null;  	AltosUIFlightSeries flight_series; -	AltosUITimeSeries[] setup(AltosFlightStats stats, AltosRecordSet record_set) { +	AltosUITimeSeries[] setup(AltosFlightStats stats, AltosUIFlightSeries flight_series, AltosCalData cal_data) {  		AltosUIAxis	height_axis, speed_axis, accel_axis, voltage_axis, temperature_axis, nsat_axis, dbm_axis;  		AltosUIAxis	distance_axis, pressure_axis, thrust_axis; @@ -105,33 +113,109 @@ public class AltosGraphNew extends AltosUIGraphNew {  		course_axis = newAxis("Course", orient_units, gps_course_color, 0);  		dop_axis = newAxis("Dilution of Precision", dop_units, gps_pdop_color, 0); -		flight_series = new AltosUIFlightSeries(); +		flight_series.register_axis("default", +					    speed_color, +					    false, +					    speed_axis); -		flight_series.register_extra("default", -					     speed_color, -					     false, -					     speed_axis); +		flight_series.register_marker(AltosUIFlightSeries.state_name, +					      state_color, +					      true, +					      plot); -		flight_series.register_extra(AltosUIFlightSeries.accel_name, -					     accel_color, -					     true, -					     accel_axis); +		flight_series.register_axis(AltosUIFlightSeries.accel_name, +					    accel_color, +					    true, +					    accel_axis); -		flight_series.register_extra(AltosUIFlightSeries.pressure_name, -					     pressure_color, -					     true, -					     pressure_axis); +		flight_series.register_axis(AltosUIFlightSeries.kalman_accel_name, +					    kalman_accel_color, +					    false, +					    accel_axis); -		flight_series.register_extra(AltosUIFlightSeries.thrust_name, -					     thrust_color, -					     true, -					     thrust_axis); +		flight_series.register_axis(AltosUIFlightSeries.rssi_name, +					    dbm_color, +					    false, +					    dbm_axis); + +		flight_series.register_axis(AltosUIFlightSeries.speed_name, +					    speed_color, +					    true, +					    speed_axis); + +		flight_series.register_axis(AltosUIFlightSeries.kalman_speed_name, +					    kalman_speed_color, +					    true, +					    speed_axis); + +		flight_series.register_axis(AltosUIFlightSeries.pressure_name, +					    pressure_color, +					    false, +					    pressure_axis); + +		flight_series.register_axis(AltosUIFlightSeries.height_name, +					    height_color, +					    true, +					    height_axis); + +		flight_series.register_axis(AltosUIFlightSeries.kalman_height_name, +					    kalman_height_color, +					    false, +					    height_axis); + + +		flight_series.register_axis(AltosUIFlightSeries.sats_in_view_name, +					    gps_nsat_view_color, +					    false, +					    nsat_axis); + + +		flight_series.register_axis(AltosUIFlightSeries.sats_in_soln_name, +					    gps_nsat_solution_color, +					    false, +					    nsat_axis); -//		addMarker("State", AltosGraphDataPoint.data_state, state_color); -		record_set.capture_series(flight_series); +		flight_series.register_axis(AltosUIFlightSeries.gps_altitude_name, +					    gps_height_color, +					    false, +					    height_axis); + +		flight_series.register_axis(AltosUIFlightSeries.gps_height_name, +					    gps_height_color, +					    false, +					    height_axis); + +		flight_series.register_axis(AltosUIFlightSeries.gps_ground_speed_name, +					    gps_ground_speed_color, +					    false, +					    speed_axis); + + +		flight_series.register_axis(AltosUIFlightSeries.gps_ascent_rate_name, +					    gps_climb_rate_color, +					    false, +					    speed_axis); + + +		flight_series.register_axis(AltosUIFlightSeries.gps_course_name, +					    gps_course_color, +					    false, +					    course_axis); + +		flight_series.register_axis(AltosUIFlightSeries.gps_speed_name, +					    gps_speed_color, +					    false, +					    speed_axis); + +		flight_series.register_axis(AltosUIFlightSeries.thrust_name, +					    thrust_color, +					    true, +					    thrust_axis); + +//		addMarker("State", AltosGraphDataPoint.data_state, state_color); -		return flight_series.series(); +		return flight_series.series(cal_data);  /*  		if (stats.has_flight_data) {  			addSeries("Height", @@ -366,9 +450,9 @@ public class AltosGraphNew extends AltosUIGraphNew {  */  	} -	public AltosGraphNew(AltosUIEnable enable, AltosFlightStats stats, AltosRecordSet record_set) { +	public AltosGraphNew(AltosUIEnable enable, AltosFlightStats stats, AltosUIFlightSeries flight_series, AltosCalData cal_data) {  		super(enable, "Flight"); -		set_series(setup(stats, record_set)); +		set_series(setup(stats, flight_series, cal_data));  	}  } diff --git a/altosuilib/AltosInfoTable.java b/altosuilib/AltosInfoTable.java index 7ede2824..c1ac774e 100644 --- a/altosuilib/AltosInfoTable.java +++ b/altosuilib/AltosInfoTable.java @@ -128,6 +128,8 @@ public class AltosInfoTable extends JTable implements AltosFlightDisplay, Hierar  	public void show(AltosState state, AltosListenerState listener_state) { +		AltosCalData	cal_data = state.cal_data; +  		if (!isShowing()) {  			last_state = state;  			last_listener_state = listener_state; @@ -136,14 +138,14 @@ public class AltosInfoTable extends JTable implements AltosFlightDisplay, Hierar  		reset();  		if (state != null) { -			if (state.device_type != AltosLib.MISSING) -				info_add_row(0, "Device", "%s", AltosLib.product_name(state.device_type)); -			else if (state.product != null) -				info_add_row(0, "Device", "%s", state.product); +			if (cal_data.device_type != AltosLib.MISSING) +				info_add_row(0, "Device", "%s", AltosLib.product_name(cal_data.device_type)); +			else if (cal_data.product != null) +				info_add_row(0, "Device", "%s", cal_data.product);  			if (state.altitude() != AltosLib.MISSING)  				info_add_row(0, "Altitude", "%6.0f    m", state.altitude()); -			if (state.ground_altitude() != AltosLib.MISSING) -				info_add_row(0, "Pad altitude", "%6.0f    m", state.ground_altitude()); +			if (cal_data.ground_altitude != AltosLib.MISSING) +				info_add_row(0, "Pad altitude", "%6.0f    m", cal_data.ground_altitude);  			if (state.height() != AltosLib.MISSING)  				info_add_row(0, "Height", "%6.0f    m", state.height());  			if (state.max_height() != AltosLib.MISSING) diff --git a/altosuilib/AltosScanUI.java b/altosuilib/AltosScanUI.java index 8843429a..ad53f66b 100644 --- a/altosuilib/AltosScanUI.java +++ b/altosuilib/AltosScanUI.java @@ -213,10 +213,10 @@ public class AltosScanUI  						if (state == null)  							continue;  						packet_count++; -						if (state.flight != AltosLib.MISSING) { -							final AltosScanResult	result = new AltosScanResult(state.callsign, -													     state.serial, -													     state.flight, +						if (reader.cal_data.flight != AltosLib.MISSING) { +							final AltosScanResult	result = new AltosScanResult(reader.cal_data.callsign, +													     reader.cal_data.serial, +													     reader.cal_data.flight,  													     frequencies[frequency_index],  													     telemetry,  													     rate); diff --git a/altosuilib/AltosUIAxis.java b/altosuilib/AltosUIAxis.java index e41667ef..40ee5161 100644 --- a/altosuilib/AltosUIAxis.java +++ b/altosuilib/AltosUIAxis.java @@ -49,14 +49,18 @@ public class AltosUIAxis extends NumberAxis {  	public final static int axis_default = axis_include_zero;  	public void set_units() { -		String u = units.parse_units(); -		if (u != null) -			setLabel(String.format("%s (%s)", label, u)); -		else -			setLabel(label); +		if (units != null) { +			String u = units.parse_units(); +			if (u != null) { +				setLabel(String.format("%s (%s)", label, u)); +				return; +			} +		} +		setLabel(label);  	}  	public void set_enable(boolean enable) { +		System.out.printf("axis %s set enable visible %d ref %d\n", label, visible, ref);  		if (enable) {  			visible++;  			if (visible > ref) diff --git a/altosuilib/AltosUIFlightSeries.java b/altosuilib/AltosUIFlightSeries.java index d15c4071..1840761e 100644 --- a/altosuilib/AltosUIFlightSeries.java +++ b/altosuilib/AltosUIFlightSeries.java @@ -19,50 +19,101 @@ import java.awt.*;  import javax.swing.*;  import org.altusmetrum.altoslib_11.*; -class AltosUITimeSeriesExtra { +import org.jfree.ui.*; +import org.jfree.chart.*; +import org.jfree.chart.plot.*; +import org.jfree.chart.axis.*; +import org.jfree.chart.renderer.*; +import org.jfree.chart.renderer.xy.*; +import org.jfree.chart.labels.*; +import org.jfree.data.xy.*; +import org.jfree.data.*; + +class AltosUITimeSeriesAxis {  	Color		color;  	boolean		enabled; +	boolean		marker;  	AltosUIAxis	axis; +	XYPlot		plot; -	public AltosUITimeSeriesExtra(Color color, boolean enabled, AltosUIAxis axis) { +	public AltosUITimeSeriesAxis(Color color, boolean enabled, AltosUIAxis axis, XYPlot plot, boolean marker) {  		this.color = color;  		this.enabled = enabled;  		this.axis = axis; +		this.plot = plot; +		this.marker = marker;  	}  }  public class AltosUIFlightSeries extends AltosFlightSeries { -	Hashtable<String,AltosUITimeSeriesExtra> extra; +	Hashtable<String,AltosUITimeSeriesAxis> axes; + +	AltosUIFlightSeries flight_series; + +	void fill_axes(String label, AltosUITimeSeriesAxis axis) { +		for (AltosTimeSeries ts : series) { +			AltosUITimeSeries uts = (AltosUITimeSeries) ts; + +			if (label.equals(ts.label) || (label.equals("default") && uts.color == null)) { +				if (axis.marker) +					uts.set_marker(axis.color, axis.enabled, axis.plot); +				else +					uts.set_axis(axis.color, axis.enabled, axis.axis); +			} +		} +	} -	public void register_extra(String label, -				   Color color, -				   boolean enabled, -				   AltosUIAxis axis) { +	public void register_axis(String label, +				  Color color, +				  boolean enabled, +				  AltosUIAxis axis) { +		AltosUITimeSeriesAxis tsa = new AltosUITimeSeriesAxis(color, +								      enabled, +								      axis, +								      null, +								      false); +		axes.put(label, tsa); +		fill_axes(label, tsa); +	} -		AltosUITimeSeriesExtra e = new AltosUITimeSeriesExtra(color, +	public void register_marker(String label, +				    Color color, +				    boolean enabled, +				    XYPlot plot) { +		AltosUITimeSeriesAxis tsa = new AltosUITimeSeriesAxis(color,  								      enabled, -								      axis); -		System.out.printf("register extra label %s extra %s\n", label, e); -		extra.put(label, e); +								      null, +								      plot, +								      true); +		axes.put(label, tsa); +		fill_axes(label, tsa);  	}  	public AltosTimeSeries make_series(String label, AltosUnits units) { -		AltosUITimeSeriesExtra e = extra.get(label); -		if (e == null) -			e = extra.get("default"); -		return new AltosUITimeSeries(label, units, -					     e.color, e.enabled, e.axis); +		AltosUITimeSeries time_series = new AltosUITimeSeries(label, units); + +		AltosUITimeSeriesAxis tsa = axes.get(label); +		if (tsa == null) +			tsa = axes.get("default"); +		if (tsa != null) { +			if (tsa.marker) +				time_series.set_marker(tsa.color, tsa.enabled, tsa.plot); +			else +				time_series.set_axis(tsa.color, tsa.enabled, tsa.axis); +		} +		return time_series;  	} -	public AltosUITimeSeries[] series() { +	public AltosUITimeSeries[] series(AltosCalData cal_data) { +		fill_in();  		return series.toArray(new AltosUITimeSeries[0]);  	} -	public AltosUIFlightSeries () { -		super(); -		extra = new Hashtable<String,AltosUITimeSeriesExtra>(); +	public AltosUIFlightSeries (AltosCalData cal_data) { +		super(cal_data); +		axes = new Hashtable<String,AltosUITimeSeriesAxis>();  	}  } diff --git a/altosuilib/AltosUIGraphNew.java b/altosuilib/AltosUIGraphNew.java index acfcd23d..709541ff 100644 --- a/altosuilib/AltosUIGraphNew.java +++ b/altosuilib/AltosUIGraphNew.java @@ -68,7 +68,6 @@ public class AltosUIGraphNew implements AltosUnitsListener {  	void addAxis(AltosUIAxis axis) {  		if (!axes_added.containsKey(axis.index)) { -			System.out.printf("Add axis %s %d\n", axis.label, axis_index);  			axes_added.put(axis.index, true);  			plot.setRangeAxis(axis.index, axis);  		} @@ -88,12 +87,8 @@ public class AltosUIGraphNew implements AltosUnitsListener {  		series_index++;  	} -/* -	public void addMarker(String label, int fetch, Color color) { -		AltosUIMarker		marker = new AltosUIMarker(fetch, color, plot); -		this.graphers.add(marker); +	public void addMarker(AltosUITimeSeries series) {  	} -*/  	public void units_changed(boolean imperial_units) {  		for (AltosUITimeSeries s : series) diff --git a/altosuilib/AltosUIMap.java b/altosuilib/AltosUIMap.java index 3e4cbe9b..05c99a12 100644 --- a/altosuilib/AltosUIMap.java +++ b/altosuilib/AltosUIMap.java @@ -413,6 +413,10 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM  		map.show(state, listener_state);  	} +	public void show(AltosGPS gps, int state) { +		map.show(gps, state); +	} +  	public String getName() {  		return "Map";  	} @@ -422,6 +426,10 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM  		map.centre(state);  	} +	public void centre(AltosGPS gps) { +		map.centre(gps); +	} +  	/* internal layout bits */  	private GridBagLayout layout = new GridBagLayout(); diff --git a/altosuilib/AltosUITimeSeries.java b/altosuilib/AltosUITimeSeries.java index fbee3125..0f5e35eb 100644 --- a/altosuilib/AltosUITimeSeries.java +++ b/altosuilib/AltosUITimeSeries.java @@ -46,8 +46,12 @@ public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher  	Color		color;  	boolean		enable;  	AltosUIAxis	axis; +	boolean		marker;  	XYItemRenderer	renderer; +	XYPlot		plot;  	AltosXYSeries	xy_series; +	ArrayList<ValueMarker>	markers; +  	/* AltosUIGrapher interface */  	public boolean need_reset() { @@ -67,13 +71,32 @@ public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher  	}  	void set_data() { -		xy_series.clear(); - -		for (AltosTimeValue v : this) { -			double y = v.y; -			if (units != null) -				y = units.graph_value(y); -			xy_series.add(v.x, y); +		if (marker) { +			if (markers != null) { +				for (ValueMarker marker : markers) +					plot.removeDomainMarker(marker); +			} +			markers = new ArrayList<ValueMarker>(); +			for (AltosTimeValue v : this) { +				String s = units.string_value(v.value); +				ValueMarker marker = new ValueMarker(v.time); +				marker.setLabel(s); +				marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT); +				marker.setLabelTextAnchor(TextAnchor.TOP_LEFT); +				marker.setPaint(color); +				if (enable) +					plot.addDomainMarker(marker); +				markers.add(marker); +			} +		} else { +			xy_series.clear(); + +			for (AltosTimeValue v : this) { +				double value = v.value; +				if (units != null) +					value = units.graph_value(value); +				xy_series.add(v.time, value); +			}  		}  	} @@ -101,19 +124,25 @@ public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher  	public void set_enable(boolean enable) {  		if (this.enable != enable) {  			this.enable = enable; -			renderer.setSeriesVisible(0, enable); -			axis.set_enable(enable); +			if (marker) { +				for (ValueMarker marker : markers) { +					if (enable) +						plot.addDomainMarker(marker); +					else +						plot.removeDomainMarker(marker); +				} +			} else { +				renderer.setSeriesVisible(0, enable); +				axis.set_enable(enable); +			}  		}  	} -	public AltosUITimeSeries(String label, AltosUnits units, -				 Color color, boolean enable, -				 AltosUIAxis axis) { -		super(label, units); -		System.out.printf("time series %s units %s\n", label, units); +	public void set_axis(Color color, boolean enable, AltosUIAxis axis) {  		this.color = color;  		this.enable = enable;  		this.axis = axis; +		this.marker = false;  		axis.ref(this.enable); @@ -123,4 +152,22 @@ public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher  		renderer.setSeriesVisible(0, enable);  		xy_series = new AltosXYSeries(label);  	} + +	public void set_marker(Color color, boolean enable, XYPlot plot) { +		this.color = color; +		this.enable = enable; +		this.marker = true; +		this.plot = plot; +	} + +	public AltosUITimeSeries(String label, AltosUnits units) { +		super(label, units); +	} + +	public AltosUITimeSeries(String label, AltosUnits units, +				 Color color, boolean enable, +				 AltosUIAxis axis) { +		this(label, units); +		set_axis(color, enable, axis); +	}  } diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am index d868ef25..b7cfedc0 100644 --- a/altosuilib/Makefile.am +++ b/altosuilib/Makefile.am @@ -53,9 +53,6 @@ altosuilib_JAVA = \  	AltosInfoTable.java \  	AltosFlightInfoTableModel.java \  	AltosFlightStatsTable.java \ -	AltosGraph.java \ -	AltosGraphDataPoint.java \ -	AltosGraphDataSet.java \  	AltosBTDevice.java \  	AltosBTDeviceIterator.java \  	AltosBTManage.java \ | 
