Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:13

0001 #include <iostream>
0002 
0003 #include <functional>
0004 #include <boost/regex.hpp>
0005 
0006 #include "Fireworks/Core/interface/FWGeometryTableViewBase.h"
0007 #include "Fireworks/Core/interface/FWGeoTopNode.h"
0008 #include "Fireworks/Core/interface/fwLog.h"
0009 #include "Fireworks/Core/interface/FWGeometryTableManagerBase.h"
0010 #include "Fireworks/TableWidget/interface/FWTableWidget.h"
0011 #include "Fireworks/Core/interface/FWGUIManager.h"
0012 #include "Fireworks/Core/interface/FWColorManager.h"
0013 #include "Fireworks/Core/interface/FWParameterSetterBase.h"
0014 #include "Fireworks/Core/src/FWColorSelect.h"
0015 #include "Fireworks/Core/src/FWPopupMenu.cc"
0016 #include "Fireworks/Core/src/FWGeoTopNodeScene.h"
0017 #include "Fireworks/Core/src/FWEveDigitSetScalableMarker.h"
0018 #include "Fireworks/Core/interface/CmsShowViewPopup.h"
0019 
0020 #include "TGFileDialog.h"
0021 #include "TGeoNode.h"
0022 #include "TGeoMatrix.h"
0023 #include "TGStatusBar.h"
0024 #include "TGButton.h"
0025 #include "TGLabel.h"
0026 #include "TGLPhysicalShape.h"
0027 #include "TGMenu.h"
0028 #include "TGComboBox.h"
0029 // #define PERFTOOL_BROWSER
0030 #include "TGeoShape.h"
0031 #include "TGeoBBox.h"
0032 #include "TEveManager.h"
0033 #include "TEveGeoNode.h"
0034 #include "TEveScene.h"
0035 #include "TEveSceneInfo.h"
0036 #include "TEveViewer.h"
0037 #include "TGLViewer.h"
0038 #include "TGLCamera.h"
0039 #include "TEveSelection.h"
0040 #include "TVirtualX.h"
0041 #ifdef PERFTOOL_BROWSER
0042 #include <google/profiler.h>
0043 #endif
0044 
0045 //______________________________________________________________________________
0046 //==============================================================================
0047 //==============================================================================
0048 //==============================================================================
0049 //==============================================================================
0050 
0051 Bool_t FWGeometryTableViewBase::FWViewCombo::HandleButton(Event_t* event) {
0052   if (event->fType == kButtonPress) {
0053     bool map = false;
0054 
0055     FWPopupMenu* m_viewPopup = new FWPopupMenu(nullptr);
0056 
0057     TEveElementList* views = gEve->GetViewers();
0058     int idx = 0;
0059 
0060     for (TEveElement::List_i it = views->BeginChildren(); it != views->EndChildren(); ++it) {
0061       TEveViewer* v = ((TEveViewer*)(*it));
0062       if (strstr(v->GetElementName(), "3D")) {
0063         bool added = false;
0064         m_viewPopup->AddEntry(v->GetElementName(), idx);
0065 
0066         for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit) {
0067           TEveScene* s = ((TEveSceneInfo*)*eit)->GetScene();
0068           if (m_el && s->HasChildren() && s->FirstChild() == m_el) {
0069             added = true;
0070             break;
0071           }
0072         }
0073         map = true;
0074         if (added)
0075           m_viewPopup->CheckEntry(idx);
0076       }
0077       ++idx;
0078     }
0079 
0080     if (map) {
0081       Window_t wdummy;
0082       Int_t ax, ay;
0083       gVirtualX->TranslateCoordinates(GetId(),
0084                                       gClient->GetDefaultRoot()->GetId(),
0085                                       event->fX,
0086                                       event->fY,  //0,0 in local coordinates
0087                                       ax,
0088                                       ay,  //coordinates of screen
0089                                       wdummy);
0090 
0091       m_viewPopup->PlaceMenu(ax, ay, true, true);
0092       m_viewPopup->Connect("Activated(Int_t)",
0093                            "FWGeometryTableViewBase",
0094                            const_cast<FWGeometryTableViewBase*>(m_tableView),
0095                            "selectView(Int_t)");
0096     } else {
0097       fwLog(fwlog::kInfo) << "No 3D View added. \n";
0098     }
0099   }
0100   return true;
0101 }
0102 
0103 //==============================================================================
0104 //==============================================================================
0105 // workaround to get ESC key event
0106 
0107 namespace {
0108   class FWGeometryVF : public TGVerticalFrame {
0109   public:
0110     FWGeometryVF(const TGWindow* p, FWGeometryTableViewBase* tv) : TGVerticalFrame(p), m_tv(tv) {
0111       m_tv = tv;
0112       gVirtualX->SelectInput(GetId(),
0113                              kKeyPressMask | kKeyReleaseMask | kExposureMask | kPointerMotionMask |
0114                                  kStructureNotifyMask | kFocusChangeMask | kEnterWindowMask | kLeaveWindowMask);
0115     }
0116 
0117     ~FWGeometryVF() override{};
0118 
0119     Bool_t HandleKey(Event_t* event) override {
0120       if (event->fCode == (UInt_t)gVirtualX->KeysymToKeycode(kKey_Escape)) {
0121         m_tv->getTableManager()->cancelEditor(true);
0122       }
0123       return TGCompositeFrame::HandleKey(event);
0124     }
0125 
0126     FWGeometryTableViewBase* m_tv;
0127   };
0128 
0129   class FWTranspEntry : public TGTextEntry {
0130   public:
0131     FWTranspEntry(const TGWindow* p, FWGeometryTableViewBase* tv) : TGTextEntry(p), m_tv(tv) {}
0132     ~FWTranspEntry() override {}
0133 
0134     Bool_t HandleKey(Event_t* event) override {
0135       if (event->fCode == (UInt_t)gVirtualX->KeysymToKeycode(kKey_Escape)) {
0136         m_tv->getTableManager()->cancelEditor(true);
0137       }
0138       return TGTextEntry::HandleKey(event);
0139     }
0140     FWGeometryTableViewBase* m_tv;
0141   };
0142 }  // namespace
0143 //==============================================================================
0144 //==============================================================================
0145 //==============================================================================
0146 //==============================================================================
0147 //==============================================================================
0148 FWGeometryTableViewBase::FWGeometryTableViewBase(TEveWindowSlot* iParent,
0149                                                  FWViewType::EType type,
0150                                                  FWColorManager* colMng)
0151     : FWViewBase(type),
0152       m_topNodeIdx(this, "TopNodeIndex", -1l, 0, 1e7),
0153       m_autoExpand(this, "ExpandList:", 1l, 0l, 100l),
0154       m_enableHighlight(this, "EnableHighlight", true),
0155       m_parentTransparencyFactor(this, "ParentTransparencyFactor", 1l, 0l, 100l),
0156       m_leafTransparencyFactor(this, "LeafTransparencyFactor", 1l, 0l, 100l),
0157       m_minParentTransparency(this, "MinParentTransparency", type == FWViewType::kOverlapTable ? 0l : 90l, 0l, 100l),
0158       m_minLeafTransparency(this, "MinLeafTransparency", 0l, 0l, 100l),
0159       m_colorManager(colMng),
0160       m_colorPopup(nullptr),
0161       m_eveWindow(nullptr),
0162       m_frame(nullptr),
0163       m_viewBox(nullptr),
0164       m_viewersConfig(nullptr),
0165       m_enableRedraw(true),
0166       m_marker(nullptr),
0167       m_eveTopNode(nullptr),
0168       m_eveScene(nullptr),
0169       m_tableRowIndexForColorPopup(-1) {
0170   m_eveWindow = iParent->MakeFrame(nullptr);
0171   TGCompositeFrame* xf = m_eveWindow->GetGUICompositeFrame();
0172 
0173   m_frame = new FWGeometryVF(xf, this);
0174 
0175   xf->AddFrame(m_frame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
0176 
0177   m_parentTransparencyFactor.changed_.connect(std::bind(&FWGeometryTableViewBase::refreshTable3D, this));
0178   m_leafTransparencyFactor.changed_.connect(std::bind(&FWGeometryTableViewBase::refreshTable3D, this));
0179   m_minParentTransparency.changed_.connect(std::bind(&FWGeometryTableViewBase::refreshTable3D, this));
0180   m_minLeafTransparency.changed_.connect(std::bind(&FWGeometryTableViewBase::refreshTable3D, this));
0181 }
0182 
0183 void FWGeometryTableViewBase::postConst() {
0184   m_tableWidget = new FWTableWidget(getTableManager(), m_frame);
0185   m_frame->AddFrame(m_tableWidget, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 0, 0));
0186   m_tableWidget->SetBackgroundColor(0xffffff);
0187   m_tableWidget->SetLineSeparatorColor(0x000000);
0188   m_tableWidget->SetHeaderBackgroundColor(0xececec);
0189   m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
0190                          "FWGeometryTableViewBase",
0191                          this,
0192                          "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
0193   m_tableWidget->disableGrowInWidth();
0194   //   resetSetters();
0195 
0196   FWTranspEntry* editor = new FWTranspEntry(m_tableWidget->body(), this);
0197   editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow - 7));
0198   editor->SetFrameDrawn(false);
0199   editor->Connect("ReturnPressed()", "FWGeometryTableViewBase", this, "transparencyChanged()");
0200   getTableManager()->setCellValueEditor(editor);
0201 
0202   m_frame->MapSubwindows();
0203   editor->UnmapWindow();
0204   m_frame->Layout();
0205   m_eveWindow->GetGUICompositeFrame()->Layout();
0206   m_frame->MapWindow();
0207 }
0208 //______________________________________________________________________________
0209 
0210 FWGeometryTableViewBase::~FWGeometryTableViewBase() {
0211   // take out composite frame and delete it directly (zwithout the timeout)
0212   TGCompositeFrame* frame = m_eveWindow->GetGUICompositeFrame();
0213   frame->RemoveFrame(m_frame);
0214   delete m_frame;
0215 
0216   m_eveWindow->DestroyWindowAndSlot();
0217   delete getTableManager();
0218 }
0219 
0220 namespace {
0221   TEveScene* getMarkerScene(TEveViewer* v) {
0222     TEveElement* si = v->FindChild(Form("SI - EventScene %s", v->GetElementName()));
0223     if (si)
0224       return ((TEveSceneInfo*)(si))->GetScene();
0225     else
0226       return nullptr;
0227   }
0228 }  // namespace
0229 //==============================================================================
0230 
0231 void FWGeometryTableViewBase::cdNode(int idx) {
0232   std::string p;
0233   getTableManager()->getNodePath(idx, p);
0234   setPath(idx, p);
0235 }
0236 
0237 void FWGeometryTableViewBase::cdTop() {
0238   std::string path = "/";
0239   path += getTableManager()->refEntries().at(0).name();
0240   setPath(-1, path);
0241 }
0242 
0243 void FWGeometryTableViewBase::cdUp() {
0244   if (getTopNodeIdx() != -1) {
0245     int pIdx = getTableManager()->refEntries()[getTopNodeIdx()].m_parent;
0246     std::string p;
0247     getTableManager()->getNodePath(pIdx, p);
0248     setPath(pIdx, p);
0249   }
0250 }
0251 
0252 void FWGeometryTableViewBase::setPath(int parentIdx, std::string&) {
0253   m_eveTopNode->clearSelection();
0254 
0255   // printf("set path %d \n", parentIdx);
0256   m_topNodeIdx.set(parentIdx);
0257   // getTableManager()->refEntries().at(getTopNodeIdx()).setBitVal(FWGeometryTableManagerBase::kVisNodeSelf,!m_disableTopNode.value() );
0258   getTableManager()->setLevelOffset(getTableManager()->refEntries().at(getTopNodeIdx()).m_level);
0259 
0260   checkExpandLevel();
0261   refreshTable3D();
0262 }
0263 
0264 //------------------------------------------------------------------------------
0265 
0266 void FWGeometryTableViewBase::checkExpandLevel() {
0267   // check expand state
0268   int ae = m_autoExpand.value();
0269   if (m_topNodeIdx.value() > 0)
0270     ae += getTableManager()->refEntries().at(m_topNodeIdx.value()).m_level;
0271 
0272   for (FWGeometryTableManagerBase::Entries_i i = getTableManager()->refEntries().begin();
0273        i != getTableManager()->refEntries().end();
0274        ++i) {
0275     if (i->m_level < ae)
0276       i->setBit(FWGeometryTableManagerBase::kExpanded);
0277     else
0278       i->resetBit(FWGeometryTableManagerBase::kExpanded);
0279   }
0280 }
0281 
0282 //==============================================================================
0283 
0284 void FWGeometryTableViewBase::populate3DViewsFromConfig() {
0285   // post-config
0286   if (m_viewersConfig) {
0287     TEveElementList* viewers = gEve->GetViewers();
0288     const FWConfiguration::KeyValues* keyVals = m_viewersConfig->keyValues();
0289 
0290     if (nullptr != keyVals) {
0291       for (FWConfiguration::KeyValuesIt it = keyVals->begin(); it != keyVals->end(); ++it) {
0292         TString sname = it->first;
0293         TEveViewer* v = dynamic_cast<TEveViewer*>(viewers->FindChild(sname.Data()));
0294         if (!v) {
0295           fwLog(fwlog::kError) << "FWGeometryTableViewBase::populate3DViewsFromConfig no viewer found " << it->first
0296                                << std::endl;
0297           return;
0298         }
0299         v->AddScene(m_eveScene);
0300         m_viewBox->setElement(m_eveTopNode);
0301         if (m_marker)
0302           getMarkerScene(v)->AddElement(m_marker);
0303 
0304         gEve->FullRedraw3D(false, true);
0305       }
0306     }
0307   }
0308 }
0309 
0310 //==============================================================================
0311 
0312 void FWGeometryTableViewBase::selectView(int idx) {
0313   // callback from sleclect view popup menu
0314 
0315   m_viewBox->setElement(m_eveTopNode);
0316 
0317   TEveElement::List_i it = gEve->GetViewers()->BeginChildren();
0318   std::advance(it, idx);
0319   TEveViewer* v = (TEveViewer*)(*it);
0320 
0321   for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit) {
0322     if ((((TEveSceneInfo*)(*eit))->GetScene()) == m_eveScene) {
0323       v->RemoveElement(*eit);
0324       if (m_marker)
0325         getMarkerScene(v)->RemoveElement(m_marker);
0326       gEve->Redraw3D();
0327       return;
0328     }
0329   }
0330 
0331   if (m_marker)
0332     getMarkerScene(v)->AddElement(m_marker);
0333   v->AddScene(m_eveScene);
0334   gEve->Redraw3D();
0335 }
0336 
0337 //==============================================================================
0338 
0339 void FWGeometryTableViewBase::setColumnSelected(int idx) {
0340   // printf("cell clicled top node %p\n", (void*)m_eveTopNode);
0341   if (gEve->GetSelection()->HasChild(m_eveTopNode))
0342     gEve->GetSelection()->RemoveElement(m_eveTopNode);
0343 
0344   if (gEve->GetHighlight()->HasChild(m_eveTopNode))
0345     gEve->GetHighlight()->RemoveElement(m_eveTopNode);
0346 
0347   // reset bits and sets for old selected table entry
0348   m_eveTopNode->UnSelected();
0349   m_eveTopNode->UnHighlighted();
0350 
0351   if (m_eveTopNode->selectPhysicalFromTable(idx))
0352     gEve->GetSelection()->AddElement(m_eveTopNode);
0353 
0354   getTableManager()->refEntry(idx).setBit(FWGeometryTableManagerBase::kSelected);
0355   getTableManager()->redrawTable();
0356   gEve->Redraw3D();
0357 }
0358 //______________________________________________________________________________
0359 
0360 void FWGeometryTableViewBase::cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t x, Int_t y) {
0361   int idx = getTableManager()->rowToIndex()[iRow];
0362   FWGeometryTableManagerBase::NodeInfo& ni = getTableManager()->refEntries()[idx];
0363 
0364   if (iColumn != 2)
0365     getTableManager()->cancelEditor(false);
0366 
0367   bool elementChanged = false;
0368   if (iButton == kButton1) {
0369     if (iColumn == 0) {
0370       Window_t wdummy;
0371       Int_t xLoc, yLoc;
0372       gVirtualX->TranslateCoordinates(
0373           gClient->GetDefaultRoot()->GetId(), m_tableWidget->GetId(), x, y, xLoc, yLoc, wdummy);
0374 
0375       if (getTableManager()->firstColumnClicked(iRow, xLoc))
0376         setColumnSelected(idx);
0377     } else if (iColumn == 1) {
0378       std::vector<Color_t> colors;
0379       m_colorManager->fillLimitedColors(colors);
0380 
0381       if (!m_colorPopup) {
0382         m_colorPopup = new FWColorPopup(gClient->GetDefaultRoot(), colors.front());
0383         m_colorPopup->InitContent("", colors);
0384         m_colorPopup->Connect("ColorSelected(Color_t)",
0385                               "FWGeometryTableViewBase",
0386                               const_cast<FWGeometryTableViewBase*>(this),
0387                               "nodeColorChangeRequested(Color_t");
0388       }
0389       m_tableRowIndexForColorPopup = idx;
0390       m_colorPopup->SetName("Selected");
0391       m_colorPopup->ResetColors(colors, m_colorManager->backgroundColorIndex() == FWColorManager::kBlackIndex);
0392       m_colorPopup->PlacePopup(x, y, m_colorPopup->GetDefaultWidth(), m_colorPopup->GetDefaultHeight());
0393       return;
0394     } else if (iColumn == 2) {
0395       // transparency edit
0396       getTableManager()->showEditor(idx);
0397     } else if (iColumn == 3) {
0398       // vis self
0399       getTableManager()->setVisibility(ni, !getTableManager()->getVisibility(ni));
0400       elementChanged = true;
0401     } else if (iColumn == 4) {
0402       // vis children
0403       getTableManager()->setVisibilityChld(ni, !getTableManager()->getVisibilityChld(ni));
0404       elementChanged = true;
0405     } else if (iColumn == 6) {
0406       // used in overlaps for RnrMarker column
0407       ni.switchBit(BIT(5));
0408       elementChanged = true;
0409     } else {
0410       setColumnSelected(idx);
0411     }
0412 
0413     if (elementChanged) {
0414       refreshTable3D();
0415       // getTableManager()->dataChanged();
0416     }
0417   } else if (iColumn == 0) {
0418     setColumnSelected(idx);
0419     m_eveTopNode->popupMenu(x, y, nullptr);
0420   }
0421 }
0422 
0423 void FWGeometryTableViewBase::setBackgroundColor() {
0424   bool backgroundIsWhite = m_colorManager->backgroundColorIndex() == FWColorManager::kWhiteIndex;
0425   if (backgroundIsWhite) {
0426     m_tableWidget->SetBackgroundColor(0xffffff);
0427     m_tableWidget->SetLineSeparatorColor(0x000000);
0428   } else {
0429     m_tableWidget->SetBackgroundColor(0x000000);
0430     m_tableWidget->SetLineSeparatorColor(0xffffff);
0431   }
0432   getTableManager()->setBackgroundToWhite(backgroundIsWhite);
0433   gClient->NeedRedraw(m_tableWidget);
0434 }
0435 
0436 //______________________________________________________________________________
0437 
0438 void FWGeometryTableViewBase::nodeColorChangeRequested(Color_t col) {
0439   // AMT: need to add virtual   FWGeometryTableView::nodeColorChangeRequested() for volume mode
0440 
0441   //   printf("color change %d \n", m_tableRowIndexForColorPopup);
0442   if (m_tableRowIndexForColorPopup >= 0) {
0443     FWGeometryTableManagerBase::NodeInfo& ni = getTableManager()->refEntries()[m_tableRowIndexForColorPopup];
0444     ni.m_color = col;
0445     ni.m_node->GetVolume()->SetLineColor(col);
0446     refreshTable3D();
0447     m_tableRowIndexForColorPopup = -1;
0448   }
0449 }
0450 
0451 //______________________________________________________________________________
0452 void FWGeometryTableViewBase::chosenItem(int menuIdx) {
0453   int selectedIdx = m_eveTopNode->getFirstSelectedTableIndex();
0454   FWGeometryTableManagerBase::NodeInfo& ni = getTableManager()->refEntry(selectedIdx);
0455   // printf("chosen item %s %d\n", ni.name(), menuIdx);
0456 
0457   TGeoVolume* gv = ni.m_node->GetVolume();
0458   bool resetHome = false;
0459   if (gv) {
0460     switch (menuIdx) {
0461       case FWGeoTopNode::kVisSelfOff:
0462         getTableManager()->setVisibility(ni, false);
0463         refreshTable3D();
0464         break;
0465 
0466       case FWGeoTopNode::kVisChldOff:
0467         getTableManager()->setDaughtersSelfVisibility(selectedIdx, false);
0468         refreshTable3D();
0469         break;
0470 
0471       case FWGeoTopNode::kVisChldOn:
0472         getTableManager()->setDaughtersSelfVisibility(selectedIdx, true);
0473         refreshTable3D();
0474         break;
0475 
0476       case FWGeoTopNode::kApplyChldCol:
0477         getTableManager()->applyColorTranspToDaughters(selectedIdx, false);
0478         refreshTable3D();
0479         break;
0480 
0481       case FWGeoTopNode::kApplyChldColRec:
0482         getTableManager()->applyColorTranspToDaughters(selectedIdx, true);
0483         refreshTable3D();
0484         break;
0485 
0486       case FWGeoTopNode::kPrintMaterial:
0487         gv->InspectMaterial();
0488         break;
0489 
0490       case FWGeoTopNode::kPrintShape:
0491         gv->InspectShape();
0492         break;
0493 
0494       case FWGeoTopNode::kPrintPath: {
0495         std::string ps;
0496         getTableManager()->getNodePath(selectedIdx, ps);
0497         std::cout << ps << std::endl;
0498         break;
0499       }
0500       case FWGeoTopNode::kSetTopNode:
0501         cdNode(selectedIdx);
0502         break;
0503 
0504       case FWGeoTopNode::kSetTopNodeCam:
0505         cdNode(selectedIdx);
0506         resetHome = true;
0507         break;
0508 
0509       case FWGeoTopNode::kCamera: {
0510         TGLViewer* v = FWGeoTopNode::s_pickedViewer;
0511         v->CurrentCamera().SetExternalCenter(true);
0512         v->CurrentCamera().SetCenterVec(FWGeoTopNode::s_pickedCamera3DCenter.X(),
0513                                         FWGeoTopNode::s_pickedCamera3DCenter.Y(),
0514                                         FWGeoTopNode::s_pickedCamera3DCenter.Z());
0515         v->SetDrawCameraCenter(true);
0516         // resetHome = true;
0517         break;
0518       }
0519       default:
0520         return;
0521     }
0522   }
0523 
0524   if (resetHome)
0525     gEve->FullRedraw3D(true, true);
0526 }
0527 //______________________________________________________________________________
0528 void FWGeometryTableViewBase::transparencyChanged() {
0529   getTableManager()->applyTransparencyFromEditor();
0530   refreshTable3D();
0531 }
0532 
0533 //______________________________________________________________________________
0534 
0535 void FWGeometryTableViewBase::refreshTable3D() {
0536   if (m_enableRedraw) {
0537     if (gEve->GetSelection()->HasChild(m_eveTopNode))
0538       gEve->GetSelection()->RemoveElement(m_eveTopNode);
0539 
0540     if (gEve->GetHighlight()->HasChild(m_eveTopNode))
0541       gEve->GetHighlight()->RemoveElement(m_eveTopNode);
0542 
0543     m_eveTopNode->m_scene->PadPaint(m_eveTopNode->m_scene->GetPad());
0544     gEve->Redraw3D();
0545 
0546     getTableManager()->redrawTable();
0547   }
0548 }
0549 
0550 //______________________________________________________________________________
0551 
0552 void FWGeometryTableViewBase::addTo(FWConfiguration& iTo) const {
0553   FWConfigurableParameterizable::addTo(iTo);
0554 
0555   FWConfiguration viewers(1);
0556   FWConfiguration tempArea;
0557 
0558   for (TEveElement::List_i k = gEve->GetViewers()->BeginChildren(); k != gEve->GetViewers()->EndChildren(); ++k) {
0559     for (TEveElement::List_i eit = (*k)->BeginChildren(); eit != (*k)->EndChildren(); ++eit) {
0560       TEveScene* s = ((TEveSceneInfo*)*eit)->GetScene();
0561       if (s->GetGLScene() == m_eveTopNode->m_scene) {
0562         viewers.addKeyValue((*k)->GetElementName(), tempArea);
0563         break;
0564       }
0565     }
0566   }
0567 
0568   iTo.addKeyValue("Viewers", viewers, true);
0569 }
0570 
0571 //______________________________________________________________________________
0572 
0573 void FWGeometryTableViewBase::setTopNodePathFromConfig(const FWConfiguration& iFrom) {
0574   int tn;
0575   const FWConfiguration* value = iFrom.valueForKey(m_topNodeIdx.name());
0576   if (!value)
0577     return;
0578 
0579   std::istringstream s(value->value());
0580   s >> tn;
0581   int lastIdx = getTableManager()->refEntries().size() - 1;
0582   if (tn >= lastIdx) {
0583     fwLog(fwlog::kWarning) << Form(
0584         "Ignoring node path from confugration file -- %s value larger than number of nodes \n",
0585         m_topNodeIdx.name().c_str());
0586     return;
0587   }
0588   //   std::cerr << "set top node " << ;
0589   m_topNodeIdx.set(tn);
0590 }
0591 
0592 //______________________________________________________________________________
0593 
0594 void FWGeometryTableViewBase::reloadColors() {
0595   // printf("relaodColors \n");
0596   for (FWGeometryTableManagerBase::Entries_i i = getTableManager()->refEntries().begin();
0597        i != getTableManager()->refEntries().end();
0598        ++i) {
0599     i->m_color = i->m_node->GetVolume()->GetLineColor();
0600   }
0601 
0602   refreshTable3D();
0603 }
0604 
0605 //______________________________________________________________________________
0606 
0607 void FWGeometryTableViewBase::populateController(ViewerParameterGUI& gui) const {
0608   gui.requestTab("Style")
0609       .separator()
0610       .
0611       //addParam(&m_parentTransparencyFactor).
0612       // addParam(&m_leafTransparencyFactor).
0613       addParam(&m_minParentTransparency)
0614       .addParam(&m_minLeafTransparency)
0615       .separator();
0616   TGTextButton* butt = new TGTextButton(gui.getTabContainer(), "ReloadColors");
0617   gui.getTabContainer()->AddFrame(butt);
0618   butt->Connect("Clicked()", "FWGeometryTableViewBase", (FWGeometryTableViewBase*)this, "reloadColors()");
0619 }