Colors.h
Go to the documentation of this file.
1 /// $Id:$
2 ///
3 /// \brief Manage all things related to colors for the event display
4 /// \author messier@indiana.edu
5 ///
6 #ifndef EVDB_COLORS_H
7 #define EVDB_COLORS_H
8 
9 #include <vector>
10 #include <string>
11 
15 #include "fhiclcpp/ParameterSet.h"
16 #include "nutools/EventDisplayBase/Reconfigurable.h"
17 
18 namespace evdb
19 {
20  class ColorScale;
21  class Colors : public Reconfigurable
22  {
23  public:
25  ~Colors();
26  void reconfigure(fhicl::ParameterSet const& p);
27 
28  ///
29  /// Set foreground and background colors for white text on black
30  /// background
31  ///
32  void WhiteOnBlack();
33 
34  ///
35  /// Set foreground and background colors for black text on black
36  /// background
37  ///
38  void BlackOnWhite();
39 
40  ///
41  /// Return the foreground color
42  /// \param i : 0 is highest contrast to background color, 5 is
43  /// least
44  ///
45  int Foreground(int i=0);
46 
47  ///
48  /// Return the background color
49  /// \param i : 0 is highest contrast to foreground color, 5 is
50  /// least
51  ///
52  int Background(int i=0);
53 
54  ///
55  /// Look up a color scale by name
56  ///
57  ColorScale& Scale(const std::string& nm);
58 
59  private:
60  ///
61  /// Unpack the parameters for a named color scale
62  ///
64  const std::string& c);
65  ///
66  /// Push the colors off to the ROOT style
67  ///
68  void SetStyle();
69 
70  private:
71  static const int kMAX_FGBG = 6;
72  int fFG[kMAX_FGBG]; ///< Foreground colors
73  int fBG[kMAX_FGBG]; ///< Background colors
74  ///
75  /// Collection of color scales managed by this class
76  ///
77  std::map<std::string,ColorScale*> fColorScales;
78  };
79 }
80 
82 #endif // EVDB_COLORS
83 ////////////////////////////////////////////////////////////////////////
std::map< std::string, ColorScale * > fColorScales
Definition: Colors.h:77
std::string string
Definition: nybbler.cc:12
int fFG[kMAX_FGBG]
Foreground colors.
Definition: Colors.h:72
#define DECLARE_ART_SERVICE(svc, scope)
Definition: ServiceMacros.h:86
Manage all things related to colors for the event display.
void UnpackColorScale(fhicl::ParameterSet const &p, const std::string &c)
int fBG[kMAX_FGBG]
Definition: Colors.h:73
int Background(int i=0)
Colors(fhicl::ParameterSet const &p)
Build an association between a numerical range and a ROOT color index for use in, eg...
Definition: ColorScale.h:44
ColorScale & Scale(const std::string &nm)
p
Definition: test.py:223
int Foreground(int i=0)
void reconfigure(fhicl::ParameterSet const &p)
static const int kMAX_FGBG
Definition: Colors.h:71