From b5b87e24053c9f52a2edb5b1cb48f8e27e434ce1 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 00:56:07 -0700 Subject: Show xy charts only when accel applied by component --- grapher/Models/Charts/AccelCharts.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'grapher/Models/Charts/AccelCharts.cs') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 1aa3909..0136ced 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -24,8 +24,7 @@ namespace grapher ChartXY sensitivityChart, ChartXY velocityChart, ChartXY gainChart, - ToolStripMenuItem enableVelocityAndGain, - ICollection checkBoxesXY) + ToolStripMenuItem enableVelocityAndGain) { Estimated = new EstimatedPoints(); EstimatedX = new EstimatedPoints(); @@ -37,7 +36,6 @@ namespace grapher VelocityChart = velocityChart; GainChart = gainChart; EnableVelocityAndGain = enableVelocityAndGain; - CheckBoxesXY = checkBoxesXY; SensitivityChart.SetPointBinds(Estimated.Sensitivity, EstimatedX.Sensitivity, EstimatedY.Sensitivity); VelocityChart.SetPointBinds(Estimated.Velocity, EstimatedX.Velocity, EstimatedY.Velocity); @@ -78,8 +76,6 @@ namespace grapher private EstimatedPoints EstimatedY { get; } - private ICollection CheckBoxesXY { get; } - private bool Combined { get; set; } private int FormBorderHeight { get; } @@ -119,9 +115,9 @@ namespace grapher } } - public void RefreshXY() + public void RefreshXY(bool isWhole) { - if (CheckBoxesXY.All(box => box.Checked)) + if (isWhole) { ShowCombined(); } -- cgit v1.2.3 From 246fb772c5bf7dd6a85143fadebece3b4d9f1e04 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 02:18:41 -0700 Subject: Add constants class and separate classes into regions --- grapher/Models/Charts/AccelCharts.cs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'grapher/Models/Charts/AccelCharts.cs') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 0136ced..1574ce2 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -1,4 +1,5 @@ -using grapher.Models.Calculations; +using grapher.Constants; +using grapher.Models.Calculations; using grapher.Models.Charts; using System; using System.Collections.Generic; @@ -14,10 +15,7 @@ namespace grapher { public class AccelCharts { - public const int ChartSeparationVertical = 10; - - /// Needed to show full contents in form. Unsure why. - public const int FormHeightPadding = 35; + #region Constructors public AccelCharts( Form form, @@ -43,9 +41,9 @@ namespace grapher SensitivityChart.SetTop(0); VelocityChart.SetHeight(SensitivityChart.Height); - VelocityChart.SetTop(SensitivityChart.Height + ChartSeparationVertical); + VelocityChart.SetTop(SensitivityChart.Height + AccelGUIConstants.ChartSeparationVertical); GainChart.SetHeight(SensitivityChart.Height); - GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + ChartSeparationVertical); + GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + AccelGUIConstants.ChartSeparationVertical); Rectangle screenRectangle = ContaingForm.RectangleToScreen(ContaingForm.ClientRectangle); FormBorderHeight = screenRectangle.Top - ContaingForm.Top; @@ -58,6 +56,10 @@ namespace grapher ShowCombined(); } + #endregion Constructors + + #region Properties + public Form ContaingForm { get; } public ChartXY SensitivityChart { get; } @@ -80,6 +82,10 @@ namespace grapher private int FormBorderHeight { get; } + #endregion Properties + + #region Methods + public void MakeDots(int x, int y, double timeInMs) { if (Combined) @@ -149,9 +155,9 @@ namespace grapher VelocityChart.Show(); GainChart.Show(); ContaingForm.Height = SensitivityChart.Height + - ChartSeparationVertical + + AccelGUIConstants.ChartSeparationVertical + VelocityChart.Height + - ChartSeparationVertical + + AccelGUIConstants.ChartSeparationVertical + GainChart.Height + FormBorderHeight; } @@ -195,5 +201,7 @@ namespace grapher { ContaingForm.Width = SensitivityChart.Left + SensitivityChart.Width; } + + #endregion Methods } } -- cgit v1.2.3 From 4aa2f3ed741dcbd39233e125a34cac8163267d8d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 02:39:09 -0700 Subject: Move constants to central class --- grapher/Models/Charts/AccelCharts.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'grapher/Models/Charts/AccelCharts.cs') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 1574ce2..5e4b3de 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -1,5 +1,4 @@ -using grapher.Constants; -using grapher.Models.Calculations; +using grapher.Models.Calculations; using grapher.Models.Charts; using System; using System.Collections.Generic; @@ -41,9 +40,9 @@ namespace grapher SensitivityChart.SetTop(0); VelocityChart.SetHeight(SensitivityChart.Height); - VelocityChart.SetTop(SensitivityChart.Height + AccelGUIConstants.ChartSeparationVertical); + VelocityChart.SetTop(SensitivityChart.Height + Constants.ChartSeparationVertical); GainChart.SetHeight(SensitivityChart.Height); - GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + AccelGUIConstants.ChartSeparationVertical); + GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + Constants.ChartSeparationVertical); Rectangle screenRectangle = ContaingForm.RectangleToScreen(ContaingForm.ClientRectangle); FormBorderHeight = screenRectangle.Top - ContaingForm.Top; @@ -154,10 +153,10 @@ namespace grapher { VelocityChart.Show(); GainChart.Show(); - ContaingForm.Height = SensitivityChart.Height + - AccelGUIConstants.ChartSeparationVertical + + ContaingForm.Height = SensitivityChart.Height + + Constants.ChartSeparationVertical + VelocityChart.Height + - AccelGUIConstants.ChartSeparationVertical + + Constants.ChartSeparationVertical + GainChart.Height + FormBorderHeight; } -- cgit v1.2.3 From 1462da675f1bc36d2a770413f13ccc68165cf1e9 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Mon, 7 Sep 2020 20:30:15 -0700 Subject: Add chart resize --- grapher/Models/Charts/AccelCharts.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'grapher/Models/Charts/AccelCharts.cs') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 5e4b3de..6d9f0a1 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -132,6 +132,22 @@ namespace grapher } } + public void SetWidened() + { + SensitivityChart.SetWidened(); + VelocityChart.SetWidened(); + GainChart.SetWidened(); + UpdateFormWidth(); + } + + public void SetNarrowed() + { + SensitivityChart.SetNarrowed(); + VelocityChart.SetNarrowed(); + GainChart.SetNarrowed(); + UpdateFormWidth(); + } + private void OnEnableClick(object sender, EventArgs e) { EnableVelocityAndGain.Checked = !EnableVelocityAndGain.Checked; -- cgit v1.2.3 From 9502dcf7608475857b1487375997d20a9d29622e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 01:26:22 -0700 Subject: Remove and sort usings en masse --- grapher/Models/Charts/AccelCharts.cs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'grapher/Models/Charts/AccelCharts.cs') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 6d9f0a1..b3199d4 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -1,14 +1,8 @@ using grapher.Models.Calculations; using grapher.Models.Charts; using System; -using System.Collections.Generic; using System.Drawing; -using System.Linq; -using System.Security.Permissions; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; -using System.Windows.Forms.DataVisualization.Charting; namespace grapher { -- cgit v1.2.3 From ae8ee86fdaac66815827e132493c8bfcc5fbf8c9 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 14:29:37 -0700 Subject: Center write button --- grapher/Models/Charts/AccelCharts.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Charts/AccelCharts.cs') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index b3199d4..9040851 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -15,7 +15,8 @@ namespace grapher ChartXY sensitivityChart, ChartXY velocityChart, ChartXY gainChart, - ToolStripMenuItem enableVelocityAndGain) + ToolStripMenuItem enableVelocityAndGain, + Button writeButton) { Estimated = new EstimatedPoints(); EstimatedX = new EstimatedPoints(); @@ -27,6 +28,7 @@ namespace grapher VelocityChart = velocityChart; GainChart = gainChart; EnableVelocityAndGain = enableVelocityAndGain; + WriteButton = writeButton; SensitivityChart.SetPointBinds(Estimated.Sensitivity, EstimatedX.Sensitivity, EstimatedY.Sensitivity); VelocityChart.SetPointBinds(Estimated.Velocity, EstimatedX.Velocity, EstimatedY.Velocity); @@ -63,6 +65,8 @@ namespace grapher public ToolStripMenuItem EnableVelocityAndGain { get; } + private Button WriteButton { get; } + public AccelData AccelData { get; } private EstimatedPoints Estimated { get; } @@ -132,6 +136,7 @@ namespace grapher VelocityChart.SetWidened(); GainChart.SetWidened(); UpdateFormWidth(); + AlignWriteButton(); } public void SetNarrowed() @@ -140,6 +145,7 @@ namespace grapher VelocityChart.SetNarrowed(); GainChart.SetNarrowed(); UpdateFormWidth(); + AlignWriteButton(); } private void OnEnableClick(object sender, EventArgs e) @@ -211,6 +217,11 @@ namespace grapher ContaingForm.Width = SensitivityChart.Left + SensitivityChart.Width; } + private void AlignWriteButton() + { + WriteButton.Left = SensitivityChart.Left / 2 - WriteButton.Width / 2; + } + #endregion Methods } } -- cgit v1.2.3 From 25ab05b2854428891b1615b7b78e9257c2d6db35 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 14:44:53 -0700 Subject: Add option to turn off last mouse move dot --- grapher/Models/Charts/AccelCharts.cs | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'grapher/Models/Charts/AccelCharts.cs') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 9040851..84673b8 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -16,6 +16,7 @@ namespace grapher ChartXY velocityChart, ChartXY gainChart, ToolStripMenuItem enableVelocityAndGain, + ToolStripMenuItem enableLastMouseMove, Button writeButton) { Estimated = new EstimatedPoints(); @@ -28,6 +29,7 @@ namespace grapher VelocityChart = velocityChart; GainChart = gainChart; EnableVelocityAndGain = enableVelocityAndGain; + EnableLastValue = enableLastMouseMove; WriteButton = writeButton; SensitivityChart.SetPointBinds(Estimated.Sensitivity, EstimatedX.Sensitivity, EstimatedY.Sensitivity); @@ -44,7 +46,9 @@ namespace grapher FormBorderHeight = screenRectangle.Top - ContaingForm.Top; EnableVelocityAndGain.Click += new System.EventHandler(OnEnableClick); - EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableCheckStateChange); + EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableVelocityGainCheckStateChange); + + EnableLastValue.CheckedChanged += new System.EventHandler(OnEnableLastMouseMoveCheckStateChange); HideVelocityAndGain(); Combined = false; @@ -65,6 +69,8 @@ namespace grapher public ToolStripMenuItem EnableVelocityAndGain { get; } + private ToolStripMenuItem EnableLastValue { get; } + private Button WriteButton { get; } public AccelData AccelData { get; } @@ -95,11 +101,14 @@ namespace grapher } } - public void DrawPoints() + public void DrawLastMovement() { - SensitivityChart.DrawPoints(); - VelocityChart.DrawPoints(); - GainChart.DrawPoints(); + if (EnableLastValue.Checked) + { + SensitivityChart.DrawLastMovementValue(); + VelocityChart.DrawLastMovementValue(); + GainChart.DrawLastMovementValue(); + } } public void Bind() @@ -153,7 +162,7 @@ namespace grapher EnableVelocityAndGain.Checked = !EnableVelocityAndGain.Checked; } - private void OnEnableCheckStateChange(object sender, EventArgs e) + private void OnEnableVelocityGainCheckStateChange(object sender, EventArgs e) { if (EnableVelocityAndGain.Checked) { @@ -165,6 +174,16 @@ namespace grapher } } + private void OnEnableLastMouseMoveCheckStateChange(object sender, EventArgs e) + { + if (!EnableLastValue.Checked) + { + SensitivityChart.ClearLastValue(); + VelocityChart.ClearLastValue(); + GainChart.ClearLastValue(); + } + } + private void ShowVelocityAndGain() { VelocityChart.Show(); -- cgit v1.2.3 From b8a8eb8a70cf71c61e5dc851229a83027f43194d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 15:20:31 -0700 Subject: By component, anisotropy full works --- grapher/Models/Charts/AccelCharts.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'grapher/Models/Charts/AccelCharts.cs') diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 84673b8..3f228c3 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -1,5 +1,6 @@ using grapher.Models.Calculations; using grapher.Models.Charts; +using grapher.Models.Serialized; using System; using System.Drawing; using System.Windows.Forms; @@ -51,6 +52,7 @@ namespace grapher EnableLastValue.CheckedChanged += new System.EventHandler(OnEnableLastMouseMoveCheckStateChange); HideVelocityAndGain(); + SensitivityChart.Show(); Combined = false; ShowCombined(); } @@ -127,9 +129,9 @@ namespace grapher } } - public void RefreshXY(bool isWhole) + public void ShowActive(DriverSettings driverSettings) { - if (isWhole) + if (driverSettings.combineMagnitudes) { ShowCombined(); } -- cgit v1.2.3