diff options
| author | Jacob Palecki <[email protected]> | 2020-07-30 02:00:20 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-07-30 02:00:20 -0700 |
| commit | f315e8160e984df93be6667929db34749aa25cfa (patch) | |
| tree | 19684a4f515fc6185e750d7cca3424fa7d96937b /grapher/Layouts/LayoutBase.cs | |
| parent | Fully use acceloptions (diff) | |
| download | rawaccel-f315e8160e984df93be6667929db34749aa25cfa.tar.xz rawaccel-f315e8160e984df93be6667929db34749aa25cfa.zip | |
Use class heirarchy for layout types
Diffstat (limited to 'grapher/Layouts/LayoutBase.cs')
| -rw-r--r-- | grapher/Layouts/LayoutBase.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs new file mode 100644 index 0000000..9c60008 --- /dev/null +++ b/grapher/Layouts/LayoutBase.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public abstract class LayoutBase + { + public const string Acceleration = "Acceleration"; + public const string Scale = "Scale"; + public const string Exponent = "Exponent"; + public const string Limit = "Limit"; + public const string Midpoint = "Midpoint"; + + public LayoutBase() + { + Show = new bool[] { false, false, false }; + OptionNames = new string[] { string.Empty, string.Empty, string.Empty }; + } + + /// <summary> + /// Gets or sets mapping from acceleration type to identifying integer. + /// Must match order in tagged_union in rawaccel.hpp (which is 1-indexed, meaning 0 is off.) + /// </summary> + public int Index { get; internal set; } + + public string Name { get; internal set; } + + internal bool[] Show { get; set; } + + internal string[] OptionNames { get; set; } + + public void Layout(Option[] options) + { + // Relies on AccelOptions to keep lengths correct. + for (int i = 0; i< options.Length; i++) + { + if (Show[i]) + { + options[i].Show(OptionNames[i]); + } + else + { + options[i].Hide(); + } + } + + } + } +} |