summaryrefslogtreecommitdiff
path: root/grapher/Models/Charts/ChartState/ChartStateManager.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/ChartStateManager.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/ChartStateManager.cs')
-rw-r--r--grapher/Models/Charts/ChartState/ChartStateManager.cs78
1 files changed, 78 insertions, 0 deletions
diff --git a/grapher/Models/Charts/ChartState/ChartStateManager.cs b/grapher/Models/Charts/ChartState/ChartStateManager.cs
new file mode 100644
index 0000000..54d2e81
--- /dev/null
+++ b/grapher/Models/Charts/ChartState/ChartStateManager.cs
@@ -0,0 +1,78 @@
+using grapher.Models.Calculations;
+using grapher.Models.Serialized;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace grapher.Models.Charts.ChartState
+{
+ public class ChartStateManager
+ {
+ public ChartStateManager(
+ ChartXY sensitivityChart,
+ ChartXY velocityChart,
+ ChartXY gainChat,
+ AccelData accelData,
+ AccelCalculator accelCalculator)
+ {
+ CombinedState = new CombinedState(
+ sensitivityChart,
+ velocityChart,
+ gainChat,
+ accelData,
+ accelCalculator);
+
+ XYOneGraphState = new XYOneGraphState(
+ sensitivityChart,
+ velocityChart,
+ gainChat,
+ accelData,
+ accelCalculator);
+
+ XYTwoGraphState = new XYTwoGraphState(
+ sensitivityChart,
+ velocityChart,
+ gainChat,
+ accelData,
+ accelCalculator);
+ }
+
+ private CombinedState CombinedState { get; }
+
+ private XYOneGraphState XYOneGraphState { get; }
+
+ private XYTwoGraphState XYTwoGraphState { get; }
+
+
+ public ChartState DetermineState(DriverSettings settings)
+ {
+ ChartState chartState;
+
+ if (settings.combineMagnitudes)
+ {
+ if (settings.sensitivity.x != settings.sensitivity.y)
+ {
+ chartState = XYOneGraphState;
+ }
+ else
+ {
+ chartState = CombinedState;
+ }
+ }
+ else
+ {
+ chartState = XYTwoGraphState;
+ }
+
+ chartState.Settings = settings;
+ return chartState;
+ }
+
+ public ChartState InitialState()
+ {
+ return CombinedState;
+ }
+ }
+}