3 #include <boost/bind.hpp> 4 #include <boost/regex.hpp> 21 #include "TGFileDialog.h" 23 #include "TGeoMatrix.h" 24 #include "TGStatusBar.h" 27 #include "TGLPhysicalShape.h" 29 #include "TGComboBox.h" 31 #include "TGeoShape.h" 33 #include "TEveManager.h" 34 #include "TEveGeoNode.h" 35 #include "TEveScene.h" 36 #include "TEveSceneInfo.h" 37 #include "TEveViewer.h" 38 #include "TGLViewer.h" 39 #include "TGLCamera.h" 40 #include "TEveSelection.h" 41 #ifdef PERFTOOL_BROWSER 42 #include <google/profiler.h> 53 if (event->fType == kButtonPress)
59 TEveElementList* views = gEve->GetViewers();
62 for (TEveElement::List_i it = views->BeginChildren(); it != views->EndChildren(); ++it)
64 TEveViewer*
v = ((TEveViewer*)(*it));
65 if (strstr( v->GetElementName(),
"3D") )
68 m_viewPopup->AddEntry(v->GetElementName(),
idx);
70 for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit )
72 TEveScene*
s = ((TEveSceneInfo*)*eit)->GetScene();
73 if (
m_el && s->HasChildren() && s->FirstChild() ==
m_el) {
80 m_viewPopup->CheckEntry(idx);
89 gVirtualX->TranslateCoordinates(GetId(),
90 gClient->GetDefaultRoot()->GetId(),
96 m_viewPopup->PlaceMenu(ax, ay,
true,
true);
97 m_viewPopup->Connect(
"Activated(Int_t)",
98 "FWGeometryTableViewBase",
100 "selectView(Int_t)");
115 class FWGeometryVF :
public TGVerticalFrame
121 gVirtualX->SelectInput(GetId(), kKeyPressMask | kKeyReleaseMask | kExposureMask |
122 kPointerMotionMask | kStructureNotifyMask | kFocusChangeMask |
123 kEnterWindowMask | kLeaveWindowMask);
126 virtual ~FWGeometryVF() {};
128 virtual Bool_t HandleKey(Event_t *
event)
override 130 if (event->fCode == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape)) {
133 return TGCompositeFrame::HandleKey(event);
139 class FWTranspEntry :
public TGTextEntry
143 virtual ~FWTranspEntry() {}
145 virtual Bool_t HandleKey(Event_t *
event)
override 147 if (event->fCode == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape)) {
148 m_tv->getTableManager()->cancelEditor(
true);
150 return TGTextEntry::HandleKey(event);
182 TGCompositeFrame* xf =
m_eveWindow->GetGUICompositeFrame();
184 m_frame =
new FWGeometryVF(xf,
this);
186 xf->AddFrame(
m_frame,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
202 m_tableWidget->Connect(
"cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
203 "FWGeometryTableViewBase",
this,
204 "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
210 editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow-7));
211 editor->SetFrameDrawn(
false);
212 editor->Connect(
"ReturnPressed()",
"FWGeometryTableViewBase",
this,
"transparencyChanged()");
216 editor->UnmapWindow();
226 TGCompositeFrame *frame =
m_eveWindow->GetGUICompositeFrame();
238 TEveScene* getMarkerScene(TEveViewer*
v)
240 TEveElement* si = v->FindChild(Form(
"SI - EventScene %s", v->GetElementName()));
242 return ((TEveSceneInfo*)(si))->GetScene();
314 TEveElementList* viewers = gEve->GetViewers();
321 TString
sname = it->first;
322 TEveViewer*
v =
dynamic_cast<TEveViewer*
>(viewers->FindChild(sname.Data()));
325 fwLog(
fwlog::kError) <<
"FWGeometryTableViewBase::populate3DViewsFromConfig no viewer found " << it->first << std::endl;
332 gEve->FullRedraw3D(
false,
true);
347 TEveElement::List_i it = gEve->GetViewers()->BeginChildren();
348 std::advance(it, idx);
349 TEveViewer*
v = (TEveViewer*)(*it);
351 for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit )
353 if ((((TEveSceneInfo*)(*eit))->GetScene()) ==
m_eveScene)
355 v->RemoveElement(*eit);
401 bool elementChanged =
false;
402 if (iButton == kButton1)
408 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
m_tableWidget->GetId(),
x,
y, xLoc, yLoc, wdummy);
413 else if (iColumn == 1)
415 std::vector<Color_t>
colors;
421 m_colorPopup->Connect(
"ColorSelected(Color_t)",
"FWGeometryTableViewBase", const_cast<FWGeometryTableViewBase*>(
this),
"nodeColorChangeRequested(Color_t");
429 else if (iColumn == 2)
434 else if (iColumn == 3)
438 elementChanged =
true;
440 else if (iColumn == 4)
444 elementChanged =
true;
446 else if (iColumn == 6)
450 elementChanged =
true;
457 if (elementChanged) {
462 else if (iColumn == 0)
473 if(backgroundIsWhite) {
494 ni.
m_node->GetVolume()->SetLineColor(col);
508 TGeoVolume *gv = ni.
m_node->GetVolume();
509 bool resetHome =
false;
540 gv->InspectMaterial();
566 v->CurrentCamera().SetExternalCenter(
true);
568 v->SetDrawCameraCenter(
true);
577 if (resetHome) gEve->FullRedraw3D(
true,
true);
615 for(TEveElement::List_i
k = gEve->GetViewers()->BeginChildren();
k!= gEve->GetViewers()->EndChildren(); ++
k)
617 for (TEveElement::List_i eit = (*k)->BeginChildren(); eit != (*k)->EndChildren(); ++eit )
619 TEveScene*
s = ((TEveSceneInfo*)*eit)->GetScene();
622 viewers.
addKeyValue( (*k)->GetElementName(), tempArea);
639 std::istringstream
s(value->
value());
657 i->m_color =
i->m_node->GetVolume()->GetLineColor();
675 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)
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
bool firstColumnClicked(int row, int xPos)
FWTableWidget * m_tableWidget
FWGeoTopNode * m_eveTopNode
const KeyValues * keyValues() const
FWGeometryTableViewBase * m_tableView
virtual void addTo(FWConfiguration &) const
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
void fillLimitedColors(std::vector< Color_t > &cv) const
FWLongParameter m_autoExpand
void populate3DViewsFromConfig()
FWLongParameter m_leafTransparencyFactor
void getNodePath(int, std::string &) const
FWLongParameter m_minParentTransparency
void nodeColorChangeRequested(Color_t)
virtual void applyColorTranspToDaughters(int selectedIdx, bool recurse)
virtual void setVisibilityChld(NodeInfo &, bool)
sigc::signal< void, T > changed_
void setBackgroundColor()
std::vector< int > rowToIndex()
virtual void setPath(int, std::string &)
virtual void refreshTable3D()
void switchBit(UChar_t f)
int getFirstSelectedTableIndex()
int m_tableRowIndexForColorPopup
FWGeoTopNodeGLScene * m_scene
void setLevelOffset(int x)
FWGeometryTableViewBase(TEveWindowSlot *, FWViewType::EType, FWColorManager *)
FWColorPopup * m_colorPopup
BackgroundColorIndex backgroundColorIndex() const
virtual ~FWGeometryTableViewBase()
FWLongParameter m_topNodeIdx
void setBackgroundToWhite(bool)
void transparencyChanged()
void applyTransparencyFromEditor()
virtual void popupMenu(int x, int y, TGLViewer *)
void setDaughtersSelfVisibility(bool)
TGCompositeFrame * m_frame
virtual void setVisibility(NodeInfo &, bool)
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
FWColorManager * m_colorManager
const std::string & value(unsigned int iIndex=0) const
FWLongParameter m_minLeafTransparency
bool selectPhysicalFromTable(int)
static TGLViewer * s_pickedViewer
NodeInfo & refEntry(int i)
void setCellValueEditor(TGTextEntry *editor)
KeyValues::const_iterator KeyValuesIt
TGCompositeFrame * getTabContainer()
int getTopNodeIdx() const
virtual void UnHighlighted()
virtual Bool_t HandleButton(Event_t *event)
TEveWindowFrame * m_eveWindow
const FWConfiguration * valueForKey(const std::string &iKey) const
Entries_v::iterator Entries_i
void redrawTable(bool setExpand=false)
virtual void UnSelected()
virtual void chosenItem(int)
virtual void populateController(ViewerParameterGUI &) const
const std::string & name() const
static TGLVector3 s_pickedCamera3DCenter
void setColumnSelected(int idx)
FWBoolParameter m_enableHighlight
virtual void addTo(FWConfiguration &) const
virtual FWGeometryTableManagerBase * getTableManager()