File: axis.h

package info (click to toggle)
aoflagger 3.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,960 kB
  • sloc: cpp: 83,076; python: 10,187; sh: 260; makefile: 178
file content (37 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (2)
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
#ifndef PLOT_AXIS_H_
#define PLOT_AXIS_H_

#include <string>
#include <vector>

enum class AxisType { kNumeric, kText, kTime };

class Axis {
 public:
  const std::vector<std::pair<double, std::string>>& TickLabels() const {
    return tick_labels_;
  }
  void SetTickLabels(
      const std::vector<std::pair<double, std::string>>& tick_labels) {
    tick_labels_ = tick_labels;
    type_ = AxisType::kText;
  }
  void SetTickLabels(
      std::vector<std::pair<double, std::string>>&& tick_labels) {
    tick_labels_ = std::move(tick_labels);
    type_ = AxisType::kText;
  }

  bool RotateUnits() const { return rotate_units_; }
  void SetRotateUnits(bool rotate_units) { rotate_units_ = rotate_units; }

  AxisType Type() const { return type_; }
  void SetType(AxisType type) { type_ = type; }

 private:
  AxisType type_ = AxisType::kNumeric;
  std::vector<std::pair<double, std::string>> tick_labels_;
  bool rotate_units_ = false;
};

#endif