Inspector.cxx
Go to the documentation of this file.
1 
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15 
16 #ifdef _MSC_VER
17 #include "msdevstudio/MSconfig.h"
18 #endif
19 
20 #include "Inspector.h"
21 
22 #include "CanvasSelectionEvent.h"
23 #include "CanvasWindow.h"
24 #include "PlotterEvent.h"
25 #include "WindowController.h"
26 #include "AxisWidget.h"
27 #include "QtFont.h"
28 
29 #include <qapplication.h>
30 
31 #if QT_VERSION < 0x040000
32 #include "qlistview.h"
33 #include "qbuttongroup.h"
34 #include "qgroupbox.h"
35 #include "qwidgetstack.h"
36 #include "qlayout.h"
37 #else
38 #include <QtCore/QCustomEvent>
39 #include <QtGui/QHBoxLayout>
40 #include <QtGui/QVBoxLayout>
41 #include "q3button.h"
42 #include "q3listview.h"
43 #include "q3buttongroup.h"
44 #include "q3groupbox.h"
45 #include "q3widgetstack.h"
46 #endif
47 
48 #include "qtooltip.h"
49 #include "qcheckbox.h"
50 #include "qcolordialog.h"
51 #include "qcombobox.h"
52 #include "qlineedit.h"
53 #include "qmessagebox.h"
54 #include "qpushbutton.h"
55 #include "qradiobutton.h"
56 #include "qslider.h"
57 #include "qlabel.h"
58 #include "qinputdialog.h"
59 #include "qfontdialog.h"
60 #include "qtabwidget.h"
61 #include "qsettings.h"
62 #include "qstringlist.h"
63 #include "qtextstream.h"
64 
65 
66 #include "colorreps/BinToColor.h"
71 
74 
76 #include "datasrcs/NTuple.h"
77 #include "datasrcs/TupleCut.h"
78 
79 #include "plotters/CutPlotter.h"
80 #include "plotters/TextPlotter.h"
81 
83 
84 #include "reps/ContourPointRep.h"
86 
87 #ifdef HAVE_ROOT
88 #include "root/RootController.h"
89 #include "boost/tokenizer.hpp"
90 #include "boost/lexical_cast.hpp"
91 #endif
92 
93 #include "pattern/string_convert.h"
94 
95 #include <algorithm>
96 #include <stdexcept>
97 
98 #include <cmath>
99 #include <cassert>
100 
101 
102 using std::map;
103 using std::runtime_error;
104 using std::string;
105 using std::vector;
106 
107 using namespace hippodraw;
108 
109 
110 void
112 stringTokenize ( std::string input, const std::string & delimiters,
113  std::vector<std::string> & tokens, bool clear )
114 {
115  if (clear) {
116  tokens.clear();
117  }
118  std::string::size_type j;
119  while ( (j = input.find_first_of(delimiters)) != std::string::npos ) {
120  if (j != 0) {
121  tokens.push_back(input.substr(0, j));
122  }
123  input = input.substr(j+1);
124  }
125  tokens.push_back(input);
126  if (tokens.back() == "") {
127  tokens.pop_back();
128  }
129 }
130 
131 
132 QString Inspector::s_registry ( "/Trolltech" );
133 
134 
136 Inspector ( QWidget * parent, const char * name, bool modal, Qt::WFlags flags )
137  : InspectorBase ( parent, name, modal, flags ),
138  m_plotter ( 0 ),
139  m_is_updating ( false ),
140  m_user_models_loaded ( false )
141 {
142  init ();
144  const vector < string > & names = controller -> getFitterNames ();
145  for ( unsigned int i = 0; i < names.size(); i++ ) {
146  QString name ( names[i].c_str() );
147  m_fitter_names -> insertItem ( name );
148  }
149 #if QT_VERSION < 0x040000
150 #else // correct code generated by uic3 with release 4.1.1
151 // for ( int i = 0; i < 3; i++ ) {
152 // o QAbstractButton * b = axis_button_group -> find ( i );
153 // axis_button_group -> remove ( b );
154 // }
155 // radioButton38 = new QRadioButton(axis_button_group);
156 // radioButton38->setObjectName(QString::fromUtf8("radioButton38"));
157 // radioButton38->setEnabled(true);
158 // radioButton38->setGeometry(QRect(10, 0, 65, 30));
159 // radioButton38->setMinimumSize(QSize(60, 0));
160 // radioButton38->setChecked(true);
161 
162 // radioButton39 = new QRadioButton(axis_button_group);
163 // radioButton39->setObjectName(QString::fromUtf8("radioButton39"));
164 // radioButton39->setEnabled(true);
165 // radioButton39->setGeometry(QRect(80, 0, 65, 30));
166 // radioButton39->setMinimumSize(QSize(65, 0));
167 // radioButton39->setChecked(false);
168 
169 // radioButton40 = new QRadioButton(axis_button_group);
170 // radioButton40->setObjectName(QString::fromUtf8("radioButton40"));
171 // radioButton40->setEnabled(true);
172 // radioButton40->setGeometry(QRect(150, 0, 65, 30));
173 // radioButton40->setMinimumSize(QSize(65, 0));
174 // radioButton40->setChecked(false);
175 
176  // add index change for Qt 4
177  connect ( m_all_ntuples, SIGNAL ( currentIndexChanged ( int ) ),
178  this, SLOT ( dataNTupleSelChanged ( int ) ) );
179 #endif
180 
181 
182  connect ( axisWidget1, SIGNAL ( lowTextReturnPressed() ),
183  this, SLOT ( setLowText() ) );
184 
185  connect ( axisWidget2, SIGNAL ( lowTextReturnPressed() ),
186  this, SLOT ( cutText_returnPressed() ) );
187 
188  connect ( axisWidget1, SIGNAL ( highTextReturnPressed() ),
189  this, SLOT ( setHighText() ) );
190 
191  connect ( axisWidget2, SIGNAL ( highTextReturnPressed() ),
192  this, SLOT ( cutText_returnPressed() ) );
193 
194  connect ( axisWidget1, SIGNAL ( lowSliderReleased() ),
195  this, SLOT ( lowRangeDrag() ) );
196 
197  connect ( axisWidget2, SIGNAL ( lowSliderReleased() ),
198  this, SLOT ( cutLowSlider_sliderReleased() ) );
199 
200  connect ( axisWidget1, SIGNAL ( lowSliderPressed() ),
201  this, SLOT ( setDragOn() ) );
202 
203  connect ( axisWidget1, SIGNAL ( highSliderPressed() ),
204  this, SLOT ( setDragOn() ) );
205 
206  connect ( axisWidget1, SIGNAL ( lowSliderValueChanged ( int ) ),
207  this, SLOT ( setLowRange ( int ) ) );
208 
209  connect ( axisWidget2, SIGNAL ( lowSliderValueChanged ( int ) ),
210  this, SLOT ( cutLowSlider_sliderMoved ( int ) ) );
211 
212  connect ( axisWidget1, SIGNAL ( highSliderReleased() ),
213  this, SLOT ( highRangeDrag() ) );
214 
215  connect ( axisWidget2, SIGNAL ( highSliderReleased() ),
216  this, SLOT ( cutHighSlider_sliderReleased() ) );
217 
218  connect ( axisWidget1, SIGNAL ( highSliderValueChanged ( int ) ),
219  this, SLOT ( setHighRange ( int ) ) );
220 
221  connect ( axisWidget2, SIGNAL ( highSliderValueChanged ( int ) ),
222  this, SLOT ( cutHighSlider_sliderMoved ( int ) ) );
223 
224  connect ( axisWidget1, SIGNAL ( zoomPanCheckBoxClicked () ),
225  this, SLOT ( axisZoomPanCheckBox_clicked () ) );
226 
227  connect ( axisWidget2, SIGNAL ( zoomPanCheckBoxClicked () ),
228  this, SLOT ( cutZoomPanCheckBox_clicked () ) );
229 
230  axisWidget2 -> setCut ( true );
231  // Default position of the sliders is center which corrosponds to
232  // a value of 50. So initialization takes place as 50.
235 
236  updatePlotTypes ();
237 
238 }
239 
242 {
244  delete controller;
245 
246 }
247 
248 void
251 {
252 
253  unsigned int n = 5;
254  m_new_labels.reserve ( n );
255  m_new_labels.push_back ( new_binding_0 );
256  m_new_labels.push_back ( new_binding_1 );
257  m_new_labels.push_back ( new_binding_2 );
258  m_new_labels.push_back ( new_binding_3 );
259  m_new_labels.push_back ( new_binding_4 );
260 
261  m_new_combos.reserve ( n );
262  m_new_combos.push_back ( new_combo_0 );
263  m_new_combos.push_back ( new_combo_1 );
264  m_new_combos.push_back ( new_combo_2 );
265  m_new_combos.push_back ( new_combo_3 );
266  m_new_combos.push_back ( new_combo_4 );
267 
268  m_sel_labels.reserve ( n );
269  m_sel_labels.push_back ( sel_binding_0 );
270  m_sel_labels.push_back ( sel_binding_1 );
271  m_sel_labels.push_back ( sel_binding_2 );
272  m_sel_labels.push_back ( sel_binding_3 );
273  m_sel_labels.push_back ( sel_binding_4 );
274 
275  m_sel_combos.reserve ( n );
276  m_sel_combos.push_back ( sel_combo_0 );
277  m_sel_combos.push_back ( sel_combo_1 );
278  m_sel_combos.push_back ( sel_combo_2 );
279  m_sel_combos.push_back ( sel_combo_3 );
280  m_sel_combos.push_back ( sel_combo_4 );
281 
282  QSize cur_size = size();
283  setFixedSize ( cur_size );
284 
285  m_min_entries = 0;
286  m_rotate_enable = true;
287  m_dragging = false;
288  m_axis = Axes::X;
289  m_layoutWidget = new QWidget( currentPlot, "m_Layout" );
290  m_layoutWidget->setGeometry( QRect ( 7, 75, 360, 0 ) );
291  m_vLayout = new QVBoxLayout( m_layoutWidget, 0, 6, "m_vLayout");
292 
293  newPlotButton->setEnabled( false );
294 
295  m_newLayoutWidget = new QWidget ( m_new_plot_box, "m_newLayout" );
296  m_newLayoutWidget->setGeometry( QRect ( 7, 75, 360, 0 ) );
298  "m_newVLayout");
299 
300  updateValueCombo ();
301 
302  m_interval_le->setDisabled ( true );
303 
304  // Add fixed sized column headers to the function params group box
305  // This we could not do using the designer.
306  m_FunctionParamsListView -> addColumn( QString( "Function" ),40 );
307  m_FunctionParamsListView -> addColumn( QString( "Params" ), 20 );
308  m_FunctionParamsListView -> addColumn( QString( "Value" ), 20 );
309  m_FunctionParamsListView -> addColumn( QString( "Error" ), 20 );
310  m_FunctionParamsListView -> addColumn( QString( "Fixed" ), 3 );
311  m_FunctionParamsListView -> setSorting ( -1 );
312 
313  // vector of QRadioButtons on transform tabbed panel. Needed for
314  // workaround of faulty code generation of Qt 4.1.1
315  m_transform_buttons.push_back ( m_linear );
316  m_transform_buttons.push_back ( m_logy );
317  m_transform_buttons.push_back ( m_logx );
318  m_transform_buttons.push_back ( m_logxy );
319  m_transform_buttons.push_back ( m_hammer );
320  m_transform_buttons.push_back ( m_lambert );
321  m_transform_buttons.push_back ( m_Car );
322  m_transform_buttons.push_back ( m_Mer );
323  m_transform_buttons.push_back ( m_Gls );
324  m_transform_buttons.push_back ( m_Arc );
325  m_transform_buttons.push_back ( m_Tan );
326  m_transform_buttons.push_back ( m_Sin );
327  m_transform_buttons.push_back ( m_Stg );
328  m_transform_buttons.push_back ( m_Air );
329 }
330 
331 void
334 {
336  const vector < string > & names = controller -> getValueTransformTypes ();
337  m_value_combo -> clear ();
338  unsigned int size = names.size ();
339  for ( unsigned int i = 0; i < size; i++ ) {
340  m_value_combo -> insertItem ( names[i].c_str() );
341  }
342 }
343 
344 void
346 enableNewPlotBox ( bool yes )
347 {
348  m_new_plot_box->setEnabled ( yes );
349  m_summary->setEnabled ( yes );
350 }
351 
352 #if QT_VERSION < 0x040000
354 #else
355 void Inspector::customEvent ( QEvent * event )
356 #endif
357 {
358  PlotterEvent * pev = dynamic_cast < PlotterEvent * > ( event );
359  if ( pev != 0 ) {
360  m_plotter = pev -> plotter ();
361  update ();
362  }
363 
365  = dynamic_cast < CanvasSelectionEvent * > ( event );
366  if ( ev != 0 ) {
367  m_plotter_list = ev -> getPlotters ();
368  if ( m_plotter_list.size () == 1 ) {
369  m_plotter = m_plotter_list.front ();
370  }
371  else {
372  m_plotter = 0;
373  }
374  update ();
375  }
376 }
377 
378 PlotterBase *
381 {
382  return m_plotter;
383 }
384 
385 void
387 setZRadioButton ( bool enabled )
388 {
389  if (!enabled && m_axis == Axes::Z )
390  {
391 #if QT_VERSION < 0x040000
392  QButton * b = axis_button_group -> find ( 0 );
393 #else
394  QAbstractButton * b = axis_button_group -> find ( 2 );
395 #endif
396  QRadioButton * button = dynamic_cast< QRadioButton * > ( b );
397  button -> setChecked ( true );
398  m_axis = Axes::X;
399  updateAxisTab ();
400  }
401 
402 #if QT_VERSION < 0x040000
403  QButton * button = axis_button_group -> find ( 2 );
404 #else
405  QAbstractButton * button = axis_button_group -> find ( 2 );
406 #endif
407 
408  button -> setEnabled ( enabled );
409 }
410 
411 void
414 {
415  update ();
416 }
417 
418 void
421 {
422  if ( isHidden() == true ) return;
423  m_is_updating = true;
424  int index = m_plot_tab -> currentPageIndex ();
425 
426  switch ( index )
427  {
428  case ( 0 ) :
429  updateDataTab();
430  break;
431  case ( 1 ) :
432  updatePlotTab();
433  break;
434  case ( 2 ) :
435  updateAxisTab();
436  break;
437  case ( 3 ) :
438  updateCutsTab();
439  break;
440  case ( 4 ) :
442  break;
443  case ( 5 ) :
444  updateSummaryTab ();
445  break;
446  case ( 6 ) :
448  break;
449  default :
450  assert ( false );
451  break;
452  }
453 
454 // if ( m_plotter != 0 ) {
455 // bool hasZ = m_plotter -> hasAxis ( Axes::Z );
456 // setZRadioButton ( hasZ );
457 
458 // }
459 
460  m_is_updating = false;
461  updateCutsActive ();
462 
463 }
464 
465 void
468 {
469  PlotterBase * plotter = getPlotter ();
470  if ( plotter == 0 ) {
471  setAllCutsActive ( true );
472  }
473  else {
474  vector < PlotterBase * > cutlist;
475  CutController * controller = CutController::instance ();
476  controller -> fillCutList ( plotter, cutlist );
477 
478  if ( cutlist.empty () ) {
479  setAllCutsActive ( false );
480  return;
481  }
482  else {
483  setAllCutsActive ( false );
484  vector < PlotterBase * >::iterator first = cutlist.begin();
485  while ( first != cutlist.end () ) {
486  PlotterBase * pb = *first++;
487  CutPlotter * cutter = dynamic_cast < CutPlotter * > ( pb );
488  assert ( cutter );
489  cutter -> setActive ( true );
490  }
491  }
492  }
493 }
494 
495 std::string
498 {
499  string s;
500  const vector < string > & names
501  = DataSourceController::instance () -> getNTupleNames ();
502  int index = m_all_ntuples -> count () == 0 ? -1 : m_all_ntuples -> currentItem ();
503  if ( index >= 0 &&
504  names.empty () == false ) {
505  s = names [ index ];
506  }
507 
508  return s;
509 }
510 
511 void
514 {
515  const vector < string > & nt_vector
516  = DataSourceController::instance() -> getNTupleNames ();
517 
518 
519  if ( nt_vector.empty () ) {
520 
521  m_all_ntuples -> clear ();
522  return;
523  }
524 
525  unsigned int count = m_all_ntuples -> count ();
526  if ( count == nt_vector.size () ) return;
527 
528 #ifdef ITERATOR_MEMBER_DEFECT
529  //std::
530 #endif
531 
532  m_all_ntuples -> clear();
533  vector < string > ::const_iterator first = nt_vector.begin();
534  while ( first != nt_vector.end() ) {
535  const string & name = *first++;
536  m_all_ntuples->insertItem ( name.c_str() );
537  }
538 
539  if ( m_all_ntuples -> count () != 0 ) {
540  const string & name = nt_vector.back ();
541 
542  setNewPlotNTuple ( name );
543 
544 
545  availPlotTypesActivated ( name.c_str() );
546 
547  }
548  else {
549  availPlotTypesActivated ( QString::null );
550 
551  }
552 }
553 
554 void
556 setNewPlotNTuple ( const std::string & name )
557 {
558  const vector < string > & nt_vector
559  = DataSourceController::instance() -> getNTupleNames ();
560 
561  for ( unsigned int i = 0; i < nt_vector.size(); i++ ) {
562  if ( nt_vector[i] == name ) {
563  unsigned int current = m_all_ntuples -> currentItem ();
564  if ( current != i ) {
565  m_all_ntuples -> setCurrentItem ( i );
566  }
567  break;
568  }
569  }
570 
571  // Update tip tool.
573  const QString tip=getSelectedDataSourceName().c_str();
575 
576 }
577 
578 void
581 {
582  m_last_ntuple_edited = m_all_ntuples -> currentItem ();
583 
584 }
585 
586 void
588 changeNTupleName ( const QString & text )
589 {
591  vector < DataSource * > nt_vector;
592  controller -> getDataSources ( nt_vector ); // get all
593  DataSource * ds = nt_vector [ m_last_ntuple_edited ];
594  if ( ds == 0 ) return;
595 
596  const string new_name = text.latin1();
597 
598  ds -> setName ( new_name );
599 }
600 
601 void
604 {
606  controller -> setCurrentIndex ( item );
607 
608  m_all_ntuples -> setCurrentItem ( item );
609  QString text ( "" );
610 
611  availPlotTypesActivated ( text );
612 
613  // Update tip tool.
615  const QString tip=getSelectedDataSourceName().c_str();
617 
618 }
619 
620 void
623 {
624  // Change the number and type of axes depending on what is selected
625  // inside m_availPlotTypes. Then insert the axis labels based on the
626  // selection of nTupleNameComboBox.
627 
628  changeNTupleName ( text );
629  m_all_ntuples -> setCurrentItem ( m_last_ntuple_edited );
630  m_all_ntuples -> changeItem ( text, m_last_ntuple_edited );
631 
633  int index = m_all_ntuples -> currentItem ();
634  controller -> setCurrentIndex( index );
635 
636  availPlotTypesActivated ( text );
637 }
638 
639 void
642 {
643  axisLabelChanged ( 0, label );
644 }
645 
646 void
649 {
650  axisLabelChanged ( 1, label );
651 }
652 
653 void
656 {
657  axisLabelChanged ( 2, label );
658 }
659 
660 void
663 {
664  axisLabelChanged ( 3, label );
665 }
666 
667 void
669 axisLabelChanged ( int index, const QString & label )
670 {
671  if ( m_plotter_list.size () > 1 ) {
673  return;
674  }
675 
676  PlotterBase * plotter = getPlotter ();
677  if ( !plotter ) return ;
678 
679  QString axisName = m_sel_labels [index] -> text();
680  const std::string strAxisName ( axisName.latin1() );
681  const std::string strLabel( label.latin1() );
682 
684  controller -> setAxisBinding ( plotter, strAxisName, strLabel );
685 
686  bool valid = controller -> isDataValid ( plotter );
687  if ( valid == false ) {
689  }
690 }
691 
692 void
695 {
696  const vector < string > & dataRepNames
697  = DisplayController::instance() -> getDisplayTypes ();
698  if ( dataRepNames.empty () ) return;
699  unsigned int size = m_availPlotTypes -> count ();
700 
701  if ( dataRepNames.size() != size ) {
703 
704  vector < string > ::const_iterator first = dataRepNames.begin ();
705  while ( first != dataRepNames.end() ) {
706  const string & name = *first++;
707  if ( name.find ( "Static" ) != string::npos ) continue;
708  m_availPlotTypes->insertItem ( name.c_str() );
709  }
710  m_availPlotTypes->setCurrentItem ( 2 ); //Histogram
711  }
712 
713  newPlotButton->setEnabled( true );
714 }
715 
716 void
718 clear ( std::vector < QLabel * > & labels,
719  std::vector < QComboBox * > & combos )
720 {
721  unsigned int size = combos.size ();
722  for ( unsigned int i = 0; i < size; i++ ) {
723  QComboBox * box = combos [ i ];
724  box -> clear ();
725  box -> setEnabled ( false );
726  QLabel * label = labels [ i ];
727  label -> setEnabled ( false );
728  }
729 }
730 
731 void
734 {
735  int index = m_all_ntuples -> count () == 0 ? -1 : m_all_ntuples -> currentItem ();
736  vector < DataSource * > nt_vector;
737  DataSourceController::instance() -> getDataSources ( nt_vector );
738 
739 
740  int size = static_cast < int > ( nt_vector.size() );
741  if ( size == 0 ) {
743  return;
744  }
745 
746 
747  if ( ! (index < size ) ) {
748  index = 0;
749  }
750  std::string plotTypeStr( (m_availPlotTypes->currentText()).latin1() );
751 
753 
754  const vector < string > & bindingOptions
755  = controller -> bindingOptions ( plotTypeStr );
756 
757  if ( bindingOptions.empty () ) return;
758 
759  //Layout the stuff.
760 
762 
763  vector < int > indices;
764  unsigned int s = m_new_combos.size ();
765  for ( unsigned int i = 0; i < s; i++ ) {
766  indices.push_back ( m_new_combos[i] -> currentItem () );
767  }
769  QString qs1;
770 
771  if ( index >= 0 ) {
772  DataSource * nt = nt_vector[index];
773  const vector < string > & cols = nt->getLabels();
774 
775  for ( unsigned int i = 0; i < m_new_combos.size (); i++ ) {
776  if ( i < bindingOptions.size () ) {
777  const string & axisName = bindingOptions[i];
778 
779  qs1 = ( axisName.c_str() );
780  m_new_labels [i] -> setEnabled ( true );
781  m_new_labels [i] -> setText ( qs1 );
782  m_new_combos [i] -> setEnabled ( true );
783  for (std::vector<string>::size_type j = 0; j < cols.size(); j++){
784  m_new_combos [i] -> insertItem ( cols [j].c_str() );
785  }
786 
787  if ( axisName.find ( "optional" ) != string::npos ) {
788  m_new_combos [i] -> insertItem ( "nil" );
789  m_new_combos [i] -> setCurrentText ( "nil" );
790  indices[i] = -1;
791  }
792  }
793  }
794  }
795 
796 
797  for ( unsigned int i = 0; i < m_new_combos.size(); i++ ) {
798 
799 
800  if ( indices[i] >= 0 &&
801  indices[i] < m_new_combos[i] -> count () ) {
802  m_new_combos[i] ->setCurrentItem ( indices[i] );
803  }
804  }
805 
806 }
807 
808 void
811 {
812 
813 
815 
816 
818 
819 
820  PlotterBase * plotter = getPlotter ();
821  updateSelectedPlotType ( plotter );
822 
823 
824 
825  if ( plotter != 0 ) {
826 
827  currentPlot->setEnabled ( true );
828  bool yes = plotter -> isTargetable ();
829  if ( yes == false ) return;
830  }
831  else {
832 
833  if ( m_plotter_list.empty () == true ) {
834 
835  currentPlot -> setDisabled ( true );
836  }
837  else {
838 
839  currentPlot -> setDisabled ( false );
840  }
841 
842  return;
843  }
844 
845 
846 
847  updateSelectedPlotData ( plotter );
848 
849 
850 
851 
852 }
853 
854 void
856 updateSelectedPlotDataSource ( const std::string & name )
857 {
858  const vector < string > & nt_vector
859  = DataSourceController::instance () -> getNTupleNames ();
860 
861  unsigned int size = nt_vector.size ();
862  unsigned int count = m_sel_ntuple_name -> count ();
863  bool refresh = count != size;
864  if ( refresh ) m_sel_ntuple_name -> clear ();
865  int jndex = -1;
866  for ( std::size_t i = 0; i < size; i++ ) {
867  const string & ntname = nt_vector[i];
868  if ( ntname == name ) jndex = i;
869  if ( refresh ) m_sel_ntuple_name -> insertItem ( ntname.c_str () );
870  }
871 
872  if ( jndex < 0 ) { // not bound to ntuple
873  m_sel_ntuple_name -> setEnabled ( false );
874  }
875  else {
876  m_sel_ntuple_name -> setEnabled ( true );
877  m_sel_ntuple_name -> setCurrentItem ( jndex );
878  }
879  // Update tip tool.
881  const QString tip = m_sel_ntuple_name -> currentText ();
883 
884 
885 }
886 
887 void
890 {
891  bool yes = plotter != 0;
892  if ( yes ) {
893  yes = plotter -> isTargetable ();
894  if ( yes ) {
895  DataRep * datarep = plotter -> getTarget ();
896  yes = datarep != 0;
897  if ( yes ) {
898  int index = plotter -> indexOf ( datarep );
900  const string & dataRepName
901  = controller -> getType ( plotter, index );
902  QString qst2 ( dataRepName.c_str() );
903  m_dataRepNameText->setText ( qst2 );
904  }
905  }
906  }
907 
908  m_dataRepNameText -> setEnabled ( yes );
909 }
910 
911 void
914 {
915  QLayoutIterator it = m_vLayout->iterator();
916  while ( it.current() != 0 )
917  {
918  QLayoutItem * ptr = it.current();
919  QHBoxLayout * hbox = static_cast <QHBoxLayout *> (ptr);
920 
921  QLayoutIterator hit = hbox->iterator();
922  while ( hit.current() != 0 )
923  {
924  QLayoutItem * hptr = hit.current();
925  QWidget * hwidget = hptr->widget();
926  hit.deleteCurrent();
927  if ( hwidget ) delete ( hwidget );
928  }
929 
930  it.deleteCurrent();
931 
932  }
933 }
934 
935 void
938 {
940  DataRep * datarep = plotter -> getTarget ();
941  int index = plotter -> indexOf ( datarep );
942  assert ( datarep != 0 );
943 
944  bool ntuple_bindings = datarep -> hasNTupleBindings ( );
945  string name;
946 
947  if ( ntuple_bindings ) {
948  name = controller -> getDataSourceName ( plotter, index );
949  setNewPlotNTuple ( name );
950  }
951  else {
952  name = "<none>";
953  }
955 
956  //Layout the stuff.
957 
958  m_layoutWidget->hide();
959 
960  const vector < string > & bindings
961  = controller -> axisBindings ( plotter, index );
962  const vector < string > & bindingOptions
963  = controller -> bindingOptions ( plotter, index );
964  unsigned int listSize;
965 
966  if ( bindings.size() < bindingOptions.size() )
967  {
968  listSize = bindings.size();
969  }
970  else
971  {
972  listSize = bindingOptions.size();
973  }
974 
975  bool yes = plotter -> isTargetable ();
976  if ( ntuple_bindings == false ||
977  yes == false ) return;
978 
979  // Now add the new hlayouts.
980 
981  QString qs1, qs2;
982 
983  const vector < string > & cols
984  = controller -> getDataSourceLabels ( plotter, index );
985 
986  if ( cols.empty () ) return;
987 
989 
990  for ( unsigned int i = 0; i < m_sel_combos.size (); i++ )
991  {
992  if ( i == listSize ) break;
993  const string & axisLabel = bindings[i];
994  const string & axisName = bindingOptions[i];
995 
996  qs1 = ( axisName.c_str() );
997  m_sel_labels [i] -> setEnabled ( true );
998  m_sel_labels [i] -> setText ( qs1 );
999 
1000  qs2 = ( axisLabel.c_str() );
1001 
1002  // Insert all column labels from the vector cols, and make qs2
1003  // the current text.
1004 
1005  m_sel_combos [i] -> setEnabled ( true );
1006  for (std::vector<string>::size_type j = 0; j < cols.size(); j++ )
1007  {
1008  m_sel_combos [i] -> insertItem ( cols [j].c_str() );
1009  }
1010  if ( axisName.find ( "optional" ) != string::npos )
1011  {
1012  m_sel_combos [i] -> insertItem ( "nil" );
1013  }
1014  m_sel_combos [i] -> setCurrentText ( qs2 );
1015  }
1016 }
1017 
1018 void
1021 {
1022  const QString message =
1023  "One or more columns of the bound data source\n"
1024  "contains invalid data.";
1025  QMessageBox::warning ( this, // parent
1026  "Invalid data", // caption
1027  message,
1028  QMessageBox::Ok,
1029  Qt::NoButton,
1030  Qt::NoButton );
1031 }
1032 
1033 void
1036 {
1037  const QString message =
1038  "No n-tuple selected error\n"
1039  "Need to load n-tuple to create a plot";
1040  QMessageBox::critical ( this, // parent
1041  "No n-tuple selected error", // cpation
1042  message,
1043  QMessageBox::Ok,
1044  Qt::NoButton,
1045  Qt::NoButton );
1046 }
1047 
1048 void
1050 incompatibleDataRepError ( const std::string & type )
1051 {
1052  QString message ("Plot of type " );
1053  message += type.c_str();
1054  message += " can not be added\n"
1055  "to selected plot\n\n"
1056  "It might be incompatible. For example, \n"
1057  "requiring a Z axis display while selected\n"
1058  "does not have one.";
1059  QMessageBox::critical ( this, // parent
1060  "Add to plot error", // caption
1061  message,
1062  QMessageBox::Ok,
1063  Qt::NoButton,
1064  Qt::NoButton );
1065 }
1066 void
1068 incompatibleFitterError ( const std::string & type )
1069 {
1070  QString message ( "Fitter of type " );
1071  message += type.c_str();
1072  message += " can not be used\n"
1073  "with selected plot\n\n"
1074  "It might be incompatible. For example, \n"
1075  "Maximum Likelihood fitting requires binned\n"
1076  "data representation.";
1077  QMessageBox::critical ( this, // parent
1078  "Set fitter error", // caption
1079  message,
1080  QMessageBox::Ok,
1081  Qt::NoButton,
1082  Qt::NoButton );
1083 }
1084 
1085 void
1087 badFunctionError ( const std::string & name, const char * what )
1088 {
1089  QString message = "Function`";
1090  message += name.c_str();
1091  message += "' could not be used because ...\n";
1092  message += what;
1093  message +="\nMaybe the copy constructor or clone function is bad.";
1094 
1095  QMessageBox::critical ( this, // parent
1096  "Function error", // caption
1097  message,
1098  QMessageBox::Ok,
1099  Qt::NoButton,
1100  Qt::NoButton );
1101 }
1102 
1103 void
1105 incompatibleFunctionError ( const std::string & type )
1106 {
1107  QString message ( "Funtion of type " );
1108  message += type.c_str();
1109  message += " can not be used\n"
1110  "with selected fitter\n\n"
1111  "It might be incompatible. For example, \n"
1112  "the fitter requires derivatives\n"
1113  "that the function can not supply.";
1114  QMessageBox::critical ( this, // parent
1115  "Set fitter error", // caption
1116  message,
1117  QMessageBox::Ok,
1118  Qt::NoButton,
1119  Qt::NoButton );
1120 }
1121 
1122 void
1124 invalidRangeError ( const std::string & bad )
1125 {
1126  QString message ( "Attempt to apply invalid range:\n\n" );
1127  message += bad.c_str();
1128  message += "\n\n Low end of range must be less than high end.";
1129 
1130  QMessageBox::critical ( this, // parent
1131  "Range error", // caption
1132  message,
1133  QMessageBox::Ok,
1134  Qt::NoButton,
1135  Qt::NoButton );
1136 }
1137 
1138 void
1140 multipleDataRepError ( const std::string & type )
1141 {
1142  QString message ( "Multiple data representations are active.\n"
1143  "Can not apply a " );
1144  message += type.c_str();
1145 #ifdef Q_OS_MACX
1146  message += ".\n\n"
1147  "Use Command-click to select only one data representation.";
1148 #else
1149  message += ".\n\n"
1150  "Use Control-click to select only one data representation.";
1151 #endif
1152  QMessageBox::information ( this, // parent
1153  "Multiple data representation error", // caption
1154  message,
1155  QMessageBox::Ok,
1156  Qt::NoButton,
1157  Qt::NoButton );
1158 }
1159 
1160 bool
1162 multipleDataRepInfo ( const std::string & type )
1163 {
1164  bool ok = false;
1165  QString message ( "Multiple data representations are active.\n"
1166  "Apply " );
1167  message += type.c_str();
1168  message += " to each?\n\n";
1169 
1170 #ifdef Q_OS_MACX
1171  message += "One can use Control-click to apply a ";
1172 #else
1173  message += "One can use Command-click to apply a ";
1174 #endif
1175  message += type.c_str();
1176  message +=" to a selected data representation.";
1177 
1178  int result = QMessageBox::
1179  information ( this, // parent
1180  "Multiple data representation error", // caption
1181  message,
1182  QMessageBox::Yes,
1183  QMessageBox::No,
1184  QMessageBox::NoButton );
1185 
1186  ok = result == QMessageBox::Ok;
1187 
1188  return ok;
1189 }
1190 
1191 void
1194 {
1195  const QString message ( "Attempt to add cut to itself\n"
1196  "The request was ignorned" );
1197  QMessageBox::information ( this, // parent
1198  "Applying cut error", // caption
1199  message,
1200  QMessageBox::Ok,
1201  Qt::NoButton,
1202  Qt::NoButton );
1203 }
1204 
1205 void
1208 {
1209  const QString message (
1210  "Multiple plots are selected.\n"
1211  "Can not apply change until only one is selected\n\n"
1212  "Use shift-click to deselect a selected plot" );
1213  QMessageBox::information ( this, // parent
1214  "Multiple plot error", // caption
1215  message, // .c_str(),
1216  QMessageBox::Ok,
1217  Qt::NoButton,
1218  Qt::NoButton );
1219 }
1220 
1222 {
1223  const QString message =
1224  "Functions are not supported on the selected data reaxisWitation.";
1225 
1226  QMessageBox::critical ( this, "Function Add Error",
1227  message,
1228  QMessageBox::Ok,
1229  Qt::NoButton,
1230  Qt::NoButton );
1231 }
1232 
1236 void
1238 newPlotError ( const std::exception & e )
1239 {
1240  QString message ( "New plot could not be created because:\n" );
1241  message += e.what ();
1242  QMessageBox::critical ( this, // parent
1243  "New plot error", // caption
1244  message,
1245  QMessageBox::Ok,
1246  Qt::NoButton,
1247  Qt::NoButton );
1248 }
1249 
1250 std::string
1252 getArrayTupleLabel( const DataSource * rtuple, const std::string & column )
1253 {
1254 #ifdef HAVE_ROOT
1255  RootController * controller = RootController::instance ();
1256  vector < int > dimSize;
1257  controller -> fillDimSize ( dimSize, rtuple, column );
1258 
1259  // Set the caption
1260  QString caption( "MultiDimensional data in rows of the column ");
1261  caption.append( QString( column.c_str() ) );
1262 
1263  // Set the label
1264  std::ostringstream ost;
1265  ost << " Rows of this column are of size ";
1266 
1267  unsigned int i;
1268  for( i = 0; i < dimSize.size() - 1; i++ )
1269  ost << dimSize[i] << " x ";
1270  ost << dimSize[i];
1271 
1272  ost << "\n Enter C-style index of a single element of this";
1273  ost << "\n multidimentional data which you wish to analyse.";
1274  ost << "\n Index should be a comma separated list of ";
1275  ost << dimSize.size() << " integers.";
1276 
1277  ost << "\n For e.g. ";
1278  for( i = 0; i < dimSize.size() - 1; i++ )
1279  ost << "0, ";
1280  ost << "0 \n";
1281 
1282  string label( ost.str() );
1283 
1284  bool ok;
1285  QString text = QInputDialog::getText( caption, QString( label.c_str() ),
1287  QString::null, &ok, this );
1288 
1289  // Also create the array tuple label
1290  std::ostringstream labelstream;
1291  labelstream << column;
1292 
1293  if ( ok && !text.isEmpty() )
1294  {
1295  vector< unsigned int > index;
1296  string s( text.ascii() );
1297 
1298  // User entered something and pressed OK
1299  // Creating the list of dropped delimiters.
1300  boost::char_separator< char > sep( "," );
1301 
1302  // A tokenizer with above dropped delimiters.
1303  typedef boost::tokenizer< boost::char_separator< char > > tokenizer;
1304  tokenizer tok( s, sep );
1305 
1306  // Start extracting the dimension sizes.
1307  for( tokenizer::iterator tok_iter = tok.begin();
1308  tok_iter != tok.end();
1309  ++tok_iter )
1310  {
1311  unsigned int idx = boost::lexical_cast< unsigned int >( *tok_iter );
1312  index.push_back( idx );
1313  labelstream << "[" << idx << "]";
1314  }
1315  }
1316 
1317  return labelstream.str();
1318 #else
1319  return string(); // will not be used.
1320 #endif
1321 }
1322 
1323 void
1326 {
1327  vector < DataSource * > nt_vector;
1328  DataSourceController::instance() -> getDataSources ( nt_vector );
1329 
1330  if ( nt_vector.empty() )
1331  {
1333  return;
1334  }
1335 
1336  // See all comboboxes and create a new plotter.
1337  int current = m_all_ntuples->currentItem ();
1338  DataSource * ds = nt_vector[current];
1339 
1340  // Find the datarep.
1341  std::string plotTypeStr( (m_availPlotTypes -> currentText()).latin1() );
1342 
1343  // Find the axis bindings.
1344  vector < string > bindings;
1345  for ( unsigned int i = 0; i < m_new_combos.size(); i++ )
1346  {
1347  if ( m_new_combos [i] -> count () == 0 ) break;
1348 
1349  QString qstring = m_new_combos [ i ] -> currentText();
1350  string column ( qstring.latin1() );
1351  string label = column;
1352 
1353 #ifdef HAVE_ROOT
1354  if( column != "nil" && ds -> isMultiDimensional( column ) ) {
1355  bool yes = ds -> isUseable ( column );
1356  if ( yes == false ) {
1357  const QString
1358  message ( "This column is not useable because it contains\n"
1359  "a multidimension array that varies is size or is\n"
1360  "an unsupported data type." );
1361  QMessageBox::critical ( this, // parent
1362  "DataSource error",
1363  message,
1364  QMessageBox::Ok,
1365  QMessageBox::NoButton,
1366  QMessageBox::NoButton );
1367  return;
1368  }
1369 
1370  label = getArrayTupleLabel ( ds, column );
1371  RootController * rcontroller = RootController::instance();
1372  rcontroller -> smartExpandRootNTuple ( ds, column );
1373  }
1374 #endif
1375  bindings.push_back ( label );
1376  }
1377 
1378  // Create the plotter.
1379  try {
1381  PlotterBase * newDisplay =
1382  controller -> createDisplay ( plotTypeStr, * ds, bindings );
1383  CanvasWindow * canvas = WindowController::instance() -> currentCanvas();
1384  canvas->addPlotDisplay ( newDisplay, true );
1385 
1386  bool valid = controller -> isDataValid ( newDisplay );
1387  if ( valid == false ) {
1388  invalidDataWarning ();
1389  }
1390  }
1391 // catch ( const DataSourceException & e ) {
1392  catch ( const std::exception & e ) {
1393  newPlotError ( e );
1394  }
1395 }
1396 
1397 
1398 void
1401 {
1402  // Find the display.
1403 
1404  PlotterBase * plotter = getPlotter ();
1405  if ( !plotter ) return;
1406 
1407  // Find the datarep.
1408  std::string plotTypeStr( (m_availPlotTypes->currentText()).latin1() );
1409 
1410  vector < DataSource * > nt_vector;
1411  DataSourceController::instance() -> getDataSources ( nt_vector );
1412 
1413  int current = m_all_ntuples->currentItem ();
1414  DataSource * ds = nt_vector[current];
1415 
1416  // Find the axis bindings.
1417 
1418  vector < string > bindings;
1419  for ( unsigned int i = 0; i < m_new_combos.size(); i++ )
1420  {
1421  if ( m_new_combos [i] -> count () == 0 ) break;
1422 
1423  QString qstring = m_new_combos [ i ] -> currentText();
1424  string column ( qstring.latin1() );
1425  string label = column;
1426 #ifdef HAVE_ROOT
1427  if ( column != "nil" && ds -> isMultiDimensional ( column ) ) {
1428  label = getArrayTupleLabel ( ds, column );
1429  RootController * rcontroller = RootController::instance ();
1430  rcontroller -> smartExpandRootNTuple ( ds, column );
1431  }
1432 #endif
1433  bindings.push_back ( label );
1434  }
1435 
1436  // Add the data rep.
1437 
1439  DataRep * rep = controller -> addDataRep ( plotter, plotTypeStr, ds,
1440  bindings );
1441 
1442  // If incompatible, do nothing.
1443  if ( rep == 0 )
1444  {
1445  incompatibleDataRepError ( plotTypeStr );
1446  return;
1447  }
1448 
1449  rep->set(Color::getColor());
1450 
1451  plotter -> autoScale ();
1452  bool valid = controller -> isDataValid ( rep );
1453  if ( valid == false ) {
1454  invalidDataWarning ();
1455  }
1456 
1457  update ();
1458 }
1459 
1460 void
1463 {
1464  PlotterBase * plotter = getPlotter ();
1465  if ( !plotter ) return;
1466 
1467  int num_active = plotter->activePlotIndex();
1468  int num_rep = plotter -> getNumDataReps();
1469 
1470  // If more than one active datarep or only one datarep
1471  // in the plot, show warning message and do nothing.
1472  if (( num_active < 0) || ( num_rep <= 1 ))
1473  {
1474  const QString message=
1475  "You must have more than one DataReps \n"
1476  "in this view AND only one DataRep \n"
1477  "selected to be removed.";
1478 
1479  QMessageBox::warning ( this, // parent
1480  "Unable to remove DataRep", // caption
1481  message,
1482  QMessageBox::Ok,
1483  Qt::NoButton,
1484  Qt::NoButton );
1485  return;
1486  }
1487 
1488  DataRep * rep = plotter -> getDataRep( num_active );
1489  //Reset index before remove the datarep.
1490  plotter->setActivePlot(-1,false);
1491  plotter -> removeDataRep ( rep );
1492  plotter -> autoScale ();
1493  delete rep;
1494 
1495  update();
1496 }
1497 
1498 
1499 void
1502 {
1503  const PlotterBase * plotter = getPlotter ();
1504  if ( plotter == 0 ) return;
1506  NTuple * ntuple = fc -> createNTuple ( plotter, 0 );
1507  DataSourceController::instance () -> registerNTuple ( ntuple );
1508 
1509  update ();
1510 }
1511 
1512 
1513 void
1515 fillPlotterList ( std::vector < PlotterBase * > & plotterlist )
1516 {
1517  plotterlist.clear();
1519 
1520  if ( canvaz != 0 ) {
1521  canvaz -> fillPlotterList ( plotterlist );
1522  }
1523 }
1524 
1525 void
1527 ntupleChanged ( int index )
1528 {
1529  // Update tip tool.
1531  const QString tip = m_sel_ntuple_name -> currentText ();
1533 
1534  unsigned int size = m_plotter_list.size ();
1535  if ( size == 0 ) return;
1536 
1537  CutController * controller = CutController::instance ();
1538  vector < PlotterBase * > web;
1539  controller -> fillCutWeb ( m_plotter_list, web );
1540  size = web.size ();
1541 
1542  for ( unsigned int i = 0; i < size; i++ ) {
1543  PlotterBase * plotter = web [ i ];
1544  bool yes = plotter != 0;
1545  if ( yes ) yes = plotter -> isTargetable ();
1546  if ( yes == false ) continue;
1547 
1548  DataRep * rep = plotter -> getTarget ();
1549  yes = rep -> hasNTupleBindings ();
1550  if ( yes == false ) continue;
1551 
1553  const vector < string > & names = ds_controller -> getNTupleNames ();
1554  const string & ds_name = names [ index ];
1555  const DataSource * source = ds_controller -> getDataSource ( ds_name );
1556  DataRepController * dr_controller = DataRepController::instance ();
1557 
1558  try {
1559  dr_controller -> changeDataSource ( rep, source );
1560  }
1561  catch ( const runtime_error & e ) {
1562  QString message ( "Could not change binding because\n" );
1563  message += e.what ();
1564  QMessageBox::critical ( this, // parent
1565  "Data source error",
1566  message,
1567  QMessageBox::Ok,
1568  Qt::NoButton,
1569  Qt::NoButton );
1570  }
1571  }
1572 }
1573 
1574 void
1577 {
1579 
1580  const vector < double > & sv =
1581  controller -> getValueCtrlPts ( plotter );
1582  unsigned int size = sv.size ();
1583  if ( size > 0 ) {
1584  brk_pt -> setEnabled ( true );
1585  brk_label -> setEnabled ( true );
1586  brk_pt -> setValue ( static_cast <int> ( sv[0] * brk_pt -> maxValue() ));
1587  }
1588  if ( size > 1 ) {
1589  flat_width -> setEnabled ( true );
1590  flatlabel -> setEnabled ( true );
1591  flat_width->setValue(static_cast <int>( sv[1] * flat_width->maxValue()));
1592  }
1593  if ( size > 2 ) {
1594  color_scale -> setEnabled ( true );
1595  colorlabel -> setEnabled ( true);
1596  color_scale->setValue(static_cast<int>( sv[2] * color_scale->maxValue()));
1597  }
1598  if ( size < 3 ) {
1599  color_scale -> setEnabled ( false );
1600  colorlabel -> setEnabled ( false);
1601  }
1602  if ( size < 2 ) {
1603  flat_width -> setEnabled ( false );
1604  flatlabel -> setEnabled ( false );
1605  }
1606  if ( size < 1 ) {
1607  brk_pt -> setEnabled ( false );
1608  brk_label -> setEnabled ( false );
1609  }
1610 }
1611 
1615 void
1618 {
1619 
1620  loadAllUserModels ();
1621 
1622  bool yes = m_plotter_list.empty();
1623 
1624  m_plot_title -> setDisabled ( yes );
1625 
1626  PlotterBase * plotter = getPlotter ();
1627 
1628  yes = plotter != 0;
1629  if ( yes ) {
1630  int number = plotter -> getNumDataReps ();
1631  int index = plotter -> activePlotIndex ();
1632  yes = ( number < 2 ) || index >= 0;
1633  }
1634 
1635  m_plot_symbols->setEnabled ( yes );
1636 // m_plot_color->setEnabled ( yes );
1637 // m_selectedColor -> setEnabled ( yes );
1638  m_interval_le->setEnabled ( yes );
1639  m_interval_cb->setEnabled ( yes );
1640  m_errorBars ->setEnabled ( yes );
1641  m_grid -> setEnabled ( yes );
1642  m_boxedge->setEnabled ( yes );
1643  m_pointRepComboBox->setEnabled ( yes );
1644  if ( yes == false ) {
1645  m_selectedColor->setPaletteBackgroundColor ( "black" );
1646  return;
1647  }
1648 
1649 
1650  // Point Reps stuff.
1651 
1653 
1655 
1656  DataRep * datarep = controller -> activeDataRep ( plotter );
1657 
1658  assert ( datarep != 0 );
1659 
1660  yes = datarep -> hasErrorDisplay ();
1661  m_errorBars -> setEnabled ( yes );
1662 
1663  ProjectorBase * proj = datarep -> getProjector();
1664 
1665  if ( proj != 0 ) {
1666  const vector <string> & pointreps = proj -> getPointReps();
1667 
1668 
1669  if ( pointreps.empty () == false ) {
1670  for (std::vector<string>::size_type i = 0; i < pointreps.size(); i++ ) {
1671 
1672 
1673  m_pointRepComboBox->insertItem ( pointreps[i].c_str() );
1674  }
1675  }
1676  RepBase * rep = datarep->getRepresentation();
1677 
1678  const string & curRep = rep->name();
1679  m_pointRepComboBox->setCurrentText ( curRep.c_str() );
1680  }
1681 
1682  if ( plotter -> hasAxis ( Axes::Z ) == false ) { // no Z axis (colormap)
1683  m_value_combo -> setDisabled ( true );
1684  m_slider_control -> setDisabled ( true );
1685  }
1686  else { // has z axis (colormap)
1687 
1688  int jndex = controller -> getValueTransformIndex ( plotter ); // return the index to the list
1689 
1690 
1691  // of value to color transform names of the plotter. from 0 to size-1
1692  if ( jndex < 0 ) { // no value available, jndex=-1
1693  m_value_combo -> setDisabled ( true );
1694  }
1695  else {
1696  m_value_combo -> setEnabled ( true );
1697  m_value_combo -> setCurrentItem ( jndex );
1698 
1699  // ***************************
1700  const BinToColor * repp=plotter -> getValueRep ();
1701 
1702  if (repp != 0) {
1703  bool yess = repp -> acceptChangeColor ();
1704  m_plot_color -> setEnabled (yess);
1705  m_selectedColor -> setEnabled (yess);
1706  }
1707  // *****************************
1708 
1709  bool yes = controller -> hasControlPoints ( plotter ); //return true if the value to color transform has control points
1710  m_slider_control -> setEnabled ( yes );
1711  yes = controller -> isUserDefinedValueTransform ( plotter );
1712  edit_model -> setEnabled ( yes );
1713  updateColorMapCtrls ( plotter );
1714  }// end of jndex<0
1715  }// end of plotter -> hasAxis ( Axes::Z ) == false
1716 
1717  // data source
1718  const DataSource * nt = controller -> getDataSource ( plotter, 0 );
1719 
1720  if ( nt && nt -> empty () ) {
1721  m_plot_symbols->setDisabled ( true );
1722  m_plot_title->setDisabled ( true );
1723  m_plot_color->setDisabled ( true );
1724  m_selectedColor -> setDisabled ( true );
1725  return;
1726  }
1727 
1728  //title
1729  const std::string & st = plotter->getTitle();
1730  QString qst ( st.c_str() );
1731  m_titleText->setText ( qst );
1732 
1733  // error bar and show grid checkbox
1734  m_errorBars->setChecked ( plotter->errorDisplay ( Axes::Y ) );
1735  m_grid->setChecked ( plotter->getShowGrid () );
1736  m_boxedge->setChecked (plotter->getBoxEdge ());
1737 
1738  // whether use symbols(triangle,plus,circle...) to represent data
1739  yes = controller -> hasSymbolRep ( plotter );
1740  m_symbol_group -> setEnabled ( yes );
1741 
1742  if ( yes ) {
1743  m_point_stack -> raiseWidget ( 0 );
1744  unsigned int index = controller ->getRepStyle ( plotter );
1745  m_symbol_group -> setButton ( index );
1746  }
1747 
1748  // whether use line(solid, dash...)to represent data
1749  yes = controller -> hasLineRep ( plotter );
1750  m_line_group -> setEnabled ( yes );
1751  if ( yes ) {
1752  m_point_stack -> raiseWidget ( 1 );
1753  unsigned int style = controller -> getRepStyle ( plotter );
1754 #if QT_VERSION < 0x040000
1755  QButton * button = m_line_group -> find ( style );
1756 #else
1757  QAbstractButton * button = m_line_group -> find ( style );
1758 #endif
1759  QRadioButton * rb = dynamic_cast < QRadioButton * > ( button );
1760  rb -> setChecked ( true );
1761  }
1762  // set the point size
1763  float ptsize = controller -> pointSize ( plotter );
1764  m_symbolPointSize -> setText ( QString ("%1").arg (ptsize) );
1765 
1766  // set color the user choose by RGB
1767  const Color & color = plotter->repColor ();
1768  QColor qcolor ( color.getRed(), color.getGreen(), color.getBlue () ); // constructor
1769  m_selectedColor->setPaletteBackgroundColor ( qcolor );
1770 
1771  // display interval
1772  if ( nt == 0 ) {
1773  m_interval_cb -> setEnabled ( false );
1774  m_interval_le -> setEnabled ( false );
1775  return;
1776  }
1777  const NTuple * ntuple = dynamic_cast < const NTuple * > ( nt );
1778  yes = ntuple != 0 && ntuple -> isIntervalEnabled ();
1779  m_interval_cb->setChecked ( yes );
1780  m_interval_le->setEnabled ( yes );
1781 
1782  if ( yes ) {
1783  unsigned int count = ntuple->getIntervalCount ();
1784  m_interval_le->setText ( QString ("%1").arg ( count ) );
1785  }
1786 }
1787 
1788 void
1790 valueChanged ( int index )
1791 {
1792  PlotterBase * plotter = getPlotter ();
1793  if ( plotter != 0 ) {
1794 
1796  controller -> setValueTransform ( plotter, index );
1797 
1798  const BinToColor * rep = plotter -> getValueRep();
1799  bool yes = false;
1800  if ( rep != 0 ) {
1801  yes = rep -> acceptChangeColor ();
1802  }
1803  m_plot_color -> setEnabled ( yes );
1804  m_selectedColor -> setEnabled ( yes );
1805 
1806  yes = controller -> hasControlPoints ( plotter );
1807  m_slider_control -> setEnabled ( yes );
1808  bool y = rep -> isUserDefined ();
1809  edit_model -> setEnabled ( y );
1810  if ( yes ) {
1811  m_is_updating = true;
1812  updateColorMapCtrls ( plotter );
1813  m_is_updating = false;
1814  }
1815  }
1816 }
1817 
1818 void
1821 {
1823  if ( canvas != 0 ) {
1824  m_app_key = canvas -> getAppKey ();
1825  m_model_name = m_app_key + "/Model Name/";
1826  m_break_point = m_app_key + "/break point/";
1827  m_flat_width = m_app_key + "/flat width/";
1828  m_color_scale = m_app_key + "/color scale/";
1829  }
1830 }
1831 
1832 void
1835 {
1836  if ( m_user_models_loaded == false ) {
1837  setAppKey ();
1838 
1839  QSettings settings;
1840  settings.insertSearchPath ( QSettings::Windows, s_registry );
1841 
1842  QString model_name_key ( m_model_name );
1843  QStringList model_list
1844  = settings.entryList ( model_name_key );
1845 
1846  QStringList::size_type size = model_list.size ();
1847  for ( QStringList::size_type i = 0; i < size ; i++ )
1848  {
1849  QString number = model_list [ i ];
1850  QString name
1851  = settings.readEntry ( model_name_key + number );
1852 
1853  double brk_pt
1854  = settings.readDoubleEntry ( m_break_point + number );
1855  double flat_width
1856  = settings.readDoubleEntry ( m_flat_width + number );
1857  double color_scale
1858  = settings.readDoubleEntry ( m_color_scale + number );
1859 
1860  string mname ( name.latin1() );
1861  vector < double > cpts;
1862  cpts.push_back ( brk_pt );
1863  cpts.push_back ( flat_width );
1864  cpts.push_back ( color_scale );
1865 
1867  controller -> addValueTransform ( mname, cpts );
1868  }
1869 
1870  updateValueCombo ();
1871  m_user_models_loaded = true;
1872  }
1873 }
1874 
1875 void
1878 {
1879  if ( m_is_updating == false ) {
1880  vector < double > sv;
1881 
1882  double m = brk_pt -> maxValue ();
1883  assert(m != 0);
1884  sv.push_back ( (brk_pt -> value()) / m + 0.001);
1885 
1886  double w = flat_width -> maxValue();
1887  assert(w != 0);
1888  sv.push_back ( (flat_width -> value()) / w + 0.001);
1889 
1890  double c = color_scale -> maxValue ();
1891  assert( c!= 0 );
1892  sv.push_back ( ( ( (color_scale -> value()) / c ) ) * 1.5 );
1893 
1894  PlotterBase * plotter = getPlotter ();
1895  if ( plotter != 0 ) {
1897  controller -> setValueCtrlPts (plotter,sv );
1898  }
1899  }
1900 }
1901 
1902 void
1905 {
1906  if ( m_slider_control -> isEnabled () )
1907  {
1908  brk_pt -> setValue ( 50 );
1909  flat_width -> setValue ( 50 );
1910  color_scale -> setValue ( 0 );
1911  }
1912 }
1913 
1914 
1915 void
1917 convertCtrlPts ( std::vector < double > & sv )
1918 {
1919  sv.clear();
1920 
1921  int ibp = brk_pt -> value ();
1922  int ifw = flat_width -> value ();
1923  int ics = color_scale -> value ();
1924 
1925  double bp = static_cast < double > ( ibp) /
1926  static_cast <double>( brk_pt -> maxValue () );
1927 
1928  double fw = static_cast < double > ( ifw ) /
1929  static_cast <double>( flat_width -> maxValue () );
1930 
1931  double cs = static_cast < double > ( ics ) /
1932  static_cast <double>(color_scale -> maxValue () );
1933 
1934  sv.push_back ( bp );
1935  sv.push_back ( fw );
1936  sv.push_back ( cs );
1937 }
1938 
1939 void
1942 {
1943  setAppKey ();
1944 
1945  bool ok = false;
1946  QString text = QInputDialog::getText ( "Save color model", // caption
1947  "Enter name", // label
1949  QString::null, // default text
1950  & ok, this );
1951 
1952  if ( ok )
1953  {
1954  const string name ( text.latin1() );
1955  vector < double > sv;
1956  convertCtrlPts ( sv );
1958  controller -> addValueTransform ( name, sv );
1959 
1960  updateValueCombo ();
1961 
1962  PlotterBase * plotter = getPlotter ();
1963  controller -> setValueTransform ( plotter, name );
1964  int index = controller -> getValueTransformIndex ( plotter );
1965  m_value_combo -> setCurrentItem ( index );
1966 
1967  QSettings settings;
1968  settings.insertSearchPath ( QSettings::Windows, s_registry );
1969  QString model_name_key ( m_model_name );
1970 
1971  QStringList model_list
1972  = settings.entryList ( model_name_key );
1973 
1974  int iat = 0;
1975  while ( true ) {
1976  int index = model_list.findIndex ( QString::number ( iat )) ;
1977  if ( index == -1 ) break;
1978  iat++;
1979  }
1980 
1981  QString at ( QString::number ( iat ) );
1982  settings.writeEntry ( m_model_name + at, text );
1983  settings.writeEntry ( m_break_point + at, sv[0] );
1984  settings.writeEntry ( m_flat_width + at, sv[1] );
1985  settings.writeEntry ( m_color_scale + at, sv[2] );
1986  }
1987 }
1988 
1989 void
1992 {
1993  // If it's the first time to save the variable rainbow color scale,
1994  // we will need special handling.
1995  bool isFirstVR = true;
1996 
1997  QString item = m_value_combo -> currentText ();
1998  vector < double > sv;
1999  convertCtrlPts ( sv );
2000 
2001  PlotterBase * plotter = getPlotter ();
2003  // Use saveValueCtrlPts instead of setValueCtrlPts to make the
2004  // changes effective in this session.
2005  controller -> saveValueCtrlPts ( plotter, sv );
2006 
2007  QSettings settings;
2008  settings.insertSearchPath ( QSettings::Windows, s_registry );
2009 
2010  QString model_name_key ( m_model_name );
2011  QStringList model_list
2012  = settings.entryList ( model_name_key );
2013 
2014 #if QT_VERSION < 0x040000
2015  for ( unsigned int i = 0; i < model_list.size(); i++ ) {
2016 #else
2017  for ( int i = 0; i < model_list.size(); i++ ) {
2018 #endif
2019  QString at ( QString::number ( i ) );
2020  QString name_key ( model_name_key + at );
2021  QString name = settings.readEntry ( name_key );
2022  if ( name == item ) {
2023  settings.writeEntry ( m_break_point + at, sv[0] );
2024  settings.writeEntry ( m_flat_width + at, sv[1] );
2025  settings.writeEntry ( m_color_scale + at, sv[2] );
2026  isFirstVR = false;
2027  break;
2028  }
2029  }
2030 
2031  // For the first time, save the variable rainbow color scale.
2032  if ( isFirstVR ) {
2033  // Find the end of the settings.
2034  int iat = 0;
2035  while ( true ) {
2036  int index = model_list.findIndex ( QString::number ( iat )) ;
2037  if ( index == -1 ) break;
2038  iat++;
2039  }
2040 
2041  QString at ( QString::number ( iat ) );
2042  settings.writeEntry ( m_model_name + at, item );
2043  settings.writeEntry ( m_break_point + at, sv[0] );
2044  settings.writeEntry ( m_flat_width + at, sv[1] );
2045  settings.writeEntry ( m_color_scale + at, sv[2] );
2046  }
2047 }
2048 
2049 void
2052 {
2053  QString item = m_value_combo -> currentText ();
2054  const string name ( item.latin1() );
2055 
2057  bool yes = controller -> removeValueTransform ( name );
2058 
2059  if ( yes ) {
2060  PlotterBase * plotter = getPlotter ();
2061  controller -> setValueTransform ( plotter, "Rainbow" );
2062 
2063  QSettings settings;
2064  settings.insertSearchPath ( QSettings::Windows, s_registry );
2065  QString model_name_key ( m_model_name );
2066  QStringList model_list
2067  = settings.entryList ( model_name_key );
2068  QStringList::size_type size = model_list.size ();
2069 
2070  for (QStringList::size_type i = 0; i < size; i++ ) {
2071  QString at ( model_list [ i ] );
2072  QString name_key ( model_name_key + at );
2073  QString name = settings.readEntry ( name_key );
2074  if ( name == item ) {
2075  settings.removeEntry ( name_key );
2076  settings.removeEntry ( m_break_point + at );
2077  settings.removeEntry ( m_flat_width + at );
2078  settings.removeEntry ( m_color_scale + at );
2079  break;
2080  }
2081  }
2082  updateValueCombo ();
2083  }
2084 }
2085 
2086 void
2089 {
2090  PlotterBase * plotter = getPlotter ();
2091  if ( !plotter ) return;
2092 
2093  bool checked = m_errorBars->isChecked();
2095 
2096  controller -> setErrorDisplayed ( plotter, Axes::Y, checked );
2097 }
2098 void
2100 {
2101  const QString message ( "HippoDraw was not built with TeX support on "
2102  "this platfrom." );
2103  QMessageBox::information ( this, /* parent */
2104  "Input error",
2105  message,
2106  QMessageBox::Ok,
2107  Qt::NoButton,
2108  Qt::NoButton );
2109 }
2110 
2111 void
2114 {
2115  std::string s( (m_titleText->text()).latin1() );
2116  unsigned int size = m_plotter_list.size();
2117 
2118  for ( unsigned int i = 0; i < size; i++ ) {
2119  PlotterBase * plotter = m_plotter_list [ i ];
2120 
2121  /* The size of drawrect, marginrect, need to be updated
2122  according to title text format. LaTeX format starts with
2123  "tex:" (case insensitive).
2124  */
2125  bool needMargin = String::ci_find(s, "tex:")==0;
2126  if ( needMargin ) {
2127 #ifdef HAVE_TEX_UTILS
2128  plotter -> setTopMargin ( needMargin?10.0:0.0 );
2129  plotter -> setNeedUpdate(true);
2130  plotter -> notifyObservers ();
2131 #else
2132  warningTex ();
2133  s.erase ( 0, 4 );
2134 
2135 #endif
2136  }
2137  plotter->setTitle ( s );
2138  }
2139 
2140 
2141 }
2142 
2144 {
2145  m_symbol_group -> setButton ( id );
2146  PlotterBase * plotter = getPlotter ();
2147  if ( !plotter ) return ;
2148 
2150  DataRep * rep = controller -> activeDataRep ( plotter );
2151  if ( rep == 0 ) {
2152  multipleDataRepError ( "plot symbol change" );
2153  return;
2154  }
2155 
2156  rep -> setRepStyle ( id );
2157 }
2158 
2160 {
2161 
2162  m_line_group -> setButton ( id );
2163  PlotterBase * plotter = getPlotter ();
2164  if ( !plotter ) return ;
2165 
2167  DataRep * rep = controller -> activeDataRep ( plotter );
2168  if ( rep == 0 ) {
2169  multipleDataRepError ( "plot symbol change" );
2170  return;
2171  }
2172 
2173  rep -> setRepStyle ( id );
2174 }
2175 
2177 {
2178 
2179  PlotterBase * plotter = getPlotter ();
2180  if ( !plotter ) return;
2181 
2183  DataRep * rep = controller -> activeDataRep ( plotter );
2184  if ( rep == 0 ) {
2185  multipleDataRepError ( "plot symbol size change" );
2186  return;
2187  }
2188 
2189  QString text = m_symbolPointSize->text();
2190  float size = text.toFloat();
2191 
2192  rep->setRepSize ( size );
2193 
2194 }
2195 
2197 {
2198  PlotterBase * plotter = getPlotter ();
2199  if ( plotter == 0 ) return;
2200 
2202  controller->setIntervalEnabled ( plotter, state );
2203  m_interval_le->setEnabled ( state );
2204 }
2205 
2206 void
2209 {
2210  PlotterBase * plotter = getPlotter ();
2211  if ( plotter == 0 ) return;
2212 
2214 
2215  unsigned int interval = text.toUInt ();
2216  controller->setIntervalCount ( plotter, interval );
2217 }
2218 
2219 void
2222 {
2223  PlotterBase * plotter = getPlotter ();
2224  if ( !plotter ) return;
2225 
2226  int index = plotter->activePlotIndex ();
2227 
2228  if ( index < 0 ) {
2229  multipleDataRepError ( "color change" );
2230  return;
2231  }
2232 
2233  const Color & rep_color = plotter->repColor();
2234  QColor color ( rep_color.getRed(),
2235  rep_color.getGreen(),
2236  rep_color.getBlue() );
2237  color = QColorDialog::getColor ( color );
2238  if ( color.isValid() == false ) return;
2239 
2240  m_selectedColor->setPaletteBackgroundColor ( color );
2241 
2242  Color c ( color.red(), color.green(), color.blue() );
2243  plotter->setRepColor ( c );
2244 }
2245 
2246 void
2249 {
2250  PlotterBase * plotter = getPlotter ();
2251 
2252  if ( plotter != 0 ) {
2254  const string rep ( qstr.latin1() );
2255 
2256  controller -> setPointRep ( plotter, rep );
2257 
2258  if ( plotter -> hasAxis ( Axes::Z ) == true ) {
2259 
2260  int index = m_value_combo -> currentItem ();
2261  controller -> setValueTransform ( plotter, index );
2262  }
2263 
2264  updatePlotTab (); // to update the m_point_stack and size.
2265  }
2266 }
2267 
2268 void
2271 {
2272 // #if QT_VERSION < 0x040000
2273 // #else
2274 // id -= 3; // The re-inserted ones have wrong id
2275 // #endif
2277  updateAxisTab ();
2278 }
2279 
2280 void
2283 {
2284  PlotterBase * plotter = getPlotter ();
2285  if ( !plotter ) return;
2286 
2287  plotter->setAutoRanging ( m_axis, false );
2288  const Range & r = plotter->getRange ( m_axis, true );
2289 
2290  m_autoScale->setChecked ( false );
2291 
2292  if ( axisWidget1->isZoomPanChecked() ) {
2293  m_zoompan[plotter] = true;
2294  }
2295 
2296  else {
2297 
2298  std::map < const PlotterBase *, bool >::const_iterator it
2299  = m_zoompan.find ( plotter );
2300  if ( it != m_zoompan.end () ) {
2301  m_zoompan[plotter] = false;
2302  }
2303 
2304  }
2305 
2307 }
2308 
2309 void
2312 {
2313  int value = axisWidget1->getHighSliderValue ();
2314  setHighRange ( value, false );
2315 
2317 }
2318 
2319 void
2322 {
2323  int value = axisWidget1->getLowSliderValue ();
2324  setLowRange ( value, false );
2325 
2327 }
2328 
2329 void
2332 {
2333  int value = m_offset_range->value ();
2334  setOffset ( value, false );
2335  m_offset_range->setValue ( 50 );
2336 }
2337 
2338 void
2341 {
2342  int value = m_width_range->value ();
2343  setBinWidth ( value, false );
2344 
2345  m_width_range->setValue ( 50 );
2346 }
2347 
2348 void
2351 {
2352  int value = min_entries_slider->value ();
2353  m_dragging = false;
2354  setMinEntries(value);
2355 
2356  // min_entries_slider->setValue ( 50 );
2357 }
2358 
2359 void
2362 {
2363  PlotterBase * plotter = getPlotter ();
2364  if ( !plotter ) return;
2365 
2367  int index = controller -> activeDataRepIndex ( plotter );
2368  bool yes = controller -> hasNTupleBindings ( plotter, index );
2369  if ( yes ) {
2370  //Get the string and convert it to double.
2371  QString text = m_width_text->text();
2372  double width = text.toDouble();
2373 
2374  if ( width == 0 ) return; // To prevent it from crashing.
2375  plotter -> setBinWidth ( m_axis, width );
2376  }
2377 
2378  updateAxisTab();
2379 }
2380 
2381 void
2384 {
2385  m_dragging = true;
2387 
2388  if ( ! axisWidget1->isZoomPanChecked() )
2389  {
2390  m_autoScale->setChecked ( false );
2391  autoScale_clicked ();
2392  }
2393  else
2394  {
2395  // Save current width and position.
2396  m_autoScale->setChecked ( false );
2397  autoScale_clicked ();
2398 
2399  PlotterBase * plotter = getPlotter ();
2400  if ( !plotter ) return;
2401  const Range & r = plotter->getRange ( m_axis, true );
2402  m_range.setRange ( r.low(), r.high(), r.pos() );
2403  }
2404 
2405 }
2406 
2407 void
2410 {
2411  PlotterBase * plotter = getPlotter ();
2412  if ( !plotter ) return;
2413 
2415  int index = controller -> activeDataRepIndex ( plotter );
2416  bool yes = controller -> hasNTupleBindings ( plotter, index );
2417  if ( yes ) {
2418  //Get the string and convert it to double.
2419  QString text = m_offset_text->text();
2420  double offset = text.toDouble();
2421 
2422  int value = static_cast < int > ( 50.0 * offset ) + 49;
2423  setDragOn ();
2424  setOffset( value );
2425  offsetDrag ();
2426  }
2427 
2428  updateAxisTab ();
2429 }
2430 
2431 void
2433 setBinWidth ( int value )
2434 {
2435  setBinWidth ( value, m_dragging );
2436 
2437  if ( m_dragging == false ) m_width_range -> setValue ( 50 );
2438 }
2439 
2440 void
2442 setBinWidth ( int value, bool drag )
2443 {
2444  PlotterBase * plotter = getPlotter ();
2445  if ( !plotter ) return;
2446  m_dragging = drag;
2447 
2448  plotter -> setBinWidth ( m_axis, value, m_dragging );
2449  updateAxisTab ();
2450 }
2451 
2452 void
2455 {
2456  PlotterBase * plotter = getPlotter ();
2457  if ( plotter != 0 ) {
2458  QString text = m_axis_label -> text ();
2459  string ltext = text.latin1();
2460  const string axis = convertToString ( m_axis );
2461 
2462  /* The size of drawrect, marginrect, need to be updated
2463  according to title text format. LaTeX format starts with
2464  "tex:" (case insensitive).
2465  */
2466  bool needMargin = String::ci_find(ltext, "tex:")==0;
2467  if ( needMargin ) {
2468 #ifdef HAVE_TEX_UTILS
2469  if (m_axis==Axes::X)
2470  plotter -> setBottomMargin ( needMargin?8.0:0.0 );
2471  else if (m_axis==Axes::Y)
2472  plotter -> setLeftMargin ( needMargin?0.0:0.0 );
2473  else if (m_axis==Axes::Z)
2474  plotter -> setZMargin ( needMargin?7.0:0.0 );
2475  plotter -> setNeedUpdate(true);
2476  plotter -> notifyObservers ();
2477 #else
2478  warningTex();
2479  ltext.erase( 0, 4 );
2480 #endif
2481  }
2482  plotter -> setLabel ( m_axis, ltext );
2483  }
2484 
2485 
2486 }
2487 
2488 void
2491 {
2492 
2493  PlotterBase * plotter = getPlotter ();
2494  if ( !plotter ) return;
2495 
2496  Range r = plotter->getRange ( m_axis, true );
2497 
2499 
2500  plotter->setRange ( m_axis, r, true, false ); // scaled, keep bin width
2501  m_autoScale->setChecked ( false );
2502 
2503  updateAxisTab ();
2504 }
2505 
2506 void
2508 setLowRange ( int value )
2509 {
2510  if ( m_is_updating == false ) {
2511  setLowRange ( value, m_dragging );
2512  if ( m_dragging == false ) {
2514  }
2515  }
2516 }
2517 
2518 void
2520 setLowRange ( int value, bool yes )
2521 {
2522  PlotterBase * plotter = getPlotter ();
2523  if ( !plotter ) return;
2524  m_dragging = yes;
2525 
2526  plotter->setAutoRanging ( m_axis, false );
2527 
2528  if ( ! axisWidget1->isZoomPanChecked() )
2529  {
2530  const string axis = convertToString ( m_axis );
2531  plotter->setLowRange ( m_axis, value, m_dragging );
2532  const Range & r = plotter->getRange ( m_axis, true );
2533  double low = r.low();
2534  axisWidget1 -> setLowText ( QString("%1").arg(low));
2535  }
2536  else
2537  {
2538  const Range & r = plotter->getRange ( m_axis, true );
2539  Range range ( r.low(), r.high(), r.pos() );
2540  axisWidget1->processLowSliderMoved ( value, range, m_range );
2541  if ( m_dragging ) plotter->setRange ( m_axis, range, true, false );
2542  }
2543 }
2544 
2545 void
2547 setHighRange ( int value )
2548 {
2549  if ( m_is_updating == false ) {
2550  setHighRange ( value, m_dragging );
2551  if ( m_dragging == false ) {
2553  }
2554  }
2555 }
2556 
2557 void
2559 setHighRange ( int value, bool yes )
2560 {
2561  PlotterBase * plotter = getPlotter ();
2562  if ( !plotter ) return;
2563  m_dragging = yes;
2564 
2565  plotter->setAutoRanging ( m_axis, false );
2566 
2567  if ( !axisWidget1->isZoomPanChecked() )
2568  {
2569  const string axis = convertToString ( m_axis );
2570  plotter->setHighRange ( m_axis, value, m_dragging );
2571  const Range & r = plotter->getRange ( m_axis, true );
2572  double high = r.high();
2573  axisWidget1 -> setHighText ( QString("%1").arg(high));
2574  return;
2575  }
2576 
2577  BinaryTransform *t =
2578  dynamic_cast< BinaryTransform* > ( plotter->getTransform() );
2579 
2580  if ( axisWidget1->isZoomPanChecked() && ! t->isPeriodic() )
2581  {
2582  const Range & r = plotter->getRange ( m_axis, true );
2583  Range range ( r.low(), r.high(), r.pos() );
2584  axisWidget1->processHighSliderMoved ( value, range, m_range );
2585  if ( m_dragging ) plotter->setRange ( m_axis, range, true, false );
2586  return;
2587  }
2588 
2589  double offset(0.0), incr(0.0);
2590 
2591  if ( axisWidget1->isZoomPanChecked() && t->isPeriodic() )
2592  {
2593 
2595  dynamic_cast< PeriodicBinaryTransform* > ( t );
2596 
2597  const Range & r = plotter->getRange ( m_axis, true );
2598  Range range (r.low(), r.high(), r.pos());
2599 
2600  incr = ( value - m_highslider1_last_val ) * r.length() / 100;
2601  m_highslider1_last_val = value;
2602 
2603  // Exchange axes to make the GUI more understandable.
2604  if ( m_axis == Axes::Y )
2605  {
2606  offset = tp->xOffset();
2607  offset = tp->moduloAddY( offset, incr );
2608  tp->setXOffset( offset );
2609  }
2610  else if ( m_axis == Axes::X )
2611  {
2612  offset = tp->yOffset();
2613  offset = tp->moduloAddX( offset, incr );
2614  tp->setYOffset( offset );
2615  }
2616 
2617 
2618  axisWidget1 -> setHighText ( QString( "%1" ).arg( offset ) );
2619  if ( m_dragging ) plotter->setRange ( m_axis, range, true, false );
2620  return;
2621  }
2622 }
2623 
2624 void
2627 {
2628 
2629  PlotterBase * plotter = getPlotter ();
2630  if ( !plotter ) return;
2631 
2632  Range r = plotter->getRange ( m_axis, true );
2633 
2635 
2636  plotter->setRange ( m_axis, r, true, false ); // scaled and keep bin width
2637  m_autoScale->setChecked ( false );
2638 
2639  updateAxisTab ();
2640 }
2641 
2642 void
2644 setOffset ( int value )
2645 {
2646  setOffset( value, m_dragging );
2647 }
2648 
2649 void
2651 setOffset ( int value, bool yes )
2652 {
2653  PlotterBase * plotter = getPlotter ();
2654  if ( !plotter ) return;
2655  m_dragging = yes;
2656 
2657  const string axis = convertToString ( m_axis );
2659  controller -> setOffset ( plotter, axis, value, m_dragging );
2660  double offset = plotter->getOffset ( m_axis );
2661  m_offset_text -> setText ( QString ("%1").arg (offset) );
2662 
2663  updateAxisTab ();
2664 }
2665 
2666 const std::vector < PlotterBase * > &
2669 {
2670  vector < PlotterBase * > plotterlist;
2671  fillPlotterList ( plotterlist );
2672 
2673 
2675  const DataSource * tuple = controller -> getDataSource ( plotter );
2676  CutController * cutcontroller = CutController::instance();
2677  return cutcontroller->getCutList ( plotterlist, tuple );
2678 }
2679 
2680 void
2683 {
2684  m_is_updating = true;
2685 
2686  int id = cutRadioId ();
2687  bool fit_cut = id == 2;
2688 
2689  int index = m_selCutComboBox -> currentItem ();
2690  Range currentRange = m_tuple_cuts [index] -> getRange();
2691  PlotterBase * plotter = getSelectedCut();
2692 
2693  if ( fit_cut == false ) {
2694  Axes::Type cut_axis = getAxes ( index );
2695  const Range & fullRange = plotter -> getRange ( cut_axis, false );
2696  axisWidget2->processTextBoxReturnPressed ( currentRange, fullRange );
2697  plotter->setCutRangeAt ( currentRange, cut_axis );
2698  }
2699  else {
2700  const Range & fullRange = plotter -> getRange ( Axes::X, false );
2701  axisWidget2->processTextBoxReturnPressed ( currentRange, fullRange );
2702  plotter->setCutRangeAt ( currentRange, index );
2703  }
2704 }
2705 
2707 {
2708  axisWidget2->setAllDisabled ( yes );
2709  colorSelect_2->setDisabled ( yes );
2710  cutRemovePushButton->setDisabled ( yes );
2711  cutInvertPushButton->setDisabled ( yes );
2712  cutEnablePushButton -> setDisabled ( yes );
2713  m_cutAddSelected->setDisabled ( yes );
2714  m_cutAddAll -> setDisabled ( yes );
2715 
2716  if ( yes ) {
2717  int number = m_selCutComboBox -> count ();
2718  while ( number-- > 0 ) {
2719  m_selCutComboBox -> removeItem ( 0 );
2720  }
2721  }
2722  m_selCutComboBox -> setDisabled ( yes );
2723 }
2724 
2725 void
2727 updateTupleCuts ( const std::vector < PlotterBase * > & cutlist )
2728 {
2729  m_tuple_cuts.clear ();
2730  m_tuple_cut_plotters.clear ();
2731 
2732  unsigned int size = cutlist.size ();
2733 
2734  for ( unsigned int i = 0; i < size; i++ ) {
2735  PlotterBase * plotter = cutlist[i];
2736  TupleCutList_t cuts;
2737  plotter -> fillCutList ( cuts );
2738 
2739  for ( unsigned int j = 0; j < cuts.size (); j++ ) {
2740  m_tuple_cuts.push_back ( cuts[j] );
2741  m_tuple_cut_plotters.push_back ( plotter );
2742  }
2743  }
2744 }
2745 
2746 void
2748 updateCutControls ( const std::vector < PlotterBase * > & cutlist )
2749 {
2750  QString old_current = m_selCutComboBox -> currentText ();
2751  int numberItems = m_selCutComboBox->count();
2752 
2753  while ( numberItems-- > 0 ) {
2755  }
2756 
2757  m_selCutComboBox -> setEnabled ( true );
2758 
2759  updateTupleCuts ( cutlist );
2760  bool yes = m_tuple_cuts.empty ();
2761  if ( yes ) {
2762  cutRemovePushButton -> setEnabled ( false );
2763  return;
2764  }
2765 
2766  int index = -1;
2767  unsigned int size = m_tuple_cuts.size ();
2768 
2769  for ( unsigned int i = 0; i < size; i++ ) {
2770  const TupleCut * cut = m_tuple_cuts[i];
2771  const string & label = cut -> getLabel ();
2772  QString item = label.c_str ();
2773  m_selCutComboBox -> insertItem ( item );
2774  if ( item == old_current ) index = i;
2775  }
2776 
2777  PlotterBase * plotter = getPlotter ();
2778  assert ( plotter );
2779  index = -1;
2780  map < PlotterBase *, int > ::iterator first
2781  = m_cut_map.find ( plotter );
2782 
2783  if ( first == m_cut_map.end () ) { // not found
2784  index = 0;
2785  m_cut_map [ plotter ] = index;
2786  }
2787  else {
2788  index = first -> second;
2789  }
2790  int count = m_selCutComboBox -> count ();
2791  if ( index >= count ) {
2792  index = count -1;
2793  m_cut_map [ plotter] = index;
2794  }
2795 
2796  m_selCutComboBox -> setCurrentItem ( index );
2798 }
2799 
2803 void
2806 {
2807  if ( m_tuple_cuts.empty () ) return;
2808 
2809  int index = m_selCutComboBox -> currentItem ();
2810  const TupleCut * cut = m_tuple_cuts [ index ];
2811  assert ( cut != 0 );
2812  bool yes = cut -> isEnabled ();
2813  m_cut_enable_updating = true;
2814  cutEnablePushButton -> setOn ( ! yes );
2815  m_cut_enable_updating = false;
2816 }
2817 
2818 Axes::Type
2820 getAxes ( unsigned int index )
2821 {
2822  Axes::Type axis = Axes::Y;
2823 
2824  PlotterBase * plotter = m_tuple_cut_plotters [ index ];
2825  unsigned int size = m_tuple_cut_plotters.size ();
2826  for ( unsigned int i = 0; i < size; i++ ) {
2827  if ( m_tuple_cut_plotters[i] == plotter ) {
2828  if ( i == index ) {
2829  axis = Axes::X;
2830  }
2831  break;
2832  }
2833  }
2834 
2835  return axis;
2836 }
2837 
2838 void
2841 {
2842  m_is_updating = true;
2843  int index = m_selCutComboBox -> currentItem ();
2844  const Range & currentRange = m_tuple_cuts[index] -> getRange ();
2845 
2846  Axes::Type cut_axis = Axes::X;
2847  int id = cutRadioId ();
2848  bool fit_cut = id == 2;
2849  if ( fit_cut == false ) {
2850  cut_axis = getAxes ( index );
2851  }
2852  const Range & fullRange = cplotter->getRange ( cut_axis, false );
2853 
2854  axisWidget2->updateCutControlValues ( currentRange, fullRange );
2855  CutController * controller = CutController::instance ();
2856 
2857  bool yes
2858  = controller -> isZoomPan ( cplotter, cut_axis );
2859  axisWidget2 -> setZoomPan ( yes );
2860  axisWidget2->processZoomPanCheckBoxClicked ( currentRange, fullRange );
2861  m_is_updating = false;
2862 }
2863 
2864 // void
2865 // Inspector::
2866 // fillCutsOn ( const PlotterBase * plotter,
2867 // std::vector < PlotterBase * > & cutlist )
2868 // {
2869 // cutlist.clear();
2870 
2871 // DisplayController * controller = DisplayController::instance ();
2872 // const DataRep * datarep = controller -> activeDataRep ( plotter );
2873 // if ( datarep != 0 ) {
2874 // CutController * cutcontroller = CutController::instance();
2875 
2876 // cutcontroller->fillCutList ( datarep, cutlist );
2877 // }
2878 // }
2879 
2880 const std::vector < const TupleCut * > &
2882 getCutList ( const PlotterBase * plotter ) const
2883 {
2885  int index = controller -> activeDataRepIndex ( plotter );
2886  if ( index < 0 ) {
2887  string what ( "Inspector::getCutList: " );
2888  what += "no active DataRep in PlotterBase object.";
2889  throw std::logic_error ( what );
2890  }
2891  const DataRep * datarep = plotter -> getDataRep ( index );
2892  CutController * cut_controller = CutController::instance ();
2893 
2894  return cut_controller -> getCutList ( datarep );
2895 }
2896 
2897 void
2900 {
2901  if ( !m_selectedPlotRadioButton->isChecked() ) return;
2902 
2903  // Change the items in the combo box to only cuts over selected datarep.
2904 
2905  PlotterBase * plotter = getPlotter ();
2906  bool yes = plotter != 0;
2907  if ( yes ) yes = plotter -> isTargetable ();
2908  disableCutControls ( yes == false );
2909  if ( yes == false ) return;
2910 
2911  vector < PlotterBase * > cutlist;
2912 
2913  if ( cutRadioId () != 2 ) {
2914  CutController * controller = CutController::instance ();
2915  controller -> fillCutList ( plotter, cutlist );
2916 
2917  // Clear the combobox and insert the new strings.
2918 
2919  if ( cutlist.empty () ) {
2920  disableCutControls ( true );
2921  cutRemovePushButton->setEnabled ( false );
2922  return;
2923  }
2924  }
2925  else { // fitting cut
2926  cutlist.push_back ( plotter );
2927  }
2928 
2929  updateCutControls ( cutlist );
2930 
2931  if ( m_tuple_cuts.empty () ) {
2932  disableCutControls ( true );
2933  cutRemovePushButton->setEnabled ( false );
2934  return;
2935  }
2936 
2937  // Update Controls.
2938 
2939  disableCutControls ( false );
2940  cutRemovePushButton->setEnabled ( true );
2941  m_cutAddSelected -> setDisabled ( true );
2942  m_cutAddAll -> setDisabled ( true );
2943 
2944  // Update texts and sliders.
2945 
2946  int index = m_selCutComboBox -> currentItem ();
2947  const PlotterBase * cut_plotter = m_tuple_cut_plotters [ index ];
2948  updateCutControlValues ( cut_plotter );
2949 }
2950 
2951 void
2954 {
2955  // Take the selected cut from cutlistcombobox and add it to selected
2956  // plotter on canvas.
2957 
2958  // Find the selected cutplotter.
2959 
2960  CutPlotter * cp = getSelectedCut();
2961 
2962  // Find the selected Plotter.
2963  PlotterBase * plotter = getPlotter ();
2964  if ( !plotter ) return ;
2965 
2966  // Add the cut to the plotter.
2967  CutController * controller = CutController::instance();
2968  controller -> addCut ( cp, plotter );
2969 
2970 }
2971 
2972 void
2975 {
2976  PlotterBase * plotter = getPlotter ();
2977  if ( plotter == 0 ) return;
2978 
2979  CutController * controller = CutController::instance ();
2980  const vector < PlotterBase * > & cut_list = getDataCutList ( plotter );
2981 
2982  controller -> addCuts ( cut_list, plotter );
2983 
2984  unsigned int size = cut_list.size ();
2985  for ( unsigned int i = 0; i < size; i++ ) {
2986  PlotterBase * pb = cut_list[i];
2987  CutPlotter * cut_plotter = dynamic_cast < CutPlotter * > ( pb );
2988  if ( cut_plotter == plotter ) {
2989  cutOnCutError ();
2990  }
2991  }
2992 }
2993 
2994 /* Take the selected cut from cutlistcombobox and remove it from the selected
2995  plotter on canvas.
2996 */
2997 void
3000 {
3001  PlotterBase * plotter = getPlotter ();
3002  if ( !plotter ) return ;
3003 
3004  bool is_fit_radio = cutRadioId () == 2;
3005  if ( is_fit_radio ) {
3007  int index = controller->activeDataRepIndex ( plotter );
3008  DataRep * rep = plotter -> getDataRep ( index );
3009  FunctionController::instance () -> removeTupleCut ( plotter, rep );
3010  }
3011  else {
3012  // Find the selected cutplotter.
3013  CutPlotter * cp = getSelectedCut();
3014  CutController::instance() -> removeCut ( cp, plotter );
3015  }
3016 
3017  if ( m_selectedPlotRadioButton -> isChecked () ) {
3018  // post event so we don't delete item that sent us the signal.
3019  PlotterEvent * event = new PlotterEvent ( plotter );
3020  QApplication::postEvent ( this, event );
3021  }
3022 }
3023 
3024 void
3027 {
3028  if ( !allCutsRadioButton->isChecked() ) return;
3029 
3030  PlotterBase * plotter = getPlotter ();
3031 
3032  bool yes = plotter != 0;
3033  if ( yes ) yes = plotter -> isTargetable ();
3034 
3035  disableCutControls ( yes == false );
3036  if ( yes == false ) return;
3037 
3038  const vector < PlotterBase * > & cutlist = getDataCutList ( plotter );
3039 
3040  // Clear the combobox and insert the new strings.
3041 
3042  updateCutControls ( cutlist );
3043 
3044  if ( cutlist.empty () ) {
3045  disableCutControls ( true );
3046  return;
3047  }
3048 
3049  // Update Controls.
3050 
3051  disableCutControls ( false );
3052  cutRemovePushButton->setDisabled ( true );
3053  m_cutAddSelected -> setEnabled ( true );
3054  m_cutAddAll -> setEnabled ( true );
3055 
3056  // Update texts and sliders.
3057 
3058  const PlotterBase * cut_plotter = cutlist.back ();
3059  updateCutControlValues ( cut_plotter );
3060 }
3061 
3063 {
3064  CutPlotter * cut_plotter = getSelectedCut ();
3065  updateCutControlValues ( cut_plotter );
3066 
3067  PlotterBase * plotter = getPlotter (); // the target
3068  int index = m_selCutComboBox -> currentItem ();
3069  m_cut_map [ plotter ] = index;
3070 
3072 }
3073 
3074 CutPlotter *
3077 {
3078  if ( cutRadioId() != 2 ) {
3079  PlotterBase * plotter = getPlotter ();
3080  if ( plotter == 0 ) return 0;
3081 
3083 
3085  return dynamic_cast < CutPlotter * > ( pb );
3086  }
3087  else { // fitting cut
3088  PlotterBase * pb = getPlotter ();
3089  CutPlotter * plotter = dynamic_cast < CutPlotter * > ( pb);
3090  return plotter;
3091  }
3092 }
3093 
3097 void
3100 {
3101  // Get the column label from m_CutVariableComboBox1, and create a cut on
3102  // the selected plotter with that column label. Also update the list of
3103  // cuts and the high and low range.
3104 
3105  PlotterBase * plotter = getPlotter ();
3106  bool yes = plotter != 0;
3107 
3108  if ( yes ) yes = plotter -> isTargetable ();
3109  if ( yes == false ) {
3110  int index = plotter -> activePlotIndex ();
3111  if ( index < 0 ) {
3112  multipleDataRepError ( "Cut" );
3113  }
3114  else { // must be a function
3115  const QString message ( "Can not apply cut to a function" );
3116  QMessageBox::information ( this, /* parent */
3117  "Cut application error",
3118  message,
3119  QMessageBox::Ok,
3120  Qt::NoButton,
3121  Qt::NoButton );
3122  }
3123  return;
3124  }
3125 
3127  int index = controller->activeDataRepIndex ( plotter );
3128  assert ( index >= 0 );
3129 
3130  const DataRep * rep = plotter -> getDataRep ( index );
3131  if ( rep -> hasNTupleBindings () == false ) {
3132  const QString message ( "Can not apply cut to a static histogram" );
3133  QMessageBox::information ( this, /* parent */
3134  "Cut application error",
3135  message,
3136  QMessageBox::Ok,
3137  Qt::NoButton,
3138  Qt::NoButton );
3139  return;
3140  }
3141 
3142  vector < string > bindings;
3143  int id = cutRadioId ();
3144  if ( id != 2 ) {
3145 #if QT_VERSION < 0x030100 // 3.1.0
3146  string label1 ( m_CutVariableComboBox1 -> currentText() );
3147  string label2 ( m_CutVariableComboBox2 -> currentText() );
3148 #else
3149  QString text1 = m_CutVariableComboBox1 -> currentText();
3150  string label1 = text1.latin1();
3151  QString text2 = m_CutVariableComboBox2 -> currentText();
3152  string label2 = text2.latin1();
3153 #endif
3154 
3155  switch ( id ) {
3156  case 0 : // 1d data cut
3157  bindings.push_back( label1 );
3158  break;
3159  case 1 : // 2d data cut
3160  bindings.push_back( label1 );
3161  bindings.push_back( label2 );
3162  break;
3163  }
3164  CutController * cutcontroller = CutController::instance();
3165  PlotterBase * cutplotter = cutcontroller -> addCut ( plotter, index, bindings );
3167  if ( canvas == 0 ) return;
3168 
3169  canvas -> addPlotDisplay ( cutplotter, false );
3170  }
3171  else {
3172  DataRep * datarep = plotter -> getDataRep ( index );
3174  controller -> setTupleCut ( plotter, datarep );
3175  }
3176 
3177  // Update other guys.
3179  allCutsRadioButton_toggled ( true );
3180 }
3181 
3182 int
3185 {
3186  int index = -1;
3187 
3188  int size = m_selCutComboBox -> count ();
3189  for ( int i = 0; i < size; i++ ) {
3190  QString text = m_selCutComboBox -> text ( i );
3191  if ( text == label ) {
3192  index = i;
3193  break;
3194  }
3195  }
3196  return index;
3197 }
3198 
3199 void
3202 {
3203  if ( m_new_plot_box->isEnabled () == false ) return;
3204 
3205  PlotterBase * plotter = getPlotter ();
3206  bool yes = plotter != 0;
3207  m_new_cut_box->setEnabled ( yes );
3208 
3209  if ( yes ) yes = plotter -> isTargetable ();
3210  m_cut_selected_box->setEnabled ( yes );
3211 
3212  if ( yes ) {
3213  int id = cutRadioId ();
3214  bool is_fit_radio = id == 2;
3216  allCutsRadioButton_toggled ( true );
3217 
3218  if ( is_fit_radio == false ) {
3219  updateDataCutsTab ();
3220  }
3221  else {
3222  updateFitCutsTab ();
3223  }
3224  }
3225 }
3226 
3227 void
3230 {
3231 }
3232 
3233 void
3236 {
3237  int id = cutRadioId ();
3238 
3239  if ( id == 0 ) {
3240  m_CutVariableComboBox2 -> setEnabled ( false );
3241  }
3242 
3243  PlotterBase * plotter = getPlotter ();
3245  int index = controller->activeDataRepIndex ( plotter );
3246  if ( index < 0 ) {
3247  m_new_cut_box -> setDisabled ( true );
3248  m_cut_selected_box -> setDisabled ( true );
3249  }
3250  else {
3251  DataRep * datarep = plotter->getDataRep ( index );
3252  if ( datarep->hasZeroRows() )
3253  {
3254  m_new_cut_box->setDisabled ( true );
3255  m_cut_selected_box->setDisabled ( true );
3256  return;
3257  }
3258 
3259  m_new_cut_box->setDisabled ( false );
3260  const vector < PlotterBase * > & cuts = getDataCutList ( plotter );
3261  if ( cuts.empty() ) {
3262  m_cut_selected_box->setDisabled ( true );
3263  }
3264  else {
3265  m_cut_selected_box -> setDisabled ( false );
3266  }
3267  }
3268 
3269  updateCutVarGroupBox ( plotter, index );
3270 }
3271 
3272 void
3274 setAllCutsActive ( bool yes )
3275 {
3276  vector < PlotterBase * > plotters;
3277  fillPlotterList ( plotters );
3278 
3279  if ( plotters.empty () == false ) {
3280  CutController * controller = CutController::instance ();
3281  vector < CutPlotter * > cutters;
3282  controller -> fillCutList ( plotters, cutters );
3283  vector < CutPlotter * > ::iterator first = cutters.begin ();
3284 
3285  while ( first != cutters.end () ) {
3286  CutPlotter * cutter = *first++;
3287  cutter -> setActive ( yes );
3288  }
3289  }
3290 }
3291 
3292 void
3294 updateCutVarGroupBox ( const PlotterBase * plotter, int index )
3295 {
3296  const DataSource * tuple
3297  = DisplayController::instance() -> getDataSource ( plotter, index );
3298 
3299  if (!tuple) return;
3300  int index1 = -1;
3301  int index2 = -1;
3302  if ( m_CutVariableComboBox1 -> count() > 0 ) {
3303  index1 = m_CutVariableComboBox1 -> currentItem ();
3304  }
3305  if ( m_CutVariableComboBox2 -> count() > 0 ) {
3306  index2 = m_CutVariableComboBox2 -> currentItem ();
3307  }
3310 
3311  const vector < string > & cols = tuple->getLabels();
3312 #ifdef ITERATOR_MEMBER_DEFECT
3313  std::
3314 #endif
3315  vector < string > ::const_iterator first = cols.begin ();
3316  while ( first != cols.end() ) {
3317  const string & str = *first++;
3318  m_CutVariableComboBox1 -> insertItem ( str.c_str() );
3319  m_CutVariableComboBox2 -> insertItem ( str.c_str() );
3320  }
3321  if ( index1 >= m_CutVariableComboBox1 -> count () ) {
3322  index1 = 0;
3323  }
3324  if ( index2 >= m_CutVariableComboBox2 -> count () ) {
3325  index2 = 0;
3326  }
3327 
3328  if ( index1 >= 0 ) {
3329  m_CutVariableComboBox1 -> setCurrentItem ( index1 );
3330  }
3331  if ( index2 >= 0 ) {
3332  m_CutVariableComboBox2 -> setCurrentItem ( index2 );
3333  }
3334 
3335  cut_button_group -> setEnabled ( true );
3336  int id = cutRadioId ();
3337  if ( id == 1 ) {
3338  m_CutVariableComboBox2 -> setEnabled( true );
3339  }
3340 }
3341 
3342 int
3344 cutRadioId () const
3345 {
3346  int id = -1;
3347  if ( m_cut_data1 -> isChecked () ) id = 0;
3348  if ( m_cut_data2 -> isChecked () ) id = 1;
3349  if ( m_cut_fit_radio -> isChecked () ) id = 2;
3350 
3351  return id;
3352 }
3353 
3354 void
3357 {
3358  int id = cutRadioId ();
3359 
3360  switch ( id ) {
3361  case 0 : // 1d data cut
3362  m_CutVariableComboBox1 -> setEnabled ( true );
3363  m_CutVariableComboBox2 -> setEnabled ( false );
3364  break;
3365  case 1 : // 2d data cut
3366  m_CutVariableComboBox1 -> setEnabled ( true );
3367  m_CutVariableComboBox2 -> setEnabled ( true );
3368  break;
3369  case 2 : // fit cut
3370  m_CutVariableComboBox1 -> setEnabled ( false );
3371  m_CutVariableComboBox2 -> setEnabled ( false );
3372  break;
3373  }
3374 
3375  updateCutsTab (); // in case of switching from data to fitting
3376 }
3377 void
3379  setSelectedFitter ( const std::string & name )
3380 {
3382  const vector < string > & fitters = controller -> getFitterNames ();
3383  for ( unsigned int i = 0; i < fitters.size(); i++ ) {
3384  if ( name == fitters[i] )
3385  {
3386  m_fitter_names -> setCurrentItem ( i );
3387  break;
3388  }
3389  }
3390 }
3391 
3392 void
3395 {
3397  const vector < string > & names = controller -> getFunctionNames ();
3398  int current = newFunctionsComboBox->currentItem ();
3399 
3400  if ( newFunctionsComboBox -> count () !=
3401  static_cast < int > ( names.size () ) ) {
3403 
3404  for ( unsigned int i = 0; i < names.size(); i++) {
3405  if ( names[i] != "Linear Sum" ) {
3406  newFunctionsComboBox->insertItem ( names[i].c_str() );
3407  }
3408  }
3409  }
3410 
3411  PlotterBase * plotter = getPlotter();
3412  bool yes = plotter != 0;
3413  m_func_new->setEnabled ( yes );
3414 
3415  if ( yes ) yes = plotter -> isTargetable ();
3416  functionsRemoveButton -> setEnabled ( yes );
3417  m_IgnoreErrorCheckBox -> setEnabled (yes);
3418  functionsFitToDataButton -> setEnabled ( yes );
3419  functionsResetButton -> setEnabled ( yes );
3420  m_resid->setEnabled ( yes );
3421  if ( yes == false ) {
3422  return;
3423  }
3424 
3425  const DataSource * nt
3426  = DisplayController::instance()->getDataSource ( plotter, 0 );
3427 
3428  if ( nt && nt -> empty () )
3429  {
3430  m_func_new->setDisabled ( true );
3431  functionsRemoveButton -> setEnabled ( false );
3432  m_IgnoreErrorCheckBox -> setDisabled (true);
3433  functionsFitToDataButton -> setEnabled ( false );
3434  functionsResetButton -> setEnabled ( false );
3435  return;
3436  }
3437 
3438  // Update new functions section //
3439  //------------------------------//
3440  newFunctionsAddButton->setEnabled ( true );
3441  m_func_new->setEnabled ( true );
3442 
3443  if ( current >= 0 ) {
3445  }
3446  newFunctionsComboBox->setEnabled ( true );
3447 
3448  // Update functionsAppliedComboBox. //
3449  //----------------------------------//
3450  bool to_enable = false;
3451  DisplayController * d_controller = DisplayController::instance ();
3452  int index = d_controller -> activeDataRepIndex ( plotter );
3453 
3455 
3456  if ( index >= 0 ) {
3457  DataRep * datarep = plotter ->getDataRep ( index );
3458  if ( f_controller -> hasFunction ( plotter, datarep ) ) {
3459 
3460  const vector < string > & fnames
3461  = f_controller -> functionNames ( plotter, datarep );
3462 
3463  if ( fnames.size() != 0 )
3464  {
3465  to_enable = true;
3466  m_functionIndexMap.clear();
3467 
3468  for ( unsigned i = 0; i < fnames.size(); i++)
3469  {
3470  if ( fnames[i].find ( "Linear Sum" ) == string::npos )
3471  {
3472  m_functionIndexMap.push_back ( i );
3473  }
3474  }
3475  }
3476  }
3477  }
3478 
3479  functionsRemoveButton -> setEnabled ( to_enable );
3480  m_IgnoreErrorCheckBox -> setEnabled (to_enable);
3481  functionsFitToDataButton -> setEnabled ( to_enable );
3482  functionsResetButton -> setEnabled ( to_enable );
3483  if ( to_enable == false ) {
3485  }
3486 
3487  if ( to_enable )
3488  {
3489  Fitter * fitter = f_controller -> getFitter ( plotter );
3490  string name = "none";
3491  if ( fitter != 0 ) {
3492  name = f_controller -> getFitterName ( plotter );
3493  setSelectedFitter ( name );
3494  }
3495  }
3496 
3497  m_resid->setEnabled ( to_enable );
3498 
3499  // Update function parameters tab //
3500  //--------------------------------//
3501 
3502  // Set Parameters in list view as well as in line editor and
3503  // the check box. Focus is set to the current selected item
3504  // or in case none is selected 1st item.
3505  if ( to_enable ) setParameters ( index, plotter );
3506 
3507  // Set the slider to be in the center
3508  m_FunctionParamsSlider -> setValue(50);
3509 
3510 }
3511 
3512 void
3515 {
3516  PlotterBase * plotter = getPlotter ();
3517  if ( !plotter ) return ;
3518 
3519  FunctionRep * frep = getFunctionRep ( );
3521  controller -> removeFunction ( plotter, frep );
3522  if ( plotter->activePlotIndex ( ) != 0 )
3523  plotter->setActivePlot ( -1, true );
3524  else
3525  plotter->setActivePlot ( 0, true );
3526 
3527  // Update the rest.
3529 }
3530 
3531 void
3534 {
3535  PlotterBase * plotter = getPlotter ();
3536  if ( !plotter ) return ;
3537 
3539  int index = dcontroller -> activeDataRepIndex ( plotter );
3540  if ( index < 0 ) return;
3541  DataRep * datarep = plotter -> getDataRep ( index );
3542 
3544  if ( ! ( fcontroller -> hasFunction ( plotter, datarep ) ) ) {
3545  return;
3546  }
3547 
3548  fcontroller -> restoreParameters ( plotter );
3549 
3550  // Set the parameters
3551  setParameters ( index, plotter );
3552 }
3553 
3554 void
3556 setParameters ( int index, PlotterBase * plotter )
3557 {
3559  m_FunctionParamsCheckBox -> setChecked( false );
3561 
3562  DataRep * datarep = plotter -> getDataRep ( index );
3563  assert ( datarep != 0 );
3564 
3566  if ( ! ( controller -> hasFunction ( plotter, datarep ) ) )
3567  {
3568  return;
3569  }
3570 
3571  const vector < string > & fnames
3572  = controller -> functionNames ( plotter, datarep );
3573 
3574  if ( fnames.empty () ) {
3575  return;
3576  }
3577 
3578  m_function_lv_map.clear ();
3579  vector < FunctionRep * > freps;
3580  controller -> fillTopLevelFunctionReps ( freps, plotter, datarep );
3581  for ( unsigned int i = 0; i < freps.size (); i++ ) {
3582  FunctionRep * frep = freps [ i ];
3583  const string & func_name = frep -> functionName ();
3584 
3585 #if QT_VERSION < 0x040000
3586  QListViewItem * parent
3588 #else
3589  Q3ListViewItem * parent
3590  = new Q3ListViewItem ( m_FunctionParamsListView );
3591 #endif
3592  parent -> setOpen ( true );
3593  parent -> setText ( Index, QString ( func_name.c_str() ) );
3594  m_function_lv_map [ parent ] = frep;
3595 
3596  //Ignore errors flag, conected with the ignoreError check box.
3597  bool ignoreFlag = true;
3598 
3599  Fitter * fitter = frep -> getFitter ();
3600  if ( fitter != 0 ) {
3601  //Get the ignore errors flag of the current function.
3602  ignoreFlag = frep -> getIgnoreErrors ();
3603  }
3604  const vector < double > & parms = frep -> parameters ();
3605  unsigned int start_index = parms.size();
3606  fillFunctionParameters ( parent, frep, start_index );
3607 
3608  m_FunctionParamsListView -> setAllColumnsShowFocus ( true );
3609 #if QT_VERSION < 0x040000
3610  QListViewItem * firstItem = parent -> firstChild ();
3611 #else
3612  Q3ListViewItem * firstItem = parent -> firstChild ();
3613 #endif
3614  m_IgnoreErrorCheckBox -> setChecked(ignoreFlag);
3615 
3616  if ( firstItem != 0 ) {
3617  m_FunctionParamsLineEdit -> setText ( firstItem -> text( Value ) );
3618  m_FunctionParamsListView -> setSelected ( firstItem, true );
3619  m_FunctionParamsListView -> setCurrentItem ( firstItem );
3620 
3621  QString fixedFlag = firstItem -> text( Fixed );
3622  m_FunctionParamsCheckBox->setChecked((fixedFlag == QString ( "Yes" ) ) ?
3623  true : false );
3624  }
3625  }
3626 }
3627 
3628 void
3629 Inspector::
3630 #if QT_VERSION < 0x040000
3632  const FunctionRep * frep,
3633  unsigned int & index )
3634 #else
3635 fillFunctionParameters ( Q3ListViewItem * parent,
3636  const FunctionRep * frep,
3637  unsigned int & index )
3638 #endif
3639 {
3640  const CompositeFunctionRep * composite
3641  = dynamic_cast < const CompositeFunctionRep * > ( frep );
3642 
3643  if ( composite != 0 ) {
3644  const vector < FunctionRep * > & freps
3645  = composite -> getFunctionReps ();
3646  unsigned int size = freps.size();
3647 
3648  // because children are inserted at the beginning, we must do things
3649  // backwards
3650  for ( int i = size -1; i >= 0; i-- ) {
3651  FunctionRep * rep = freps[i];
3652  const string & func_name = rep -> functionName ();
3653 #if QT_VERSION < 0x040000
3654  QListViewItem * child
3655  = new QListViewItem ( parent );
3656 #else
3657  Q3ListViewItem * child
3658  = new Q3ListViewItem ( parent );
3659 #endif
3660  child -> setOpen ( true );
3661  child -> setText ( Index, QString ( func_name.c_str() ) );
3662  m_function_lv_map [ child ] = rep;
3663 
3664  fillFunctionParameters ( child, rep, index );
3665  }
3666  }
3667  else { // not composite
3668  vector < FunctionParameter > function_parameters;
3669  frep -> fillFunctionParameters ( function_parameters );
3670 
3671  QString qyes( "Yes" );
3672  QString qno( "No" );
3673 
3674  // Because items are inserted at the begining, we must do things
3675  // backwards
3676  unsigned int size = function_parameters.size ();
3677 
3678  for ( int pindex = size-1; pindex >= 0; pindex-- ) {
3679  FunctionParameter fp = function_parameters[pindex];
3680  QString dummy;
3681 #if QT_VERSION < 0x040000
3682  QCheckListItem * item
3683  = new QCheckListItem ( parent, dummy,
3684  QCheckListItem::CheckBox );
3685 #else
3686  Q3CheckListItem * item
3687  = new Q3CheckListItem ( parent, dummy,
3688  Q3CheckListItem::CheckBox );
3689 #endif
3690  item -> setText( Index, QString( "%1" ).arg( index-- ) );
3691 
3692  const string & name = fp.name ();
3693  QString pname = name.c_str();
3694  QString fixedFlag ( qno );
3695  fixedFlag = fp.isFixed () ? qyes : qno;
3696 
3697  item -> setText( Name, QString( "%1" ).arg( pname ) );
3698  item -> setText( Value, QString( "%1" ).arg( fp.value() ) );
3699  item -> setText( Error, QString( "%1" ).arg( fp.error() ));
3700  item -> setText( Fixed, QString( "%1" ).arg( fixedFlag ) );
3701  item -> setText( Dummy, QString( "%1" ).arg( pindex ) );
3702  }
3703  }
3704 }
3705 
3709 void
3712 {
3713  PlotterBase * plotter = getPlotter ();
3714  if ( !plotter ) return ;
3715 
3716  bool yes = plotter -> isTargetable ();
3717  if ( yes == false ) {
3718  multipleDataRepError ( "function" );
3719  return;
3720  }
3721 
3723 
3724  DataRep * datarep = dc -> activeDataRep ( plotter );
3725  assert ( datarep != 0 );
3726 
3727  if ( !datarep->acceptFunction(1) ){
3728  functionAddError ();
3729  return;
3730  }
3731 
3732  // Get the selected function name.
3733 
3735  std::string fun_name = qstr.latin1();
3736 
3737  // Add the function.
3738 
3739  QString s = m_fitter_names -> currentText ( );
3740  const string fit_name = s.latin1();
3741 
3743  yes = fc -> isCompatible ( fun_name, fit_name );
3744 
3745  if ( yes == false ) {
3746  incompatibleFunctionError ( fun_name );
3747  return;
3748  }
3749 
3750  FunctionRep * new_rep = 0;
3751  try {
3752 #if QT_VERSION < 0x040000
3753  QListViewItem * item = m_FunctionParamsListView -> currentItem ();
3754 #else
3755  Q3ListViewItem * item = m_FunctionParamsListView -> currentItem ();
3756 #endif
3757  bool is_selected = m_FunctionParamsListView -> isSelected ( item );
3758  FunctionRep * frep = 0;
3759  if ( is_selected ) {
3760  frep = getTopFunctionRep ( item );
3761  }
3762 
3763  new_rep = fc->addFunction ( plotter, fun_name, frep, datarep );
3764  }
3765  catch ( std::exception & e ) {
3766  badFunctionError ( fun_name, e.what() );
3767  }
3768 
3769  int index = m_fitter_names -> currentItem ();
3770  fitterNamesActivated ( index ); // sets the fitter
3771 
3772  functionsRemoveButton -> setEnabled ( true );
3773  m_IgnoreErrorCheckBox -> setEnabled (true);
3774  functionsFitToDataButton -> setEnabled ( true );
3775  functionsResetButton -> setEnabled ( true );
3776  fc->saveParameters ( plotter );
3777 
3778  bool ok = false;
3779  if ( new_rep != 0 ) {
3780  ok = fc -> tryFitFunction ( plotter, new_rep ); // try fit
3781  }
3782  if ( ! ok ) {
3783  fitFailedError ();
3784  }
3785  // Update other tabs that need it.
3786 
3788 }
3789 
3790 void
3793 {
3795  const vector < string > & names = controller -> getFitterNames ();
3796  const string & def_fitter = names [ index ];
3797  controller -> setDefaultFitter ( def_fitter );
3798 
3799  PlotterBase * plotter = getPlotter ();
3800  if ( plotter != 0 ) {
3801  const DataRep * datarep = plotter -> getTarget ();
3802  bool yes = controller -> hasFunction ( plotter, datarep );
3803  if ( yes ) {
3804  bool ok = controller -> changeFitter ( plotter, datarep,
3805  def_fitter );
3806  if ( ok == false ) {
3807  incompatibleFitterError ( def_fitter );
3808  functionsFitToDataButton -> setEnabled ( false );
3809  }
3810  else {
3811  functionsFitToDataButton -> setEnabled ( true );
3812  }
3813  }
3814  }
3815 }
3816 
3817 void
3820 {
3821  const QString message ( "The Fit failed to converge" );
3822  QMessageBox::critical ( this, // parent
3823  "Fit failed",
3824  message,
3825  QMessageBox::Ok,
3826  Qt::NoButton,
3827  Qt::NoButton );
3828 }
3829 
3830 FunctionRep *
3831 Inspector::
3832 #if QT_VERSION < 0x040000
3834 #else
3835 getTopFunctionRep ( Q3ListViewItem * item )
3836 #endif
3837 {
3838  FunctionRep * rep = 0;
3839  if ( item != 0 ) {
3840  item = getTopParent ( item );
3841  rep = m_function_lv_map [ item ];
3842  }
3843  return rep;
3844 }
3845 
3846 FunctionRep *
3847 Inspector::
3848 #if QT_VERSION < 0x040000
3850 #else
3851 getFunctionRep ( Q3ListViewItem * item )
3852 #endif
3853 {
3854  FunctionRep * rep = 0;
3855  if ( item != 0 ) {
3856  rep = m_function_lv_map [ item ];
3857  }
3858  return rep;
3859 }
3860 
3861 FunctionRep *
3864 {
3865 #if QT_VERSION < 0x040000
3866  QListViewItem * item = m_FunctionParamsListView -> currentItem();
3867 #else
3868  Q3ListViewItem * item = m_FunctionParamsListView -> currentItem();
3869 #endif
3870 
3871  return getTopFunctionRep ( item );
3872 }
3873 
3874 FunctionRep *
3877 {
3878 #if QT_VERSION < 0x040000
3879  QListViewItem * item = m_FunctionParamsListView -> currentItem();
3880 #else
3881  Q3ListViewItem * item = m_FunctionParamsListView -> currentItem();
3882 #endif
3883 
3884  if ( item -> childCount() == 0 ) { // parameter item
3885  item = item -> parent ();
3886  }
3887 
3888  return getFunctionRep ( item );
3889 }
3890 
3891 void
3894 {
3895  PlotterBase * plotter = getPlotter ();
3896  if ( !plotter ) return ;
3897 
3899  if ( ! ( fcnt -> hasFunction ( plotter, 0 ) ) ) { // any function
3900  return;
3901  }
3902 
3903  fcnt -> saveParameters ( plotter );
3904 
3905  FunctionRep * fun_rep = getTopFunctionRep ();
3906 
3907  bool ok = fcnt -> fitFunction ( plotter, fun_rep );
3908  if ( ! ok ) {
3909  fitFailedError ();
3910  }
3911 
3912  // Set the parameters
3914  int index = dcontroller -> activeDataRepIndex ( plotter );
3915 
3916  setParameters ( index, plotter );
3917 }
3918 
3919 void
3922 {
3923  QString text_str = box -> text ();
3924  int i = text_str.find ( "=" );
3925  text_str.remove ( i + 1, 1024 );
3926  box -> setText ( text_str );
3927 }
3928 
3930 {
3931  if ( m_new_plot_box->isEnabled() == false ) return;
3932 
3933  PlotterBase * plotter = getPlotter();
3934  bool yes = plotter == 0;
3935  if ( yes == false ) {
3936  TextPlotter * text = dynamic_cast < TextPlotter * > ( plotter );
3937  yes |= text != 0;
3938  }
3939  bool enable = ! yes;
3940  m_summary->setEnabled ( enable );
3941 
3942  if ( enable == false ) return;
3943 
3945  const DataSource * nt = dcontroller -> getDataSource ( plotter, 0 );
3946 
3947  if ( nt && nt -> empty () ) {
3948  m_summary->setEnabled ( false );
3949  return;
3950  }
3951 
3952  enable = false; // might be changed below...
3953  int index = dcontroller -> activeDataRepIndex ( plotter );
3954  if ( index >= 0 ) {
3955  DataRep * datarep = plotter -> getDataRep ( index );
3957 
3958  enable = controller->hasFunction ( plotter, datarep );
3959  }
3960  if ( enable == false ) {
3961  if ( m_stats_fparms->isChecked () ||
3962  m_stats_chi->isChecked () ) {
3963  m_stats_number->setChecked ( true );
3964  }
3965  }
3966 
3967  m_stats_fparms->setEnabled ( enable );
3968  m_stats_chi->setEnabled ( enable );
3969 
3970  yes = index < 0;
3971 
3972  m_stats_number->setDisabled ( yes );
3973  m_stats_underflow->setDisabled ( yes );
3974  m_stats_overflow->setDisabled ( yes );
3975  m_stats_avg_x->setDisabled ( yes );
3976  m_stats_avg_y->setDisabled ( yes );
3977  m_stats_text->setDisabled ( yes );
3978  yes = m_stats_text -> isChecked ();
3979  m_statsTextField ->setEnabled ( yes );
3980 
3986 
3987  if ( index >= 0 ) {
3988  int number = dcontroller -> getNumberOfEntries ( plotter, index );
3989  QString text = m_stats_number -> text ();
3990  QString str;
3991  str.setNum ( number );
3992  text += " ";
3993  text += str;
3994  m_stats_number -> setText ( text );
3995 
3996  int underflow = dcontroller -> getUnderflow ( plotter, index );
3997  text = m_stats_underflow -> text ();
3998  if ( underflow == -1 ) str = "meaningless";
3999  else str.setNum ( underflow );
4000  text += " ";
4001  text += str;
4002  m_stats_underflow -> setText ( text );
4003 
4004  int overflow = dcontroller -> getOverflow ( plotter, index );
4005  text = m_stats_overflow -> text ();
4006  if ( overflow == -1 ) str = "meaningless";
4007  else str.setNum ( overflow );
4008  text += " ";
4009  text += str;
4010  m_stats_overflow -> setText ( text );
4011 
4012  double average = dcontroller -> getAverage ( plotter, Axes::X, index );
4013  text = m_stats_avg_x -> text ();
4014  str.setNum ( average );
4015  text += " ";
4016  text += str;
4017  m_stats_avg_x -> setText ( text );
4018 
4019  average = dcontroller -> getAverage ( plotter, Axes::Y, index );
4020  text = m_stats_avg_y -> text ();
4021  str.setNum ( average );
4022  text += " ";
4023  text += str;
4024  m_stats_avg_y -> setText ( text );
4025  }
4026 
4027 }
4028 
4029 void
4032 {
4033  bool yes = m_stats_text -> isChecked ();
4034  m_statsTextField -> setEnabled ( yes );
4035 }
4036 
4038 void Inspector::
4040 {
4041  PlotterBase * plotter = getPlotter ();
4042  if ( !plotter ) return;
4043 
4044  DisplayController * d_controller = DisplayController::instance ();
4045  int index = d_controller->activeDataRepIndex ( plotter );
4046  if ( index < 0 ) {
4047  multipleDataRepError ( "summary" );
4048  return;
4049  }
4050 
4052 
4053  string nullstring ("");
4054 
4055  if ( m_stats_number->isChecked() )
4056  {
4057  const string s ("Total Entries");
4058  canvas->addTextDisplay ( plotter, s, nullstring );
4059  }
4060 
4061  else if ( m_stats_underflow->isChecked() )
4062  {
4063  const string s ("Underflow");
4064  canvas->addTextDisplay ( plotter, s, nullstring );
4065  }
4066 
4067  else if ( m_stats_overflow->isChecked() )
4068  {
4069  const string s ("Overflow");
4070  canvas->addTextDisplay ( plotter, s, nullstring );
4071  }
4072 
4073  else if ( m_stats_avg_x->isChecked() )
4074  {
4075  const string s ("averagex");
4076  canvas->addTextDisplay ( plotter, s, nullstring );
4077  }
4078 
4079  else if ( m_stats_avg_y->isChecked() )
4080  {
4081  const string s ("averagey");
4082  canvas->addTextDisplay ( plotter, s, nullstring );
4083  }
4084 
4085  else if ( m_stats_fparms->isChecked() )
4086  {
4087  const string s ("Function Parameters");
4089  assert ( controller -> hasFunction ( plotter, 0 ) );
4090  canvas->addFuncDisplay ( plotter, s );
4091 
4092  }
4093 
4094  else if ( m_stats_chi->isChecked() )
4095  {
4096  const string s ("Chi-squared");
4098  assert ( controller -> hasFunction ( plotter, 0 ) );
4099  canvas->addFuncDisplay ( plotter, s );
4100 
4101  }
4102 
4103  else if ( m_stats_text->isChecked() )
4104  {
4105 
4106  QString qtext = m_statsTextField->text();
4107  const string t = qtext.latin1();
4108  bool needMargin = String::ci_find(t, "tex:")==0;
4109  if ( needMargin ) {
4110 #ifdef HAVE_TEX_UTILS
4111 #else
4112  qtext.remove (0, 4);
4113  warningTex ();
4114 #endif
4115  }
4116  string text (qtext.latin1());
4117  const string s ("Text From Box");
4118  canvas->addTextDisplay ( plotter, s, text );
4119  }
4120 }
4121 
4125 {
4126  PlotterBase * plotter = getPlotter ();
4127  if ( plotter == 0 ) return;
4128 
4129  FunctionRep * func_rep = getTopFunctionRep ();
4131  PlotterBase * res_plotter
4132  = controller -> createResidualsDisplay ( plotter, func_rep );
4133  const Range & range = plotter -> getRange ( Axes::X, false );
4134  res_plotter -> setRange ( Axes::X, range, false );
4135 
4136  CanvasWindow * canvas = WindowController::instance () -> currentCanvas ();
4137 
4138  canvas -> addPlotDisplay ( res_plotter, true );
4139 }
4140 
4141 void Inspector::
4143 {
4144  m_func_parm_checked.clear ();
4145 
4146 #if QT_VERSION < 0x040000
4148 #else
4149  Q3ListViewItemIterator it ( m_FunctionParamsListView );
4150 #endif
4151  while ( it.current () ) {
4152 #if QT_VERSION < 0x040000
4153  QListViewItem * item = it.current ();
4154  QCheckListItem * check_item = dynamic_cast < QCheckListItem * > ( item );
4155 #else
4156  Q3ListViewItem * item = it.current ();
4157  Q3CheckListItem * check_item = dynamic_cast < Q3CheckListItem * > ( item );
4158 #endif
4159  if ( check_item != 0 ) {
4160  bool yes = check_item -> isOn ();
4161  if ( yes ) {
4162  m_func_parm_checked.push_back ( item );
4163  }
4164  }
4165  ++it;
4166  }
4167 }
4168 
4173 void
4176 {
4177  PlotterBase * plotter = getPlotter ();
4178  if ( plotter == 0 ) return;
4179 
4181 
4183  if ( m_func_parm_checked.size () != 2 ) {
4184  const QString
4185  message ( "Two and only two function parameters should be\n"
4186  "checked to create error contour display.\n" );
4187  QMessageBox::critical( this, // parent
4188  "Invalid parameter pair selection", // caption
4189  message,
4190  QMessageBox::Ok,
4191  Qt::NoButton,
4192  Qt::NoButton );
4193  return;
4194  }
4195 
4196 #if QT_VERSION < 0x040000
4197  QListViewItem * first = m_func_parm_checked[0];
4198  QListViewItem * second = m_func_parm_checked[1];
4199 #else
4200  Q3ListViewItem * first = m_func_parm_checked[0];
4201  Q3ListViewItem * second = m_func_parm_checked[1];
4202 #endif
4203  if ( getTopParent ( first ) != getTopParent ( second ) ) {
4204  const QString message =
4205  "Both checked function parameters must\n"
4206  "have same parent function.";
4207  QMessageBox::critical( this, // parent
4208  "Invalid parameter pair selection", // caption
4209  message,
4210  QMessageBox::Ok,
4211  Qt::NoButton,
4212  Qt::NoButton );
4213  return;
4214  }
4215  QString text = first -> text ( Index );
4216  bool ok = true;
4217  int index = text.toInt ( & ok ) - 1;
4218  fcontroller -> setEllpsoidParamIndex ( Axes::X , index );
4219 
4220  text = second -> text ( Index );
4221  ok = true;
4222  index = text.toInt ( & ok ) -1 ;
4223  fcontroller -> setEllpsoidParamIndex ( Axes::Y , index );
4224 
4225  // Create / refresh the error plot
4226  const QString xlabel = first -> text ( Name );
4227  const QString ylabel = second -> text ( Name );
4228  QString stat = m_PushButtonNewErrorPlot -> text();
4229 #if QT_VERSION < 0x040000
4230  QListViewItem * parent = getTopParent ( first );
4231 #else
4232  Q3ListViewItem * parent = getTopParent ( first );
4233 #endif
4234  FunctionRep * frep = m_function_lv_map [ parent ];
4235  if( stat == QString( "Change Error Plot" ) )
4236  {
4237  fcontroller -> refreshEllipsoidDisplay ( plotter, frep );
4238  plotter -> setLabel( Axes::X, xlabel.latin1() );
4239  plotter -> setLabel( Axes::Y, ylabel.latin1() );
4240  }
4241  else // "New Error Plot"
4242  {
4243  PlotterBase * err_plotter =
4244  fcontroller -> createNewEllipsoidDisplay ( plotter, frep );
4245  assert( err_plotter != 0);
4246 
4247  err_plotter -> setLabel( Axes::X, xlabel.latin1() );
4248  err_plotter -> setLabel( Axes::Y, ylabel.latin1() );
4249 
4250  CanvasWindow * canvas
4251  = WindowController::instance () -> currentCanvas ();
4252  assert( canvas != 0 );
4253 
4254  // Add the plot to the display BUT donot select it. Let mother
4255  // plot be the one which is selected.
4256  canvas -> addPlotDisplay ( err_plotter, false );
4257  }
4258 }
4259 
4260 const std::string
4263 {
4264  if ( axis == Axes::X ) return "X";
4265  else if ( axis == Axes::Y ) return "Y";
4266  else if ( axis == Axes::Z ) return "Z";
4267 
4268  return "nil";
4269 }
4270 
4271 void
4274 {
4275  bool yes = m_plotter_list.empty () == false;
4276 
4277  logScale -> setEnabled ( yes );
4278  if ( yes ) {
4279  PlotterBase * plotter = m_plotter_list.front ();
4280  bool log = DisplayController::instance () -> getLog ( plotter, m_axis );
4281  logScale -> setChecked ( log );
4282  }
4283 }
4284 
4285 void
4288 {
4289  bool yes = m_plotter_list.empty () == false;
4290  m_autoScale -> setEnabled ( yes );
4291  if ( yes ) {
4292  PlotterBase * plotter = m_plotter_list.front ();
4293  bool scaled = plotter -> isAutoRanging ( m_axis );
4294  m_autoScale -> setChecked ( scaled );
4295  }
4296 }
4297 
4298 void
4301 {
4302  bool yes = ( m_plotter_list.empty () == false )
4303  && ( m_axis == Axes::X );
4304  m_reverse -> setEnabled ( yes );
4305 
4306  if ( yes ) {
4307  PlotterBase * plotter = m_plotter_list.front ();
4308  bool reversed = plotter -> isReverse ();
4309  m_reverse -> setChecked ( reversed );
4310  }
4311 }
4312 
4319 void
4322 {
4323  updateLogBox ();
4324  updateAutoScaleBox ();
4325  updateReverseBox ();
4326 
4327  PlotterBase * plotter = getPlotter ();
4328  bool yes = plotter == 0;
4329  if ( yes == false ) {
4330  TextPlotter * text = dynamic_cast < TextPlotter * > ( plotter );
4331  yes |= text != 0;
4332  }
4333  m_axis_frame->setEnabled ( ! yes );
4334 
4335  if ( yes ) return;
4336 
4338  int index = -1;
4339  if ( plotter -> isTargetable () ) {
4340  index = controller->activeDataRepIndex ( plotter );
4341  }
4342 
4343  bool has_ntuple = controller->hasNTupleBindings ( plotter, 0 );
4344  if ( has_ntuple )
4345  {
4346  const DataSource * nt
4347  = DisplayController::instance() -> getDataSource ( plotter, 0 );
4348  if ( nt && nt -> empty () ) return;
4349  }
4350 
4351  if ( plotter -> hasAxis ( m_axis ) == false ) setZRadioButton ( false );
4352  bool enabled = plotter -> hasAxis ( Axes::Z );
4353  setZRadioButton ( enabled );
4354 
4355  const string & label = plotter -> getLabel ( m_axis );
4356  const QString ltext = label.c_str();
4357  m_axis_label -> setText ( ltext );
4358 
4359  const string s_axis = convertToString ( m_axis );
4360  bool axis_bined = controller -> isAxisBinned ( plotter, s_axis );
4361  const Range & r = plotter->getRange(m_axis, true);
4362  double low = r.low();
4363  double high = r.high();
4364 
4365  axisWidget1 -> setLowText ( QString("%1").arg(low),
4366  axis_bined == true &&
4367  has_ntuple == false );
4368  axisWidget1 -> setHighText ( QString("%1").arg(high),
4369  axis_bined == true &&
4370  has_ntuple == false );
4371 
4372  axisWidget1 -> setLowSliderValue( 50 );
4373  m_lowslider1_last_val = 50;
4374  axisWidget1 -> setHighSliderValue( 50 );
4376 
4377  if (getMinEntries()==-1) {
4378  m_combine_checkbox->setEnabled( false );
4379  min_entries_text->setEnabled ( false );
4380  min_entries_slider->setEnabled ( false );
4381  }
4382 
4383  else {
4384  m_combine_checkbox->setEnabled( true );
4385 
4386  if ( m_combine_checkbox->isChecked() )
4387  {
4388  min_entries_text->setEnabled ( true );
4389  min_entries_slider->setEnabled ( true );
4390  unsigned int min = getMinEntries();
4391  min_entries_text->setText( QString ("%1").arg(min) );
4393  }
4394  else
4395  {
4396  min_entries_text->setEnabled ( false );
4397  min_entries_slider->setEnabled ( false );
4398  unsigned int min = getMinEntries();
4399  min_entries_text->setText( QString ("%1").arg(min) );
4400  min_entries_slider->setValue ( 50 );
4401  }
4402  }
4403 
4404 
4405 
4406 
4407  if ( axis_bined == false )
4408  {
4409  m_width_text->setEnabled ( false );
4410  m_width_range->setEnabled ( false );
4411  m_width_text -> setText ( QString ("%1").arg (0) );
4412 
4413  m_offset_text->setEnabled ( false );
4414  m_offset_range->setEnabled ( false );
4415  m_offset_text -> setText ( QString ("%1").arg (0) );
4416  }
4417  else
4418  {
4419  m_width_text->setEnabled ( true );
4420  m_width_range->setEnabled ( true );
4421  double width = plotter->getBinWidth ( m_axis );
4422  m_width_text -> setText ( QString ("%1").arg (width) );
4423 
4424  m_offset_text->setEnabled ( true );
4425  m_offset_range->setEnabled ( true );
4426  double offset = plotter->getOffset ( m_axis );
4427  m_offset_text -> setText ( QString ("%1").arg (offset) );
4428 
4429  // make read only if not bound to ntuple
4430  m_width_text->setReadOnly ( ! has_ntuple );
4431  m_width_range->setEnabled ( has_ntuple );
4432  m_offset_text->setReadOnly ( ! has_ntuple );
4433  m_offset_range->setEnabled ( has_ntuple );
4434  }
4435 
4436  //----------------------------//
4437  // Handling the log check box //
4438  //----------------------------//
4439  bool disable_log = has_ntuple == false && axis_bined == true;
4440  logScale -> setDisabled ( disable_log );
4441  m_autoScale -> setDisabled ( disable_log );
4442 
4443  const PeriodicBinaryTransform *pbtf =
4444  dynamic_cast < const PeriodicBinaryTransform * >
4445  ( plotter->getTransform() );
4446 
4447  if( pbtf == 0 ) {
4448  bool log = DisplayController::instance() -> getLog ( plotter, m_axis );
4449 
4450  if( log )
4451  {
4452  m_offset_text -> setEnabled( false );
4453  m_offset_range -> setEnabled( false );
4454  }
4455  }
4456 
4457 
4458  axisWidget1->setAllDisabled ( false );
4459 
4460  //--------------------------------//
4461  // Handling of zoom pan check box //
4462  //--------------------------------//
4463  bool isZoomPan = false;
4464 
4465  std::map < const PlotterBase *, bool >::const_iterator it
4466  = m_zoompan.find ( plotter );
4467  if ( it != m_zoompan.end () )
4468  isZoomPan = it->second;
4469 
4470  // By defalut for periodic binary transforms (pbtf) zoom pan mode should
4471  // be set for both X and Y axis. For Z axis setting zoom pan mode does
4472  // not make sense.
4473  if( pbtf != 0 && m_axis != Axes::Z) {
4474  axisWidget1->setZoomPan ( true, true );
4475  }
4476  else {
4477  if ( m_axis == Axes::Z ) {
4478  axisWidget1 -> setZoomPan ( false, true ); //disables it
4479  }
4480  else {
4481  axisWidget1->setZoomPan ( isZoomPan );
4482  }
4483  }
4484 
4486 
4487  yes = false;
4488  if ( index >= 0 ) {
4489  const DataRep * datarep = plotter -> getDataRep ( index );
4490  RepBase * rep = datarep -> getRepresentation ();
4491  ContourPointRep * contourRep = dynamic_cast < ContourPointRep * > ( rep );
4492  yes = contourRep != 0;
4493  if ( yes ) {
4494  bool user = contourRep->getUsingUserValues();
4495  contourRadioButton1->setChecked ( !user );
4496  contourRadioButton2->setChecked ( user );
4497  contourRadioButton1_toggled ( true );
4498  }
4499  }
4500 
4501  m_contourBox->setEnabled ( yes );
4502 }
4503 
4504 
4508 #if QT_VERSION < 0x040000
4510 #else
4512 #endif
4513 {
4514 #if QT_VERSION < 0x040000
4515  QListViewItem * item = m_FunctionParamsListView -> currentItem ();
4516 #else
4517  Q3ListViewItem * item = m_FunctionParamsListView -> currentItem ();
4518 #endif
4519  bool is_selected = m_FunctionParamsListView -> isSelected ( item );
4520  bool is_parm = item -> childCount () == 0;
4521  bool enable = is_selected && is_parm;
4522 
4523  m_FunctionParamsCheckBox -> setEnabled ( enable );
4524  m_FunctionParamsLineEdit -> setEnabled ( enable );
4525  m_FunctionParamsSlider -> setEnabled ( enable );
4526 
4527  if ( enable ) {
4528  QString fixedFlag = item -> text( Fixed );
4529  QString qyes( "Yes" );
4531  setChecked(( fixedFlag == qyes ) ? true : false );
4532  m_FunctionParamsLineEdit -> setText ( item -> text( Value ) );
4533  }
4534 
4535  enable = is_selected && (! is_parm);
4536  functionsRemoveButton -> setEnabled ( enable );
4537 
4538 }
4539 #if QT_VERSION < 0x040000
4540 QListViewItem *
4543 {
4544  QListViewItem * parent = item;
4545  while ( true ) {
4546  QListViewItem * t = parent -> parent ();
4547  if ( t == 0 ) break;
4548  parent = t;
4549  }
4550 #else
4551 Q3ListViewItem *
4553 getTopParent ( Q3ListViewItem * item )
4554 {
4555  Q3ListViewItem * parent = item;
4556  while ( true ) {
4557  Q3ListViewItem * t = parent -> parent ();
4558  if ( t == 0 ) break;
4559  parent = t;
4560  }
4561 #endif
4562  return parent;
4563 }
4564 
4567 void
4570 {
4571  PlotterBase * plotter = getPlotter();
4572  if ( !plotter ) return;
4573 
4575  if ( ! ( fcontroller -> hasFunction ( plotter, 0 ) ) ) {
4576  return;
4577  }
4578 
4579  fcontroller -> saveParameters ( plotter );
4580 
4581 #if QT_VERSION < 0x040000
4582  QListViewItem * item = m_FunctionParamsListView -> currentItem();
4583 #else
4584  Q3ListViewItem * item = m_FunctionParamsListView -> currentItem();
4585 #endif
4586  if( !item ) return;
4587 
4588  FunctionRep * frep = getTopFunctionRep ( item );
4589 
4590  vector < int > fixed = frep -> getFixedFlags ();
4591 
4592  QString pidx = item -> text( Index ); // As a hack we hide in the 5th place
4593  int paramindex = pidx.toUInt() - 1; // the index of the parameter
4594 
4595  // Set the new fixed flag for the function
4596  bool flag = m_FunctionParamsCheckBox -> isChecked();
4597 
4598  fixed[ paramindex ] = flag == true ? 1 : 0;
4599  frep -> setFixedFlags( fixed );
4600 
4601  if ( item -> childCount () == 0 ) {
4602  QString qyes ( "Yes" );
4603  QString qno ( "No" );
4604  QString fixedFlag = ( flag == true ) ? qyes : qno;
4605  item -> setText ( Fixed, fixedFlag );
4606  }
4607 
4608 }
4609 
4610 
4615 {
4616  // Check if there is plotter.
4617  PlotterBase * plotter = getPlotter();
4618  if ( !plotter ) return;
4619 
4620  // Check if there is a function attached to this plotter.
4622  if ( ! ( fcontroller -> hasFunction ( plotter, 0 ) ) )
4623  return;
4624 
4625  // Save old parameters
4626  fcontroller -> saveParameters ( plotter );
4627 
4628  // Get the current item and item-number
4629 #if QT_VERSION < 0x040000
4630  QListViewItem * item = m_FunctionParamsListView -> currentItem();
4631 #else
4632  Q3ListViewItem * item = m_FunctionParamsListView -> currentItem();
4633 #endif
4634  if( !item ) return;
4635 
4636  QString pidx = item -> text( Index );
4637  int paramindex = pidx.toUInt() -1; // the index of the parameter
4638 
4639  FunctionRep * frep = getTopFunctionRep ( item );
4640  vector < double > parameters = frep-> parameters();
4641 
4642  // Set the new fixed flag for the function
4643  QString text = m_FunctionParamsLineEdit -> text();
4644  parameters[ paramindex ] = text.toDouble();
4645  frep -> setParameters( parameters );
4646  frep -> setDirty();
4647 
4648  // Change the new parameter in ListView
4649  item -> setText ( Value, QString ( "%1" ).arg ( parameters[ paramindex ] ) );
4650 }
4651 
4652 
4656 void
4659 {
4660  PlotterBase * plotter = getPlotter();
4661  if ( !plotter ) return;
4662 
4664  if ( ! ( fcontroller -> hasFunction ( plotter, 0 ) ) )
4665  return;
4666 
4667  // Save old parameters
4668  fcontroller -> saveParameters ( plotter );
4669 
4670  FunctionRep * frep = getTopFunctionRep ( );
4671 
4672  if ( frep != 0 ) {
4673  m_oldParameters = frep -> parameters ();
4674  }
4675 }
4676 
4677 
4681 void
4684 {
4685  PlotterBase * plotter = getPlotter();
4686  if ( !plotter ) return;
4687 
4689  if ( ! ( fcontroller -> hasFunction ( plotter, 0 ) ) )
4690  return;
4691 
4692 #if QT_VERSION < 0x040000
4693  QListViewItem * item = m_FunctionParamsListView -> currentItem();
4694 #else
4695  Q3ListViewItem * item = m_FunctionParamsListView -> currentItem();
4696 #endif
4697 
4698  if( !item ) return;
4699 
4700  QString pidx = item -> text( Index );
4701  int paramindex = pidx.toUInt() - 1; // the index of the parameter
4702 
4703  vector < double > newParameters = m_oldParameters;
4704 
4705  int sliderValue = m_FunctionParamsSlider -> value();
4706  int sign = ( m_oldParameters[ paramindex ] < 0 )? -1:1;
4707 
4708  newParameters[ paramindex ]
4709  = m_oldParameters[ paramindex ] *
4710  pow ( 2.0, static_cast<double>( (sliderValue - 50) * sign) / 50.0 );
4711 
4712  FunctionRep * frep = getTopFunctionRep ( item );
4713  frep -> setParameters( newParameters ); // will set projector dirty
4714 
4715  item -> setText( Value, QString ( "%1" ).arg ( newParameters[ paramindex ]));
4717  setText ( QString ( "%1" ).arg ( newParameters[ paramindex ] ) );
4718 }
4719 
4722 void
4725 {
4726  m_FunctionParamsSlider -> setValue(50);
4727 }
4728 
4729 void
4731 invalidOperationError ( const string & message )
4732 {
4733  QMessageBox::critical ( this, // parent )
4734  "Operation error", // caption
4735  message.c_str(), // message
4736  QMessageBox::Ok,
4737  Qt::NoButton,
4738  Qt::NoButton );
4739 }
4740 
4745 {
4746  bool log = logScale -> isChecked();
4747  bool auto_scale = m_autoScale -> isChecked ();
4748 
4749  vector < PlotterBase * > ::iterator first = m_plotter_list.begin ();
4750 
4751  while ( first != m_plotter_list.end () ) {
4752  PlotterBase * plotter = *first++;
4753  try {
4754  DisplayController::instance()-> setLog ( plotter, m_axis, log );
4755  plotter -> setAutoRanging ( m_axis, auto_scale );
4756  }
4757  catch ( const runtime_error & e ) {
4758  invalidOperationError ( e.what () );
4759  }
4760  }
4761 
4762  updateAxisTab ();
4763 }
4764 
4766 {
4767  bool reverse = m_reverse -> isChecked();
4768 
4769  vector < PlotterBase * > ::iterator first = m_plotter_list.begin ();
4770 
4771  while ( first != m_plotter_list.end () ) {
4772  PlotterBase * plotter = *first++;
4773  plotter -> setReverse ( reverse );
4774  }
4775 
4776  updateAxisTab ();
4777 }
4778 
4780 {
4781  bool scale = m_autoScale -> isChecked ();
4782  vector < PlotterBase * > ::iterator first = m_plotter_list.begin ();
4783 
4784  while ( first != m_plotter_list.end () ) {
4785  PlotterBase * plotter = *first++;
4786  plotter -> setAutoRanging ( m_axis, scale );
4787 
4788  // If the transform be periodic it sets both the offsets to be 0.0
4790  dynamic_cast< PeriodicBinaryTransform* > ( plotter->getTransform() );
4791  if ( tp != 0 )
4792  {
4793  tp->setXOffset( 0.0 );
4794  tp->setYOffset( 0.0 );
4795  }
4796  }
4797 
4798  updateAxisTab();
4799 }
4800 
4802 {
4803  if ( m_is_updating == false ) {
4804  int index = m_selCutComboBox -> currentItem ();
4805  Range currentRange = m_tuple_cuts [ index] -> getRange ();
4806  int id = cutRadioId ();
4807  bool fit_cut = id == 2;
4808 
4809  if ( fit_cut == false ) { //data cut
4810  Axes::Type axis = getAxes ( index );
4811  PlotterBase * plotter = getSelectedCut();
4812  const Range & fullRange = plotter -> getRange ( axis, false );
4813  axisWidget2 -> processHighSliderMoved ( value, currentRange, fullRange );
4814  plotter -> setCutRangeAt ( currentRange, axis );
4815  }
4816  else { // fit cut
4817  PlotterBase * plotter = getPlotter ();
4818  const Range & fullRange = plotter -> getRange ( Axes::X, false );
4819  axisWidget2 -> processHighSliderMoved ( value, currentRange, fullRange );
4820  plotter -> setCutRangeAt ( currentRange, index );
4821  }
4822  }
4823 }
4824 
4826 {
4827  if ( m_is_updating == false ) {
4828  int index = m_selCutComboBox -> currentItem ();
4829  Range currentRange = m_tuple_cuts [ index ] -> getRange ();
4830 
4831  bool fit_cut = cutRadioId () == 2;
4832 
4833  if ( fit_cut == false ) { //data cut
4834  Axes::Type axis = getAxes ( index );
4835  PlotterBase * plotter = getSelectedCut();
4836  const Range & fullRange = plotter -> getRange ( axis, false );
4837  axisWidget2 -> processLowSliderMoved ( value, currentRange, fullRange );
4838  plotter -> setCutRangeAt ( currentRange, axis );
4839  }
4840  else { // fit cut
4841  PlotterBase * plotter = getPlotter ();
4842  const Range & fullRange = plotter -> getRange ( Axes::X, false );
4843  axisWidget2 -> processLowSliderMoved ( value, currentRange, fullRange );
4844  plotter -> setCutRangeAt ( currentRange, index );
4845  }
4846  }
4847 }
4848 
4850 {
4851  PlotterBase * cd = getSelectedCut();
4852  if ( cd == 0 ) return;
4853  int index = m_selCutComboBox -> currentItem ();
4854  Axes::Type axis = getAxes ( index );
4855  const Range & fullRange = cd->getRange ( axis, false );
4856  axisWidget2->processLowSliderReleased ( fullRange );
4857 }
4858 
4860 {
4861  PlotterBase * cd = getSelectedCut();
4862  if ( cd == 0 ) return;
4863  int index = m_selCutComboBox -> currentItem ();
4864  Axes::Type axis = getAxes ( index );
4865  const Range & fullRange = cd->getRange ( axis, false );
4866  axisWidget2->processHighSliderReleased ( fullRange );
4867 }
4868 
4870 {
4871  PlotterBase * plotter = getSelectedCut();
4872 
4873  int index = m_selCutComboBox -> currentItem ();
4874  int id = cutRadioId ();
4875  bool fit_cut = id ==2;
4876 
4877  Axes::Type axis = Axes::X;
4878  if ( fit_cut == false ) {
4879  axis = getAxes ( index );
4880  }
4881  bool yes = axisWidget2 -> isZoomPanChecked ();
4882  CutController * controller = CutController::instance ();
4883  controller -> setZoomPan ( plotter, axis, yes );
4884 
4885  Range currentRange = m_tuple_cuts [ index ] -> getRange ();
4886  const Range & fullRange = plotter -> getRange ( axis, false );
4887 
4888  axisWidget2 -> processZoomPanCheckBoxClicked ( currentRange, fullRange ) ;
4889 }
4890 
4891 
4893 {
4894  int id = cutRadioId ();
4895  bool fit_cut = id == 2;
4896 
4897  if ( fit_cut == false ) { //data cut
4898  PlotterBase * plotter = getSelectedCut ();
4899  CutPlotter * cp = dynamic_cast < CutPlotter * > ( plotter );
4900  cp -> toggleInverted ();
4901  }
4902  else {
4903  int index = m_selCutComboBox -> currentItem ();
4904  bool state = ! m_tuple_cuts [ index ] -> getInversion ();
4905  PlotterBase * plotter = getPlotter ();
4906  XyPlotter * xyplotter = dynamic_cast < XyPlotter * > ( plotter );
4907  xyplotter -> setCutInverted ( index, state );
4908  }
4909 }
4910 
4911 void
4914 {
4915  if ( m_cut_enable_updating == true ) return;
4916 
4917  bool fit_cut = cutRadioId () == 2;
4918 
4919  if ( fit_cut == false ) { //data cut
4920  PlotterBase * plotter = getSelectedCut ();
4921  CutPlotter * cut_plotter = dynamic_cast < CutPlotter * > ( plotter );
4922  cut_plotter -> setEnabled ( ! on );
4923  }
4924  else {
4925  int index = m_selCutComboBox -> currentItem ();
4926  PlotterBase * plotter = getPlotter ();
4927  XyPlotter * xyplotter = dynamic_cast < XyPlotter * > ( plotter );
4928  xyplotter -> setCutEnabled ( index, ! on );
4929  }
4930 }
4931 
4932 void
4935 {
4936  int id = cutRadioId ();
4937  bool fit_cut = id == 2;
4938  if ( fit_cut ) {
4939  }
4940  else {
4941  PlotterBase * cplotter = getSelectedCut();
4942  CutPlotter * cp = dynamic_cast < CutPlotter * > ( cplotter );
4943 
4944  const Color & rep_color = cp -> getCutColor ();
4945  QColor color ( rep_color.getRed(),
4946  rep_color.getGreen(),
4947  rep_color.getBlue () );
4948 
4949  color = QColorDialog::getColor ( color );
4950 
4951  if ( color.isValid() == true ) {
4952  Color c( color.red(), color.green(), color.blue() );
4953  cp -> setCutColor ( c );
4954  }
4955  }
4956 }
4957 
4958 void
4961 {
4962 
4963  PlotterBase * plotter = getPlotter ();
4964  if ( !plotter ) return;
4966  int index = controller->activeDataRepIndex ( plotter );
4967  DataRep * datarep = plotter->getDataRep ( index );
4968 
4969  RepBase * rep = datarep->getRepresentation();
4970  ContourPointRep * contourRep = dynamic_cast < ContourPointRep * > ( rep );
4971 
4972  if ( !contourRep ) return;
4973 
4974  contourRep->setUsingUserValues ( false );
4975  contourRep->setNumContours ( val );
4976  m_numContoursTextBox->setText ( QString("%1").arg ( val ) );
4977 
4978  datarep->notifyObservers();
4979 
4980 }
4981 
4982 void
4985 {
4986 
4987  PlotterBase * plotter = getPlotter ();
4988  if ( !plotter ) return;
4990  int index = controller->activeDataRepIndex ( plotter );
4991  DataRep * datarep = plotter->getDataRep ( index );
4992 
4993  RepBase * rep = datarep->getRepresentation();
4994  ContourPointRep * contourRep = dynamic_cast < ContourPointRep * > ( rep );
4995 
4996  if ( !contourRep ) return;
4997 
4998  QString text = m_numContoursTextBox->text();
4999  int val = text.toInt();
5000 
5001  if ( val < 1 || val > 100 ) {
5002  int num = contourRep->getNumContours ();
5003  m_numContourSlider->setValue ( num );
5004  m_numContoursTextBox->setText ( QString ("%1").arg ( num ) );
5005  return;
5006  }
5007 
5008  contourRep->setUsingUserValues ( false );
5009  contourRep->setNumContours ( val );
5010  m_numContourSlider->setValue ( val );
5011 
5012  datarep->notifyObservers();
5013 
5014 }
5015 
5016 void
5019 {
5020  PlotterBase * plotter = getPlotter ();
5021  if ( !plotter ) return;
5022  if ( plotter -> isTargetable () == false ) return;
5023 
5024  DataRep * datarep = plotter -> getTarget ( );
5025  RepBase * rep = datarep->getRepresentation();
5026 
5027  ContourPointRep * contourRep = dynamic_cast < ContourPointRep * > ( rep );
5028 
5029  if ( !contourRep ) return;
5030 
5031  if ( contourRadioButton1->isChecked() ) {
5032 
5033  m_numContourSlider->setEnabled ( true );
5034  m_numContoursTextBox->setEnabled ( true );
5035  m_numContoursLabel->setEnabled ( true );
5036  m_contourLevelsTextBox->setEnabled ( false );
5037 
5038  int num = contourRep->getNumContours ();
5039  m_numContourSlider->setValue ( num );
5040  m_numContoursTextBox->setText ( QString ("%1").arg ( num ) );
5041 
5043 
5044  }
5045 
5046  else {
5047 
5048  m_numContourSlider->setEnabled ( false );
5049  m_numContoursTextBox->setEnabled ( false );
5050  m_numContoursLabel->setEnabled ( false );
5051  m_contourLevelsTextBox->setEnabled ( true );
5052 
5054 
5055  }
5056 
5057 }
5058 
5059 void
5062 {
5063 // const QString message =
5064 // "Invalid Input String. Please check that\n"
5065 // "1. The string contains only numbers separated by white spaces, and,\n"
5066 // "2. The numbers are in increasing order without any duplicates.\n";
5067  const QString message =
5068  "Invalid Input String.\n"
5069  "Please check that the string contains only numbers,\n"
5070  "separated by commas or white space.\n";
5071  QMessageBox::critical ( this, // parent
5072  "Invalid Input String", // caption
5073  message,
5074  QMessageBox::Ok,
5075  Qt::NoButton,
5076  Qt::NoButton );
5077 }
5078 
5079 void
5082 {
5083  if ( contourRadioButton2->isChecked () == false ) return;
5084 
5085  PlotterBase * plotter = getPlotter ();
5086  if ( !plotter ) return;
5088  int index = controller->activeDataRepIndex ( plotter );
5089  DataRep * datarep = plotter->getDataRep ( index );
5090 
5091  RepBase * rep = datarep->getRepresentation();
5092  ContourPointRep * contourRep = dynamic_cast < ContourPointRep * > ( rep );
5093 
5094  if ( !contourRep ) return;
5095 
5096  const QString qstr1 = m_contourLevelsTextBox->text();
5097  if ( qstr1.isEmpty () ) return;
5098 
5099  const QString qstr2 = qstr1.simplifyWhiteSpace();
5100 
5101  vector < double > values;
5102 
5103 // Get a std::string from the QString.
5104 #if QT_VERSION < 0x040000
5105  std::string contourLevels(qstr2.ascii());
5106 #else
5107  std::string contourLevels(qstr2.toAscii());
5108 #endif
5109 
5110 // Break string into components; convert and validate each value.
5111  std::vector<std::string> tokens;
5112  stringTokenize(contourLevels, " \t,", tokens);
5113  for (size_t i = 0; i < tokens.size(); i++) {
5114  QString strval(tokens.at(i).c_str() );
5115  bool ok(true);
5116  double value(strval.toDouble(&ok));
5117  if (!ok) {
5118  contourError();
5119  return;
5120  }
5121  values.push_back(value);
5122  }
5123 
5124 // Sort and remove duplicates.
5125  std::stable_sort(values.begin(), values.end());
5126  vector<double>::iterator leftover =
5127  std::unique(values.begin(), values.end());
5128  values.erase(leftover, values.end());
5129 
5130  contourRep->setContourValues ( values, datarep->getProjector() );
5131  datarep->notifyObservers();
5132 }
5133 
5135 {
5136  PlotterBase * plotter = getPlotter ();
5137  if ( !plotter ) return ;
5138 
5139  QFont labelFont;
5140  bool ok;
5141 
5142  XyPlotter * xyplotter = dynamic_cast < XyPlotter * > ( plotter );
5143  assert ( xyplotter != 0 );
5144 
5145  const FontBase * fb = xyplotter -> labelFont ( m_axis );
5146  if ( fb == 0 ) {
5147  labelFont = QFontDialog::getFont ( &ok, this);
5148  }
5149  else {
5150  const QtFont * qtfont = dynamic_cast < const QtFont * > ( fb );
5151  const QFont & qfont = qtfont -> font ();
5152  labelFont = QFontDialog::getFont ( &ok, qfont, this);
5153  }
5154 
5155  if ( ok )
5156  {
5157  QtFont * font = new QtFont;
5158  font -> setFont( labelFont );
5159  xyplotter -> setLabelFont( font, m_axis );
5160 
5161  /* The size of drawrect, marginrect, need to be updated
5162  according to new font.
5163  */
5164  xyplotter -> setNeedUpdate(true);
5165  xyplotter -> notifyObservers ();
5166  }
5167 }
5168 
5170 {
5171  PlotterBase * plotter = getPlotter ();
5172  if ( plotter == 0 ) return ;
5173 
5174  XyPlotter * xyplotter = dynamic_cast< XyPlotter* > ( plotter );
5175  assert( xyplotter != 0 );
5176 
5177  QFont titleFont;
5178  bool ok;
5179 
5180  const FontBase * fb = xyplotter -> titleFont ();
5181  if ( fb == 0 ) {
5182  // From the Qt documentation - "The usual way to use QFontDialog class is
5183  // to call one of the static convenience functions"
5184  titleFont = QFontDialog::getFont ( &ok, this );
5185  }
5186  else {
5187  const QtFont * qtfont = dynamic_cast < const QtFont * > ( fb );
5188  const QFont & qfont = qtfont -> font ();
5189  titleFont = QFontDialog::getFont ( &ok, qfont, this );
5190  }
5191 
5192  if ( ok )
5193  {
5194  QtFont * font = new QtFont;
5195  font -> setFont( titleFont );
5196  xyplotter -> setTitleFont( font );
5197 
5198  /* The size of drawrect, marginrect, need to be updated
5199  according to new font.
5200  */
5201  xyplotter -> setNeedUpdate(true);
5202  xyplotter -> notifyObservers ();
5203  }
5204 }
5205 
5206 
5208 {
5209  // Check if there is plotter.
5210  PlotterBase * plotter = getPlotter();
5211  if ( !plotter ) return;
5212 
5213  // Check if there is a function attached to this plotter.
5215  if ( ! ( fcontroller -> hasFunction ( plotter, 0 ) ) ) {
5216  return;
5217  }
5218 
5219  FunctionRep * frep = getTopFunctionRep ();
5220  Fitter * fitter = frep -> getFitter ();
5221 
5222  // Set the new ignoreError flag for the function
5223  bool flag = m_IgnoreErrorCheckBox -> isChecked();
5224  if ( fitter != 0 ) {
5225  frep -> setIgnoreError ( flag );
5226  }
5227 }
5228 
5229 void
5232 {
5233 
5234  // Disable the tab if no plotter selected.
5235  PlotterBase * plotter = getPlotter ();
5236  bool yes = plotter == 0;
5237  if ( yes == false ) {
5238  TextPlotter * tp = dynamic_cast < TextPlotter * > ( plotter );
5239  yes |= tp != 0;
5240  }
5241  if ( yes ) {
5242  transform_button_group -> setEnabled ( false );
5243  rotateGroupBox -> setEnabled ( false );
5244  return;
5245  }
5246  else {
5247  transform_button_group -> setEnabled ( true );
5248  }
5249 
5250  bool hasZ = plotter -> hasAxis ( Axes::Z );
5251  m_hammer -> setEnabled ( hasZ );
5252  m_lambert -> setEnabled ( hasZ );
5253  m_Car -> setEnabled ( hasZ );
5254  m_Mer -> setEnabled ( hasZ );
5255  m_Gls -> setEnabled ( hasZ );
5256  m_Arc -> setEnabled ( hasZ );
5257  m_Tan -> setEnabled ( hasZ );
5258  m_Sin -> setEnabled ( hasZ );
5259  m_Stg -> setEnabled ( hasZ );
5260  m_Air -> setEnabled ( hasZ );
5261 
5262 
5264 
5265  bool xlog = d_controller -> getLog ( plotter, Axes::X );
5266  bool ylog = d_controller -> getLog ( plotter, Axes::Y );
5267 
5268 
5269  if ( ( !xlog ) && ( !ylog ) ){
5270 
5271  BinaryTransform *t =
5272  dynamic_cast< BinaryTransform* > ( plotter->getTransform() );
5273 
5274  if (( t -> name () == "HammerAito" ) || ( t->name() == "HammerAito2")){
5275  m_hammer -> setChecked ( true );
5276  }
5277 
5278  else if (( t -> name() == "Lambert" ) || ( t->name() == "Lambert2")) {
5279  m_lambert -> setChecked ( true );
5280  }
5281 
5282  else if (( t -> name() == "Cartesian" ) || ( t->name() == "Cartesian2")){
5283  m_Car -> setChecked ( true );
5284  }
5285 
5286  else if (( t -> name() == "Mercator" ) || ( t->name() == "Mecator2")){
5287  m_Mer -> setChecked ( true );
5288  }
5289 
5290  else if (( t -> name() == "GlobalSinusoidal" ) || ( t->name() == "GlobalSinusoidal2")) {
5291  m_Gls -> setChecked ( true );
5292  }
5293 
5294  else if (( t -> name() == "ARC" ) || (t->name()=="ARC2")){
5295  m_Arc -> setChecked ( true );
5296  }
5297 
5298  else if (( t -> name() == "TAN" ) || (t->name()=="TAN2")){
5299  m_Tan -> setChecked ( true );
5300  }
5301 
5302  else if (( t -> name() == "SIN" ) || (t->name()=="SIN2")){
5303  m_Sin -> setChecked ( true );
5304  }
5305 
5306  else if (( t -> name() == "STG" ) || (t->name()=="STG2")){
5307  m_Stg -> setChecked ( true );
5308  }
5309 
5310  else if (( t -> name() == "AIR" ) || (t->name()=="AIR2")){
5311  m_Air -> setChecked ( true );
5312  }
5313 
5314  else m_linear->setChecked ( true );
5315 
5316  // Enable rotation if periodic transform.
5317  // Then set the rotation offset.
5318  if (t->isPeriodic()) {
5319 
5320  rotateGroupBox -> setEnabled ( true );
5321 
5323  dynamic_cast< PeriodicBinaryTransform* > ( t );
5324 
5325  int xoffset = (int) tp->xOffset();
5326  int yoffset = (int) tp->yOffset();
5327 
5328  setRotate ( yoffset, xoffset);
5329  }
5330  else {
5331  setRotate ( 0, 0 );
5332  rotateGroupBox -> setEnabled ( false );
5333  }
5334  }
5335 
5336  else if ( ( !xlog ) && ( ylog ) ){
5337  m_logy -> setChecked ( true );
5338  }
5339 
5340  else if ( ( xlog ) && ( !ylog ) ){
5341  m_logx -> setChecked ( true );
5342  }
5343 
5344  else if ( ( xlog ) && ( ylog ) ){
5345  m_logxy -> setChecked ( true );
5346  }
5347 }
5348 
5349 
5350 void
5353 {
5354  QString message (
5355  "A transform of this type can not be used because\n"
5356  "this application was not compiled with WCSLIB support." );
5357 
5358  QMessageBox::information ( this, // parent
5359  "Invalid transform", // caption
5360  message, // .c_str(),
5361  QMessageBox::Ok,
5362  Qt::NoButton,
5363  Qt::NoButton );
5364 }
5365 
5366 int
5368 transformId () const
5369 {
5370  int id = -1;
5371  for ( unsigned int i = 0; i < m_transform_buttons.size (); i++ ) {
5372  if ( m_transform_buttons[i] -> isChecked () ) {
5373  id = i;
5374  break;
5375  }
5376  }
5377  return id;
5378 }
5379 
5380 void
5383 {
5384 
5385  int id = transformId ();
5386 
5387  PlotterBase * plotter = getPlotter ();
5388  if ( !plotter ) return;
5389 
5390  // Reset rotation offset when do another transform
5391  setRotate ( 0, 0 );
5392 
5393 #ifndef HAVE_WCSLIB
5394  if ( id > 3 ) {
5396  return;
5397  }
5398 #endif
5399 
5401  int max_x = validPeriodicTransformRange();
5402  bool valid2 = false;
5403  try {
5404  switch ( id ) {
5405  case 0:
5406  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5407  d_controller -> setTransform ( plotter, "Linear Linear" );
5408  rotateGroupBox -> setEnabled ( false );
5409  break;
5410 
5411  case 1:
5412  d_controller -> setTransformAxis ( plotter, "Linear", "Log" );
5413  d_controller -> setTransform ( plotter, "Linear Log");
5414  rotateGroupBox -> setEnabled ( false );
5415  break;
5416 
5417  case 2:
5418  d_controller -> setTransformAxis ( plotter, "Log", "Linear" );
5419  d_controller -> setTransform ( plotter, "Log Linear" );
5420  rotateGroupBox -> setEnabled ( false );
5421  break;
5422 
5423  case 3:
5424  d_controller -> setTransformAxis ( plotter, "Log", "Log" );
5425  d_controller -> setTransform ( plotter, "Log Log" );
5426  rotateGroupBox -> setEnabled ( false );
5427  break;
5428 
5429  case 4:
5430  if ( max_x == 180 ) {
5431  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5432  d_controller -> setTransform ( plotter, "HammerAito" );
5433  rotateGroupBox -> setEnabled ( true );
5434  }
5435  else if ( max_x == 360 ) {
5436  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5437  d_controller -> setTransform ( plotter, "HammerAito2" );
5438  rotateGroupBox -> setEnabled ( true );
5439  }
5440  else {
5441  QString message (
5442  "The range of current plotter is not valid for.\n"
5443  "HammerAito transform.\n\n"
5444  "A valid range should be within: \n"
5445  "X axis [-180, 180] or [0, 360]\n"
5446  "Y axis [ -90, 90]\n" );
5447  QMessageBox::information ( this, // parent
5448  "Invalid range", // caption
5449  message, // .c_str(),
5450  QMessageBox::Ok,
5451  Qt::NoButton,
5452  Qt::NoButton );
5453  }
5454  break;
5455 
5456  case 5:
5457  if ( max_x == 180 ) {
5458  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5459  d_controller -> setTransform ( plotter, "Lambert" );
5460  rotateGroupBox -> setEnabled ( true );
5461  }
5462  else if ( max_x == 360 ) {
5463  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5464  d_controller -> setTransform ( plotter, "Lambert2" );
5465  rotateGroupBox -> setEnabled ( true );
5466  }
5467  else {
5468  QString message (
5469  "The range of current plotter is not valid for.\n"
5470  "Lambert transform.\n\n"
5471  "A valid range should be within: \n"
5472  "X axis [-180, 180] or [0, 360]\n"
5473  "Y axis [ -90, 90]\n" );
5474  QMessageBox::information ( this, // parent
5475  "Invalid range", // caption
5476  message, // .c_str(),
5477  QMessageBox::Ok,
5478  Qt::NoButton,
5479  Qt::NoButton );
5480  }
5481  break;
5482 
5483  case 6:
5484  if ( max_x==180 ) {
5485  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5486  d_controller -> setTransform ( plotter, "Cartesian" );
5487  rotateGroupBox -> setEnabled ( true );
5488  }
5489  else if ( max_x==360 ) {
5490  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5491  d_controller -> setTransform ( plotter, "Cartesian2" );
5492  rotateGroupBox -> setEnabled ( true );
5493  }
5494  else {
5495  QString message (
5496  "The range of current plotter is not valid for.\n"
5497  "Cartesian transform.\n\n"
5498  "A valid range should be within: \n"
5499  "X axis [-180, 180]\n"
5500  "Y axis [ -90, 90]\n" );
5501  QMessageBox::information ( this, // parent
5502  "Invalid range", // caption
5503  message, // .c_str(),
5504  QMessageBox::Ok,
5505  Qt::NoButton,
5506  Qt::NoButton );
5507  }
5508  break;
5509 
5510  case 7:
5511  if ( max_x == 180 ) {
5512  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5513  d_controller -> setTransform ( plotter, "Mercator" );
5514  rotateGroupBox -> setEnabled ( true );
5515  }
5516  else if ( max_x == 360 ) {
5517  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5518  d_controller -> setTransform ( plotter, "Mercator2" );
5519  rotateGroupBox -> setEnabled ( true );
5520  }
5521  else {
5522  QString message (
5523  "The range of current plotter is not valid for.\n"
5524  "Mercator transform.\n\n"
5525  "A valid range should be within: \n"
5526  "X axis [-180, 180] or [0, 360]\n"
5527  "Y axis [ -90, 90]\n" );
5528  QMessageBox::information ( this, // parent
5529  "Invalid range", // caption
5530  message, // .c_str(),
5531  QMessageBox::Ok,
5532  Qt::NoButton,
5533  Qt::NoButton );
5534  }
5535  break;
5536 
5537  case 8:
5538  if ( max_x == 180 ) {
5539  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5540  d_controller -> setTransform ( plotter, "GlobalSinusoidal" );
5541  rotateGroupBox -> setEnabled ( true );
5542  }
5543  else if ( max_x == 360 ) {
5544  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5545  d_controller -> setTransform ( plotter, "GlobalSinusoidal2" );
5546  rotateGroupBox -> setEnabled ( true );
5547  }
5548  else {
5549  QString message (
5550  "The range of current plotter is not valid for.\n"
5551  "GlobalSinusoidal transform.\n\n"
5552  "A valid range should be within: \n"
5553  "X axis [-180, 180] or [0, 360]\n"
5554  "Y axis [ -90, 90]\n" );
5555  QMessageBox::information ( this, // parent
5556  "Invalid range", // caption
5557  message, // .c_str(),
5558  QMessageBox::Ok,
5559  Qt::NoButton,
5560  Qt::NoButton );
5561  }
5562  break;
5563 
5564  case 9:
5565  if ( max_x == 180 ) {
5566  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5567  d_controller -> setTransform ( plotter, "ARC" );
5568  rotateGroupBox -> setEnabled ( true );
5569  }
5570  else if ( max_x == 360 ) {
5571  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5572  d_controller -> setTransform ( plotter, "ARC" );
5573  rotateGroupBox -> setEnabled ( true );
5574  }
5575  else {
5576  QString message (
5577  "The range of current plotter is not valid for.\n"
5578  "ARC transform.\n\n"
5579  "A valid range should be within: \n"
5580  "X axis [-180, 180] or [0, 360]\n"
5581  "Y axis [ -90, 90]\n" );
5582  QMessageBox::information ( this, // parent
5583  "Invalid range", // caption
5584  message, // .c_str(),
5585  QMessageBox::Ok,
5586  Qt::NoButton,
5587  Qt::NoButton );
5588  }
5589  break;
5590 
5591  case 10:
5592  valid2 = validPeriodicTransformRange( 0 );
5593  if ( max_x == 180 && valid2 ) {
5594  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5595  d_controller -> setTransform ( plotter, "TAN" );
5596  rotateGroupBox -> setEnabled ( true );
5597  }
5598  else if ( max_x == 360 && valid2 ) {
5599  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5600  d_controller -> setTransform ( plotter, "TAN2" );
5601  rotateGroupBox -> setEnabled ( true );
5602  }
5603  else {
5604  QString message (
5605  "The range of current plotter is not valid for.\n"
5606  "TAN transform.\n\n"
5607  "A valid range should be within: \n"
5608  "X axis [-180, 180] or [0, 360]\n"
5609  "Y axis ( 0, 90]\n" );
5610  QMessageBox::information ( this, // parent
5611  "Invalid range", // caption
5612  message, // .c_str(),
5613  QMessageBox::Ok,
5614  Qt::NoButton,
5615  Qt::NoButton );
5616  }
5617  break;
5618 
5619  case 11:
5620  valid2 = validPeriodicTransformRange( 0 );
5621  if ( max_x==180 && valid2 ) {
5622  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5623  d_controller -> setTransform ( plotter, "SIN" );
5624  rotateGroupBox -> setEnabled ( true );
5625  }
5626  if ( max_x==360 && valid2 ) {
5627  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5628  d_controller -> setTransform ( plotter, "SIN2" );
5629  rotateGroupBox -> setEnabled ( true );
5630  }
5631  else {
5632  QString message (
5633  "The range of current plotter is not valid for.\n"
5634  "SIN transform.\n\n"
5635  "A valid range should be within: \n"
5636  "X axis [-180, 180] or [0, 360]\n"
5637  "Y axis ( 0, 90]\n" );
5638  QMessageBox::information ( this, // parent
5639  "Invalid range", // caption
5640  message, // .c_str(),
5641  QMessageBox::Ok,
5642  Qt::NoButton,
5643  Qt::NoButton );
5644  }
5645  break;
5646 
5647  case 12:
5648  valid2 = true; //validPeriodicTransformRange( -90 );
5649  if ( max_x==180 && valid2 ) {
5650  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5651  d_controller -> setTransform ( plotter, "STG" );
5652  rotateGroupBox -> setEnabled ( true );
5653  }
5654  if ( max_x==360 && valid2 ) {
5655  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5656  d_controller -> setTransform ( plotter, "STG2" );
5657  rotateGroupBox -> setEnabled ( true );
5658  }
5659  else {
5660  QString message (
5661  "The range of current plotter is not valid for.\n"
5662  "STG transform.\n\n"
5663  "A valid range should be within: \n"
5664  "X axis [-180, 180] or [0, 360]\n"
5665  "Y axis ( -90, 90]\n" );
5666  QMessageBox::information ( this, // parent
5667  "Invalid range", // caption
5668  message, // .c_str(),
5669  QMessageBox::Ok,
5670  Qt::NoButton,
5671  Qt::NoButton );
5672  }
5673  break;
5674 
5675  case 13:
5676  valid2 = validPeriodicTransformRange( -90 );
5677  if ( max_x==180 && valid2 ) {
5678  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5679  d_controller -> setTransform ( plotter, "AIR" );
5680  rotateGroupBox -> setEnabled ( true );
5681  }
5682  if ( max_x==360 && valid2 ) {
5683  d_controller -> setTransformAxis ( plotter, "Linear", "Linear" );
5684  d_controller -> setTransform ( plotter, "AIR2" );
5685  rotateGroupBox -> setEnabled ( true );
5686  }
5687  else {
5688  QString message (
5689  "The range of current plotter is not valid for.\n"
5690  "AIR transform.\n\n"
5691  "A valid range should be within: \n"
5692  "X axis [-180, 180] or [0, 360]\n"
5693  "Y axis ( -90, 90]\n" );
5694  QMessageBox::information ( this, // parent
5695  "Invalid range", // caption
5696  message, // .c_str(),
5697  QMessageBox::Ok,
5698  Qt::NoButton,
5699  Qt::NoButton );
5700  }
5701  break;
5702 
5703  }
5704  }
5705  catch ( const std::runtime_error & e ) {
5706  invalidOperationError ( e.what() );
5707  }
5708 }
5709 
5710 
5711 
5712 int
5715 {
5716  PlotterBase * plotter = getPlotter ();
5717 
5718  const Range & rx = plotter -> getDataRange ( Axes::X );
5719  const Range & ry = plotter -> getDataRange ( Axes::Y );
5720 
5721  if ( ( rx.low() > -181 ) && ( rx.high() < 181 ) &&
5722  ( ry.low() > -91 ) && ( ry.high() < 91 )) {
5723  return 180;
5724  }
5725 
5726  if ( ( rx.low() > -1 ) && ( rx.high() < 361 ) &&
5727  ( ry.low() > -91 ) && ( ry.high() < 91 )) {
5728  return 360;
5729  }
5730 
5731  else return 0;
5732 }
5733 
5734 
5735 bool
5738 {
5739  PlotterBase * plotter = getPlotter ();
5740 
5741  const Range & rx = plotter -> getRange ( Axes::X, false );
5742  const Range & ry = plotter -> getRange ( Axes::Y, false );
5743 
5744  if ( ( rx.low() < -180 ) || ( rx.high() > 180 ) ||
5745  ( ry.low() <= miny ) || ( ry.high() > 90 ) ) {
5746  return false;
5747  }
5748 
5749  else {
5750  return true;
5751  }
5752 }
5753 
5754 
5755 
5756 void
5758 rotateX( int offset )
5759 {
5760  if (!m_rotate_enable) return;
5761 
5762  if (offset>180) offset = offset-360 ;
5763  if (offset< -180) offset = offset+360;
5764 
5765  PlotterBase * plotter = getPlotter ();
5766  if ( !plotter ) return;
5767 
5768  plotter->setAutoRanging ( Axes::X, false );
5769 
5770 
5771  BinaryTransform *t =
5772  dynamic_cast< BinaryTransform* > ( plotter->getTransform() );
5773 
5774 
5776  dynamic_cast< PeriodicBinaryTransform* > ( t );
5777 
5778  const Range & r = plotter->getRange ( Axes::X, true );
5779  Range range (r.low(), r.high(), r.pos());
5780 
5781  // Actually rotating X axes
5782  tp->setYOffset( offset );
5783 
5784  plotter->setRange ( Axes::X, range, true, false );
5785  m_x_offset_text->setText ( QString("%1").arg(offset)) ;
5786 
5787 }
5788 
5789 
5790 void
5792 rotateY( int offset )
5793 {
5794  if (!m_rotate_enable) return;
5795 
5796  if (offset>180) offset = offset-360 ;
5797  if (offset< -180) offset = offset+360;
5798 
5799  PlotterBase * plotter = getPlotter ();
5800  if ( !plotter ) return;
5801 
5802  plotter->setAutoRanging ( Axes::Y, false );
5803 
5804 
5805  BinaryTransform *t =
5806  dynamic_cast< BinaryTransform* > ( plotter->getTransform() );
5807 
5808 
5810  dynamic_cast< PeriodicBinaryTransform* > ( t );
5811 
5812  const Range & r = plotter->getRange ( Axes::Y, true );
5813  Range range (r.low(), r.high(), r.pos());
5814 
5815  // Rotate Y;
5816  tp->setXOffset( offset );
5817 
5818  plotter->setRange ( Axes::Y, range, true, false );
5819  m_y_offset_text->setText ( QString("%1").arg(offset)) ;
5820 
5821 }
5822 
5823 void
5825 setRotate( int x, int y )
5826 {
5827  m_rotate_enable = false;
5828  m_x_offset -> setValue ( x );
5829  m_x_offset_text -> setText ( QString("%1").arg(x) );
5830  m_y_offset -> setValue ( y );
5831  m_y_offset_text -> setText ( QString("%1").arg(y) );
5832  m_rotate_enable = true;
5833 }
5834 
5835 void
5838 {
5839  rotateX(0);
5840  rotateY(0);
5841  setRotate(0, 0);
5842 }
5843 
5844 void
5847 {
5848  PlotterBase * plotter = getPlotter ();
5849  if ( !plotter ) return;
5850 
5851  plotter->setShowGrid ( m_grid -> isChecked() );
5852 }
5853 
5854 void
5857 {
5858  PlotterBase * plotter = getPlotter();
5859  if ( !plotter ) return;
5860  plotter->setBoxEdge( m_boxedge->isChecked() );
5861 }
5862 
5863 
5864 void
5867 {
5868  PlotterBase * plotter = getPlotter ();
5869  if ( !plotter ) return;
5870 
5871  if (m_combine_checkbox->isChecked()) {
5872  plotter->setMinEntries(m_min_entries);
5873  }
5874  else plotter->setMinEntries(0);
5875 
5876  updateAxisTab();
5877 }
5878 
5879 void
5881 setMinEntries( int increment )
5882 {
5883  int minEntries = m_min_entries + increment - 50;
5884  if ( minEntries < 0 ) minEntries = 0;
5885 
5886  PlotterBase * plotter = getPlotter ();
5887  if ( !plotter ) return;
5888 
5889  if (!m_combine_checkbox->isChecked()) return;
5890 
5891  plotter->setMinEntries(minEntries);
5892  min_entries_text->setText(QString("%1").arg(minEntries));
5893 
5894  if (m_dragging == false ) {
5895  m_min_entries = minEntries;
5897  }
5898 }
5899 
5900 int
5903 {
5904  PlotterBase * plotter = getPlotter ();
5905  if ( !plotter ) return -1;
5906 
5907  return plotter->getMinEntries ();
5908 }
5909 
5910 void
5913 {
5914  PlotterBase * plotter = getPlotter ();
5915  if ( !plotter ) return;
5916 
5917  int min = min_entries_text->text().toInt();
5918  plotter->setMinEntries(min);
5919  updateAxisTab();
5920 }
5921 
5922 
5923 void
5926 {
5927  PlotterBase * plotter = getPlotter ();
5928  if ( !plotter ) return;
5929 
5930  int offset = m_x_offset_text->text().toInt();
5931 
5932 
5933  if (!m_rotate_enable) return;
5934 
5935  if (offset>180) offset = offset-360 ;
5936  if (offset< -180) offset = offset+360;
5937 
5938  plotter->setAutoRanging ( Axes::X, false );
5939 
5940  BinaryTransform *t =
5941  dynamic_cast< BinaryTransform* > ( plotter->getTransform() );
5942 
5943 
5945  dynamic_cast< PeriodicBinaryTransform* > ( t );
5946 
5947  const Range & r = plotter->getRange ( Axes::X, true );
5948  Range range (r.low(), r.high(), r.pos());
5949 
5950  // Actually rotating X axes
5951  tp->setYOffset( offset );
5952 
5953  plotter->setRange ( Axes::X, range, true, false );
5954  m_x_offset->setValue(offset);
5955  m_x_offset_text->setText ( QString("%1").arg(offset)) ;
5956 
5957  updateAxisTab();
5958 }
5959 
5960 void
5963 {
5964  PlotterBase * plotter = getPlotter ();
5965  if ( !plotter ) return;
5966 
5967  int offset = m_y_offset_text->text().toInt();
5968 
5969 
5970  if (!m_rotate_enable) return;
5971 
5972  if (offset>180) offset = offset-360 ;
5973  if (offset< -180) offset = offset+360;
5974 
5975  plotter->setAutoRanging ( Axes::Y, false );
5976 
5977  BinaryTransform *t =
5978  dynamic_cast< BinaryTransform* > ( plotter->getTransform() );
5979 
5980 
5982  dynamic_cast< PeriodicBinaryTransform* > ( t );
5983 
5984  const Range & r = plotter->getRange ( Axes::Y, true );
5985  Range range (r.low(), r.high(), r.pos());
5986 
5987  // Actually rotating Y axes
5988  tp->setXOffset( offset );
5989 
5990  plotter->setRange ( Axes::Y, range, true, false );
5991  m_y_offset->setValue(offset);
5992  m_y_offset_text->setText ( QString("%1").arg(offset)) ;
5993 
5994  updateAxisTab();
5995 }
5996 
5999 void
6002 {
6003  PlotterBase * plotter = getPlotter ();
6004 
6005  if ( !plotter ) return;
6006 
6007  int num_rep = plotter -> getNumDataReps();
6008 
6009  // If number of datarep is not equal to 2
6010  // in the plot, show warning message and do nothing.
6011  if ( num_rep != 2 )
6012  {
6013  const QString message=
6014  "You must have two DataReps in this view.";
6015 
6016  QMessageBox::warning ( this, // parent
6017  "Unable to compare DataRep", // caption
6018  message,
6019  QMessageBox::Ok,
6020  Qt::NoButton,
6021  Qt::NoButton );
6022  return;
6023  }
6024 
6025 
6026  FunctionRep * func_rep = getTopFunctionRep ();
6028  PlotterBase * res_plotter
6029  //= controller -> createResidualsDisplay ( plotter, func_rep );
6030  = controller -> createDifferenceDisplay ( plotter );
6031  const Range & range = plotter -> getRange ( Axes::X, false );
6032  res_plotter -> setRange ( Axes::X, range, false );
6033 
6034  CanvasWindow * canvas = WindowController::instance () -> currentCanvas ();
6035 
6036  canvas -> addPlotDisplay ( res_plotter, true );
6037 }
void updateColorMapCtrls(const PlotterBase *plotter)
Updates the controls for the color map if applicable, othewise disables them.
Definition: Inspector.cxx:1576
virtual void allCutsRadioButton_toggled(bool selected)
Definition: Inspector.cxx:3026
void contourError()
Raises message box on contour input error.
Definition: Inspector.cxx:5061
void saveParameters(PlotterBase *plotter)
Saves the parameters so they can be restored.
virtual void setAutoRanging(const std::string &axis, bool flag)
Sets the auto-ranging.
static DisplayController * instance()
Returns the pointer to the singleton instance.
virtual void dataCreateNTuple()
Definition: Inspector.cxx:1501
hippodraw::AxisWidget * axisWidget1
QRadioButton * m_Tan
A singleton class that handles the application logic for cuts.
Definition: CutController.h:38
void setRange(double low, double high, double pos)
Changes the current Range.
Definition: Range.cxx:126
virtual double getBinWidth(Axes::Type axis) const
Returns the bin width.
void updateNewPlotControls()
Updates the controls in the new plot group box.
Definition: Inspector.cxx:513
QCheckBox * m_IgnoreErrorCheckBox
virtual void updatePlotTypes()
Updates the available plot types combo box.
Definition: Inspector.cxx:694
virtual void dataNTupleSelChanged(int item)
Definition: Inspector.cxx:603
void updateCutControls(const std::vector< PlotterBase * > &cutlist)
Updates the Cut controls in the Cut tabbed panel.
Definition: Inspector.cxx:2748
virtual void logScale_clicked()
The Qt slot which responds to the toggle in state of the logScale checkbox.
Definition: Inspector.cxx:4744
QRadioButton * m_linear
The base class for the PlotterBase hierarchy.
Definition: PlotterBase.h:55
QString m_break_point
The color model break point settings key.
Definition: Inspector.h:255
void changeNTupleName(const QString &)
Changes the name NTuple.
Definition: Inspector.cxx:588
static QString s_registry
The QSettings Windows registry key.
Definition: Inspector.h:738
virtual void setOffset(int value)
Definition: Inspector.cxx:2644
QScrollBar * m_width_range
column
The column indices for 2 dimension data point tuple.
virtual void setLowRange(Axes::Type axis, int parm, bool dragging)
Sets the low end of the Range of data displayed.
bool isFixed() const
Returns the fixed flag.
int m_highslider1_last_val
The value of the high slider in Axis Widget 1 as last recorded.
Definition: Inspector.h:354
A Periodic transform that transforms coordinates from one 2D coordinate system to another...
const std::string & getTitle() const
Gets the title to be displayed.
QLineEdit * m_width_text
virtual void contourRadioButton1_toggled(bool)
Responds to change in 1st contour radio button.
Definition: Inspector.cxx:5018
virtual void functionParamsSliderSliderMoved(int)
Slot which alters the parameter values as the function Params slider is moved.
Definition: Inspector.cxx:4683
QComboBox * new_combo_2
Definition: InspectorBase.h:61
virtual void setBinWidth(int value)
Definition: Inspector.cxx:2433
void fitFailedError()
Raises failed fit error dialog.
Definition: Inspector.cxx:3819
QComboBox * new_combo_3
Definition: InspectorBase.h:63
virtual void cutZoomPanCheckBox_clicked()
Definition: Inspector.cxx:4869
QComboBox * sel_combo_0
Definition: InspectorBase.h:74
bool getUsingUserValues() const
Get the m_usingUserValues boolean.
QLabel * new_binding_1
Definition: InspectorBase.h:58
FunctionRep * getTopFunctionRep()
Returns the FunctionRep corresponding to top of selected function chain (the composite function if an...
Definition: Inspector.cxx:3863
virtual void updateDataCutsTab()
Updates the cut tabbed panel when in data cut mode.
Definition: Inspector.cxx:3235
virtual void autoScale_clicked()
Slot which responds to the toggle in state of the autoScale check box.
Definition: Inspector.cxx:4779
hippodraw::AxisWidget class interface
virtual const std::string convertToString(hippodraw::Axes::Type)
Definition: Inspector.cxx:4262
void cutOnCutError()
Raises information dialog to say applying a cut to itself was not done.
Definition: Inspector.cxx:1193
QPushButton * m_cutAddAll
QGroupBox * m_plot_symbols
Definition: InspectorBase.h:90
QRadioButton * m_selectedPlotRadioButton
find(QChar c, int index=0, bool cs=TRUE) const
QLineEdit * m_FunctionParamsLineEdit
QRadioButton * m_logxy
virtual void updateAxisTab()
Updates the axis tabbed panel's widgets.
Definition: Inspector.cxx:4321
virtual ~Inspector()
The virtual destructor.
Definition: Inspector.cxx:241
virtual void m_grid_clicked()
Responds to the toggle in state of the show grid check box.
Definition: Inspector.cxx:5846
hippodraw::BinToColor class interface
unsigned int getIntervalCount() const
Returns the current interval count.
Definition: NTuple.cxx:608
QRadioButton * m_cut_data1
virtual void cutLowSlider_sliderMoved(int value)
Definition: Inspector.cxx:4825
setCurrentText(const QString &)
QRadioButton * m_logx
QButtonGroup * m_symbol_group
Definition: InspectorBase.h:93
virtual void setDragOn()
Called when any slider is pressed.
Definition: Inspector.cxx:2383
setNum(short n, int base=10)
QRadioButton * contourRadioButton2
The base class for the point representation hierarchy.
Definition: RepBase.h:45
QComboBox * sel_combo_3
Definition: InspectorBase.h:80
QScrollBar * min_entries_slider
QString m_app_key
The QSettings application key for searching for setting.
Definition: Inspector.h:338
void updateCutControlValues(const PlotterBase *cutplotter)
Updates the Cut control values with those of the designated cut Plotter.
Definition: Inspector.cxx:2840
void setContourValues(std::vector< double > &values, ProjectorBase *proj)
Set user defined contour values.
QLineEdit * min_entries_text
hippodraw::CanvasWindow class interface.
void addPlotDisplay(PlotterBase *plotter, bool select)
Adds a new plot display to the canvas.
virtual bool getShowGrid()
Gets the show-grid status to update the inspector.
QRadioButton * m_Air
QCheckBox * m_interval_cb
DataSource * getDataSource(const PlotterBase *plotter)
Returns the Datasource for the plotter's selected DataRep or the DataSource used by all the DataRep o...
virtual void setZRadioButton(bool enabled)
Sets the Z axis radio button to proper state.
Definition: Inspector.cxx:387
static RootController * instance()
Returns the singleton instance of the RootController.
add(QWidget *widget, const QString &text)
ascii() const
bool isZoomPanChecked()
Returns whether zoomPanCheckBox is checked.
Definition: AxisWidget.cxx:553
QRadioButton * m_stats_underflow
virtual void setRepColor(const Color &)=0
Sets the representation's color.
const std::vector< const TupleCut * > & getCutList(const DataRep *rep) const
Returns a list of TupleCut objects that are used by the DataRep.
QRadioButton * m_hammer
void processHighSliderReleased(const Range &fullRange)
Called by InspectorBase in response to the highSliderReleased signal.
Definition: AxisWidget.cxx:248
virtual void axis_button_group_clicked(int id)
Responds to change in axis tabbed panel's axis radio button group.
Definition: Inspector.cxx:2270
entryList(const QString &key) const
PlotterBase * m_plotter
The currently selected PlotterBase object.
Definition: Inspector.h:334
A abstract base class for font handling.
Definition: FontBase.h:32
void processTextBoxReturnPressed(Range &currentRange, const Range &fullRange)
Called by InspectorBase in response to the lowTextReturnPressed and highTextReturnPressed signals...
Definition: AxisWidget.cxx:157
setChecked(bool check)
virtual void cut_button_group_clicked()
Responds to change of the cut panel's radio group.
Definition: Inspector.cxx:3356
virtual void selCutChanged()
Definition: Inspector.cxx:3062
std::vector< QLabel * > m_new_labels
Binding labels for new plot group box.
Definition: Inspector.h:267
QRadioButton * m_cut_data2
isChecked() const
const std::string & name() const
Returns the name of the representation.
Definition: RepBase.cxx:47
int m_last_cut_index
The index of the last selected cut.
Definition: Inspector.h:348
A Controller class for ROOT files.
void init()
Initializes the Inspector.
Definition: Inspector.cxx:250
QListViewItem * getTopParent(QListViewItem *item)
Help function to find the top level object in a QListViewItem tree.
Definition: Inspector.cxx:4542
QGroupBox * m_summary
Inspector(QWidget *parent=0, const char *name=0, bool modal=false, Qt::WFlags flags=0)
The constructor.
Definition: Inspector.cxx:136
QString m_flat_width
The color model flat width settings key.
Definition: Inspector.h:259
virtual void contourSlider_valueChanged(int val)
Definition: Inspector.cxx:4960
virtual void cutAddAll()
Adds all the cuts to the DataRep.
Definition: Inspector.cxx:2974
virtual void selectedCutsRadioButton_toggled(bool selected)
Definition: Inspector.cxx:2899
virtual int getMinEntries()
Get the minimum entries number of the plot.
Definition: Inspector.cxx:5902
virtual bool acceptFunction(int number)
Returns true if the DataRep accepts functions on number variables.
Definition: DataRep.cxx:299
int getHighSliderValue()
Get the high slider value.
Definition: AxisWidget.cxx:514
QRadioButton * m_Arc
size_t ci_find(const string &str1, const string &str2)
Case insensitive find.
PlotterList_t m_tuple_cut_plotters
The PlotterBase object associated with each TupleCut object.
Definition: Inspector.h:328
text() const
simplifyWhiteSpace() const
void updateTupleCuts(const std::vector< PlotterBase * > &cutlist)
Updates the list of TupleCut objects and their corresponding Plotter.
Definition: Inspector.cxx:2727
A singleton class that is the interface between GUI and the displays.
QRadioButton * m_stats_number
setChecked(bool check)
QComboBox * m_all_ntuples
Definition: InspectorBase.h:53
hippodraw::CutPlotter class interface
virtual void combineCheckBox_clicked()
Responds to the combined bins checkbox clicked.
Definition: Inspector.cxx:5866
QPushButton * m_cutAddSelected
QPushButton * m_selectedColor
double moduloAddY(double y1, double y2) const
Modulo Addition along Y axis.
virtual void pointRepComboBox_activated(const QString &qstr)
Definition: Inspector.cxx:2248
std::map< QListViewItem *, FunctionRep * > m_function_lv_map
Map between a function's QListViewItem and its FunctionRep pointer.
Definition: Inspector.h:284
virtual void functionParamsCheckBoxToggled(bool)
Slot which recieves the signal if state of the checkbox changes in the the function Params tab...
Definition: Inspector.cxx:4569
setText(const QString &)
hippodraw::CutController class interface
virtual void setCutRangeAt(const Range &range, unsigned int i)
Sets the Range of a TupleCut object.
void setUsingUserValues(bool flag)
Set the m_usingUserValues boolean.
QPushButton * cutRemovePushButton
QLineEdit * m_symbolPointSize
double length() const
Returns the length of the range object.
Definition: Range.h:156
virtual void reverse_clicked()
Slot which respons to the toggle in state of the reverse check box.
Definition: Inspector.cxx:4765
virtual void functionsRemoveButton_clicked()
Removing the selected function and updating appropriate tabbed panels.
Definition: Inspector.cxx:3514
QLabel * label
Definition: InspectorBase.h:71
void dataClearSelectedControls()
Clears the previous binding controls.
Definition: Inspector.cxx:913
virtual void removeDataRepButton_clicked()
Responds to click on the remove Data Rep button.
Definition: Inspector.cxx:1462
void noNTupleSelectedError()
Raises no NTuple selected error dialog.
Definition: Inspector.cxx:1035
virtual void sel_combo_1_activated(const QString &)
Responds to combo box of selected plot be activated by changing the binding.
Definition: Inspector.cxx:648
virtual void contourLevelsTextBox_returnPressed()
Responds to change in contour levels text box.
Definition: Inspector.cxx:5081
void updateValueCombo()
Updates the value to color transform combo box.
Definition: Inspector.cxx:333
void setIntervalEnabled(const PlotterBase *plotter, bool yes)
Sets the interval counting to yes on the NTuple of the active DataRep of the plotter.
readDoubleEntry(const QString &key, double def=0, bool *ok=0) const
virtual void setParameters(int, PlotterBase *)
Definition: Inspector.cxx:3556
void setNumContours(int i)
Set number of contours.
QButtonGroup * m_contourBox
void statsStripValue(QRadioButton *box)
Strips the value part of the text field.
Definition: Inspector.cxx:3921
void setXOffset(double x_offset)
Sets the xOffset of the (periodic) transform.
QComboBox * m_fitter_names
QComboBox * m_availPlotTypes
Definition: InspectorBase.h:55
remove(uint index, uint len)
virtual void colorSelect_2_clicked()
Sets the Color of the cut plotter.
Definition: Inspector.cxx:4934
QLabel * m_numContoursLabel
virtual void updatePlotTab()
Updates the Plot tabbed panel's widgets.
Definition: Inspector.cxx:1617
QRadioButton * allCutsRadioButton
static CutController * instance()
Returns the pointer to the singleton instance.
void setAllCutsActive(bool yes)
Sets all CutPlotter objects to active state if yes is true, otherwise sets them inactive.
Definition: Inspector.cxx:3274
Type convert(const std::string &axis)
Converts from string representation ot Axes::Type representation.
Definition: AxesType.cxx:32
TupleCutList_t m_tuple_cuts
The list of TupleCut objects currently selected.
Definition: Inspector.h:320
setGeometry(int x, int y, int w, int h)
toDouble(bool *ok=0) const
virtual void functionsFitToDataButton_clicked()
Fits the selected function to the data.
Definition: Inspector.cxx:3893
int getBlue() const
Definition: Color.cxx:174
QRadioButton * m_stats_text
std::vector< QComboBox * > m_sel_combos
Binding combo boxes for selected plot group box.
Definition: Inspector.h:279
virtual void newColorModel()
Brings up dialog to create a new Value to Color model.
Definition: Inspector.cxx:1941
QLineEdit * m_axis_label
void updateCutEnableButton()
Updates the cut enabled push button control.
Definition: Inspector.cxx:2805
virtual double getOffset(Axes::Type axis) const
Returns the offset on designated axis, similarly to getBinWidth.
virtual void ignoreErrorCheckBoxToggled(bool)
Slot which responds to the ignoreError check box.
Definition: Inspector.cxx:5207
void fillPlotterList(std::vector< PlotterBase * > &plot_list)
Clears and Fills plot_list with the PlotterBase objects on the current canvas.
Definition: Inspector.cxx:1515
The base class for the value to the color transformation.
Definition: BinToColor.h:30
QLabel * colorlabel
QRadioButton * m_Sin
TextPlotter class interface.
insertSearchPath(System s, const QString &path)
information(QWidget *parent, const QString &caption, const QString &text, int button0, int button1=0, int button2=0)
double error() const
Returns the error on the value of the parameter.
QGroupBox * m_new_plot_box
Definition: InspectorBase.h:51
virtual void entriesDrag()
Definition: Inspector.cxx:2350
An implementation of FontBase that uses a Qt QFont as implementation.
Definition: QtFont.h:28
readEntry(const QString &key, const QString &def=QString::null, bool *ok=0) const
insertItem(const QString &t, int index=-1)
virtual void cutHighSlider_sliderReleased()
Definition: Inspector.cxx:4859
QPushButton * newFunctionsAddButton
bool hasNTupleBindings(const PlotterBase *plotter, int index)
Returns true if the DataRep contained by the plotter at index index has NTuple bindings.
virtual void cutAddSelected()
Adds selected cut to the DataRep.
Definition: Inspector.cxx:2953
void incompatibleFunctionError(const std::string &type)
Raises the incompatible function error dialog.
Definition: Inspector.cxx:1105
bool m_is_updating
Set to true if updating is being processed.
Definition: Inspector.h:359
A Plotter class that plots points in 2 dimensions and option a third dimension in color...
Definition: XyPlotter.h:44
A PointRep class that draws a contour lines.
QPushButton * colorSelect_2
QLineEdit * m_statsTextField
QLabel * new_binding_0
Definition: InspectorBase.h:56
virtual void setWidthText()
Responds to return in bin width text field.
Definition: Inspector.cxx:2361
virtual void cutLowSlider_sliderReleased()
Definition: Inspector.cxx:4849
QLabel * new_binding_3
Definition: InspectorBase.h:62
void setTitle(const std::string &title)
Sets the title to be displayed.
double xOffset() const
Returns the xOffset of the (periodic) transform.
virtual void setOffsetText()
Responds to return in bin offset text field.
Definition: Inspector.cxx:2409
QSlider * brk_pt
unsigned int getRepStyle(const PlotterBase *plotter) const
Returns the style of the point representation.
virtual void notifyObservers() const
Notifies Observer objects of a change.
Definition: Observable.cxx:93
static Color::Value getColor()
Instead of getting a random color, this static method loop over the 5 common colors: red...
Definition: Color.cxx:181
hippodraw::Axes::Type m_axis
Definition: Inspector.h:299
number(long n, int base=10)
QLineEdit * m_contourLevelsTextBox
std::string getSelectedDataSourceName() const
Returns the name of the currently selected DataSource in Data tabbed panel.
Definition: Inspector.cxx:497
postEvent(QObject *receiver, QEvent *event)
QGroupBox * m_slider_control
latin1() const
QButtonGroup * transform_button_group
QRadioButton * m_Gls
append(char ch)
virtual bool hasZeroRows()
Returns true if this DataRep has zero rows in its DataSource.
Definition: DataRep.cxx:304
void updateAutoScaleBox()
Updates the active and inactive cuts.
Definition: Inspector.cxx:4287
bool multipleDataRepInfo(const std::string &type)
Raises a multiple DataRep info dialog.
Definition: Inspector.cxx:1162
QLineEdit * m_y_offset_text
virtual void lowRangeDrag()
Definition: Inspector.cxx:2321
virtual void updateSummaryTab()
Updates the Stats tabbed panel's widgets.
Definition: Inspector.cxx:3929
virtual void cutInvertPushButton_clicked()
Definition: Inspector.cxx:4892
QComboBox * m_pointRepComboBox
void warningTex()
Raises warning if TeX not supported.
Definition: Inspector.cxx:2099
QButtonGroup * axis_button_group
bool m_cut_enable_updating
Set to true when hippodraw::Inspector::cutEnablePushButton is being updated.
Definition: Inspector.h:364
virtual void updateFitCutsTab()
Update the cut tabbed panel when in fit cut mode.
Definition: Inspector.cxx:3229
const std::string & name() const
Returns the name of the parameter.
void disableCutControls(bool yes)
Disables all the control widgets for a cut.
Definition: Inspector.cxx:2706
virtual void dataTupleNameChanged(const QString &)
Respond to change of DataSource name change.
Definition: Inspector.cxx:580
void updateLogBox()
Update the status of the log scale check box.
Definition: Inspector.cxx:4273
QComboBox * m_CutVariableComboBox1
void invalidRangeError(const std::string &bad)
Raises invalid range error dialog.
Definition: Inspector.cxx:1124
virtual void m_boxedge_clicked()
Definition: Inspector.cxx:5856
RepBase * getRepresentation() const
Returns the representation used to draw the data points.
Definition: DataRep.cxx:234
virtual TransformBase * getTransform() const
Returns the transform object used by the plotter.
QComboBox * sel_combo_4
Definition: InspectorBase.h:82
void updateCutVarGroupBox(const PlotterBase *plotter, int index)
Updates the QGroupBox that displays to controller for creating a new cut.
Definition: Inspector.cxx:3294
QRadioButton * contourRadioButton1
virtual void setActivePlot(int index, bool redraw)
Sets the active plot.
QLineEdit * m_x_offset_text
QWidgetStack * m_point_stack
Definition: InspectorBase.h:91
A singleton class is the interface between an application and the list of FunctionRep objects contain...
void setLowSliderValue(int value)
Set the low slider value.
Definition: AxisWidget.cxx:502
virtual void updateDataTab()
Definition: Inspector.cxx:810
A DataSource class implemented with std::vector to store the column data. ...
Definition: NTuple.h:33
double low() const
Returns the minimum of the range object.
Definition: Range.cxx:87
QLabel * sel_binding_4
Definition: InspectorBase.h:81
virtual void setHighRange(Axes::Type axis, int parm, bool dragging)
Sets the high end of the Range of data displayed.
void clear(std::vector< QLabel * > &labels, std::vector< QComboBox * > &combos)
Clears the labels and combo boxes.
Definition: Inspector.cxx:718
QGroupBox * m_new_cut_box
QLabel * sel_binding_1
Definition: InspectorBase.h:75
DisplayController class interface declaration.
QSlider * color_scale
virtual void resetSlider()
Resets sliders to default position.
Definition: Inspector.cxx:1904
intp size(numeric::array arr)
Definition: num_util.cpp:296
double moduloAddX(double x1, double x2) const
Modulo Addition along X axis.
virtual void setHighRange(int value)
Definition: Inspector.cxx:2547
std::vector< QComboBox * > m_new_combos
Binding combo boxes for new plot group box.
Definition: Inspector.h:271
toInt(bool *ok=0, int base=10) const
A derived class of DataRep which is a base class for displaying a function.
Definition: FunctionRep.h:34
virtual void setLowText()
Definition: Inspector.cxx:2490
virtual void availPlotTypesActivated(const QString &)
Definition: Inspector.cxx:733
QPushButton * functionsResetButton
virtual void sliderChanged(int)
Responds to change in the sliders of one of the value to color sliders.
Definition: Inspector.cxx:1877
isEmpty() const
void addTextDisplay(PlotterBase *plotter, const std::string &type)
Adds a textual display to the canvas of type type.
void editTitleFontClicked()
Edit the title font, ( if user wants to overwrite he default )
Definition: Inspector.cxx:5169
virtual const Range & getRange(Axes::Type axis, bool scaled) const
Returns the range on the specified axis.
virtual void cutText_returnPressed()
Responds to entry in one of the cut text fields.
Definition: Inspector.cxx:2682
void processHighSliderMoved(int value, Range &currentRange, const Range &fullRange)
Called by InspectorBase in response to the highSliderMoved signal.
Definition: AxisWidget.cxx:332
virtual void cutNew()
Definition: Inspector.cxx:3099
virtual void createResiduals()
Creates a display showing the residuals of the function.
Definition: Inspector.cxx:4124
A derived class of QCustomEvent with which the CanvasView notifiies clients of changes in selections ...
void invalidOperationError(const std::string &message)
Raises operatonal error messge ox with messge.
Definition: Inspector.cxx:4731
QRadioButton * m_cut_fit_radio
virtual void cutEnablePushButton_toggled(bool on)
Responds to the cut enable push button.
Definition: Inspector.cxx:4913
virtual void sel_combo_2_activated(const QString &)
Responds to combo box of selected plot be activated by changing the binding.
Definition: Inspector.cxx:655
virtual void functionParamsListViewCurrentChanged()
Slot which recieves the signal if Current item changes in the List View of the function Params...
Definition: Inspector.cxx:4509
setCurrentItem(int index)
virtual void ntupleChanged(int)
Responds to combo box that shows the NTuple name of the selected plot.
Definition: Inspector.cxx:1527
QLabel * brk_label
hippodraw::NTupleProjector class interface
virtual void functionParamsLineEditReturnPressed()
Slot which recieves the signal if enter is pressed in the line edit in the the function Params tab...
Definition: Inspector.cxx:4614
QComboBox * sel_combo_2
Definition: InspectorBase.h:78
QRadioButton * m_Stg
void invalidDataWarning()
Raises a dialog to warn user that bound DataSource has invalid data.
Definition: Inspector.cxx:1020
const std::string & name() const
Returns the name of the Transform.
A concrete window class that contains the canvas and responds to menu item and tool bar events from t...
Definition: CanvasWindow.h:106
void processLowSliderReleased(const Range &fullRange)
Called by InspectorBase in response to the lowSliderReleased signal.
Definition: AxisWidget.cxx:234
virtual bool getBoxEdge()
Get the box-edge status to update the inspector.
remove(QWidget *widget)
QLabel * new_binding_4
Definition: InspectorBase.h:64
QLabel * sel_binding_3
Definition: InspectorBase.h:79
A transform that transforms coordinates from one 2D coordinate system to another. ...
double yOffset() const
Returns the yOffset of the (periodic) transform.
QButtonGroup * cut_button_group
virtual void editColorModel()
Brings up dialog to edit an existing Value to Color model.
Definition: Inspector.cxx:1991
virtual void tabChanged()
Receives the signal that the tabbed panel changed and invokes the update method.
Definition: Inspector.cxx:413
void setHighSliderValue(int value)
Set the high slider value.
Definition: AxisWidget.cxx:519
hippodraw::NTuple class interface.
virtual int getMinEntries()
Get the minimum entries/bin.
virtual void summaryNew()
Definition: Inspector.cxx:4039
QCheckBox * m_grid
result() const
QSlider * flat_width
void updateSelectedPlotType(const PlotterBase *plotter)
Updates the selected plot DataRep type.
Definition: Inspector.cxx:889
virtual void setMinEntries(int increment)
Responds to minimum entries slider.
Definition: Inspector.cxx:5881
PyArray_TYPES type(numeric::array arr)
Definition: num_util.cpp:249
A derived class of InspectorBase class which is generated by the Qt designer.
Definition: Inspector.h:234
Namespace for HippoDraw.
Definition: AxesType.cxx:21
virtual void update()
The Update Method.
Definition: Inspector.cxx:420
QCheckBox * m_boxedge
virtual void widthDrag()
Definition: Inspector.cxx:2340
QGroupBox * m_plot_title
Definition: InspectorBase.h:87
QGroupBox * m_cut_selected_box
int findCutIndex(const QString &label)
Returns the index of the cut selections with label label.
Definition: Inspector.cxx:3184
Type
Axes constants.
Definition: AxesType.h:31
void addFuncDisplay(PlotterBase *plotter, const std::string &name)
Adds function textual display to the canvas.
int getLowSliderValue()
Get the low slider value.
Definition: AxisWidget.cxx:497
static FunctionController * instance()
Returns the pointer to the singleton instance.
virtual void setMinEntriesText()
Responds to the user input of minimum entries number.
Definition: Inspector.cxx:5912
std::vector< int > m_functionIndexMap
Definition: Inspector.h:298
virtual void lineStyleButtonGroup_clicked(int id)
Definition: Inspector.cxx:2159
static DataRepController * instance()
Returns the pointer to the singleton instance.
void setRepSize(double size)
Sets the size of the representation.
Definition: DataRep.cxx:126
count() const
QLineEdit * m_dataRepNameText
Definition: InspectorBase.h:72
A Color class for creating the color object following the standard RGB color space.
Definition: Color.h:37
void convertCtrlPts(std::vector< double > &sv)
Converts the value to color control points from int slider values to float values.
Definition: Inspector.cxx:1917
CanvasSelectionEvent class interface.
void setAllDisabled(bool flag)
Enable all controls if flag = false, disable if true.
Definition: AxisWidget.cxx:524
virtual void statsButtonGroupClicked(int)
Definition: Inspector.cxx:4031
virtual int activePlotIndex() const
Returns the index of the active plotter.
QScrollBar * m_x_offset
virtual void setXRotateText()
Definition: Inspector.cxx:5925
Base class for DataSource.
Definition: DataSource.h:55
setReadOnly(bool)
virtual void contourTextBox_returnPressed()
Definition: Inspector.cxx:4984
void invalidPeriodicTransform()
Displays a warning message that application was not compiled with WCSLIB support. ...
Definition: Inspector.cxx:5352
getText(const QString &caption, const QString &label, QLineEdit::EchoMode mode=QLineEdit::Normal, const QString &text=QString::null, bool *ok=0, QWidget *parent=0, const char *name=0)
QCheckBox * m_autoScale
virtual void setShowGrid(bool flag)
Sets the show-grid status to flag.
bool hasFunction(const PlotterBase *plotter, const DataRep *rep)
Returns true if rep contained by plotter has a function attached.
virtual void symbolTypeButtonGroup_clicked(int id)
Definition: Inspector.cxx:2143
virtual void resetRotate()
Reset to zero.
Definition: Inspector.cxx:5837
writeEntry(const QString &key, bool value)
std::vector< PlotterBase * > m_plotter_list
The currently selected plotters.
Definition: Inspector.h:342
static WindowController * instance()
Returns the application instance.
QCheckBox * m_errorBars
void setNewPlotNTuple(const std::string &name)
Sets the current item in the available NTuple selection box to one that matches name.
Definition: Inspector.cxx:556
double pos() const
Returns the first positive element in range.
Definition: Range.cxx:113
void updateSelectedPlotData(const PlotterBase *plotter)
Updates the controls in the selected plot QGroupBox of the data inspector.
Definition: Inspector.cxx:937
QPushButton * newPlotButton
Definition: InspectorBase.h:66
void enableNewPlotBox(bool yes=true)
Enables the new plot box.
Definition: Inspector.cxx:346
virtual void axisLabelText()
Responds to return in axis label text box.
Definition: Inspector.cxx:2454
virtual const Color & repColor() const =0
Returns the color used for the representation.
QLabel * flatlabel
virtual void diffDataRep()
Create display with differenece between two DataRep objects in Plotter.
Definition: Inspector.cxx:6001
QRadioButton * m_stats_chi
virtual CutPlotter * getSelectedCut()
Definition: Inspector.cxx:3076
QVBoxLayout * m_vLayout
Definition: Inspector.h:307
QPushButton * cutInvertPushButton
virtual bool errorDisplay(Axes::Type axis) const =0
Returns the state of error bar display on specified axis.
void incompatibleFitterError(const std::string &type)
Raises incompatible Fitter error dialog.
Definition: Inspector.cxx:1068
QComboBox * m_selCutComboBox
void functionAddError()
Raises a function add error QMessageBox when the selected DataRep does not support the selected funct...
Definition: Inspector.cxx:1221
void setYOffset(double y_offset)
Sets the yOffset of the (periodic) transform.
static DataSourceController * instance()
Returns the pointer to the singleton instance.
getColor(const QColor &initial=white, QWidget *parent=0, const char *name=0)
QComboBox * m_sel_ntuple_name
Definition: InspectorBase.h:70
void setIntervalCount(const PlotterBase *plotter, unsigned int count)
Sets the interval count on the the NTuple of the active DataRep of the plotter.
QGroupBox * m_func_new
hippodraw::RootController class interface.
virtual void sel_combo_3_activated(const QString &)
Responds to combo box of selected plot be activated by changing the binding.
Definition: Inspector.cxx:662
QComboBox * new_combo_0
Definition: InspectorBase.h:57
A class to collect function parameters from a FunctionBase object but also the constraints and errors...
void updateSelectedPlotDataSource(const std::string &name)
Updates the selected plot data source combo box.
Definition: Inspector.cxx:856
void fillFunctionParameters(QListViewItem *parent, const FunctionRep *function, unsigned int &index)
Fills the QListView with items for each function parameter or function as a child of parent...
Definition: Inspector.cxx:3631
virtual void functionAdd()
Definition: Inspector.cxx:3711
A PlotterBase derived class that serves a base class for cut plotters.
Definition: CutPlotter.h:43
virtual void setRange(Axes::Type axis, const Range &range, bool scaled=false, bool adjust_width=true)
Sets the range on the specified axis.
QGroupBox * currentPlot
Definition: InspectorBase.h:68
QLineEdit * m_numContoursTextBox
QRadioButton * m_stats_overflow
QCheckBox * m_combine_checkbox
QLabel * sel_binding_0
Definition: InspectorBase.h:73
QGroupBox * rotateGroupBox
QPushButton * functionsFitToDataButton
A Derived class of FunctionRep which hold a composite function.
virtual void axisLabelChanged(int index, const QString &axisName)
Responds to change in axis binding on existing plotter.
Definition: Inspector.cxx:669
QCheckBox * m_reverse
virtual void intervalStateChanged(bool state)
Definition: Inspector.cxx:2196
isChecked() const
virtual void setYRotateText()
Definition: Inspector.cxx:5962
const std::vector< const TupleCut * > & getCutList(const PlotterBase *plotter) const
Clears and fills the cut_list with PlotterBase objects that are cuts whose target is the active DataR...
Definition: Inspector.cxx:2882
QComboBox * new_combo_4
Definition: InspectorBase.h:65
value() const
QVBoxLayout * m_newVLayout
Definition: Inspector.h:308
void multiplePlotError()
Raises a multiple plot error message box.
Definition: Inspector.cxx:1207
int getNumContours() const
Returns the number of contours.
removeItem(int index)
hippodraw::WindowController class interface
virtual void highRangeDrag()
Definition: Inspector.cxx:2311
CompositeFunctionRep class interface.
QButtonGroup * m_line_group
double high() const
Returns the maximum of the range object.
Definition: Range.cxx:100
std::vector< QRadioButton * > m_transform_buttons
The list of transform radio buttons.
Definition: Inspector.h:381
QSlider * m_FunctionParamsSlider
void processZoomPanCheckBoxClicked(const Range &currentRange, const Range &fullRange)
Called by InspectorBase in response to the zoomPanCheckBoxClicked signal.
Definition: AxisWidget.cxx:392
QPushButton * cutEnablePushButton
QComboBox * sel_combo_1
Definition: InspectorBase.h:76
bool isPeriodic() const
Sets whether this transform is periodic.
void updateReverseBox()
Update the status of the reverse check box.
Definition: Inspector.cxx:4300
std::string getArrayTupleLabel(const DataSource *rtuple, const std::string &column)
In case we are dealing with multidimensional data in rows of this column in the given DataSource we w...
Definition: Inspector.cxx:1252
int cutRadioId() const
Returns the Id of the cut radio button group.
Definition: Inspector.cxx:3344
void updateCutControlValues(const Range &currentRange, const Range &fullRange)
Set the textboxes and sliders to the values given by the arguments.
Definition: AxisWidget.cxx:535
static void stringTokenize(std::string input, const std::string &delimiters, std::vector< std::string > &tokens, bool clear=true)
Definition: Inspector.cxx:112
QCheckBox * m_FunctionParamsCheckBox
QRadioButton * m_lambert
int m_min_entries
The min_entries when draging starts.
Definition: Inspector.h:385
QRadioButton * m_logy
The base class for fitters.
Definition: Fitter.h:33
QPushButton * edit_model
QLineEdit * m_titleText
Definition: InspectorBase.h:88
void setAppKey()
Ensures that the application's key value has been set.
Definition: Inspector.cxx:1820
virtual void setBoxEdge(bool flag)
Set the box-edge status to flag.
QPushButton * m_resid
int activeDataRepIndex(const PlotterBase *plotter) const
Returns the active DataRep index for the DataRep objects contained in the plotter.
virtual void rotateY(int offset)
Definition: Inspector.cxx:5792
toFloat(bool *ok=0) const
void processLowSliderMoved(int value, Range &currentRange, const Range &fullRange)
Called by InspectorBase in response to the lowSliderMoved signal.
Definition: AxisWidget.cxx:258
hippodraw::PlotterEvent class interface
DataRepController class interface.
virtual DataRep * getDataRep(int index) const
Returns the specified DataRep or null pointer if it doesn't exits.
virtual void symbolPointSize_returnPressed()
Definition: Inspector.cxx:2176
virtual void setRotate(int x, int y)
Reset the rotation slider and text, from the plotter.
Definition: Inspector.cxx:5825
int transformId() const
Returns the Id of the transform radio button that is selected.
Definition: Inspector.cxx:5368
QComboBox * newFunctionsComboBox
virtual void valueChanged(int)
Responds to change of the value to color combo box.
Definition: Inspector.cxx:1790
const std::vector< PlotterBase * > & getDataCutList(PlotterBase *plotter)
Returns the list of data cut plotter objects that target plotter.
Definition: Inspector.cxx:2668
void setZoomPan(bool check, bool disables=false)
Checks zoomPanCheckBox if check is true, else un-checks it.
Definition: AxisWidget.cxx:558
currentItem() const
A singleton class that is the interface between GUI and the DataSource objects.
hippodraw::FunctionController class interface
virtual void customEvent(QCustomEvent *event)
The method to receive update events from the application queue.
Definition: Inspector.cxx:353
The base class for data representations.
Definition: DataRep.h:68
QComboBox * m_CutVariableComboBox2
QString m_model_name
The color model name settings key.
Definition: Inspector.h:251
critical(QWidget *parent, const QString &caption, const QString &text, int button0, int button1, int button2=0)
virtual PlotterBase * getPlotter()
Definition: Inspector.cxx:380
virtual void updateFunctionsTab()
Updates the functions tabbed panel's widgets.
Definition: Inspector.cxx:3394
hippodraw::TupleCut class interface
virtual void fitterNamesActivated(int)
Definition: Inspector.cxx:3792
virtual void cutHighSlider_sliderMoved(int value)
Definition: Inspector.cxx:4801
bool m_rotate_enable
When changing current plot, set to false so that Inspector don't update the rotation repeatedly...
Definition: Inspector.h:376
void multipleDataRepError(const std::string &type)
Raises a multiple DataRep error QMessageBox.
Definition: Inspector.cxx:1140
virtual void axisZoomPanCheckBox_clicked()
Responds to change in zoom/pan check box.
Definition: Inspector.cxx:2282
void newPlotError(const std::exception &e)
Raises a dialog for new plot error.
Definition: Inspector.cxx:1238
QLineEdit * m_offset_text
QScrollBar * m_offset_range
warning(QWidget *parent, const QString &caption, const QString &text, int button0, int button1, int button2=0)
currentText() const
QTabWidget * m_plot_tab
Definition: InspectorBase.h:49
virtual void updateCutsTab()
Updates the cut tabbed panel's widgets' state and values.
Definition: Inspector.cxx:3201
CanvasWindow * currentCanvas()
Returns a pointer to the current CanvasWindow.
FunctionParameter class interface.
virtual void updateTransformTab()
Update the transform tabbed panel's widgets.
Definition: Inspector.cxx:5231
setValue(int)
virtual void setLowRange(int value)
Definition: Inspector.cxx:2508
A Plotter class that draws text.
Definition: TextPlotter.h:38
int getGreen() const
Definition: Color.cxx:169
double value() const
Returns the value of the parameter.
virtual const std::vector< std::string > & getLabels() const
Returns the list of available labels.
Definition: DataSource.cxx:172
virtual void transform_button_group_clicked()
Responds to change in transform tabbed panel's radio button group.
Definition: Inspector.cxx:5382
QFrame * m_axis_frame
int m_last_ntuple_edited
The m_all_ntuples item that was lasted edited.
Definition: Inspector.h:345
virtual void setMinEntries(int entries)
Set the minimum entries/bin.
virtual void rotateX(int offset)
Rotation for periodic transform.
Definition: Inspector.cxx:5758
STL namespace.
virtual void intervalTextChanged(const QString &)
Definition: Inspector.cxx:2208
virtual void setHighText()
Definition: Inspector.cxx:2626
A derived class of QCustomEvent to handle updates from PlotterBase.
Definition: PlotterEvent.h:39
A singleton class that is the interface between GUI and the DataRep.
hippodraw::PeriodicBinaryTransform class interface
virtual void titleText_returnPressed()
Responds to title text return.
Definition: Inspector.cxx:2113
virtual void pushButtonNewErrorPlotClicked()
The slot that recieves the signal when the PushButtonNewErrorPlot is clicked.
Definition: Inspector.cxx:4175
std::vector< const TupleCut * > TupleCutList_t
The type of container for current TupleCut objects.
Definition: Inspector.h:316
virtual void cutRemovePushButton_clicked()
Responds to the button that removes a cut.
Definition: Inspector.cxx:2999
QLabel * sel_binding_2
Definition: InspectorBase.h:77
maxValue() const
QSlider * m_numContourSlider
QPushButton * m_plot_color
QRadioButton * m_stats_fparms
QRadioButton * m_Mer
QPushButton * functionsRemoveButton
hippodraw::ContourPointRep class interface
hippodraw::Axes::Type getAxes(unsigned int index)
Populates the three vectors(usr_models,brk_points,flat_widths) with details about the user defined Co...
Definition: Inspector.cxx:2820
QWidget * m_layoutWidget
Definition: Inspector.h:306
virtual void functionParamsSliderSliderPressed()
Slot which recieves signal when params slider is presssed.
Definition: Inspector.cxx:4658
The namespace for conversion to string.
virtual ProjectorBase * getProjector() const
Returns the Projector object controlling the data.
Definition: DataRep.cxx:138
void incompatibleDataRepError(const std::string &type)
Raises incompatible DataRep error dialog.
Definition: Inspector.cxx:1050
QPushButton * m_PushButtonNewErrorPlot
QRadioButton * m_stats_avg_y
QRadioButton * m_stats_avg_x
std::map< PlotterBase *, int > m_cut_map
A map of the last cut item selected for each plotter.
Definition: Inspector.h:312
void editLabelFontClicked()
Edit label font, ( if user wants to overwrite he default )
Definition: Inspector.cxx:5134
QCheckBox * logScale
std::vector< QLabel * > m_sel_labels
Binding labels for selected plot group box.
Definition: Inspector.h:275
QComboBox * m_value_combo
virtual void colorSelect_clicked()
Definition: Inspector.cxx:2221
FunctionRep * getFunctionRep()
Returns the FunctionRep directly coresponding to the selected item.
Definition: Inspector.cxx:3876
virtual void errorBars_toggled(bool)
Responds to error bars check box.
Definition: Inspector.cxx:2088
void fillCheckedFunctionRepItems()
Clears and fills m_func_parm_checked vector with the function parameters that have their check box on...
Definition: Inspector.cxx:4142
virtual void deleteColorModel()
Deletes an existing Value to Color Model.
Definition: Inspector.cxx:2051
virtual void newPlotButton_clicked()
Definition: Inspector.cxx:1325
QString m_color_scale
The color model color scale settings key.
Definition: Inspector.h:263
virtual void functionsResetButton_clicked()
Reset the function parameters from the parameters saved before the last fit.
Definition: Inspector.cxx:3533
virtual void addDataRepButton_clicked()
Responds to click on the add Data Rep button.
Definition: Inspector.cxx:1400
The class expresses a cut on a DataSource, i.e.
Definition: TupleCut.h:43
virtual void allNtupleComboActivated(const QString &)
Definition: Inspector.cxx:622
std::map< const PlotterBase *, bool > m_zoompan
Definition: Inspector.h:301
void set(Color::Value value)
Sets the Color of the PointRepBase object.
Definition: DataRep.cxx:241
QtFont class interface.
void setSelectedFitter(const std::string &name)
Sets the selected Fitter.
Definition: Inspector.cxx:3379
DataSourceController class interface.
bool m_user_models_loaded
Set to true after the user defined value to color transforms have been loaded.
Definition: Inspector.h:371
QRadioButton * m_Car
FunctionBase * addFunction(PlotterBase *plotter, const std::string &name)
Adds a function to the first DataRep object of the plotter.
QComboBox * new_combo_1
Definition: InspectorBase.h:59
QLabel * new_binding_2
Definition: InspectorBase.h:60
Expresses a range of values.
Definition: Range.h:33
virtual void sel_combo_0_activated(const QString &)
Responds to combo box of selected plot be activated by changing the binding.
Definition: Inspector.cxx:641
hippodraw::AxisWidget * axisWidget2
virtual void offsetDrag()
Definition: Inspector.cxx:2331
removeEntry(const QString &key)
hippodraw::Inspector class interface.
int validPeriodicTransformRange()
Return true if the range is valid for HammerAito or Lambert transform.
Definition: Inspector.cxx:5714
getFont(bool *ok, const QFont &initial, QWidget *parent=0, const char *name=0)
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
virtual void functionParamsSliderSliderReleased()
Slot which set the slider to mid point after it has been release.
Definition: Inspector.cxx:4724
QListView * m_FunctionParamsListView
QLineEdit * m_interval_le
void badFunctionError(const std::string &name, const char *what)
Raise bad function error dialog.
Definition: Inspector.cxx:1087
std::vector< QListViewItem * > m_func_parm_checked
The list of functions parameters that are checked for use by the error contour display.
Definition: Inspector.h:293
int m_lowslider1_last_val
The value of the low slider in Axis Widget 1 as last recorded.
Definition: Inspector.h:351
toUInt(bool *ok=0, int base=10) const
int getRed() const
Definition: Color.cxx:164
QWidget * m_newLayoutWidget
Definition: Inspector.h:304
std::vector< double > m_oldParameters
Definition: Inspector.h:300
QScrollBar * m_y_offset

Generated for HippoDraw Class Library by doxygen