GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4PolyCondPainter.cxx
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#include "TGo4PolyCondPainter.h"
15
16#include "TVirtualPad.h"
17#include "TROOT.h"
18
19#include "TGo4PolyCondView.h"
20
26
27TGo4PolyCondPainter::TGo4PolyCondPainter(const char *name, const char *title) :
28 TGo4ConditionPainter(name,title),
29 fxCutView(nullptr)
30{
31}
32
34{
36 if (fxCutView) {
37 delete fxCutView;
38 fxCutView = nullptr;
39 }
40}
41
42
44{
45 if(!gPad) return;
46 TObject *cutinpad = gPad->GetListOfPrimitives()->FindObject(fxCutView);
47
48 //if(fxCutView && cutinpad && (fxCutView->IsAtExecuteMouseEvent() || fxCutView->IsAtExecuteMouseMenu())) return; // do not repaint during mouse move on polygon
49
50 if(fxCutView && cutinpad && fxCutView->IsAtExecuteMouseEvent()) return; // do not repaint during mouse move on polygon
51 if(fxCutView && fxCutView->IsAtExecuteMouseMenu()) return;
52
53 TGo4PolyCond *pconny=dynamic_cast<TGo4PolyCond*>(fxCondition);
54 if(pconny && pconny->IsVisible()) {
55 TCutG *cutg = pconny->GetCut(kFALSE);
56 if(!cutg) return; // case of empty polygon condition
57 // JAM2016: deletion from canvas is suppressed inside Go4 by QtROOT interface. Just create if not already there:
58 if(!fxCutView) {
59 // Only set up new view object if not already there
60 // necessary to change cut interactively (points, colors, etc...)
61 // Since cutg may be deleted from canvas by user.
62 fxCutView = new TGo4PolyCondView(cutg);
63
64 fxCutView->SetLineWidth(pconny->GetLineWidth());
65 fxCutView->SetLineColor(pconny->GetLineColor());
66 fxCutView->SetLineStyle(pconny->GetLineStyle());
67 fxCutView->SetFillColor(pconny->GetFillColor());
68 fxCutView->SetFillStyle(pconny->GetFillStyle());
69 } else {
70 //if(!fxCutView->IsAtExecuteMouseMenu()) // suppress exchanging point arrays during insert/remove points menu JAM2016
71 fxCutView->SetCut(cutg); // update view if condition was changed manually
72 }
73
74 fxCutView->SetCondition(pconny); // back-reference for execute event
75 if(!strcmp(opt,"fixstyle")) {
76 // reproduce condition colors always
77 // this mode will prevent the user from changing style interactively
78 fxCutView->SetLineWidth(pconny->GetLineWidth());
79 fxCutView->SetLineColor(pconny->GetLineColor());
80 fxCutView->SetLineStyle(pconny->GetLineStyle());
81 fxCutView->SetFillColor(pconny->GetFillColor());
82 fxCutView->SetFillStyle(pconny->GetFillStyle());
83 }
84 if(!cutinpad) {
85 fxCutView->AppendPad();
86 }
87 }// if(pconny && pconny->IsVisible())
88else
90}
91
93{
94 if(!fxCutView) return; // JAM2016
95 gROOT->GetListOfCanvases()->RecursiveRemove(fxCutView);
96 // we do not delete view, but restore graphics properties though invisible
97 TString option(opt);
98 if(option.Contains("reset")) {
99 delete fxCutView;
100 fxCutView = nullptr;
101 }
102}
103
105{
106 if(fxCutView) fxCutView->Pop(); // box to front
107 TGo4LabelPainter::DisplayToFront(opt); // label itself will be frontmost
108}
109
111{
112 fxCondition = con;
113 if (fxCutView)
114 fxCutView->SetCondition(dynamic_cast<TGo4PolyCond *>(con));
115}
TGo4Condition * fxCondition
Condition to be painted.
Go4 condition class.
virtual Bool_t IsVisible() const
Visibility property for gui display in editor.
virtual void DisplayToFront(Option_t *opt="")
pop all components to the front of the pad
void UnPaintCondition(Option_t *opt="") override
Erase condition view.
void SetCondition(TGo4Condition *con) override
Not inline, because we overwrite this for polygon condition.
void DisplayToFront(Option_t *opt="") override
pop all components to the front of the pad
void PaintCondition(Option_t *opt="") override
Display condition with plain root canvas and in go4 viewpanel.
TGo4PolyCondView * fxCutView
Cut used for polygon display.
Polygon condition.
TCutG * GetCut(Bool_t changeowner) override
Used to return the cut pointer of a TGo4PolyCond.