summaryrefslogtreecommitdiff
path: root/grapher/Models/Options/AccelOptions.cs
diff options
context:
space:
mode:
authorJacobPalecki <[email protected]>2020-09-08 16:00:05 -0700
committerGitHub <[email protected]>2020-09-08 16:00:05 -0700
commite5461fa84e65d78823d0022339fa2d8864f7e63c (patch)
treeb486ef524c93bfeb29a86403114b6805bf9decf1 /grapher/Models/Options/AccelOptions.cs
parentMerge pull request #19 from JacobPalecki/gainOffset (diff)
parentSave show last mouse value (diff)
downloadrawaccel-e5461fa84e65d78823d0022339fa2d8864f7e63c.tar.xz
rawaccel-e5461fa84e65d78823d0022339fa2d8864f7e63c.zip
Merge pull request #20 from JacobPalecki/GUI
GUI: Add By Component & Anisotropy; Remove Logarithm and Sigmoid; Delete Console; Some Refactoring
Diffstat (limited to 'grapher/Models/Options/AccelOptions.cs')
-rw-r--r--grapher/Models/Options/AccelOptions.cs91
1 files changed, 0 insertions, 91 deletions
diff --git a/grapher/Models/Options/AccelOptions.cs b/grapher/Models/Options/AccelOptions.cs
deleted file mode 100644
index 6b98274..0000000
--- a/grapher/Models/Options/AccelOptions.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using grapher.Layouts;
-using grapher.Models.Options;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace grapher
-{
- public class AccelOptions
- {
- public const int PossibleOptionsCount = 4;
- public const int PossibleOptionsXYCount = 2;
-
- public static readonly Dictionary<string, LayoutBase> AccelerationTypes = new List<LayoutBase>
- {
- new LinearLayout(),
- new ClassicLayout(),
- new NaturalLayout(),
- new LogLayout(),
- new SigmoidLayout(),
- new PowerLayout(),
- new NaturalGainLayout(),
- new SigmoidGainLayout(),
- new OffLayout()
- }.ToDictionary(k => k.Name);
-
- public AccelOptions(
- ComboBox accelDropdown,
- Option[] options,
- OptionXY[] optionsXY,
- Button writeButton,
- ActiveValueLabel activeValueLabel)
- {
- AccelDropdown = accelDropdown;
- AccelDropdown.Items.Clear();
- AccelDropdown.Items.AddRange(AccelerationTypes.Keys.ToArray());
- AccelDropdown.SelectedIndexChanged += new System.EventHandler(OnIndexChanged);
-
- if (options.Length > PossibleOptionsCount)
- {
- throw new Exception("Layout given too many options.");
- }
-
- if (optionsXY.Length > PossibleOptionsXYCount)
- {
- throw new Exception("Layout given too many options.");
- }
-
- Options = options;
- OptionsXY = optionsXY;
- WriteButton = writeButton;
- ActiveValueLabel = activeValueLabel;
-
- Layout("Off");
- }
-
- public Button WriteButton { get; }
-
- public ComboBox AccelDropdown { get; }
-
- public int AccelerationIndex { get; private set; }
-
- public ActiveValueLabel ActiveValueLabel { get; }
-
- public Option[] Options { get; }
-
- public OptionXY[] OptionsXY { get; }
-
- public void SetActiveValue(int index)
- {
- var name = AccelerationTypes.Where(t => t.Value.Index == index).FirstOrDefault().Value.Name;
- ActiveValueLabel.SetValue(name);
- }
-
- private void OnIndexChanged(object sender, EventArgs e)
- {
- var accelerationTypeString = AccelDropdown.SelectedItem.ToString();
- Layout(accelerationTypeString);
- }
-
- private void Layout(string type)
- {
- var accelerationType = AccelerationTypes[type];
- AccelerationIndex = accelerationType.Index;
- accelerationType.Layout(Options, OptionsXY, WriteButton);
- }
- }
-}