casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PanelDisplay.h
Go to the documentation of this file.
1 //# PanelDisplay.h: Provision of panelled displays for data
2 //# Copyright (C) 2000,2001,2002,2003
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 TRIALDISPLAY_PANELDISPLAY_H
29 #define TRIALDISPLAY_PANELDISPLAY_H
30 
31 #include <list>
32 #include <casa/aips.h>
37 
38 namespace casa { //# NAMESPACE CASA - BEGIN
39 
40  class PixelCanvas;
41  class WorldCanvas;
42  class WorldCanvasHolder;
43  class Attribute;
44  class AttributeBuffer;
45  class MultiWCTool;
46 
47 // <summary>
48 // A class which creates and manages "panelled" displays.
49 // </summary>
50 //
51 // <use visibility=export>
52 //
53 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
54 // </reviewed>
55 //
56 // <prerequisite>
57 // <li><linkto class="PixelCanvas">PixelCanvas</linkto>
58 // <li><linkto class="MultiWCHolder">MultiWCHolder</linkto>
59 // <li><linkto class="DisplayData">DisplayData</linkto>
60 // </prerequisite>
61 //
62 // <etymology>
63 // The PanelDisplay class provides a display consisting of a
64 // number of panels.
65 // </etymology>
66 //
67 // <synopsis>
68 // This class uses the <linkto
69 // class="MultiWCHolder">MultiWCHolder</linkto> class to provide a
70 // regular set of panels for display multi-view DisplayDatas.
71 // </synopsis>
72 //
73 // <example>
74 // </example>
75 //
76 // <motivation>
77 // </motivation>
78 
79  class PanelDisplay : public MultiWCHolder, public DisplayOptions {
80 
81  public:
82 
83  enum FillOrder {
84  // left to right, then top to bottom
86  // others are imaginable
87  };
88 
89 
90  // Constructor taking: a pointer to the PixelCanvas on which to lay
91  // the panels, the number of panels in the x and y directions, the
92  // extent of the PixelCanvas to cover with panels, and the
93  // fractional spacing between the panels.
94  PanelDisplay(PixelCanvas* pixelcanvas,
95  const casacore::Int nx = 3, const casacore::Int ny = 2,
96  const casacore::Float xOrigin = 0.0, const casacore::Float yOrigin = 0.0,
97  const casacore::Float xSize = 1.0, const casacore::Float ySize = 1.0,
98  const casacore::Float dx = 0.0, const casacore::Float dy = 0.0,
99  const PanelDisplay::FillOrder order = LEFT_TOP);
100 
101  // Destructor.
102  virtual ~PanelDisplay();
103 
104  // Install the default options for this PanelDisplay
105  virtual void setDefaultOptions();
106 
107  // Apply options stored in rec to the PanelDisplay; these get
108  // forwarded to all underlying WorldCanvases
109  virtual casacore::Bool setOptions(const casacore::Record& rec, casacore::Record& updatedOptions);
110  virtual casacore::Record getOptions() const;
111  // Set attributes on all WolrdCanvases
112  virtual void setAttributes(AttributeBuffer& at);
113  virtual void getAttributeValue(const casacore::String& name, casacore::Int& newValue) const;
114 
115  // Describe or set the geometry of the panels, either explicitly
116  // or in casacore::RecordInterface form.
117  // (Note: setGeometry() does not automatically refresh;
118  // when called within setOptions it does, though.)
119  // <group>
120  virtual void getGeometry(casacore::Int& nx, casacore::Int& ny, casacore::Float& xOrigin,
121  casacore::Float& yOrigin, casacore::Float& xSize, casacore::Float& ySize,
123  PanelDisplay::FillOrder& order) const;
124  virtual void getGeometry(casacore::RecordInterface& rec) const;
125  virtual void setGeometry(const casacore::Int nx, const casacore::Int ny, const casacore::Float xOrigin,
126  const casacore::Float yOrigin, const casacore::Float xSize,
127  const casacore::Float ySize, const casacore::Float dx, const casacore::Float dy,
128  const PanelDisplay::FillOrder order);
129  virtual void setGeometry(const casacore::RecordInterface& rec);
130  // </group>
131 
132  // Clear our part of the PC. (Clears both front and back buffers.)
133  virtual void clear();
134 
135 
136  virtual WorldCanvasHolder* wcHolder(WorldCanvas* wc) const;
137 
139  return itsPixelCanvas;
140  }
141 
142  // get controlled access to world canvases shared among a number of objects
143  // return value indicates if the operation was possible (in the future it
144  // may be necessary to serialize access so this function may return false
145  // if mutual exclusion prevents access to the world canvas list)
146  bool wcsApply( std::function<void(WorldCanvas *)> apply );
147 
148  virtual void addTool(const casacore::String& key, const std::shared_ptr<MultiWCTool> & );
149  /* virtual void addTool(const casacore::String& key, MultiWCTool* value); */
150  virtual void removeTool(const casacore::String& key);
151  virtual void setToolKey(const casacore::String& toolname,
152  const Display::KeySym& keysym);
153  virtual casacore::Bool hasTools();
154  virtual void updateTools(casacore::Bool remove = true, casacore::Bool add = true);
155  virtual void disableTools();
156  virtual void enableTools();
157  virtual void enableTool(const casacore::String& toolname);
158  virtual void disableTool(const casacore::String& toolname);
159  virtual const std::shared_ptr<MultiWCTool> getTool(const casacore::String& key);
160 
161  // Is the specified DisplayData the one in charge of coordinate
162  // state of the Panel's WCs?
163  virtual casacore::Bool isCSmaster(const DisplayData *dd) const;
164  void setCSmaster( DisplayData* dd );
165 
170  float getDrawUnit( ) const;
171 
176  int getColumnCount( ) const;
177 
182  int getRowCount() const;
183 
184 
187  static const casacore::String X_SIZE;
188  static const casacore::String Y_SIZE;
189 
190 
191 
192 
193  private:
194 
195  // The PixelCanvas on which the panels are laid.
197 
198  // The number of panels in x and y.
200 
201  // The origin and size of the used area of the PixelCanvas.
203 
204  // The offset between each panel.
206 
207  //The pgmargins
209 
210  // What order do we fill the canvases in?
212 
213  // Whether the geometry is currently setup?
215 
216  // The WorldCanvases which we made, and a convenient iterator.
217  std::list<WorldCanvas*> itsWCList;
218 
219  // The WorldCanvasHolders which we made, and a convenient iterator.
220 
221  // (dk note: you should create a local iterator instead of using member
222  // iterators. Otherwise, a call chain may include two methods in the
223  // class stepping on each other's iterator use. Even if you think that
224  // won't happen currently, it creates a maintenance minefield).
225  //
226  // Also note: _exactly the same list_ (with the same _name_, even)
227  // is maintained on MWCH level (to be fixed).
228 
229  std::list<WorldCanvasHolder* > itsWCHList;
230 
231  std::map<casacore::String, std::shared_ptr<MultiWCTool> > itsMWCTools;
232 
233  // unSetup the Geometry.
234  void unSetupGeometry();
235 
236 
237 
238 
239  };
240 
241 
242 } //# NAMESPACE CASA - END
243 
244 #endif
PanelDisplay(PixelCanvas *pixelcanvas, const casacore::Int nx=3, const casacore::Int ny=2, const casacore::Float xOrigin=0.0, const casacore::Float yOrigin=0.0, const casacore::Float xSize=1.0, const casacore::Float ySize=1.0, const casacore::Float dx=0.0, const casacore::Float dy=0.0, const PanelDisplay::FillOrder order=LEFT_TOP)
Constructor taking: a pointer to the PixelCanvas on which to lay the panels, the number of panels in ...
virtual casacore::Bool hasTools()
int Int
Definition: aipstype.h:50
static const casacore::String X_SIZE
Definition: PanelDisplay.h:187
Class to provide option parsing routines for display classes.
casacore::Float itsXOrigin
The origin and size of the used area of the PixelCanvas.
Definition: PanelDisplay.h:202
casacore::Int itslpgm
The pgmargins.
Definition: PanelDisplay.h:208
virtual casacore::Bool isCSmaster(const DisplayData *dd) const
Is the specified DisplayData the one in charge of coordinate state of the Panel&#39;s WCs...
casacore::Float itsDX
The offset between each panel.
Definition: PanelDisplay.h:205
virtual void getGeometry(casacore::Int &nx, casacore::Int &ny, casacore::Float &xOrigin, casacore::Float &yOrigin, casacore::Float &xSize, casacore::Float &ySize, casacore::Float &dx, casacore::Float &dy, PanelDisplay::FillOrder &order) const
Describe or set the geometry of the panels, either explicitly or in casacore::RecordInterface form...
virtual void clear()
Clear our part of the PC.
casacore::Float itsXSize
Definition: PanelDisplay.h:202
static const casacore::String X_ORIGIN
Definition: PanelDisplay.h:185
void apply(const Jones &j1, VisVector &v, const Jones &j2)
Apply a pair of Jones to a VisVector:
Buffer for storing Attributes.
left to right, then top to bottom
Definition: PanelDisplay.h:85
virtual void setAttributes(AttributeBuffer &at)
Set attributes on all WolrdCanvases.
virtual casacore::Record getOptions() const
virtual void setDefaultOptions()
Install the default options for this PanelDisplay.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
int getColumnCount() const
Returns the number of columns of plots that are currently being displayed.
void unSetupGeometry()
unSetup the Geometry.
virtual const std::shared_ptr< MultiWCTool > getTool(const casacore::String &key)
casacore::Float itsYOrigin
Definition: PanelDisplay.h:202
Base class defining interface to pixel-based output devices.
Definition: PixelCanvas.h:161
void setCSmaster(DisplayData *dd)
casacore::Int itsrpgm
Definition: PanelDisplay.h:208
virtual void enableTool(const casacore::String &toolname)
casacore::Int itsNY
Definition: PanelDisplay.h:199
float getDrawUnit() const
Returns the current mapping of PGP units to pixel units.
virtual casacore::Bool setOptions(const casacore::Record &rec, casacore::Record &updatedOptions)
Apply options stored in rec to the PanelDisplay; these get forwarded to all underlying WorldCanvases...
virtual WorldCanvasHolder * wcHolder(WorldCanvas *wc) const
virtual void enableTools()
static const casacore::String Y_ORIGIN
Definition: PanelDisplay.h:186
virtual void setGeometry(const casacore::Int nx, const casacore::Int ny, const casacore::Float xOrigin, const casacore::Float yOrigin, const casacore::Float xSize, const casacore::Float ySize, const casacore::Float dx, const casacore::Float dy, const PanelDisplay::FillOrder order)
virtual PixelCanvas * pixelCanvas()
Definition: PanelDisplay.h:138
virtual void removeTool(const casacore::String &key)
virtual void addTool(const casacore::String &key, const std::shared_ptr< MultiWCTool > &)
bool wcsApply(std::function< void(WorldCanvas *)> apply)
get controlled access to world canvases shared among a number of objects return value indicates if th...
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Float itsDY
Definition: PanelDisplay.h:205
std::list< WorldCanvas * > itsWCList
The WorldCanvases which we made, and a convenient iterator.
Definition: PanelDisplay.h:217
A holder of WorldCanvasHolders to use for panelling applications.
Definition: MultiWCHolder.h:99
virtual void setToolKey(const casacore::String &toolname, const Display::KeySym &keysym)
float Float
Definition: aipstype.h:54
FillOrder itsOrder
What order do we fill the canvases in?
Definition: PanelDisplay.h:211
PixelCanvas * itsPixelCanvas
The PixelCanvas on which the panels are laid.
Definition: PanelDisplay.h:196
void add(casacore::Int spectralWindow, casacore::Int firstChannel, casacore::Int nChannels, casacore::Int increment=1)
virtual ~PanelDisplay()
Destructor.
casacore::Bool itsGeometrySet
Whether the geometry is currently setup?
Definition: PanelDisplay.h:214
A holder to interface between DisplayDatas and a WorldCanvas.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
casacore::Int itsNX
The number of panels in x and y.
Definition: PanelDisplay.h:199
virtual void updateTools(casacore::Bool remove=true, casacore::Bool add=true)
A class which creates and manages &quot;panelled&quot; displays.
Definition: PanelDisplay.h:79
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Float itsYSize
Definition: PanelDisplay.h:202
std::list< WorldCanvasHolder * > itsWCHList
The WorldCanvasHolders which we made, and a convenient iterator.
Definition: PanelDisplay.h:229
casacore::Int itstpgm
Definition: PanelDisplay.h:208
casacore::Int itsbpgm
Definition: PanelDisplay.h:208
Base class for display objects.
Definition: DisplayData.h:317
int getRowCount() const
Returns the number of rows of plots that are currently being displayed.
Abstract base class for Record classes.
virtual void disableTools()
KeySym
Keysyms for PixelCanvas keyboard events.
Definition: DisplayEnums.h:412
virtual void getAttributeValue(const casacore::String &name, casacore::Int &newValue) const
virtual void disableTool(const casacore::String &toolname)
static const casacore::String Y_SIZE
Definition: PanelDisplay.h:188
std::map< casacore::String, std::shared_ptr< MultiWCTool > > itsMWCTools
Definition: PanelDisplay.h:231