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 
00233 // #if QT_VERSION < 0x040000
00234 class MDL_QTHIPPOPLOT_API Inspector : public InspectorBase
00235 {
00236 // #else
00237 // class MDL_QTHIPPOPLOT_API Inspector : public QDialog, private Ui::InspectorUI
00238 // {
00239 //   Q_OBJECT
00240 // #endif
00241 
00242 private:
00243  
00244 void static stringTokenize(std::string input, const std::string & delimiters,
00245                            std::vector<std::string> & tokens, bool clear=true);
00246 
00247   enum ParameterList { Index, Name, Value, Error, Fixed, Dummy };
00248 
00251   QString m_model_name;
00252 
00255   QString m_break_point;
00256 
00259   QString m_flat_width;
00260 
00263   QString m_color_scale;
00264 
00267   std::vector < QLabel * > m_new_labels;
00268 
00271   std::vector  < QComboBox * > m_new_combos;
00272 
00275   std::vector < QLabel * > m_sel_labels;
00276 
00279   std::vector  < QComboBox * > m_sel_combos;
00280 
00283 #if QT_VERSION < 0x040000
00284   std::map < QListViewItem *, FunctionRep * > m_function_lv_map;
00285 #else
00286   std::map < Q3ListViewItem *, FunctionRep * > m_function_lv_map;
00287 #endif
00288 
00292 #if QT_VERSION < 0x040000
00293   std::vector < QListViewItem * > m_func_parm_checked;
00294 #else
00295   std::vector < Q3ListViewItem * > m_func_parm_checked;
00296 #endif
00297 
00298   std::vector < int > m_functionIndexMap;
00299   hippodraw::Axes::Type m_axis;
00300   std::vector < double > m_oldParameters;
00301   std::map < const PlotterBase *, bool> m_zoompan;
00302   Range m_range;
00303 
00304   QWidget * m_newLayoutWidget;
00305   CanvasWindow * m_cur_window;
00306   QWidget * m_layoutWidget;
00307   QVBoxLayout * m_vLayout;
00308   QVBoxLayout * m_newVLayout;
00309 
00312   std::map < PlotterBase *, int > m_cut_map;
00313 
00316   typedef std::vector < const TupleCut * > TupleCutList_t;
00317 
00320   TupleCutList_t m_tuple_cuts;
00321 
00324   typedef std::vector < PlotterBase * > PlotterList_t;
00325 
00328   PlotterList_t m_tuple_cut_plotters;
00329 
00334   PlotterBase * m_plotter;
00335 
00338   QString  m_app_key;
00339 
00342   std::vector < PlotterBase * > m_plotter_list;
00343 
00345   int m_last_ntuple_edited;
00346 
00348   int m_last_cut_index;
00349 
00351   int m_lowslider1_last_val;
00352 
00354   int m_highslider1_last_val;
00355   
00359   bool m_is_updating;
00360 
00364   bool m_cut_enable_updating;
00365 
00366   bool m_dragging;
00367 
00371   bool m_user_models_loaded;
00372 
00376   bool m_rotate_enable;
00377 
00378 
00381   std::vector < QRadioButton * > m_transform_buttons;
00382 
00385   int m_min_entries;
00386 
00387 
00394   int cutRadioId () const;
00395 
00397   void warningTex ();
00398 
00401   void invalidOperationError ( const std::string & message );
00402 
00409   int transformId () const;
00410 
00412   virtual void diffDataRep ();
00415 #if QT_VERSION < 0x040000
00416   QListViewItem * getTopParent ( QListViewItem * item );
00417 #else
00418   Q3ListViewItem * getTopParent ( Q3ListViewItem * item );
00419 #endif
00420 
00424 #if QT_VERSION < 0x040000
00425   FunctionRep * getTopFunctionRep ( QListViewItem * item );
00426 #else
00427   FunctionRep * getTopFunctionRep ( Q3ListViewItem * item );
00428 #endif
00429 
00432 #if QT_VERSION < 0x040000
00433   FunctionRep * getFunctionRep ( QListViewItem * item );
00434 #else
00435   FunctionRep * getFunctionRep ( Q3ListViewItem * item );
00436 #endif
00437 
00442   FunctionRep * getTopFunctionRep ( );
00443 
00446   FunctionRep * getFunctionRep ();
00447 
00451   void fillCheckedFunctionRepItems ();
00452 
00455   void init ();
00456 
00460   virtual void sel_combo_0_activated ( const QString & );
00461 
00465   virtual void sel_combo_1_activated ( const QString & );
00466 
00470   virtual void sel_combo_2_activated ( const QString & );
00471 
00475   virtual void sel_combo_3_activated ( const QString & );
00476 
00483   hippodraw::Axes::Type getAxes ( unsigned int index );
00484 
00485   void loadAllUserModels ();
00486 
00490   void convertCtrlPts ( std::vector < double > & sv );
00491 
00494   void clear ( std::vector < QLabel * > & labels,
00495                std::vector < QComboBox * > & combos );
00496 
00497 
00501   void updateColorMapCtrls ( const PlotterBase * plotter );
00502 
00503 
00507   void updateSelectedPlotData ( const PlotterBase * plotter );
00508 
00511    void dataClearSelectedControls ();
00512 
00515   void updateSelectedPlotDataSource ( const std::string & name );
00516 
00519   void updateSelectedPlotType ( const PlotterBase * plotter );
00520 
00526   void updateAutoScaleBox ();
00527 
00530   void updateLogBox ();
00531 
00534   void updateReverseBox ();
00535 
00536   void updateCutsActive ();
00537 
00540   void updateTupleCuts ( const std::vector < PlotterBase * > & cutlist );
00541 
00544   void setAppKey ();
00545 
00548   const std::vector < PlotterBase * > & 
00549   getDataCutList ( PlotterBase * plotter );
00550 
00552   void disableCutControls ( bool yes );
00553 
00557   void fillPlotterList ( std::vector < PlotterBase * > & plot_list );
00558 
00559   /* Returns the selected cut plotter.
00560    */
00561   virtual CutPlotter * getSelectedCut ();
00562 //   /** Clears and fills the @a cut_list with PlotterBase objects that
00563 //       are cuts whose target is the active DataRep contained by @a
00564 //       plotter.
00565 //   */
00566 //   void fillCutsOn ( const PlotterBase *, 
00567 //                  std::vector < PlotterBase * > & cut_list );
00568 
00573   const std::vector < const TupleCut * > & 
00574   getCutList ( const PlotterBase * plotter ) const;
00575 
00578   int findCutIndex ( const QString & label );
00579 
00583   void setAllCutsActive ( bool yes );
00584 
00587   void cutOnCutError ();
00588 
00592   void invalidDataWarning ();
00593 
00596   void newPlotError ( const std::exception & e );
00597 
00599   void noNTupleSelectedError ();
00600 
00602   void invalidRangeError ( const std::string & bad );
00603 
00606   void incompatibleDataRepError ( const std::string & type );
00607 
00610   void incompatibleFitterError ( const std::string & type );
00611 
00614   void badFunctionError ( const std::string & name, const char * what );
00615 
00618   void fitFailedError ();
00619 
00622   void incompatibleFunctionError ( const std::string & type );
00623 
00632   void multipleDataRepError ( const std::string & type );
00633 
00637   bool multipleDataRepInfo ( const std::string & type );
00638  
00641   void multiplePlotError ();
00642 
00645   void functionAddError ();
00646 
00650 #if QT_VERSION < 0x040000
00651   void fillFunctionParameters ( QListViewItem * parent,
00652                                 const FunctionRep * function,
00653                                 unsigned int & index );
00654 #else
00655   void fillFunctionParameters ( Q3ListViewItem * parent,
00656                                 const FunctionRep * function,
00657                                 unsigned int & index );
00658 #endif
00659 
00662   void statsStripValue ( QRadioButton * box );
00663 
00666   void updateNewPlotControls ();
00667 
00671   void setNewPlotNTuple ( const std::string & name );
00672 
00678   void changeNTupleName ( const QString & );
00679 
00683   virtual void ntupleChanged ( int );
00684 
00687   virtual void updatePlotTab ();
00688 
00691   virtual void errorBars_toggled ( bool );
00692 
00696   void updateCutVarGroupBox ( const PlotterBase * plotter, int index );
00697 
00700   void updateCutControls ( const std::vector < PlotterBase * > & cutlist );
00701 
00704   void updateCutControlValues ( const PlotterBase * cutplotter );
00705 
00708   void updateCutEnableButton ();
00709 
00712   virtual void setZRadioButton ( bool enabled );
00713 
00716   void updateValueCombo ();
00717 
00721   int validPeriodicTransformRange();
00722   bool validPeriodicTransformRange( int miny );
00723 
00727   void invalidPeriodicTransform ();
00728 
00729 #if QT_VERSION < 0x040000
00730   protected:
00731 #else
00732   protected slots:
00733 #endif
00734 
00738   static QString s_registry;
00739  
00740  /* In the member functions below, all are declared in the base class
00741      where they are commented for documentation, except those that are
00742      commented here. 
00743   */
00744   virtual PlotterBase * getPlotter();
00745 
00748   virtual void addDataRepButton_clicked ( );
00749 
00752   virtual void removeDataRepButton_clicked();
00753 
00754   virtual void allNtupleComboActivated ( const QString & );
00757   virtual void updatePlotTypes ();
00758   virtual void availPlotTypesActivated ( const QString & );
00759   virtual void dataCreateNTuple ();
00760 
00764   virtual void dataTupleNameChanged (const QString & );
00765   virtual void dataNTupleSelChanged ( int item );
00766 
00769   virtual void titleText_returnPressed();
00770 
00773   virtual void axis_button_group_clicked ( int id );
00774 
00777   virtual void axisZoomPanCheckBox_clicked ();
00778 
00781   virtual void axisLabelChanged ( int index, const QString & axisName );
00782 
00783   virtual void highRangeDrag();
00784   virtual void lowRangeDrag();
00785   virtual void newPlotButton_clicked ( );
00786 
00789   virtual void setDragOn ();
00790 
00791   virtual void offsetDrag();
00792   virtual void entriesDrag();
00793   virtual void symbolTypeButtonGroup_clicked ( int id );
00794   virtual void lineStyleButtonGroup_clicked ( int id );
00795   virtual void symbolPointSize_returnPressed ( );
00796   virtual void intervalStateChanged ( bool state );
00797   virtual void intervalTextChanged ( const QString & );
00798   virtual void colorSelect_clicked ();
00799 
00802   virtual void colorSelect_2_clicked ();
00803 
00806   virtual void setWidthText ();
00807 
00810   virtual void setOffsetText ();
00811 
00812   virtual void setBinWidth ( int value );
00813 
00816   virtual void functionsFitToDataButton_clicked ();
00817 
00821   virtual void functionsRemoveButton_clicked ();
00822 
00826   virtual void functionsResetButton_clicked();
00827 
00828   virtual void setParameters ( int, PlotterBase * );
00829   virtual void functionParamsListViewCurrentChanged ();
00830   virtual void functionParamsCheckBoxToggled( bool );
00833   virtual void ignoreErrorCheckBoxToggled(bool);
00834   virtual void functionParamsLineEditReturnPressed();
00835   virtual void functionParamsSliderSliderReleased();
00836   virtual void functionParamsSliderSliderMoved( int );
00837   virtual void functionParamsSliderSliderPressed();
00838 
00845   virtual void cut_button_group_clicked ();
00846 
00847   virtual void logScale_clicked();
00848 
00851   virtual void reverse_clicked();
00852 
00855   virtual void autoScale_clicked();
00856 
00859   virtual void m_grid_clicked();
00860   virtual void m_boxedge_clicked();
00861   virtual void cutLowSlider_sliderMoved ( int value );
00862   virtual void cutHighSlider_sliderMoved ( int value );
00863   virtual void cutLowSlider_sliderReleased();
00864   virtual void cutHighSlider_sliderReleased();
00865   virtual void cutZoomPanCheckBox_clicked();
00866   virtual void cutInvertPushButton_clicked();
00867 
00870   virtual void cutAddSelected ();
00871 
00874   virtual void cutAddAll ();
00875 
00878   virtual void cutRemovePushButton_clicked ();
00879 
00882   virtual void cutText_returnPressed();
00883 
00886   virtual void cutEnablePushButton_toggled ( bool on );
00887   
00890   virtual void setBinWidth ( int value, bool drag );
00891 
00894   virtual void axisLabelText ();
00895 
00896   virtual void setLowRange ( int value );
00897 
00900   virtual void setLowRange ( int value, bool yes );
00901 
00902   virtual void setLowText ();
00903   virtual void setHighRange ( int value );
00904 
00907   virtual void setHighRange ( int value, bool yes );
00908 
00909   virtual void setHighText ();
00910   virtual void setOffset ( int value  );
00911 
00914   virtual void rotateX ( int offset );
00915   virtual void rotateY ( int offset );
00916   
00917   virtual void setXRotateText ();
00918   virtual void setYRotateText ();
00919 
00920   
00923   virtual void resetRotate ();
00924 
00927   virtual void setRotate ( int x, int y );
00928 
00931   virtual void setOffset ( int value, bool yes  );
00932   
00933   virtual void cutNew ();
00934   virtual void functionAdd ();
00935   virtual void summaryNew ();
00936 
00943   virtual void transform_button_group_clicked ();
00944   virtual void selCutChanged ();
00945   virtual void updateDataTab();
00946   virtual void pointRepComboBox_activated ( const QString & qstr );
00947 
00950   virtual void updateCutsTab ();
00951 
00954   virtual void updateDataCutsTab ();
00955 
00958   virtual void updateFitCutsTab ();
00959 
00962   virtual void updateFunctionsTab ();
00963 
00964   virtual void createResiduals();
00965   virtual void fitterNamesActivated ( int );
00966   virtual void pushButtonNewErrorPlotClicked ();
00967 
00970   virtual void updateAxisTab ();
00971 
00974   virtual void updateTransformTab ();
00975 
00976   virtual void widthDrag ();
00977 
00979   void editLabelFontClicked();
00980 
00982   void editTitleFontClicked();
00983   
00990   std::string getArrayTupleLabel( const DataSource * rtuple,
00991                                   const std::string & column );
00992 
00995   virtual void valueChanged ( int );
00996 
01000   virtual void sliderChanged ( int );
01001   
01004   virtual void resetSlider ( );
01005 
01008   virtual  void newColorModel ( );
01009  
01012   virtual  void editColorModel ( );
01013 
01016   virtual void deleteColorModel ( );
01017 
01020   virtual void combineCheckBox_clicked();
01021 
01024   virtual void setMinEntries ( int increment );
01025 
01028   virtual int getMinEntries ();
01029 
01032   virtual void setMinEntriesText();
01033 public:
01034 
01036 // #if QT_VERSION < 0x040000
01037   Inspector ( QWidget * parent = 0,
01038               const char * name = 0,
01039               bool modal = false,
01040               Qt::WFlags flags = 0 );
01041 // #else
01042 //   Inspector ( QWidget * parent = 0 );
01043 // #endif
01044 
01048   std::string getSelectedDataSourceName () const;
01049 
01055   void enableNewPlotBox ( bool yes = true );
01056 
01063 #if QT_VERSION < 0x040000
01064   virtual void customEvent ( QCustomEvent * event );
01065 #else
01066   virtual void customEvent ( QEvent * event );
01067 #endif
01068 
01072   virtual void update ( );
01073 
01074   virtual void selectedCutsRadioButton_toggled ( bool selected );
01075   virtual void allCutsRadioButton_toggled ( bool selected );
01076 
01079   virtual void updateSummaryTab ();
01080 
01081   virtual void statsButtonGroupClicked ( int );
01082 
01083 
01084 protected:
01085 
01086   virtual const std::string convertToString ( hippodraw::Axes::Type );
01087 
01088   virtual void contourSlider_valueChanged ( int val );
01089 
01090   virtual void contourTextBox_returnPressed ();
01091 
01094   virtual void contourRadioButton1_toggled ( bool );
01095 
01098   virtual void contourLevelsTextBox_returnPressed ();
01099 
01102   void contourError ();
01103 
01107   virtual void tabChanged ();
01108 
01109   public:
01110 
01113   void setSelectedFitter ( const std::string & name );
01114 
01117   virtual ~Inspector ();
01118 
01119 
01120 };
01121 
01122 } // namespace hippodraw
01123 
01124 #endif // _Inspector_H_
01125 

Generated for HippoDraw Class Library by doxygen