Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

QFitRangeCutWidget.ui.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 /****************************************************************************
00017 ** ui.h extension file, included from the uic-generated form implementation.
00018 **
00019 ** If you wish to add, delete or rename functions or slots use
00020 ** Qt Designer which will update this file, preserving your code. Create an
00021 ** init() function in place of a constructor, and a destroy() function in
00022 ** place of a destructor.
00023 *****************************************************************************/
00024 
00025 TGo4FitComponent* QFitRangeCutWidget::GetComp() {
00026    return dynamic_cast<TGo4FitComponent*> (GetItem()->Parent()->Object());
00027 }
00028 
00029 int QFitRangeCutWidget::GetCutIndex() {
00030   return GetItem()->Tag();
00031 }
00032 
00033 TCutG* QFitRangeCutWidget::GetCut() {
00034   return dynamic_cast<TCutG*> (GetObject());
00035 }
00036 
00037 void QFitRangeCutWidget::FillSpecificData() {
00038   QFitNamedWidget::FillSpecificData();
00039   TGo4FitComponent* comp = GetComp();
00040   TCutG* cut = GetCut();
00041   if (comp && cut) {
00042      ExcludeCutChk->setChecked(comp->IsRangeCutExcluding(GetCutIndex()));
00043      NumPointsSpin->setValue(cut->GetN());
00044      FillXYPointsTable();
00045   }
00046 }
00047 
00048 void QFitRangeCutWidget::FillXYPointsTable() {
00049    TCutG* cut = GetCut();
00050    if (cut==0) return;
00051 
00052    XYTable->setNumRows(cut->GetN());
00053 
00054    for (int n=0;n<cut->GetN();n++) {
00055       Double_t x,y;
00056       cut->GetPoint(n, x,y);
00057       XYTable->setText(n, 0, QString::number(x));
00058       XYTable->setText(n, 1, QString::number(y));
00059       XYTable->verticalHeader()->setLabel(n, QString::number(n));
00060    }
00061 }
00062 
00063 
00064 void QFitRangeCutWidget::NumPointsSpin_valueChanged( int npoint )
00065 {
00066   if(!fbFillWidget && (GetCut()!=0)) {
00067       TCutG* cut = GetCut();
00068       int old = cut->GetN();
00069       Double_t x=0., y=0.;
00070       if (old>1) cut->GetPoint(old-2, x, y);
00071       cut->Set(npoint);
00072       for(int n= (old-1>=0 ? old-1 : 0); n<npoint-1; n++)
00073         cut->SetPoint(n, x, y+(n-old+2)*10);
00074 
00075       cut->GetPoint(0, x, y);
00076       cut->SetPoint(npoint-1, x, y);
00077 
00078       fbFillWidget = TRUE;
00079       FillXYPointsTable();
00080       fbFillWidget = FALSE;
00081   }
00082 }
00083 
00084 
00085 void QFitRangeCutWidget::ExcludeCutChk_toggled( bool chk)
00086 {
00087     if(!fbFillWidget && (GetComp()!=0))
00088       GetComp()->SetRangeCutExcluding(GetCutIndex(), chk);
00089 }
00090 
00091 
00092 void QFitRangeCutWidget::XYTable_valueChanged( int nrow, int ncol)
00093 {
00094   if(!fbFillWidget && (GetCut()!=0)) {
00095      TCutG* cut = GetCut();
00096      bool ok;
00097      double zn = XYTable->text(nrow, ncol).toDouble(&ok);
00098      if(ok) {
00099          if (ncol==0) cut->GetX()[nrow] = zn;
00100                  else cut->GetY()[nrow] = zn;
00101          if ((nrow==0) || (nrow==cut->GetN()-1)) {
00102             int nrow1 = (nrow==0) ? cut->GetN()-1 : 0;
00103             fbFillWidget = TRUE;
00104             XYTable->setText(nrow1, ncol, XYTable->text(nrow, ncol));
00105             if (ncol==0) cut->GetX()[nrow1] = zn;
00106                     else cut->GetY()[nrow1] = zn;
00107             fbFillWidget = FALSE;
00108          }
00109      }
00110   }
00111 }
00112 
00113 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:14 2008 for Go4-v3.04-1 by  doxygen 1.4.2