summaryrefslogtreecommitdiff
path: root/grapher/Models/Charts/ChartState/ChartState.cs
diff options
context:
space:
mode:
authorJacobPalecki <[email protected]>2020-09-21 14:20:18 -0700
committerGitHub <[email protected]>2020-09-21 14:20:18 -0700
commit4ec16a2ff35e0e910a13f92713d56d317b24e790 (patch)
treec4aead24d52e3002cfd3282ddd697a3766de405a /grapher/Models/Charts/ChartState/ChartState.cs
parentMerge pull request #20 from JacobPalecki/GUI (diff)
parentx/y diff sens works (diff)
downloadrawaccel-4ec16a2ff35e0e910a13f92713d56d317b24e790.tar.xz
rawaccel-4ec16a2ff35e0e910a13f92713d56d317b24e790.zip
Merge pull request #21 from JacobPalecki/GUI
GUI: Icon, Separate X/Y sens mode, some fixes
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;
+ }
+ }
+}