casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlotMSPages.h
Go to the documentation of this file.
1 //# PlotMSPage.h: Layout of PlotCanvases on a single "page".
2 //# Copyright (C) 2009
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: $
27 
28 #ifndef PLOTMSPAGES_H_
29 #define PLOTMSPAGES_H_
30 
32 
33 namespace casa {
34 
35 class PlotMSParameters;
36 
37 // Represents (potentially) multiple pages for PlotMS, with one being current
38 // (visible) at a time.
39 class PlotMSPages {
40 
41  //# Friend class declarations.
42  friend class PlotMSPage;
43  friend class PlotMSPlot;
44  friend class PlotMSPlotManager;
45 
46 public:
47  // Constructor, which the plot manager.
49 
50  // Copy constructor.
52 
53  // Destructor.
54  ~PlotMSPages();
55 
56  // Returns the current page number.
57  unsigned int currentPageNumber() const;
58 
59  // Returns a COPY of the current page.
60  PlotMSPage currentPage() const;
61 
62  PlotMSPage getFirstPage() const;
63 
65 
66  // Accessor
67  PlotMSPage& operator[](casacore::uInt index) { return itsPages_[index]; }
68 
69  // Iterators
70  typedef std::vector<PlotMSPage>::iterator iterator;
71  iterator begin() { return itsPages_.begin(); }
72  iterator end() { return itsPages_.end(); }
73 
75  const_iterator begin() const { return itsPages_.begin(); }
76  const_iterator end() const { return itsPages_.end(); }
77 
78  // Returns the total pages.
79  unsigned int totalPages() const;
80 
81  // Clear all pages
82  void clear() { itsPages_.clear(); }
83 
84  void resize(size_t pages);
85 
86  //Erase all traces of a plot at the specific location including removing axes and title.
87  void clearCanvas( int row, int col );
88 
89  //Erase axes & titles from all the canvases.
90  void clearCanvases();
91 
92  //Resize the page to the current number of rows and columns.
93  bool gridChanged( int rows, int cols);
94 
95  // Copy operator.
97 
98  // Iterators
99  void firstPage();
100  void nextPage();
101  void previousPage();
102  void lastPage();
103 
104  // Inserts a new page at the given index, and returns it. If the given
105  // index is invalid, the page is inserted at the end.
106  PlotMSPage insertPage(int index = -1);
107 
108  // Clears all pages.
109  void clearPages();
110 
111  // Sets up the current page (see PlotMSPage::setupPage()).
112  void setupCurrentPage();
113 
114  //Remove the plot from the canvas.
115  void disown( PlotMSPlot* plot );
116  void disown( int row, int col, PlotMSPlot* plot );
117 
118  bool canvasIsOwnedBy( int row, int col, PlotMSPlot* plot ) const;
119 
121 
122  //Returns whether the spot at the given location is available for
123  //the plot (either empty or the plot is already occupying it).
124  bool isSpot( int rowIndex, int colIndex, PlotMSPlot* plot ) const;
125 
126  //Returns the row and column index of the first canvas on the
127  //page, or <-1,-1> if the page is full.
128  std::pair<int,int> findEmptySpot() const;
129 
130 private:
131  //Returns whether or not (rows,cols) would represent
132  //a change in the current page size.
133  bool isGridChanged( int rows, int cols ) const;
134 
135 
136 
137  // Plot manager.
139 
140  // Pages.
141  std::vector<PlotMSPage> itsPages_;
142 
143  // Current page number.
144  unsigned int itsCurrentPageNum_;
145 };
146 
147 
148 
149 } /* namespace ff */
150 #endif /* PLOTMSPAGES_H_ */
Represents a single page of PlotCanvases, arranged in a grid.
Definition: PlotMSPage.h:43
Elements::const_iterator const_iterator
void disown(PlotMSPlot *plot)
Remove the plot from the canvas.
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
PlotMSPage getFirstPage() const
void setCurrentPageNum(casacore::uInt num)
Subclass of PlotMSWatchedParameters that hold parameters for the whole plotter.
unsigned int totalPages() const
Returns the total pages.
std::vector< PlotMSPage >::const_iterator const_iterator
Definition: PlotMSPages.h:74
PlotMSPages & operator=(const PlotMSPages &copy)
Copy operator.
iterator end()
Definition: PlotMSPages.h:72
unsigned int itsCurrentPageNum_
Current page number.
Definition: PlotMSPages.h:144
bool isGridChanged(int rows, int cols) const
Returns whether or not (rows,cols) would represent a change in the current page size.
PlotMSPage & operator[](casacore::uInt index)
Accessor.
Definition: PlotMSPages.h:67
PlotMSPlotManager * itsManager_
Plot manager.
Definition: PlotMSPages.h:138
bool isSpot(int rowIndex, int colIndex, PlotMSPlot *plot) const
Returns whether the spot at the given location is available for the plot (either empty or the plot is...
~PlotMSPages()
Destructor.
void clearCanvases()
Erase axes &amp; titles from all the canvases.
std::vector< PlotMSPage >::iterator iterator
Iterators.
Definition: PlotMSPages.h:70
void clearCanvas(int row, int col)
Erase all traces of a plot at the specific location including removing axes and title.
Class for a single &quot;plot&quot; concept.
Definition: PlotMSPlot.h:57
void resize(size_t pages)
iterator begin()
Definition: PlotMSPages.h:71
PlotMSPage insertPage(int index=-1)
Inserts a new page at the given index, and returns it.
unsigned int currentPageNumber() const
Returns the current page number.
PlotMSPage currentPage() const
Returns a COPY of the current page.
void setupCurrentPage()
Sets up the current page (see PlotMSPage::setupPage()).
const_iterator end() const
Definition: PlotMSPages.h:76
const_iterator begin() const
Definition: PlotMSPages.h:75
std::vector< PlotMSPage > itsPages_
Pages.
Definition: PlotMSPages.h:141
std::pair< int, int > findEmptySpot() const
Returns the row and column index of the first canvas on the page, or &lt;-1,-1&gt; if the page is full...
void clearPages()
Clears all pages.
PlotMSParameters getPageParameters()
void clear()
Clear all pages.
Definition: PlotMSPages.h:82
PlotMSPages(PlotMSPlotManager &manager)
Constructor, which the plot manager.
bool gridChanged(int rows, int cols)
Resize the page to the current number of rows and columns.
bool canvasIsOwnedBy(int row, int col, PlotMSPlot *plot) const
Class which manages PlotMSPlots for plotms.
void firstPage()
Iterators.
Represents (potentially) multiple pages for PlotMS, with one being current (visible) at a time...
Definition: PlotMSPages.h:39
unsigned int uInt
Definition: aipstype.h:51