QIGUIPlotWindow.hh

00001 #ifndef _QIGUI_PLOTWINDOW__H_
00002 #define _QIGUI_PLOTWINDOW__H_
00003 
00004 #include <QMainWindow>
00005 #include <TCanvas.h>
00006 
00007 #include "ui_PlotWindow.h"
00008 #include "QIGUIPlot.hh"
00009 
00010 class QIGUIMainWindow;
00011 class QIGUISession;
00012 class QSpinBox;
00013 class QIGUIPlotData;
00014 class QIGUIPlotSet;
00015 class QIGUIScatterPlot;
00016 class QIGUIHistogram;
00017 class QIGUIPlotCanvasEditWindow;
00018 class TVirtualPadEditor;
00019 
00020 class QIGUIPlotWindow: public QMainWindow, public Ui::PlotWindow
00021 //class QIGUIPlotWindow: public QMdiSubWindow, public Ui::PlotWindow
00022 {
00023   Q_OBJECT
00024 
00025   public:
00026     QIGUIPlotWindow (QWidget * parent=0);
00027     QIGUIPlotWindow (QString& name, QWidget * parent=0);
00028     virtual ~QIGUIPlotWindow();
00029 
00030     void DivideCanvas (int x, int y);
00031 
00033     void Draw(QIGUIPlotData * );
00034 
00035     /*@brief set the active session pointer and fill the combo boxes*/
00036     void SetActiveSession(QIGUISession * ); 
00037     bool GetSuperimpose() {return fSuperimpose;}
00038     void SetSuperimpose (bool val) {fSuperimpose = val;}
00039     void ToggleSuperimposeFlag ();
00040 
00041     void Init();
00042     void CreateActions();
00043     void CreateSignals();
00044     void DestroySignals();
00045     void FillVariablesCombo(int pad = -1); // default: fill all the pads
00046     void AddTabEditCanvas();
00047     void RemoveLastTabEditCanvas();
00048     QIGUIScatterPlot * NewScatterPlot(int index, QIGUIPlotData * plotData, int plotset=0);
00049     QIGUIHistogram * NewHistogram(int index, QIGUIPlotData * plotData, int plotset=0);
00050 
00051 
00052 
00053     // Notify change in plot setup to the PlotSets & Canvas
00054     void ChangeLogScale(int pad, QString var, bool log);
00055     void NotifyChangeXVar(QString, int pad);
00056     void NotifyChangeYVar(QString, int pad);
00057     void AddPlotSet(QIGUIPlotSet * plotset);
00058     
00059     void UpdateNEvents(int index);
00060     void UpdateCutName(int index);
00061 
00062     // Getters & setters
00063     std::vector <QIGUIPlotSet*> GetPlotSets() {return fPlotSets;}
00064     QIGUIPlotSet* GetCurrentPlotSet() {return fCurrentPlotSet;}
00065     int GetCurrentPlotSetIndex() {return fCurrentPlotSetIndex;}
00066     void SetCurrentPlotSet(int ind) {fCurrentPlotSet = fPlotSets[ind]; fCurrentPlotSetIndex = ind;}
00067     void CreateGraphicalCut();
00068     
00069   
00070 
00071   public slots:
00072 
00073     /*brief set number of canvas (and tabs)*/
00074     void AskNumberOfPads ();
00075     void NotifyToggleSuperimposeFlag ();
00076     void NotifyChangePlotHisto(QTreeWidgetItem * item, int column);
00077     void NotifyChangeCurrentItemChanged(QTreeWidgetItem * current, QTreeWidgetItem * previos);
00078     void NotifyChangePlotDataChannel(int dummy);
00079     void LaunchDianaPulseViewerWithZoomCut();
00080     void NotifyTogglePadEditor();
00081 
00082     void RefreshCanvas();
00083     void ClearCanvas();
00084     void ResizeTreePlotsHisto(QTreeWidgetItem* item, int column);
00085     void ChangeActivePad(int i);
00086     void UnZoomActivePad();
00087     void ClearPlotSetup(int index, int plostset = -1);
00088     void DeletePlot(int ind = -1); // if ind == -1, delete seleted plot
00089 
00090     void CanvasEvent(TObject *obj, unsigned int event, TCanvas *c);
00091     void InitGraphicalCut();
00092     void IntegratePlot();
00093     void FitPeaks();
00094     void IncreaseGeneralChannel();
00095     void DecreaseGeneralChannel();
00096 
00097     // CoAnalysis
00098     void ToggleCoAnalysis(bool);
00099 
00100     // Save
00101     void SaveAs();
00102 
00103 
00104   private:
00105 
00106     std::string fDescription;
00107     bool fSuperimpose;
00108     QIGUIMainWindow * fMainWindow;
00109     TVirtualPadEditor * fPadEditor;
00110     bool fShowPadEditor;
00111 
00112     /*@brief pointer to active session, to obtain list of leaves*/
00113     QIGUISession * fActiveSession;
00114 
00116     TCanvas * fCanvas;
00117 
00118     /*@brief N Pads*/
00119     int fNPads;
00120 
00121     /*@brief list of editCanvas widget (as many as fNPads)*/
00122     std::vector<QIGUIPlotCanvasEditWindow*> fTabEditCanvas; 
00123 
00125     std::vector<QIGUIPlotSet*> fPlotSets;
00126 
00128     QIGUIPlotSet* fCurrentPlotSet;
00129     int fCurrentPlotSetIndex;
00130 
00131     QSpinBox * fRawsSpinBox; // nRaws Canvas
00132     QSpinBox * fColumnsSpinBox; // nColmns Canvas
00133 
00134     //Color_t fCurrentColor;
00135     std::list<Color_t>  fColors;
00136     
00137     bool fGeneratingGraphicalCut;
00138     bool fIntegrating;
00139     bool fFittingPeaks;
00140     std::vector<double> fFitPositions;
00141 
00142     // CoAnalysis
00143     bool fCoAnalysis;
00144 
00145   protected:
00146   void closeEvent ( QCloseEvent * event ) ; 
00147 
00148 
00149   public:
00150     // auxiliar
00151     QColor MapColor(Color_t icol);
00152     Color_t MapColor(QColor qcol);
00153 
00154 };
00155 
00156 #endif

Generated on Fri Mar 6 13:40:40 2009 for CUORE Software by  doxygen 1.5.1