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");
virtual void cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY)
Bool_t HandleButton(Event_t *event) override
bool firstColumnClicked(int row, int xPos)
FWTableWidget * m_tableWidget
FWGeoTopNode * m_eveTopNode
FWGeometryTableViewBase * m_tableView
const_iterator begin() const
void setElement(TEveElement *x)
FWEveDigitSetScalableMarker * m_marker
FWLongParameter m_parentTransparencyFactor
void setTopNodePathFromConfig(const FWConfiguration &iFrom)
ViewerParameterGUI & requestTab(const char *)
const FWConfiguration * m_viewersConfig
ViewerParameterGUI & separator()
FWLongParameter m_autoExpand
void populate3DViewsFromConfig()
void addTo(FWConfiguration &) const override
FWLongParameter m_leafTransparencyFactor
FWLongParameter m_minParentTransparency
void nodeColorChangeRequested(Color_t)
virtual void applyColorTranspToDaughters(int selectedIdx, bool recurse)
virtual void setVisibilityChld(NodeInfo &, bool)
void setBackgroundColor()
std::vector< int > rowToIndex()
virtual void setPath(int, std::string &)
virtual void refreshTable3D()
void switchBit(UChar_t f)
int getFirstSelectedTableIndex()
void UnHighlighted() override
const std::string & name() const
BackgroundColorIndex backgroundColorIndex() const
int m_tableRowIndexForColorPopup
FWGeoTopNodeGLScene * m_scene
void getNodePath(int, std::string &) const
void setLevelOffset(int x)
void UnSelected() override
FWGeometryTableViewBase(TEveWindowSlot *, FWViewType::EType, FWColorManager *)
FWColorPopup * m_colorPopup
FWLongParameter m_topNodeIdx
void setBackgroundToWhite(bool)
void transparencyChanged()
void applyTransparencyFromEditor()
virtual void popupMenu(int x, int y, TGLViewer *)
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
void setDaughtersSelfVisibility(bool)
TGCompositeFrame * m_frame
virtual void setVisibility(NodeInfo &, bool)
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
void populateController(ViewerParameterGUI &) const override
FWColorManager * m_colorManager
int getTopNodeIdx() const
FWLongParameter m_minLeafTransparency
bool selectPhysicalFromTable(int)
static TGLViewer * s_pickedViewer
NodeInfo & refEntry(int i)
void setCellValueEditor(TGTextEntry *editor)
ViewerParameterGUI & addParam(const FWParameterBase *)
KeyValues::const_iterator KeyValuesIt
TGCompositeFrame * getTabContainer()
const FWConfiguration * valueForKey(const std::string &iKey) const
TEveWindowFrame * m_eveWindow
sigc::signal< void(T)> changed_
Entries_v::iterator Entries_i
void fillLimitedColors(std::vector< Color_t > &cv) const
void redrawTable(bool setExpand=false)
const KeyValues * keyValues() const
void addTo(FWConfiguration &) const override
virtual void chosenItem(int)
~FWGeometryTableViewBase() override
static TGLVector3 s_pickedCamera3DCenter
void setColumnSelected(int idx)
FWBoolParameter m_enableHighlight
virtual FWGeometryTableManagerBase * getTableManager()