PlotLabel.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2006 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/Plotting/Pulsar/PlotLabel.h
10 
11 #ifndef __Pulsar_PlotLabel_h
12 #define __Pulsar_PlotLabel_h
13 
14 #include "TextInterface.h"
15 #include "pgutil.h"
16 
17 namespace Pulsar {
18 
19  class Archive;
20 
22  class PlotLabel : public Reference::Able {
23 
24  public:
25 
27  static std::string unset;
28 
30  PlotLabel ();
31 
33  virtual ~PlotLabel ();
34 
35  // Text interface to the PlotLabel class
36  class Interface : public TextInterface::To<PlotLabel> {
37  public:
38  Interface (PlotLabel* = 0);
39  };
40 
42  void set_left (const std::string& label) { left = label; }
44  std::string get_left () const { return left; }
45 
47  void set_centre (const std::string& label) { centre = label; }
49  std::string get_centre () const { return centre; }
50 
52  void set_right (const std::string& label) { right = label; }
54  std::string get_right () const { return right; }
55 
57  void set_offset (float _offset) { offset = _offset; }
58  float get_offset () const { return offset; }
59 
61  void set_spacing (float _spacing) { spacing = _spacing; }
62  float get_spacing () const { return spacing; }
63 
65  void set_all (const std::string& label) { left = right = centre = label; }
66 
68  virtual void plot (const Archive*);
69 
71  float get_margin (pgplot::Units) const;
72 
74  float get_displacement (int row, pgplot::Units) const;
75 
77  float get_displacement (int row) const;
78 
80  unsigned get_nrows (const std::string& label) const;
81 
82  protected:
83 
84  std::string left;
85  std::string right;
86  std::string centre;
87  float offset;
88  float spacing;
89 
91  void plot (const Archive*, const std::string& label, float side);
92 
94  void row (const std::string&, unsigned irow, unsigned nrow, float side);
95 
96  };
97 
98 }
99 
100 #endif
void set_indentation(const std::string &indent)
float get_margin(pgplot::Units) const
Get the margin in the specified metric.
Definition: PlotLabel.C:87
void set_left(const std::string &label)
Set the label to be drawn to the left of the frame.
Definition: PlotLabel.h:47
std::string get_left() const
Get the label to be drawn to the left of the frame.
Definition: PlotLabel.h:49
The primary interface to pulsar observational data.
Definition: Archive.h:45
Stores three labels: left, centre, and right.
Definition: PlotLabel.h:27
unsigned get_nrows(const std::string &label) const
Get the number of rows in the label.
Definition: PlotLabel.C:78
void row(const std::string &, unsigned irow, unsigned nrow, float side)
Plot a single row of the label.
Definition: PlotLabel.C:114
void set_spacing(float _spacing)
Set the spacing between label rows (multiple of character height)
Definition: PlotLabel.h:66
virtual void plot(const Archive *)
Plot the label.
Definition: PlotLabel.C:38
PlotLabel()
Default constructor.
Definition: PlotLabel.C:27
std::string get_centre() const
Get the label to be drawn in the centre of the frame.
Definition: PlotLabel.h:54
Defines the PSRCHIVE library.
Definition: CalSource.h:17
void set_centre(const std::string &label)
Set the label to be drawn in the centre of the frame.
Definition: PlotLabel.h:52
virtual ~PlotLabel()
Destructor.
Definition: PlotLabel.C:34
void set_right(const std::string &label)
Set the label to be drawn to the right of the frame.
Definition: PlotLabel.h:57
float get_displacement(int row, pgplot::Units) const
Get the displacement of label[irow] in the specified metric.
Definition: PlotLabel.C:96
static std::string unset
Default label string signifies not set by user.
Definition: PlotLabel.h:32
std::string get_right() const
Get the label to be drawn to the right of the frame.
Definition: PlotLabel.h:59
void set_offset(float _offset)
Set the offset between label and frame (multiple of character height)
Definition: PlotLabel.h:62
void set_all(const std::string &label)
Set all labels to the specified value.
Definition: PlotLabel.h:70

Generated using doxygen 1.8.17