PlotFrame.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/PlotFrame.h
10 
11 #ifndef __Pulsar_PlotFrame_h
12 #define __Pulsar_PlotFrame_h
13 
14 #include "Pulsar/PlotAttributes.h"
15 #include "Pulsar/PlotScale.h"
16 #include "Pulsar/PlotAxis.h"
17 #include "Pulsar/PlotLabel.h"
18 
19 #include <string>
20 
21 namespace Pulsar {
22 
23  class Archive;
24 
26  class PlotFrame : public PlotAttributes {
27 
28  public:
29 
32 
34  ~PlotFrame ();
35 
36  // Text interface to the PlotFrame class
37  class Interface : public TextInterface::To<PlotFrame> {
38  public:
39  Interface (PlotFrame* = 0);
40  };
41 
43  void set_viewport (float x0, float x1, float y0, float y1);
44 
46  PlotScale* get_x_scale (bool allow_transpose);
47  PlotScale* get_x_scale () { return get_x_scale(false); }
49  void set_x_scale (PlotScale* scale);
50 
52  PlotAxis* get_x_axis (bool allow_transpose);
53  PlotAxis* get_x_axis () { return get_x_axis(false); }
54 
56  PlotScale* get_y_scale (bool allow_transpose);
57  PlotScale* get_y_scale () { return get_y_scale(false); }
59  void set_y_scale (PlotScale* scale);
60 
62  PlotAxis* get_y_axis (bool allow_transpose);
63  PlotAxis* get_y_axis () { return get_y_axis(false); }
64 
66  void no_labels ();
67 
69  PlotLabel* get_label_below () { return below; }
71  void set_label_below (PlotLabel*);
72 
74  void set_transpose (bool flag = true) { transpose = flag; }
75  bool get_transpose () const { return transpose; }
76 
78  virtual void draw_axes (const Archive*);
79 
81  virtual void label_axes (const std::string& default_x,
82  const std::string& default_y);
83 
85  virtual void decorate (const Archive*);
86 
88  virtual void focus (const Archive*);
89 
91  virtual void init (const Archive*);
92 
94  virtual void include (PlotFrame*);
95 
97  virtual void copy (PlotFrame*);
98 
99  void hide_axes( void ) { draw_box = false; }
100 
102  virtual void freeze (bool f = true);
103 
104  protected:
105 
106  Reference::To<PlotScale> x_scale;
107  Reference::To<PlotScale> y_scale;
108 
111 
113 
114  bool transpose;
115 
116  bool draw_box;
117  bool frozen;
118  };
119 
120 }
121 
122 #endif
void set_viewport(float x0, float x1, float y0, float y1)
Set the viewport (normalized device coordinates)
Definition: PlotFrame.C:256
PlotAxis * get_x_axis(bool allow_transpose)
Get the x-axis.
Definition: PlotFrame.C:204
~PlotFrame()
Destructor.
Definition: PlotFrame.C:39
virtual void copy(PlotFrame *)
Copy another frame.
Definition: PlotFrame.C:269
void set_left(const std::string &label)
Set the label to be drawn to the left of the frame.
Definition: PlotLabel.h:47
void no_labels()
Remove all labels.
Definition: PlotFrame.C:241
PlotLabel * get_label_below()
Get the below-frame label.
Definition: PlotFrame.h:74
PlotAxis * get_y_axis(bool allow_transpose)
Get the y-axis.
Definition: PlotFrame.C:228
PlotScale * get_y_scale(bool allow_transpose)
Get the x-scale.
Definition: PlotFrame.C:213
The primary interface to pulsar observational data.
Definition: Archive.h:45
virtual void init(const Archive *)
Initialize the frame.
Definition: PlotFrame.C:45
Stores three labels: left, centre, and right.
Definition: PlotLabel.h:27
PlotFrame()
Default constructor.
Definition: PlotFrame.C:15
virtual void decorate(const Archive *)
Decorate the frame.
Definition: PlotFrame.C:180
void set_x_scale(PlotScale *scale)
Set the x-scale.
Definition: PlotFrame.C:198
The scale on an axis.
Definition: PlotScale.h:26
std::string get_opt() const
Get the label to be drawn on the axis.
Definition: PlotAxis.h:62
Stores the label and cpgbox options for an axis.
Definition: PlotAxis.h:24
PlotScale * get_x_scale(bool allow_transpose)
Get the x-scale.
Definition: PlotFrame.C:189
virtual void draw_axes(const Archive *)
Draw the axes of the frame.
Definition: PlotFrame.C:84
void set_transpose(bool flag=true)
Transpose the x and y axes.
Definition: PlotFrame.h:79
void set_y_scale(PlotScale *scale)
Set the y-scale.
Definition: PlotFrame.C:222
virtual void include(PlotFrame *)
Expand to include the x and y scale of another frame.
Definition: PlotFrame.C:263
virtual void focus(const Archive *)
Focus the frame.
Definition: PlotFrame.C:54
void set_label_below(PlotLabel *)
Set the below-frame label.
Definition: PlotFrame.C:236
virtual void label_axes(const std::string &default_x, const std::string &default_y)
Label the axes of the frame.
Definition: PlotFrame.C:127
Defines the PSRCHIVE library.
Definition: CalSource.h:17
virtual void freeze(bool f=true)
Freeze the frame.
Definition: PlotFrame.C:276
static std::string unset
Default label string signifies not set by user.
Definition: PlotLabel.h:32
Stores the properties of the plot frame.
Definition: PlotFrame.h:31

Generated using doxygen 1.8.17