00001
00002
00014 #ifndef _Inspector_H_
00015 #define _Inspector_H_
00016
00017
00018
00019 #include "qtui/InspectorBase.h"
00020
00021
00022
00023
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
00228
00229 class MDL_QTHIPPOPLOT_API Inspector : public InspectorBase
00230 {
00231
00232
00233
00234
00235
00236
00237 private:
00238
00239
00240 enum ParameterList { Index, Name, Value, Error, Fixed, Dummy };
00241
00244 QString m_model_name;
00245
00248 QString m_break_point;
00249
00252 QString m_flat_width;
00253
00256 QString m_color_scale;
00257
00260 std::vector < QLabel * > m_new_labels;
00261
00264 std::vector < QComboBox * > m_new_combos;
00265
00268 std::vector < QLabel * > m_sel_labels;
00269
00272 std::vector < QComboBox * > m_sel_combos;
00273
00276 #if QT_VERSION < 0x040000
00277 std::map < QListViewItem *, FunctionRep * > m_function_lv_map;
00278 #else
00279 std::map < Q3ListViewItem *, FunctionRep * > m_function_lv_map;
00280 #endif
00281
00285 #if QT_VERSION < 0x040000
00286 std::vector < QListViewItem * > m_func_parm_checked;
00287 #else
00288 std::vector < Q3ListViewItem * > m_func_parm_checked;
00289 #endif
00290
00291 std::vector < int > m_functionIndexMap;
00292 hippodraw::Axes::Type m_axis;
00293 std::vector < double > m_oldParameters;
00294 std::map < const PlotterBase *, bool> m_zoompan;
00295 Range m_range;
00296
00297 QWidget * m_newLayoutWidget;
00298 CanvasWindow * m_cur_window;
00299 QWidget * m_layoutWidget;
00300 QVBoxLayout * m_vLayout;
00301 QVBoxLayout * m_newVLayout;
00302
00305 std::map < PlotterBase *, int > m_cut_map;
00306
00309 typedef std::vector < const TupleCut * > TupleCutList_t;
00310
00313 TupleCutList_t m_tuple_cuts;
00314
00317 typedef std::vector < PlotterBase * > PlotterList_t;
00318
00321 PlotterList_t m_tuple_cut_plotters;
00322
00327 PlotterBase * m_plotter;
00328
00331 QString m_app_key;
00332
00335 std::vector < PlotterBase * > m_plotter_list;
00336
00338 int m_last_ntuple_edited;
00339
00341 int m_last_cut_index;
00342
00344 int m_lowslider1_last_val;
00345
00347 int m_highslider1_last_val;
00348
00352 bool m_is_updating;
00353
00357 bool m_cut_enable_updating;
00358
00359 bool m_dragging;
00360
00364 bool m_user_models_loaded;
00365
00369 bool m_rotate_enable;
00370
00371
00374 std::vector < QRadioButton * > m_transform_buttons;
00375
00378 int m_min_entries;
00379
00380
00387 int cutRadioId () const;
00388
00390 void warningTex ();
00391
00394 void invalidOperationError ( const std::string & message );
00395
00402 int transformId () const;
00403
00405 virtual void diffDataRep ();
00408 #if QT_VERSION < 0x040000
00409 QListViewItem * getTopParent ( QListViewItem * item );
00410 #else
00411 Q3ListViewItem * getTopParent ( Q3ListViewItem * item );
00412 #endif
00413
00417 #if QT_VERSION < 0x040000
00418 FunctionRep * getFunctionRep ( QListViewItem * item );
00419 #else
00420 FunctionRep * getFunctionRep ( Q3ListViewItem * item );
00421 #endif
00422
00426 FunctionRep * getFunctionRep ( );
00427
00431 void fillCheckedFunctionRepItems ();
00432
00435 void init ();
00436
00440 virtual void sel_combo_0_activated ( const QString & );
00441
00445 virtual void sel_combo_1_activated ( const QString & );
00446
00450 virtual void sel_combo_2_activated ( const QString & );
00451
00455 virtual void sel_combo_3_activated ( const QString & );
00456
00463 hippodraw::Axes::Type getAxes ( unsigned int index );
00464
00465 void loadAllUserModels ();
00466
00470 void convertCtrlPts ( std::vector < double > & sv );
00471
00474 void clear ( std::vector < QLabel * > & labels,
00475 std::vector < QComboBox * > & combos );
00476
00477
00481 void updateColorMapCtrls ( const PlotterBase * plotter );
00482
00483
00487 void updateSelectedPlotData ( const PlotterBase * plotter );
00488
00491 void dataClearSelectedControls ();
00492
00495 void updateSelectedPlotDataSource ( const std::string & name );
00496
00499 void updateSelectedPlotType ( const PlotterBase * plotter );
00500
00506 void updateAutoScaleBox ();
00507
00510 void updateLogBox ();
00511
00514 void updateReverseBox ();
00515
00516 void updateCutsActive ();
00517
00520 void updateTupleCuts ( const std::vector < PlotterBase * > & cutlist );
00521
00524 void setAppKey ();
00525
00528 const std::vector < PlotterBase * > &
00529 getDataCutList ( PlotterBase * plotter );
00530
00532 void disableCutControls ( bool yes );
00533
00537 void fillPlotterList ( std::vector < PlotterBase * > & plot_list );
00538
00539
00540
00541 virtual CutPlotter * getSelectedCut ();
00542
00543
00544
00545
00546
00547
00548
00553 const std::vector < const TupleCut * > &
00554 getCutList ( const PlotterBase * plotter ) const;
00555
00558 int findCutIndex ( const QString & label );
00559
00563 void setAllCutsActive ( bool yes );
00564
00567 void cutOnCutError ();
00568
00572 void invalidDataWarning ();
00573
00576 void newPlotError ( const std::exception & e );
00577
00579 void noNTupleSelectedError ();
00580
00582 void invalidRangeError ( const std::string & bad );
00583
00586 void incompatibleDataRepError ( const std::string & type );
00587
00590 void incompatibleFitterError ( const std::string & type );
00591
00594 void badFunctionError ( const std::string & name, const char * what );
00595
00598 void fitFailedError ();
00599
00602 void incompatibleFunctionError ( const std::string & type );
00603
00612 void multipleDataRepError ( const std::string & type );
00613
00617 bool multipleDataRepInfo ( const std::string & type );
00618
00621 void multiplePlotError ();
00622
00625 void functionAddError ();
00626
00630 #if QT_VERSION < 0x040000
00631 void fillFunctionParameters ( QListViewItem * parent,
00632 const FunctionRep * function,
00633 unsigned int & index );
00634 #else
00635 void fillFunctionParameters ( Q3ListViewItem * parent,
00636 const FunctionRep * function,
00637 unsigned int & index );
00638 #endif
00639
00642 void statsStripValue ( QRadioButton * box );
00643
00646 void updateNewPlotControls ();
00647
00651 void setNewPlotNTuple ( const std::string & name );
00652
00658 void changeNTupleName ( const QString & );
00659
00663 virtual void ntupleChanged ( int );
00664
00667 virtual void updatePlotTab ();
00668
00671 virtual void errorBars_toggled ( bool );
00672
00676 void updateCutVarGroupBox ( const PlotterBase * plotter, int index );
00677
00680 void updateCutControls ( const std::vector < PlotterBase * > & cutlist );
00681
00684 void updateCutControlValues ( const PlotterBase * cutplotter );
00685
00688 void updateCutEnableButton ();
00689
00692 virtual void setZRadioButton ( bool enabled );
00693
00696 void updateValueCombo ();
00697
00701 int validPeriodicTransformRange();
00702 bool validPeriodicTransformRange( int miny );
00703
00707 void invalidPeriodicTransform ();
00708
00709 #if QT_VERSION < 0x040000
00710 protected:
00711 #else
00712 protected slots:
00713 #endif
00714
00718 static QString s_registry;
00719
00720
00721
00722
00723
00724 virtual PlotterBase * getPlotter();
00725
00728 virtual void addDataRepButton_clicked ( );
00729
00732 virtual void removeDataRepButton_clicked();
00733
00734 virtual void allNtupleComboActivated ( const QString & );
00737 virtual void updatePlotTypes ();
00738 virtual void availPlotTypesActivated ( const QString & );
00739 virtual void dataCreateNTuple ();
00740
00744 virtual void dataTupleNameChanged (const QString & );
00745 virtual void dataNTupleSelChanged ( int item );
00746
00749 virtual void titleText_returnPressed();
00750
00753 virtual void axis_button_group_clicked ( int id );
00754
00757 virtual void axisZoomPanCheckBox_clicked ();
00758
00761 virtual void axisLabelChanged ( int index, const QString & axisName );
00762
00763 virtual void highRangeDrag();
00764 virtual void lowRangeDrag();
00765 virtual void newPlotButton_clicked ( );
00766
00769 virtual void setDragOn ();
00770
00771 virtual void offsetDrag();
00772 virtual void entriesDrag();
00773 virtual void symbolTypeButtonGroup_clicked ( int id );
00774 virtual void lineStyleButtonGroup_clicked ( int id );
00775 virtual void symbolPointSize_returnPressed ( );
00776 virtual void intervalStateChanged ( bool state );
00777 virtual void intervalTextChanged ( const QString & );
00778 virtual void colorSelect_clicked ();
00779
00782 virtual void colorSelect_2_clicked ();
00783
00786 virtual void setWidthText ();
00787
00790 virtual void setOffsetText ();
00791
00792 virtual void setBinWidth ( int value );
00793
00796 virtual void functionsFitToDataButton_clicked ();
00797
00801 virtual void functionsRemoveButton_clicked ();
00802
00806 virtual void functionsResetButton_clicked();
00807
00808 virtual void setParameters ( int, PlotterBase * );
00809 virtual void functionParamsListViewCurrentChanged ();
00810 virtual void functionParamsCheckBoxToggled( bool );
00813 virtual void ignoreErrorCheckBoxToggled(bool);
00814 virtual void functionParamsLineEditReturnPressed();
00815 virtual void functionParamsSliderSliderReleased();
00816 virtual void functionParamsSliderSliderMoved( int );
00817 virtual void functionParamsSliderSliderPressed();
00818
00825 virtual void cut_button_group_clicked ();
00826
00827 virtual void logScale_clicked();
00828
00831 virtual void reverse_clicked();
00832
00835 virtual void autoScale_clicked();
00836
00839 virtual void m_grid_clicked();
00840 virtual void m_boxedge_clicked();
00841 virtual void cutLowSlider_sliderMoved ( int value );
00842 virtual void cutHighSlider_sliderMoved ( int value );
00843 virtual void cutLowSlider_sliderReleased();
00844 virtual void cutHighSlider_sliderReleased();
00845 virtual void cutZoomPanCheckBox_clicked();
00846 virtual void cutInvertPushButton_clicked();
00847
00850 virtual void cutAddSelected ();
00851
00854 virtual void cutAddAll ();
00855
00858 virtual void cutRemovePushButton_clicked ();
00859
00862 virtual void cutText_returnPressed();
00863
00866 virtual void cutEnablePushButton_toggled ( bool on );
00867
00870 virtual void setBinWidth ( int value, bool drag );
00871
00874 virtual void axisLabelText ();
00875
00876 virtual void setLowRange ( int value );
00877
00880 virtual void setLowRange ( int value, bool yes );
00881
00882 virtual void setLowText ();
00883 virtual void setHighRange ( int value );
00884
00887 virtual void setHighRange ( int value, bool yes );
00888
00889 virtual void setHighText ();
00890 virtual void setOffset ( int value );
00891
00894 virtual void rotateX ( int offset );
00895 virtual void rotateY ( int offset );
00896
00897 virtual void setXRotateText ();
00898 virtual void setYRotateText ();
00899
00900
00903 virtual void resetRotate ();
00904
00907 virtual void setRotate ( int x, int y );
00908
00911 virtual void setOffset ( int value, bool yes );
00912
00913 virtual void cutNew ();
00914 virtual void functionAdd ();
00915 virtual void summaryNew ();
00916
00923 virtual void transform_button_group_clicked ();
00924 virtual void selCutChanged ();
00925 virtual void updateDataTab();
00926 virtual void pointRepComboBox_activated ( const QString & qstr );
00927
00930 virtual void updateCutsTab ();
00931
00934 virtual void updateDataCutsTab ();
00935
00938 virtual void updateFitCutsTab ();
00939
00942 virtual void updateFunctionsTab ();
00943
00944 virtual void createResiduals();
00945 virtual void fitterNamesActivated ( int );
00946 virtual void pushButtonNewErrorPlotClicked ();
00947
00950 virtual void updateAxisTab ();
00951
00954 virtual void updateTransformTab ();
00955
00956 virtual void widthDrag ();
00957
00959 void editLabelFontClicked();
00960
00962 void editTitleFontClicked();
00963
00970 std::string getArrayTupleLabel( const DataSource * rtuple,
00971 const std::string & column );
00972
00975 virtual void valueChanged ( int );
00976
00980 virtual void sliderChanged ( int );
00981
00984 virtual void resetSlider ( );
00985
00988 virtual void newColorModel ( );
00989
00992 virtual void editColorModel ( );
00993
00996 virtual void deleteColorModel ( );
00997
01000 virtual void combineCheckBox_clicked();
01001
01004 virtual void setMinEntries ( int increment );
01005
01008 virtual int getMinEntries ();
01009
01012 virtual void setMinEntriesText();
01013 public:
01014
01016
01017 Inspector ( QWidget * parent = 0,
01018 const char * name = 0,
01019 bool modal = false,
01020 Qt::WFlags flags = 0 );
01021
01022
01023
01024
01028 std::string getSelectedDataSourceName () const;
01029
01035 void enableNewPlotBox ( bool yes = true );
01036
01043 #if QT_VERSION < 0x040000
01044 virtual void customEvent ( QCustomEvent * event );
01045 #else
01046 virtual void customEvent ( QEvent * event );
01047 #endif
01048
01052 virtual void update ( );
01053
01054 virtual void selectedCutsRadioButton_toggled ( bool selected );
01055 virtual void allCutsRadioButton_toggled ( bool selected );
01056
01059 virtual void updateSummaryTab ();
01060
01061 virtual void statsButtonGroupClicked ( int );
01062
01063
01064 protected:
01065
01066 virtual const std::string convertToString ( hippodraw::Axes::Type );
01067
01068 virtual void contourSlider_valueChanged ( int val );
01069
01070 virtual void contourTextBox_returnPressed ();
01071
01074 virtual void contourRadioButton1_toggled ( bool );
01075
01078 virtual void contourLevelsTextBox_returnPressed ();
01079
01082 void contourError ();
01083
01087 virtual void tabChanged ();
01088
01089 public:
01090
01093 void setSelectedFitter ( const std::string & name );
01094
01097 virtual ~Inspector ();
01098
01099
01100 };
01101
01102 }
01103
01104 #endif // _Inspector_H_
01105