3 #include <boost/bind.hpp>
4 #include <boost/regex.hpp>
20 #include "TGFileDialog.h"
22 #include "TGeoMatrix.h"
23 #include "TGStatusBar.h"
26 #include "TGLPhysicalShape.h"
28 #include "TGComboBox.h"
30 #include "TGeoShape.h"
32 #include "TEveManager.h"
33 #include "TEveGeoNode.h"
34 #include "TEveScene.h"
35 #include "TEveSceneInfo.h"
36 #include "TEveViewer.h"
37 #include "TGLViewer.h"
38 #include "TGLCamera.h"
39 #include "TEveSelection.h"
40 #include "TVirtualX.h"
41 #ifdef PERFTOOL_BROWSER
42 #include <google/profiler.h>
52 if (
event->fType == kButtonPress) {
57 TEveElementList* views = gEve->GetViewers();
60 for (TEveElement::List_i it = views->BeginChildren(); it != views->EndChildren(); ++it) {
61 TEveViewer*
v = ((TEveViewer*)(*it));
62 if (strstr(
v->GetElementName(),
"3D")) {
64 m_viewPopup->AddEntry(
v->GetElementName(),
idx);
66 for (TEveElement::List_i eit =
v->BeginChildren(); eit !=
v->EndChildren(); ++eit) {
67 TEveScene*
s = ((TEveSceneInfo*)*eit)->GetScene();
68 if (
m_el &&
s->HasChildren() &&
s->FirstChild() ==
m_el) {
75 m_viewPopup->CheckEntry(
idx);
83 gVirtualX->TranslateCoordinates(GetId(),
84 gClient->GetDefaultRoot()->GetId(),
91 m_viewPopup->PlaceMenu(ax, ay,
true,
true);
92 m_viewPopup->Connect(
"Activated(Int_t)",
93 "FWGeometryTableViewBase",
108 class FWGeometryVF :
public TGVerticalFrame {
112 gVirtualX->SelectInput(GetId(),
113 kKeyPressMask | kKeyReleaseMask | kExposureMask | kPointerMotionMask |
114 kStructureNotifyMask | kFocusChangeMask | kEnterWindowMask | kLeaveWindowMask);
117 ~FWGeometryVF()
override{};
119 Bool_t HandleKey(Event_t*
event)
override {
120 if (
event->fCode == (UInt_t)gVirtualX->KeysymToKeycode(kKey_Escape)) {
123 return TGCompositeFrame::HandleKey(
event);
129 class FWTranspEntry :
public TGTextEntry {
132 ~FWTranspEntry()
override {}
134 Bool_t HandleKey(Event_t*
event)
override {
135 if (
event->fCode == (UInt_t)gVirtualX->KeysymToKeycode(kKey_Escape)) {
136 m_tv->getTableManager()->cancelEditor(
true);
138 return TGTextEntry::HandleKey(
event);
171 TGCompositeFrame* xf =
m_eveWindow->GetGUICompositeFrame();
173 m_frame =
new FWGeometryVF(xf,
this);
175 xf->AddFrame(
m_frame,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
185 m_frame->AddFrame(
m_tableWidget,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 0, 0));
189 m_tableWidget->Connect(
"cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
190 "FWGeometryTableViewBase",
192 "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
197 editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow - 7));
198 editor->SetFrameDrawn(
false);
199 editor->Connect(
"ReturnPressed()",
"FWGeometryTableViewBase",
this,
"transparencyChanged()");
203 editor->UnmapWindow();
221 TEveScene* getMarkerScene(TEveViewer*
v) {
222 TEveElement* si =
v->FindChild(Form(
"SI - EventScene %s",
v->GetElementName()));
224 return ((TEveSceneInfo*)(si))->GetScene();
287 TEveElementList* viewers = gEve->GetViewers();
290 if (
nullptr != keyVals) {
292 TString sname = it->first;
293 TEveViewer*
v = dynamic_cast<TEveViewer*>(viewers->FindChild(sname.Data()));
295 fwLog(
fwlog::kError) <<
"FWGeometryTableViewBase::populate3DViewsFromConfig no viewer found " << it->first
304 gEve->FullRedraw3D(
false,
true);
317 TEveElement::List_i it = gEve->GetViewers()->BeginChildren();
318 std::advance(it,
idx);
319 TEveViewer*
v = (TEveViewer*)(*it);
321 for (TEveElement::List_i eit =
v->BeginChildren(); eit !=
v->EndChildren(); ++eit) {
322 if ((((TEveSceneInfo*)(*eit))->GetScene()) ==
m_eveScene) {
323 v->RemoveElement(*eit);
325 getMarkerScene(
v)->RemoveElement(
m_marker);
367 bool elementChanged =
false;
368 if (iButton == kButton1) {
372 gVirtualX->TranslateCoordinates(
373 gClient->GetDefaultRoot()->GetId(),
m_tableWidget->GetId(),
x,
y, xLoc, yLoc, wdummy);
377 }
else if (iColumn == 1) {
378 std::vector<Color_t>
colors;
385 "FWGeometryTableViewBase",
386 const_cast<FWGeometryTableViewBase*>(
this),
387 "nodeColorChangeRequested(Color_t");
394 }
else if (iColumn == 2) {
397 }
else if (iColumn == 3) {
400 elementChanged =
true;
401 }
else if (iColumn == 4) {
404 elementChanged =
true;
405 }
else if (iColumn == 6) {
408 elementChanged =
true;
413 if (elementChanged) {
417 }
else if (iColumn == 0) {
425 if (backgroundIsWhite) {
445 ni.
m_node->GetVolume()->SetLineColor(
col);
457 TGeoVolume* gv = ni.
m_node->GetVolume();
458 bool resetHome =
false;
487 gv->InspectMaterial();
511 v->CurrentCamera().SetExternalCenter(
true);
515 v->SetDrawCameraCenter(
true);
525 gEve->FullRedraw3D(
true,
true);
558 for (TEveElement::List_i
k = gEve->GetViewers()->BeginChildren();
k != gEve->GetViewers()->EndChildren(); ++
k) {
559 for (TEveElement::List_i eit = (*k)->BeginChildren(); eit != (*k)->EndChildren(); ++eit) {
560 TEveScene*
s = ((TEveSceneInfo*)*eit)->GetScene();
562 viewers.
addKeyValue((*k)->GetElementName(), tempArea);
579 std::istringstream
s(
value->value());
584 "Ignoring node path from confugration file -- %s value larger than number of nodes \n",
599 i->m_color =
i->m_node->GetVolume()->GetLineColor();
616 TGTextButton* butt =
new TGTextButton(gui.
getTabContainer(),
"ReloadColors");