PanelDisplay.h

Go to the documentation of this file.
00001 //# PanelDisplay.h: Provision of panelled displays for data
00002 //# Copyright (C) 2000,2001,2002,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_PANELDISPLAY_H
00029 #define TRIALDISPLAY_PANELDISPLAY_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Containers/List.h>
00033 #include <casa/Containers/RecordInterface.h>
00034 #include <casa/Containers/SimOrdMap.h>
00035 #include <display/Utilities/DisplayOptions.h>
00036 #include <display/Display/MultiWCHolder.h>
00037 #include <display/Display/DisplayEnums.h>
00038 
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 
00041         class PixelCanvas;
00042         class WorldCanvas;
00043         class WorldCanvasHolder;
00044         class Attribute;
00045         class AttributeBuffer;
00046         class MultiWCTool;
00047 
00048 // <summary>
00049 // A class which creates and manages "panelled" displays.
00050 // </summary>
00051 //
00052 // <use visibility=export>
00053 //
00054 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00055 // </reviewed>
00056 //
00057 // <prerequisite>
00058 //   <li><linkto class="PixelCanvas">PixelCanvas</linkto>
00059 //   <li><linkto class="MultiWCHolder">MultiWCHolder</linkto>
00060 //   <li><linkto class="DisplayData">DisplayData</linkto>
00061 // </prerequisite>
00062 //
00063 // <etymology>
00064 // The PanelDisplay class provides a display consisting of a
00065 // number of panels.
00066 // </etymology>
00067 //
00068 // <synopsis>
00069 // This class uses the <linkto
00070 // class="MultiWCHolder">MultiWCHolder</linkto> class to provide a
00071 // regular set of panels for display multi-view DisplayDatas.
00072 // </synopsis>
00073 //
00074 // <example>
00075 // </example>
00076 //
00077 // <motivation>
00078 // </motivation>
00079 
00080         class PanelDisplay : public MultiWCHolder, public DisplayOptions {
00081 
00082         public:
00083 
00084                 enum FillOrder {
00085                     // left to right, then top to bottom
00086                     LEFT_TOP
00087                     // others are imaginable
00088                 };
00089 
00090 
00091                 // Constructor taking: a pointer to the PixelCanvas on which to lay
00092                 // the panels, the number of panels in the x and y directions, the
00093                 // extent of the PixelCanvas to cover with panels, and the
00094                 // fractional spacing between the panels.
00095                 PanelDisplay(PixelCanvas* pixelcanvas,
00096                              const Int nx = 3, const Int ny = 2,
00097                              const Float xOrigin = 0.0, const Float yOrigin = 0.0,
00098                              const Float xSize = 1.0, const Float ySize = 1.0,
00099                              const Float dx = 0.0, const Float dy = 0.0,
00100                              const PanelDisplay::FillOrder order = LEFT_TOP);
00101 
00102                 // Destructor.
00103                 virtual ~PanelDisplay();
00104 
00105                 // Install the default options for this PanelDisplay
00106                 virtual void setDefaultOptions();
00107 
00108                 // Apply options stored in rec to the PanelDisplay; these get
00109                 // forwarded to all underlying WorldCanvases
00110                 virtual Bool setOptions(const Record& rec, Record& updatedOptions);
00111                 virtual Record getOptions() const;
00112                 // Set attributes on all WolrdCanvases
00113                 virtual void setAttributes(AttributeBuffer& at);
00114                 virtual void getAttributeValue(const String& name, Int& newValue) const;
00115 
00116                 // Describe or set the geometry of the panels, either explicitly
00117                 // or in RecordInterface form.
00118                 // (Note: setGeometry() does not automatically refresh;
00119                 //  when called within setOptions it does, though.)
00120                 // <group>
00121                 virtual void getGeometry(Int& nx, Int& ny, Float& xOrigin,
00122                                          Float& yOrigin, Float& xSize, Float& ySize,
00123                                          Float& dx, Float& dy,
00124                                          PanelDisplay::FillOrder& order) const;
00125                 virtual void getGeometry(RecordInterface& rec) const;
00126                 virtual void setGeometry(const Int nx, const Int ny, const Float xOrigin,
00127                                          const Float yOrigin, const Float xSize,
00128                                          const Float ySize, const Float dx, const Float dy,
00129                                          const PanelDisplay::FillOrder order);
00130                 virtual void setGeometry(const RecordInterface& rec);
00131                 // </group>
00132 
00133                 // Clear our part of the PC.  (Clears both front and back buffers.)
00134                 virtual void clear();
00135 
00136 
00137                 virtual WorldCanvasHolder* wcHolder(WorldCanvas* wc) const;
00138 
00139                 virtual PixelCanvas* pixelCanvas() {
00140                         return itsPixelCanvas;
00141                 }
00142 
00143                 ConstListIter<WorldCanvas* >* myWCLI;
00144 
00145                 virtual void addTool(const String& key, const SHARED_PTR<MultiWCTool> & );
00146                 /* virtual void addTool(const String& key, MultiWCTool* value); */
00147                 virtual void removeTool(const String& key);
00148                 virtual void setToolKey(const String& toolname,
00149                                         const Display::KeySym& keysym);
00150                 virtual Bool hasTools();
00151                 virtual void updateTools(Bool remove = True, Bool add = True);
00152                 virtual void disableTools();
00153                 virtual void enableTools();
00154                 virtual void enableTool(const String& toolname);
00155                 virtual void disableTool(const String& toolname);
00156                 virtual const SHARED_PTR<MultiWCTool> getTool(const String& key);
00157 
00158                 virtual ListIter<WorldCanvas* > wcs() {
00159                         //return itsWCLI;
00160                         return ListIter<WorldCanvas* >(itsWCList);
00161                 }
00162 
00163                 // Is the specified DisplayData the one in charge of coordinate
00164                 // state of the Panel's WCs?
00165                 virtual Bool isCSmaster(const DisplayData *dd) const;
00166                 void setCSmaster( DisplayData* dd );
00167 
00172                 float getDrawUnit(  ) const;
00173 
00178                 int getColumnCount( ) const;
00179 
00184                 int getRowCount() const;
00185 
00186 
00187                 static const String X_ORIGIN;
00188                 static const String Y_ORIGIN;
00189                 static const String X_SIZE;
00190                 static const String Y_SIZE;
00191 
00192 
00193 
00194 
00195         private:
00196 
00197                 // The PixelCanvas on which the panels are laid.
00198                 PixelCanvas* itsPixelCanvas;
00199 
00200                 // The number of panels in x and y.
00201                 Int itsNX, itsNY;
00202 
00203                 // The origin and size of the used area of the PixelCanvas.
00204                 Float itsXOrigin, itsYOrigin, itsXSize, itsYSize;
00205 
00206                 // The offset between each panel.
00207                 Float itsDX, itsDY;
00208 
00209                 //The pgmargins
00210                 Int itslpgm, itsrpgm, itstpgm, itsbpgm;
00211 
00212                 // What order do we fill the canvases in?
00213                 FillOrder itsOrder;
00214 
00215                 // Whether the geometry is currently setup?
00216                 Bool itsGeometrySet;
00217 
00218                 // The WorldCanvases which we made, and a convenient iterator.
00219                 List<WorldCanvas* > itsWCList;
00220                 //ListIter<WorldCanvas* >* itsWCLI;
00221 
00222 
00223                 // The WorldCanvasHolders which we made, and a convenient iterator.
00224 
00225                 // (dk note: you should create a local iterator instead of using member
00226                 // iterators.  Otherwise, a call chain may include two methods in the
00227                 // class stepping on each other's iterator use.  Even if you think that
00228                 // won't happen currently, it creates a maintenance minefield).
00229                 //
00230                 // Also note: _exactly the same list_ (with the same _name_, even)
00231                 // is maintained on MWCH level (to be fixed).
00232 
00233                 List<WorldCanvasHolder* > itsWCHList;
00234 
00235                 //ListIter<WorldCanvasHolder* >* itsWCHLI;
00236 
00237                 SimpleOrderedMap<String, SHARED_PTR<MultiWCTool> > itsMWCTools;
00238 
00239                 // unSetup the Geometry.
00240                 void unSetupGeometry();
00241 
00242 
00243 
00244 
00245         };
00246 
00247 
00248 } //# NAMESPACE CASA - END
00249 
00250 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1