summaryrefslogtreecommitdiff
path: root/grapher/Models/Charts/ChartState/ChartState.cs
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-09-21 14:27:12 -0700
committerJacob Palecki <[email protected]>2020-09-21 14:27:12 -0700
commit96112bf6eaee310985ae607b66b43fafcc5efb1e (patch)
tree6ffdee3a16c7b5c89b6f12117e8a9b78b1112e6f /grapher/Models/Charts/ChartState/ChartState.cs
parentconditional around lookup map (diff)
parentMerge pull request #21 from JacobPalecki/GUI (diff)
downloadrawaccel-96112bf6eaee310985ae607b66b43fafcc5efb1e.tar.xz
rawaccel-96112bf6eaee310985ae607b66b43fafcc5efb1e.zip
Merge branch 'GUI' into experiment
Diffstat (limited to 'grapher/Models/Charts/ChartState/ChartState.cs')
-rw-r--r--grapher/Models/Charts/ChartState/ChartState.cs104
1 files changed, 104 insertions, 0 deletions
diff --git a/grapher/Models/Charts/ChartState/ChartState.cs b/grapher/Models/Charts/ChartState/ChartState.cs
new file mode 100644
index 0000000..ea67e83
--- /dev/null
+++ b/grapher/Models/Charts/ChartState/ChartState.cs
@@ -0,0 +1,104 @@
+using grapher.Models.Calculations;
+using grapher.Models.Serialized;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace grapher.Models.Charts.ChartState
+{
+ public abstract class ChartState
+ {
+ public ChartState(
+ ChartXY sensitivityChart,
+ ChartXY velocityChart,
+ ChartXY gainChart,
+ AccelData accelData,
+ AccelCalculator calculator)
+ {
+ SensitivityChart = sensitivityChart;
+ VelocityChart = velocityChart;
+ GainChart = gainChart;
+ Data = accelData;
+ Calculator = calculator;
+ TwoDotsPerGraph = false;
+ }
+
+ public ChartXY SensitivityChart { get; }
+
+ public ChartXY VelocityChart { get; }
+
+ public ChartXY GainChart { get; }
+
+ public AccelData Data { get; }
+
+ public AccelCalculator Calculator { get; }
+
+ public virtual DriverSettings Settings { get; set; }
+
+ internal bool TwoDotsPerGraph { get; set; }
+
+ public abstract void MakeDots(int x, int y, double timeInMs);
+
+ public abstract void Bind();
+
+ public abstract void Activate();
+
+ public abstract void Calculate(ManagedAccel accel, DriverSettings settings);
+
+ public virtual void SetUpCalculate(DriverSettings settings)
+ {
+ Data.Clear();
+ Calculator.ScaleByMouseSettings();
+ }
+
+ public void DrawLastMovement()
+ {
+ SensitivityChart.DrawLastMovementValue(TwoDotsPerGraph);
+ VelocityChart.DrawLastMovementValue(TwoDotsPerGraph);
+ GainChart.DrawLastMovementValue(TwoDotsPerGraph);
+ }
+
+ public void SetWidened()
+ {
+ SensitivityChart.SetWidened();
+ VelocityChart.SetWidened();
+ GainChart.SetWidened();
+ }
+
+ public void SetNarrowed()
+ {
+ SensitivityChart.SetNarrowed();
+ VelocityChart.SetNarrowed();
+ GainChart.SetNarrowed();
+ }
+
+ public void ClearLastValue()
+ {
+ SensitivityChart.ClearLastValue();
+ VelocityChart.ClearLastValue();
+ GainChart.ClearLastValue();
+ }
+
+ public void ShowVelocityAndGain(Form form, int borderHeight)
+ {
+ VelocityChart.Show();
+ GainChart.Show();
+ form.Height = SensitivityChart.Height +
+ Constants.ChartSeparationVertical +
+ VelocityChart.Height +
+ Constants.ChartSeparationVertical +
+ GainChart.Height +
+ borderHeight;
+ }
+
+ public void HideVelocityAndGain(Form form, int borderHeight)
+ {
+ VelocityChart.Hide();
+ GainChart.Hide();
+ form.Height = SensitivityChart.Height + borderHeight;
+ }
+ }
+}