summaryrefslogtreecommitdiff
path: root/grapher/Layouts/LayoutBase.cs
blob: 9c6000881d6b094a0b7c2b885119f575fdb13f60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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();
                }
            }

        }
    }
}