00001 //# Copyright (C) 2009 00002 //# Associated Universities, Inc. Washington DC, USA. 00003 //# 00004 //# This library is free software; you can redistribute it and/or modify it 00005 //# under the terms of the GNU Library General Public License as published by 00006 //# the Free Software Foundation; either version 2 of the License, or (at your 00007 //# option) any later version. 00008 //# 00009 //# This library is distributed in the hope that it will be useful, but WITHOUT 00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 //# License for more details. 00013 //# 00014 //# You should have received a copy of the GNU Library General Public License 00015 //# along with this library; if not, write to the Free Software Foundation, 00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00017 //# 00018 //# Correspondence concerning AIPS++ should be addressed as follows: 00019 //# Internet email: aips2-request@nrao.edu. 00020 //# Postal address: AIPS++ Project Office 00021 //# National Radio Astronomy Observatory 00022 //# 520 Edgemont Road 00023 //# Charlottesville, VA 22903-2475 USA 00024 //# 00025 //# $Id: $ 00026 #ifndef PLOTMSDATACOLLAPSIBLE_QO_H 00027 #define PLOTMSDATACOLLAPSIBLE_QO_H 00028 00029 #include <QtGui/QWidget> 00030 #include <casa/BasicSL/String.h> 00031 #include <plotms/GuiTabs/PlotMSDataCollapsible.ui.h> 00032 #include <plotms/Plots/PlotMSPlotParameters.h> 00033 #include <plotms/PlotMS/PlotMS.h> 00034 00035 class QLineEdit; 00036 00037 namespace casa { 00038 00039 class PlotMSPlotTab; 00040 class PlotMSDataTab; 00041 class PlotMSPlotter; 00042 00048 class PlotMSDataCollapsible : public QWidget{ 00049 Q_OBJECT 00050 00051 public: 00052 PlotMSDataCollapsible(PlotMSPlotter* plotter, QWidget* parent, int plotIndex = -1); 00053 ~PlotMSDataCollapsible(); 00054 00055 //Return the plot tab. 00056 PlotMSDataTab* getSingleData(); 00057 00058 //Set the numbers of rows and cols that the page can currently 00059 //support. 00060 void setGridSize( int rowCount, int colCount ); 00061 00062 //Return the row and column location for this plot. 00063 void getLocation( Int& rowIndex, Int& colIndex ); 00064 00065 //Plot parameters have changed. 00066 void parametersHaveChanged(const PlotMSWatchedParameters& params, 00067 int updateFlag); 00068 00069 //Return the minimum size for the plot properties. 00070 virtual QSize minimumSizeHint() const; 00071 00072 //Return the size. 00073 virtual QSize sizeHint() const; 00074 00075 //Reset the height based on the positive or negative amount of new space that 00076 //is available. 00077 void resetHeight( int diff ); 00078 00079 //The plots being displayed have changed. 00080 void plotsChanged(const PlotMSPlotManager& manager, int index); 00081 00082 //Returns the plot 00083 PlotMSPlot* getPlot(); 00084 00085 //Force (or not) the plots to update their displays. 00086 bool plot( bool forceReload ); 00087 00088 //Returns whether or not the plot is displayed by this Collapsible. 00089 bool managesPlot(PlotMSPlot* plot ) const; 00090 00091 vector<PMS::Axis> getSelectedLoadAxes() const; 00092 vector<PMS::Axis> getSelectedReleaseAxes() const; 00093 00094 //Returns whether this plot will be plotted, i.e., 00095 //its gridRow and gridCol are nonnegative AND there is an empty location 00096 //for the plot, either at its preferred gridRow and gridCol or at an empty 00097 //location somewhere else. 00098 bool isPlottable() const; 00099 00100 //Change to a compact display 00101 void minimizeDisplay(); 00102 00103 //Returns whether or not the display is compact (minimized) or expanded. 00104 bool isMinimized() const; 00105 00106 //This was put in to support overplotting. When two plots are sharing the 00107 //same canvas, we don't want to trigger a redraw until all the plots sharing 00108 //the same canvas are done updating their data in background threads. 00109 void completePlotting( bool success ); 00110 void clearData(); 00111 00112 //Return the ms that was loaded or an empty string. 00113 String getFile() const; 00114 00115 signals: 00116 void close( PlotMSDataCollapsible*); 00117 00118 private slots: 00119 void closePlot(); 00120 void openCloseDisplay(); 00121 void showContextMenu( const QPoint& location ); 00122 00123 private: 00124 00125 void maximizeDisplay(); 00126 00127 QAction minimizeAction; 00128 QAction maximizeAction; 00129 QAction closeAction; 00130 const int SIZE_COLLAPSED; 00131 const int SIZE_EXPANDED; 00132 const int SIZE_WIDTH; 00133 int minimumSize; 00134 00135 QLineEdit* nameLabel; 00136 PlotMSPlotTab* plotTab; 00137 Ui::PlotMSDataCollapsibleClass ui; 00138 }; 00139 } 00140 00141 #endif // PLOTMSDATACOLLAPSIBLE_QO_H