ColourBar.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2024 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/Plotting/pgutil/ColourBar.h
10
11#ifndef __ColourBar_H
12#define __ColourBar_H
13
14#include "TextInterface.h"
15#include <string>
16
17namespace pgplot {
18
21 {
22 /*
23 SIDE (input) : The first character must be one of the characters
24 'B', 'L', 'T', or 'R' signifying the Bottom, Left,
25 Top, or Right edge of the viewport.
26 The second character should be 'I' to use PGIMAG
27 to draw the wedge, or 'G' to use PGGRAY.
28 */
29 char side = 'N';
30
31 /*
32 DISP (input) : the displacement of the wedge from the specified
33 edge of the viewport, measured outwards from the
34 viewport in units of the character height. Use a
35 negative value to write inside the viewport, a
36 positive value to write outside.
37 */
38 float displacement = 4;
39
40 /*
41 WIDTH (input) : The total width of the wedge including annotation,
42 in units of the character height.
43 */
44 float width = 3;
45
46 /*
47 LABEL (input) : Optional units label. If no label is required
48 use ' '.
49 */
50 std::string label = " ";
51
52 public:
53
55 void set_label (std::string _label) { label = _label; }
56 std::string get_label () const { return label; }
57
59 void set_side (char _side);
60 char get_side () const { return side; }
61
63 void set_width (float _width) { width = _width; }
64 float get_width () const { return width; }
65
67
70 void set_displacement (float _displacement) { displacement = _displacement; }
71 float get_displacement () const { return displacement; }
72
74 /*
75 @ param foreground: The value which is to appear with shade 1
76 @ param background: The value which is to appear with shade 0
77 @ param pgimag: If true, use PGIMAG; if false, use PGGRAY
78 Use the values of foreground and background that were supplied to PGGRAY or PGIMAG.
79 */
80 void plot (float foreground, float background, bool pgimag=true);
81
83 class Interface;
84 };
85
86 class ColourBar::Interface : public TextInterface::To<ColourBar> {
87 public:
88 Interface (ColourBar* = 0);
89 };
90
91}
92#endif
Colour bar (wedge) manager.
Definition ColourBar.h:21
void set_side(char _side)
Set the side.
Definition ColourBar.C:25
void set_width(float _width)
Set the total width of the wedge including annotation, in units of the character height.
Definition ColourBar.h:63
void set_label(std::string _label)
Set the colour map name.
Definition ColourBar.h:55
void set_displacement(float _displacement)
Set displacement of the wedge from the specified edge of the viewport.
Definition ColourBar.h:70
void plot(float foreground, float background, bool pgimag=true)
Plot the colour bar using the current attributes.
Definition ColourBar.C:11

Generated using doxygen 1.14.0