Inspector.h
Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
00002 
00014 #ifndef _Inspector_H_
00015 #define _Inspector_H_
00016 
00017 //#include <qglobal.h> // for version
00018 // #if QT_VERSION < 0x040000
00019 #include "qtui/InspectorBase.h"
00020 // #else
00021 // #include "InspectorUI.h"
00022 // //Added by the Qt porting tool:
00023 // #endif
00024 
00025 #include "axes/AxesType.h"
00026 #include "axes/Range.h"
00027 
00028 #include <map>
00029 
00030 class QCustomEvent;
00031 class QVBoxLayout;
00032 
00033 namespace hippodraw {
00034 
00035 class CanvasView;
00036 class CanvasWindow;
00037 class CutPlotter;
00038 class DataSourceException;
00039 class DataSource;
00040 class FunctionRep;
00041 class PlotterBase;
00042 class RootNTuple;
00043 class TupleCut;
00044 
00230 // #if QT_VERSION < 0x040000
00231 class MDL_QTHIPPOPLOT_API Inspector : public InspectorBase
00232 {
00233 // #else
00234 // class MDL_QTHIPPOPLOT_API Inspector : public QDialog, private Ui::InspectorUI
00235 // {
00236 //   Q_OBJECT
00237 // #endif
00238 
00239 private:
00240  
00241 void static stringTokenize(std::string input, const std::string & delimiters,
00242                            std::vector<std::string> & tokens, bool clear=true);
00243 
00244   enum ParameterList { Index, Name, Value, Error, Fixed, Dummy };
00245 
00248   QString m_model_name;
00249 
00252   QString m_break_point;
00253 
00256   QString m_flat_width;
00257 
00260   QString m_color_scale;
00261 
00264   std::vector < QLabel * > m_new_labels;
00265 
00268   std::vector  < QComboBox * > m_new_combos;
00269 
00272   std::vector < QLabel * > m_sel_labels;
00273 
00276   std::vector  < QComboBox * > m_sel_combos;
00277 
00280 #if QT_VERSION < 0x040000
00281   std::map < QListViewItem *, FunctionRep * > m_function_lv_map;
00282 #else
00283   std::map < Q3ListViewItem *, FunctionRep * > m_function_lv_map;
00284 #endif
00285 
00289 #if QT_VERSION < 0x040000
00290   std::vector < QListViewItem * > m_func_parm_checked;
00291 #else
00292   std::vector < Q3ListViewItem * > m_func_parm_checked;
00293 #endif
00294 
00295   std::vector < int > m_functionIndexMap;
00296   hippodraw::Axes::Type m_axis;
00297   std::vector < double > m_oldParameters;
00298   std::map < const PlotterBase *, bool> m_zoompan;
00299   Range m_range;
00300 
00301   QWidget * m_newLayoutWidget;
00302   CanvasWindow * m_cur_window;
00303   QWidget * m_layoutWidget;
00304   QVBoxLayout * m_vLayout;
00305   QVBoxLayout * m_newVLayout;
00306 
00309   std::map < PlotterBase *, int > m_cut_map;
00310 
00313   typedef std::vector < const TupleCut * > TupleCutList_t;
00314 
00317   TupleCutList_t m_tuple_cuts;
00318 
00321   typedef std::vector < PlotterBase * > PlotterList_t;
00322 
00325   PlotterList_t m_tuple_cut_plotters;
00326 
00331   PlotterBase * m_plotter;
00332 
00335   QString  m_app_key;
00336 
00339   std::vector < PlotterBase * > m_plotter_list;
00340 
00342   int m_last_ntuple_edited;
00343 
00345   int m_last_cut_index;
00346 
00348   int m_lowslider1_last_val;
00349 
00351   int m_highslider1_last_val;
00352   
00356   bool m_is_updating;
00357 
00361   bool m_cut_enable_updating;
00362 
00363   bool m_dragging;
00364 
00368   bool m_user_models_loaded;
00369 
00373   bool m_rotate_enable;
00374 
00375 
00378   std::vector < QRadioButton * > m_transform_buttons;
00379 
00382   int m_min_entries;
00383 
00384 
00391   int cutRadioId () const;
00392 
00394   void warningTex ();
00395 
00398   void invalidOperationError ( const std::string & message );
00399 
00406   int transformId () const;
00407 
00409   virtual void diffDataRep ();
00412 #if QT_VERSION < 0x040000
00413   QListViewItem * getTopParent ( QListViewItem * item );
00414 #else
00415   Q3ListViewItem * getTopParent ( Q3ListViewItem * item );
00416 #endif
00417 
00421 #if QT_VERSION < 0x040000
00422   FunctionRep * getTopFunctionRep ( QListViewItem * item );
00423 #else
00424   FunctionRep * getTopFunctionRep ( Q3ListViewItem * item );
00425 #endif
00426 
00429 #if QT_VERSION < 0x040000
00430   FunctionRep * getFunctionRep ( QListViewItem * item );
00431 #else
00432   FunctionRep * getFunctionRep ( Q3ListViewItem * item );
00433 #endif
00434 
00439   FunctionRep * getTopFunctionRep ( );
00440 
00443   FunctionRep * getFunctionRep ();
00444 
00448   void fillCheckedFunctionRepItems ();
00449 
00452   void init ();
00453 
00457   virtual void sel_combo_0_activated ( const QString & );
00458 
00462   virtual void sel_combo_1_activated ( const QString & );
00463 
00467   virtual void sel_combo_2_activated ( const QString & );
00468 
00472   virtual void sel_combo_3_activated ( const QString & );
00473 
00480   hippodraw::Axes::Type getAxes ( unsigned int index );
00481 
00482   void loadAllUserModels ();
00483 
00487   void convertCtrlPts ( std::vector < double > & sv );
00488 
00491   void clear ( std::vector < QLabel * > & labels,
00492                std::vector < QComboBox * > & combos );
00493 
00494 
00498   void updateColorMapCtrls ( const PlotterBase * plotter );
00499 
00500 
00504   void updateSelectedPlotData ( const PlotterBase * plotter );
00505 
00508    void dataClearSelectedControls ();
00509 
00512   void updateSelectedPlotDataSource ( const std::string & name );
00513 
00516   void updateSelectedPlotType ( const PlotterBase * plotter );
00517 
00523   void updateAutoScaleBox ();
00524 
00527   void updateLogBox ();
00528 
00531   void updateReverseBox ();
00532 
00533   void updateCutsActive ();
00534 
00537   void updateTupleCuts ( const std::vector < PlotterBase * > & cutlist );
00538 
00541   void setAppKey ();
00542 
00545   const std::vector < PlotterBase * > & 
00546   getDataCutList ( PlotterBase * plotter );
00547 
00549   void disableCutControls ( bool yes );
00550 
00554   void fillPlotterList ( std::vector < PlotterBase * > & plot_list );
00555 
00556   /* Returns the selected cut plotter.
00557    */
00558   virtual CutPlotter * getSelectedCut ();
00559 //   /** Clears and fills the @a cut_list with PlotterBase objects that
00560 //       are cuts whose target is the active DataRep contained by @a
00561 //       plotter.
00562 //   */
00563 //   void fillCutsOn ( const PlotterBase *, 
00564 //                  std::vector < PlotterBase * > & cut_list );
00565 
00570   const std::vector < const TupleCut * > & 
00571   getCutList ( const PlotterBase * plotter ) const;
00572 
00575   int findCutIndex ( const QString & label );
00576 
00580   void setAllCutsActive ( bool yes );
00581 
00584   void cutOnCutError ();
00585 
00589   void invalidDataWarning ();
00590 
00593   void newPlotError ( const std::exception & e );
00594 
00596   void noNTupleSelectedError ();
00597 
00599   void invalidRangeError ( const std::string & bad );
00600 
00603   void incompatibleDataRepError ( const std::string & type );
00604 
00607   void incompatibleFitterError ( const std::string & type );
00608 
00611   void badFunctionError ( const std::string & name, const char * what );
00612 
00615   void fitFailedError ();
00616 
00619   void incompatibleFunctionError ( const std::string & type );
00620 
00629   void multipleDataRepError ( const std::string & type );
00630 
00634   bool multipleDataRepInfo ( const std::string & type );
00635  
00638   void multiplePlotError ();
00639 
00642   void functionAddError ();
00643 
00647 #if QT_VERSION < 0x040000
00648   void fillFunctionParameters ( QListViewItem * parent,
00649                                 const FunctionRep * function,
00650                                 unsigned int & index );
00651 #else
00652   void fillFunctionParameters ( Q3ListViewItem * parent,
00653                                 const FunctionRep * function,
00654                                 unsigned int & index );
00655 #endif
00656 
00659   void statsStripValue ( QRadioButton * box );
00660 
00663   void updateNewPlotControls ();
00664 
00668   void setNewPlotNTuple ( const std::string & name );
00669 
00675   void changeNTupleName ( const QString & );
00676 
00680   virtual void ntupleChanged ( int );
00681 
00684   virtual void updatePlotTab ();
00685 
00688   virtual void errorBars_toggled ( bool );
00689 
00693   void updateCutVarGroupBox ( const PlotterBase * plotter, int index );
00694 
00697   void updateCutControls ( const std::vector < PlotterBase * > & cutlist );
00698 
00701   void updateCutControlValues ( const PlotterBase * cutplotter );
00702 
00705   void updateCutEnableButton ();
00706 
00709   virtual void setZRadioButton ( bool enabled );
00710 
00713   void updateValueCombo ();
00714 
00718   int validPeriodicTransformRange();
00719   bool validPeriodicTransformRange( int miny );
00720 
00724   void invalidPeriodicTransform ();
00725 
00726 #if QT_VERSION < 0x040000
00727   protected:
00728 #else
00729   protected slots:
00730 #endif
00731 
00735   static QString s_registry;
00736  
00737  /* In the member functions below, all are declared in the base class
00738      where they are commented for documentation, except those that are
00739      commented here. 
00740   */
00741   virtual PlotterBase * getPlotter();
00742 
00745   virtual void addDataRepButton_clicked ( );
00746 
00749   virtual void removeDataRepButton_clicked();
00750 
00751   virtual void allNtupleComboActivated ( const QString & );
00754   virtual void updatePlotTypes ();
00755   virtual void availPlotTypesActivated ( const QString & );
00756   virtual void dataCreateNTuple ();
00757 
00761   virtual void dataTupleNameChanged (const QString & );
00762   virtual void dataNTupleSelChanged ( int item );
00763 
00766   virtual void titleText_returnPressed();
00767 
00770   virtual void axis_button_group_clicked ( int id );
00771 
00774   virtual void axisZoomPanCheckBox_clicked ();
00775 
00778   virtual void axisLabelChanged ( int index, const QString & axisName );
00779 
00780   virtual void highRangeDrag();
00781   virtual void lowRangeDrag();
00782   virtual void newPlotButton_clicked ( );
00783 
00786   virtual void setDragOn ();
00787 
00788   virtual void offsetDrag();
00789   virtual void entriesDrag();
00790   virtual void symbolTypeButtonGroup_clicked ( int id );
00791   virtual void lineStyleButtonGroup_clicked ( int id );
00792   virtual void symbolPointSize_returnPressed ( );
00793   virtual void intervalStateChanged ( bool state );
00794   virtual void intervalTextChanged ( const QString & );
00795   virtual void colorSelect_clicked ();
00796 
00799   virtual void colorSelect_2_clicked ();
00800 
00803   virtual void setWidthText ();
00804 
00807   virtual void setOffsetText ();
00808 
00809   virtual void setBinWidth ( int value );
00810 
00813   virtual void functionsFitToDataButton_clicked ();
00814 
00818   virtual void functionsRemoveButton_clicked ();
00819 
00823   virtual void functionsResetButton_clicked();
00824 
00825   virtual void setParameters ( int, PlotterBase * );
00826   virtual void functionParamsListViewCurrentChanged ();
00827   virtual void functionParamsCheckBoxToggled( bool );
00830   virtual void ignoreErrorCheckBoxToggled(bool);
00831   virtual void functionParamsLineEditReturnPressed();
00832   virtual void functionParamsSliderSliderReleased();
00833   virtual void functionParamsSliderSliderMoved( int );
00834   virtual void functionParamsSliderSliderPressed();
00835 
00842   virtual void cut_button_group_clicked ();
00843 
00844   virtual void logScale_clicked();
00845 
00848   virtual void reverse_clicked();
00849 
00852   virtual void autoScale_clicked();
00853 
00856   virtual void m_grid_clicked();
00857   virtual void m_boxedge_clicked();
00858   virtual void cutLowSlider_sliderMoved ( int value );
00859   virtual void cutHighSlider_sliderMoved ( int value );
00860   virtual void cutLowSlider_sliderReleased();
00861   virtual void cutHighSlider_sliderReleased();
00862   virtual void cutZoomPanCheckBox_clicked();
00863   virtual void cutInvertPushButton_clicked();
00864 
00867   virtual void cutAddSelected ();
00868 
00871   virtual void cutAddAll ();
00872 
00875   virtual void cutRemovePushButton_clicked ();
00876 
00879   virtual void cutText_returnPressed();
00880 
00883   virtual void cutEnablePushButton_toggled ( bool on );
00884   
00887   virtual void setBinWidth ( int value, bool drag );
00888 
00891   virtual void axisLabelText ();
00892 
00893   virtual void setLowRange ( int value );
00894 
00897   virtual void setLowRange ( int value, bool yes );
00898 
00899   virtual void setLowText ();
00900   virtual void setHighRange ( int value );
00901 
00904   virtual void setHighRange ( int value, bool yes );
00905 
00906   virtual void setHighText ();
00907   virtual void setOffset ( int value  );
00908 
00911   virtual void rotateX ( int offset );
00912   virtual void rotateY ( int offset );
00913   
00914   virtual void setXRotateText ();
00915   virtual void setYRotateText ();
00916 
00917   
00920   virtual void resetRotate ();
00921 
00924   virtual void setRotate ( int x, int y );
00925 
00928   virtual void setOffset ( int value, bool yes  );
00929   
00930   virtual void cutNew ();
00931   virtual void functionAdd ();
00932   virtual void summaryNew ();
00933 
00940   virtual void transform_button_group_clicked ();
00941   virtual void selCutChanged ();
00942   virtual void updateDataTab();
00943   virtual void pointRepComboBox_activated ( const QString & qstr );
00944 
00947   virtual void updateCutsTab ();
00948 
00951   virtual void updateDataCutsTab ();
00952 
00955   virtual void updateFitCutsTab ();
00956 
00959   virtual void updateFunctionsTab ();
00960 
00961   virtual void createResiduals();
00962   virtual void fitterNamesActivated ( int );
00963   virtual void pushButtonNewErrorPlotClicked ();
00964 
00967   virtual void updateAxisTab ();
00968 
00971   virtual void updateTransformTab ();
00972 
00973   virtual void widthDrag ();
00974 
00976   void editLabelFontClicked();
00977 
00979   void editTitleFontClicked();
00980   
00987   std::string getArrayTupleLabel( const DataSource * rtuple,
00988                                   const std::string & column );
00989 
00992   virtual void valueChanged ( int );
00993 
00997   virtual void sliderChanged ( int );
00998   
01001   virtual void resetSlider ( );
01002 
01005   virtual  void newColorModel ( );
01006  
01009   virtual  void editColorModel ( );
01010 
01013   virtual void deleteColorModel ( );
01014 
01017   virtual void combineCheckBox_clicked();
01018 
01021   virtual void setMinEntries ( int increment );
01022 
01025   virtual int getMinEntries ();
01026 
01029   virtual void setMinEntriesText();
01030 public:
01031 
01033 // #if QT_VERSION < 0x040000
01034   Inspector ( QWidget * parent = 0,
01035               const char * name = 0,
01036               bool modal = false,
01037               Qt::WFlags flags = 0 );
01038 // #else
01039 //   Inspector ( QWidget * parent = 0 );
01040 // #endif
01041 
01045   std::string getSelectedDataSourceName () const;
01046 
01052   void enableNewPlotBox ( bool yes = true );
01053 
01060 #if QT_VERSION < 0x040000
01061   virtual void customEvent ( QCustomEvent * event );
01062 #else
01063   virtual void customEvent ( QEvent * event );
01064 #endif
01065 
01069   virtual void update ( );
01070 
01071   virtual void selectedCutsRadioButton_toggled ( bool selected );
01072   virtual void allCutsRadioButton_toggled ( bool selected );
01073 
01076   virtual void updateSummaryTab ();
01077 
01078   virtual void statsButtonGroupClicked ( int );
01079 
01080 
01081 protected:
01082 
01083   virtual const std::string convertToString ( hippodraw::Axes::Type );
01084 
01085   virtual void contourSlider_valueChanged ( int val );
01086 
01087   virtual void contourTextBox_returnPressed ();
01088 
01091   virtual void contourRadioButton1_toggled ( bool );
01092 
01095   virtual void contourLevelsTextBox_returnPressed ();
01096 
01099   void contourError ();
01100 
01104   virtual void tabChanged ();
01105 
01106   public:
01107 
01110   void setSelectedFitter ( const std::string & name );
01111 
01114   virtual ~Inspector ();
01115 
01116 
01117 };
01118 
01119 } // namespace hippodraw
01120 
01121 #endif // _Inspector_H_
01122 

Generated for HippoDraw Class Library by doxygen