Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4ConditionsBase/TGo4PolyCondPainter.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 #include "TGo4PolyCondPainter.h"
00017 
00018 #include "TVirtualPad.h"
00019 
00020 #include "TGo4PolyCondView.h"
00021 #include "TGo4PolyCond.h"
00022 
00023 TGo4PolyCondPainter::TGo4PolyCondPainter(const Text_t * name, const Text_t * title)
00024 : TGo4ConditionPainter(name,title),fxCutView(0)
00025 {
00026 
00027 }
00028 
00029 TGo4PolyCondPainter::TGo4PolyCondPainter(const Text_t * name)
00030 : TGo4ConditionPainter(name,"Go4 polygon condition"),fxCutView(0)
00031 {
00032 
00033 }
00034 
00035 TGo4PolyCondPainter::TGo4PolyCondPainter()
00036 : TGo4ConditionPainter(),fxCutView(0)
00037 {
00038 
00039 }
00040 
00041 TGo4PolyCondPainter::~TGo4PolyCondPainter()
00042 {
00043    UnPaintCondition();
00044 }
00045 
00046 
00047 void TGo4PolyCondPainter::PaintCondition(Option_t* opt)
00048 {
00049 if(gPad==0) return;
00050 TGo4PolyCond* pconny=dynamic_cast<TGo4PolyCond*>(fxCondition);
00051 if(pconny && pconny->IsVisible())
00052    {
00053      TCutG* cutg=pconny->GetCut(kFALSE);
00054      if(cutg==0) return; // case of empty polygon condition
00055      if(fxCutView==0 || gPad->GetListOfPrimitives()->FindObject(fxCutView)==0)
00056          {
00057          // Only set up new view object if not already there
00058          // necessary to change cut interactively (points, colors, etc...)
00059          // Since cutg may be deleted from canvas by user.
00060          fxCutView= new TGo4PolyCondView(cutg);
00061          fxCutView->SetLineWidth(pconny->GetLineWidth());
00062          fxCutView->SetLineColor(pconny->GetLineColor());
00063          fxCutView->SetLineStyle(pconny->GetLineStyle());
00064          fxCutView->SetFillColor(pconny->GetFillColor());
00065          fxCutView->SetFillStyle(pconny->GetFillStyle());
00066          }
00067       else
00068          {
00069             if(cutg->GetN()==fxCutView->GetN())
00070                {
00071                   // only update if point number was not changed from rmb menu "InsertPoint"/"RemovePoint"
00072                   fxCutView->SetCut(cutg); // update view if condition was changed manually
00073                }
00074             else
00075                {
00076                   fxCutView->SetCondition(pconny);
00077                   fxCutView->UpdateCondition();
00078                }
00079          }
00080       fxCutView->SetCondition(pconny); // backreference for execute event
00081       if(!strcmp(opt,"fixstyle"))
00082             {
00083                // reproduce condition colors always
00084                // this mode will prevent the user from changing style interactively
00085                fxCutView->SetLineWidth(pconny->GetLineWidth());
00086                fxCutView->SetLineColor(pconny->GetLineColor());
00087                fxCutView->SetLineStyle(pconny->GetLineStyle());
00088                fxCutView->SetFillColor(pconny->GetFillColor());
00089                fxCutView->SetFillStyle(pconny->GetFillStyle());
00090             }
00091       if(gPad->GetListOfPrimitives()->FindObject(fxCutView)==0)
00092          {
00093             fxCutView->AppendPad();
00094          }
00095    }// if(pconny && pconny->IsVisible())
00096 else
00097    {
00098       UnPaintCondition();
00099    }
00100 }
00101 
00102 void TGo4PolyCondPainter::UnPaintCondition(Option_t* opt)
00103 {
00104 if(gPad==0) return;
00105 if(gPad->GetListOfPrimitives()->Remove(fxCutView)!=0)
00106    {
00107        // we do not delete view, but restore graphics properties though invisible
00108       TString option=opt;
00109       if(option.Contains("reset"))
00110          {
00111             delete fxCutView;
00112             fxCutView=0;
00113          }
00114       //gPad->Modified(kTRUE);
00115    }
00116 }
00117 
00118 void TGo4PolyCondPainter::SetCondition(TGo4Condition* con)
00119 {
00120     fxCondition=con;
00121     if(fxCutView)
00122        fxCutView->SetCondition(dynamic_cast<TGo4PolyCond*>(con));
00123 }
00124 
00125 
00126 ClassImp(TGo4PolyCondPainter)
00127 
00128 
00129 
00130 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:55:52 2005 for Go4-v2.10-5 by doxygen1.2.15