CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/Fireworks/Core/src/FWGeometryTableViewBase.cc

Go to the documentation of this file.
00001 #include <iostream>
00002 
00003 #include <boost/bind.hpp>
00004 #include <boost/regex.hpp>
00005 
00006 #include "Fireworks/Core/interface/FWGeometryTableViewBase.h"
00007 #include "Fireworks/Core/interface/FWGeoTopNode.h"
00008 #include "Fireworks/Core/interface/fwLog.h"
00009 #include "Fireworks/Core/interface/FWGeometryTableManagerBase.h"
00010 #include "Fireworks/TableWidget/interface/FWTableWidget.h"
00011 #include "Fireworks/Core/interface/FWGUIManager.h"
00012 #include "Fireworks/Core/interface/FWColorManager.h"
00013 #include "Fireworks/Core/interface/FWParameterSetterBase.h"
00014 #include "Fireworks/Core/src/FWColorSelect.h"
00015 #include "Fireworks/Core/src/FWPopupMenu.cc"
00016 #include "Fireworks/Core/src/FWGeoTopNodeScene.h"
00017 #include "Fireworks/Core/interface/CmsShowViewPopup.h"
00018 
00019 
00020 #include "TGFileDialog.h"
00021 #include "TGeoNode.h"
00022 #include "TGeoMatrix.h"
00023 #include "TGStatusBar.h"
00024 #include "TGButton.h"
00025 #include "TGLabel.h"
00026 #include "TGLPhysicalShape.h"
00027 #include "TGMenu.h"
00028 #include "TGComboBox.h"
00029 // #define PERFTOOL_BROWSER
00030 #include "TEvePointSet.h"
00031 #include "TGeoShape.h"
00032 #include "TGeoBBox.h"
00033 #include "TEveManager.h"
00034 #include "TEveGeoNode.h"
00035 #include "TEveScene.h"
00036 #include "TEveSceneInfo.h"
00037 #include "TEveViewer.h"
00038 #include "TGLViewer.h"
00039 #include "TGLCamera.h"
00040 #include "TEveSelection.h"
00041 #ifdef PERFTOOL_BROWSER 
00042 #include <google/profiler.h>
00043 #endif
00044 
00045 //______________________________________________________________________________
00046 //==============================================================================
00047 //==============================================================================
00048 //==============================================================================
00049 //==============================================================================
00050 
00051 Bool_t FWGeometryTableViewBase::FWViewCombo::HandleButton(Event_t* event) 
00052 {
00053    if (event->fType == kButtonPress)
00054    {
00055       bool map = false;
00056 
00057       FWPopupMenu* m_viewPopup = new FWPopupMenu(0);
00058 
00059       TEveElementList* views = gEve->GetViewers();
00060       int idx = 0;
00061 
00062       for (TEveElement::List_i it = views->BeginChildren(); it != views->EndChildren(); ++it)
00063       { 
00064          TEveViewer* v = ((TEveViewer*)(*it));
00065          if (strstr( v->GetElementName(), "3D") )
00066          {     
00067             bool added = false;          
00068             m_viewPopup->AddEntry(v->GetElementName(), idx);
00069 
00070             for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit )
00071             {
00072                TEveScene* s = ((TEveSceneInfo*)*eit)->GetScene();
00073                if (m_el && s->HasChildren() && s->FirstChild() == m_el) {
00074                   added = true;
00075                   break;
00076                }
00077             }
00078             map = true;
00079             if (added)
00080                m_viewPopup->CheckEntry(idx);
00081          }
00082          ++idx;
00083       }
00084 
00085       if (map) {
00086 
00087          Window_t wdummy;
00088          Int_t ax,ay;
00089          gVirtualX->TranslateCoordinates(GetId(),
00090                                          gClient->GetDefaultRoot()->GetId(),
00091                                          event->fX, event->fY, //0,0 in local coordinates
00092                                          ax,ay, //coordinates of screen
00093                                          wdummy);
00094 
00095 
00096          m_viewPopup->PlaceMenu(ax, ay, true,true);
00097          m_viewPopup->Connect("Activated(Int_t)",
00098                               "FWGeometryTableViewBase",
00099                               const_cast<FWGeometryTableViewBase*>(m_tableView),
00100                               "selectView(Int_t)");
00101       }
00102       else
00103       {
00104          fwLog(fwlog::kInfo) << "No 3D View added. \n";
00105       }
00106    }
00107    return true;
00108 }
00109 
00110 //==============================================================================
00111 //==============================================================================
00112 // workaround to get ESC key event 
00113 
00114 namespace {
00115    class FWGeometryVF : public TGVerticalFrame
00116    {
00117    public:
00118       FWGeometryVF(const TGWindow* p, FWGeometryTableViewBase* tv) :TGVerticalFrame(p), m_tv (tv)
00119       {
00120          m_tv = tv;
00121          gVirtualX->SelectInput(GetId(), kKeyPressMask | kKeyReleaseMask | kExposureMask |
00122                                 kPointerMotionMask | kStructureNotifyMask | kFocusChangeMask |
00123                                 kEnterWindowMask | kLeaveWindowMask);
00124       }
00125 
00126       virtual ~FWGeometryVF() {};
00127 
00128       virtual Bool_t HandleKey(Event_t *event)
00129       {
00130          if (event->fCode == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape)) {
00131             m_tv->getTableManager()->cancelEditor(true);
00132          }
00133          return TGCompositeFrame::HandleKey(event);
00134       }
00135 
00136       FWGeometryTableViewBase* m_tv;
00137    };
00138 
00139    class  FWTranspEntry : public TGTextEntry
00140    {
00141    public:
00142       FWTranspEntry(const TGWindow* p, FWGeometryTableViewBase* tv) :TGTextEntry(p), m_tv (tv){}
00143       virtual ~FWTranspEntry() {}
00144 
00145       virtual Bool_t HandleKey(Event_t *event)
00146       {
00147          if (event->fCode == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape)) {
00148             m_tv->getTableManager()->cancelEditor(true);
00149          }
00150          return TGTextEntry::HandleKey(event);
00151       }
00152       FWGeometryTableViewBase* m_tv;
00153    };
00154 }
00155 //==============================================================================
00156 //==============================================================================
00157 //==============================================================================
00158 //==============================================================================
00159 //==============================================================================
00160 FWGeometryTableViewBase::FWGeometryTableViewBase(TEveWindowSlot* iParent,FWViewType::EType type, FWColorManager* colMng )
00161    : FWViewBase(type),
00162      m_topNodeIdx(this, "TopNodeIndex", -1l, 0, 1e7),
00163      m_autoExpand(this,"ExpandList:", 1l, 0l, 100l),
00164      m_enableHighlight(this,"EnableHighlight", true),
00165      m_parentTransparencyFactor(this, "ParentTransparencyFactor", 1l, 0l, 100l),
00166      m_leafTransparencyFactor(this, "LeafTransparencyFactor", 1l, 0l, 100l),
00167      m_minParentTransparency(this, "MinParentTransparency", 90l, 0l, 100l),
00168      m_minLeafTransparency(this, "MinLeafTransparency", 0l, 0l, 100l),
00169      m_colorManager(colMng),
00170      m_colorPopup(0),
00171      m_eveWindow(0),
00172      m_frame(0),
00173      m_viewBox(0),
00174      m_viewersConfig(0),
00175      m_enableRedraw(true),
00176      m_marker(0),
00177      m_eveTopNode(0),
00178      m_eveScene(0),
00179      m_tableRowIndexForColorPopup(-1)
00180 {
00181    m_eveWindow = iParent->MakeFrame(0);
00182    TGCompositeFrame* xf = m_eveWindow->GetGUICompositeFrame();
00183 
00184    m_frame = new FWGeometryVF(xf, this);
00185 
00186    xf->AddFrame(m_frame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));  
00187    
00188    m_parentTransparencyFactor.changed_.connect(boost::bind(&FWGeometryTableViewBase::refreshTable3D,this));
00189    m_leafTransparencyFactor.changed_.connect(boost::bind(&FWGeometryTableViewBase::refreshTable3D,this));
00190    m_minParentTransparency.changed_.connect(boost::bind(&FWGeometryTableViewBase::refreshTable3D,this));
00191    m_minLeafTransparency.changed_.connect(boost::bind(&FWGeometryTableViewBase::refreshTable3D,this));
00192  
00193 }
00194 
00195 void FWGeometryTableViewBase::postConst()
00196 {
00197    m_tableWidget = new FWTableWidget(getTableManager(), m_frame); 
00198    m_frame->AddFrame(m_tableWidget,new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,2,2,0,0));
00199    m_tableWidget->SetBackgroundColor(0xffffff);
00200    m_tableWidget->SetLineSeparatorColor(0x000000);
00201    m_tableWidget->SetHeaderBackgroundColor(0xececec);
00202    m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
00203                           "FWGeometryTableViewBase",this,
00204                           "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
00205    m_tableWidget->disableGrowInWidth();
00206    //   resetSetters();
00207 
00208    
00209    FWTranspEntry *editor = new  FWTranspEntry(m_tableWidget->body(), this);
00210    editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow-7));
00211    editor->SetFrameDrawn(false);
00212    editor->Connect("ReturnPressed()",  "FWGeometryTableViewBase",this,"transparencyChanged()");
00213    getTableManager()->setCellValueEditor(editor);
00214 
00215    m_frame->MapSubwindows();
00216    editor->UnmapWindow();
00217    m_frame->Layout();
00218    m_eveWindow->GetGUICompositeFrame()->Layout();
00219    m_frame->MapWindow();
00220 }
00221 //______________________________________________________________________________
00222 
00223 FWGeometryTableViewBase::~FWGeometryTableViewBase()
00224 {
00225    // take out composite frame and delete it directly (zwithout the timeout)
00226    TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
00227    frame->RemoveFrame( m_frame );
00228    delete m_frame;
00229 
00230 
00231 
00232    m_eveWindow->DestroyWindowAndSlot();
00233    delete getTableManager();
00234 }
00235 
00236 
00237 namespace {
00238 TEveScene* getMarkerScene(TEveViewer* v)
00239 {
00240   TEveElement* si = v->FindChild(Form("SI - GeoScene %s", v->GetElementName()));
00241   if(si) 
00242     return ((TEveSceneInfo*)(si))->GetScene();
00243   else
00244     return 0;
00245 }
00246 }
00247 //==============================================================================
00248 
00249 
00250 void FWGeometryTableViewBase::cdNode(int idx)
00251 {
00252    std::string p;
00253    getTableManager()->getNodePath(idx, p);
00254    setPath(idx, p);
00255 }
00256 
00257 void FWGeometryTableViewBase::cdTop()
00258 {
00259    std::string path = "/" ;
00260    path += getTableManager()->refEntries().at(0).name();
00261    setPath(-1, path ); 
00262 }
00263 
00264 void FWGeometryTableViewBase::cdUp()
00265 {   
00266    if (getTopNodeIdx() != -1)
00267    {
00268       int pIdx = getTableManager()->refEntries()[getTopNodeIdx()].m_parent;
00269       std::string p;
00270       getTableManager()->getNodePath(pIdx, p);
00271       setPath(pIdx, p);
00272    }
00273 }
00274 
00275 void FWGeometryTableViewBase::setPath(int parentIdx, std::string&)
00276 {
00277    m_eveTopNode->clearSelection();
00278 
00279    // printf("set path %d \n", parentIdx);
00280    m_topNodeIdx.set(parentIdx);
00281    // getTableManager()->refEntries().at(getTopNodeIdx()).setBitVal(FWGeometryTableManagerBase::kVisNodeSelf,!m_disableTopNode.value() );
00282    getTableManager()->setLevelOffset(getTableManager()->refEntries().at(getTopNodeIdx()).m_level);
00283  
00284 
00285    checkExpandLevel();
00286    refreshTable3D(); 
00287 }
00288 
00289 //------------------------------------------------------------------------------
00290 
00291 void  FWGeometryTableViewBase::checkExpandLevel()
00292 {
00293    // check expand state
00294    int ae = m_autoExpand.value();
00295    if ( m_topNodeIdx.value() > 0) 
00296       ae += getTableManager()->refEntries().at(m_topNodeIdx.value()).m_level;
00297 
00298    for (FWGeometryTableManagerBase::Entries_i i = getTableManager()->refEntries().begin(); i !=  getTableManager()->refEntries().end(); ++i)
00299    {
00300       if (i->m_level  < ae)
00301          i->setBit(FWGeometryTableManagerBase::kExpanded);
00302       else
00303          i->resetBit(FWGeometryTableManagerBase::kExpanded);
00304    } 
00305 }
00306 
00307 //==============================================================================
00308 
00309 void
00310 FWGeometryTableViewBase::populate3DViewsFromConfig()
00311 {
00312    // post-config 
00313    if (m_viewersConfig) {
00314       TEveElementList* viewers = gEve->GetViewers();
00315       const FWConfiguration::KeyValues* keyVals = m_viewersConfig->keyValues();
00316 
00317       if(0!=keyVals)  
00318       {
00319          for(FWConfiguration::KeyValuesIt it = keyVals->begin(); it!= keyVals->end(); ++it) {
00320     
00321             TString sname = it->first;
00322             TEveViewer* v = dynamic_cast<TEveViewer*>(viewers->FindChild(sname.Data()));
00323             if (!v)
00324             {
00325                fwLog(fwlog::kError)  << "FWGeometryTableViewBase::populate3DViewsFromConfig no viewer found " << it->first << std::endl;
00326                return;
00327             }
00328             v->AddScene(m_eveScene);  
00329             m_viewBox->setElement(m_eveTopNode);
00330             if (m_marker) getMarkerScene(v)->AddElement(m_marker);
00331 
00332             gEve->FullRedraw3D(false, true);
00333          }   
00334       }
00335    }
00336 }
00337 
00338 //==============================================================================
00339 
00340 void 
00341 FWGeometryTableViewBase::selectView(int idx)
00342 {
00343    // callback from sleclect view popup menu
00344 
00345    m_viewBox->setElement(m_eveTopNode);
00346 
00347    TEveElement::List_i it = gEve->GetViewers()->BeginChildren();
00348    std::advance(it, idx);
00349    TEveViewer* v = (TEveViewer*)(*it);
00350 
00351    for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit )
00352    {
00353       if ((((TEveSceneInfo*)(*eit))->GetScene()) == m_eveScene)
00354       {
00355         v->RemoveElement(*eit);
00356         if (m_marker) getMarkerScene(v)->RemoveElement(m_marker);
00357         gEve->Redraw3D();
00358         return;
00359       }
00360    }
00361 
00362    if (m_marker) getMarkerScene(v)->AddElement(m_marker); 
00363    v->AddScene(m_eveScene);
00364    gEve->Redraw3D();
00365 }
00366 
00367 //==============================================================================
00368 
00369 void 
00370 FWGeometryTableViewBase::setColumnSelected(int idx)
00371 {
00372    // printf("cell clicled top node %p\n", (void*)m_eveTopNode);
00373    if (gEve->GetSelection()->HasChild( m_eveTopNode))
00374       gEve->GetSelection()->RemoveElement( m_eveTopNode);
00375 
00376    if (gEve->GetHighlight()->HasChild( m_eveTopNode))
00377       gEve->GetHighlight()->RemoveElement( m_eveTopNode);
00378 
00379    // reset bits and sets for old selected table entry
00380    m_eveTopNode->UnSelected();
00381    m_eveTopNode->UnHighlighted();
00382 
00383 
00384    if (m_eveTopNode->selectPhysicalFromTable(idx))
00385       gEve->GetSelection()->AddElement(m_eveTopNode);
00386 
00387    getTableManager()->refEntry(idx).setBit(FWGeometryTableManagerBase::kSelected);
00388    getTableManager()->redrawTable();
00389    gEve->Redraw3D();
00390 }
00391 //______________________________________________________________________________
00392 
00393 void 
00394 FWGeometryTableViewBase::cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t x, Int_t y)
00395 {
00396    int idx = getTableManager()->rowToIndex()[iRow];
00397    FWGeometryTableManagerBase::NodeInfo& ni = getTableManager()->refEntries()[idx];
00398 
00399    if (iColumn != 2)  getTableManager()->cancelEditor(false);
00400 
00401    bool elementChanged = false;
00402    if (iButton == kButton1) 
00403    {
00404       if (iColumn == 0)
00405       {
00406          Window_t wdummy;
00407          Int_t xLoc,yLoc;
00408          gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), m_tableWidget->GetId(),  x, y, xLoc, yLoc, wdummy);
00409 
00410          if (getTableManager()->firstColumnClicked(iRow, xLoc))
00411             setColumnSelected(idx);
00412       }
00413       else if (iColumn == 1)
00414       { 
00415          std::vector<Color_t> colors;
00416          m_colorManager->fillLimitedColors(colors);
00417       
00418          if (!m_colorPopup) {
00419             m_colorPopup = new FWColorPopup(gClient->GetDefaultRoot(), colors.front());
00420             m_colorPopup->InitContent("", colors);
00421             m_colorPopup->Connect("ColorSelected(Color_t)","FWGeometryTableViewBase", const_cast<FWGeometryTableViewBase*>(this), "nodeColorChangeRequested(Color_t");
00422          }
00423          m_tableRowIndexForColorPopup = idx;
00424          m_colorPopup->SetName("Selected");
00425          m_colorPopup->ResetColors(colors, m_colorManager->backgroundColorIndex()==FWColorManager::kBlackIndex);
00426          m_colorPopup->PlacePopup(x, y, m_colorPopup->GetDefaultWidth(), m_colorPopup->GetDefaultHeight());
00427          return;
00428       }
00429       else if (iColumn == 2)
00430       {
00431          // transparency edit
00432          getTableManager()->showEditor(idx);
00433       }
00434       else if (iColumn == 3)
00435       {
00436          // vis self
00437          getTableManager()->setVisibility(ni, !getTableManager()->getVisibility(ni));
00438          elementChanged = true;
00439       }
00440       else if (iColumn == 4)
00441       { 
00442          // vis children
00443          getTableManager()->setVisibilityChld(ni, !getTableManager()->getVisibilityChld(ni));
00444          elementChanged = true;
00445       }
00446       else if (iColumn == 6)
00447       {
00448          // used in overlaps for RnrMarker column
00449          ni.switchBit(BIT(6));
00450          elementChanged = true;
00451       }
00452       else
00453       {
00454          setColumnSelected(idx);
00455       }
00456 
00457       if (elementChanged) {
00458          refreshTable3D();
00459          // getTableManager()->dataChanged();
00460       }
00461    }
00462    else if (iColumn == 0)
00463    {
00464       setColumnSelected(idx);
00465       m_eveTopNode->popupMenu(x, y, 0);
00466    }
00467 }
00468 
00469 
00470 void FWGeometryTableViewBase::setBackgroundColor()
00471 {
00472    bool backgroundIsWhite = m_colorManager->backgroundColorIndex()==FWColorManager::kWhiteIndex;
00473    if(backgroundIsWhite) {
00474       m_tableWidget->SetBackgroundColor(0xffffff);
00475       m_tableWidget->SetLineSeparatorColor(0x000000);
00476    } else {
00477       m_tableWidget->SetBackgroundColor(0x000000);
00478       m_tableWidget->SetLineSeparatorColor(0xffffff);
00479    }
00480    getTableManager()->setBackgroundToWhite(backgroundIsWhite);
00481    gClient->NeedRedraw(m_tableWidget);
00482 }
00483 
00484 //______________________________________________________________________________
00485 
00486 void FWGeometryTableViewBase::nodeColorChangeRequested(Color_t col)
00487 {
00488    // AMT: need to add virtual   FWGeometryTableView::nodeColorChangeRequested() for volume mode
00489    
00490    //   printf("color change %d \n", m_tableRowIndexForColorPopup);
00491    if (m_tableRowIndexForColorPopup >= 0) {
00492       FWGeometryTableManagerBase::NodeInfo& ni = getTableManager()->refEntries()[m_tableRowIndexForColorPopup];
00493       ni.m_color = col;
00494       ni.m_node->GetVolume()->SetLineColor(col);
00495       refreshTable3D();
00496       m_tableRowIndexForColorPopup = -1;
00497    }
00498 }
00499 
00500 
00501 //______________________________________________________________________________
00502 void FWGeometryTableViewBase::chosenItem(int menuIdx)
00503 {
00504    int selectedIdx = m_eveTopNode->getFirstSelectedTableIndex();
00505    FWGeometryTableManagerBase::NodeInfo& ni = getTableManager()->refEntry(selectedIdx);
00506    // printf("chosen item %s \n", ni.name());
00507    
00508    TGeoVolume *gv = ni.m_node->GetVolume();
00509    bool resetHome = false;
00510    if (gv)
00511    {
00512       switch (menuIdx)
00513       {
00514          case FWGeoTopNode::kVisSelfOff:
00515             getTableManager()->setVisibility(ni, false);
00516             refreshTable3D();
00517             
00518          case FWGeoTopNode::kVisChldOff:
00519             getTableManager()->setDaughtersSelfVisibility(selectedIdx, false);
00520             refreshTable3D();
00521             break;
00522             
00523          case FWGeoTopNode::kVisChldOn:
00524             getTableManager()->setDaughtersSelfVisibility(selectedIdx,  true);
00525             refreshTable3D();
00526             break;
00527             
00528          case FWGeoTopNode::kPrintMaterial:
00529             gv->InspectMaterial();
00530             break;
00531             
00532          case FWGeoTopNode::kPrintShape:
00533             gv->InspectShape();
00534             break;
00535             
00536          case FWGeoTopNode::kPrintPath:
00537          {
00538             std::string ps;
00539              getTableManager()->getNodePath(selectedIdx, ps);
00540             std::cout << ps << std::endl;
00541             break;
00542          }  
00543          case FWGeoTopNode::kSetTopNode:
00544             cdNode(selectedIdx);
00545             break;         
00546             
00547          case FWGeoTopNode::kSetTopNodeCam:
00548             cdNode(selectedIdx);
00549             resetHome = true;
00550             break;
00551             
00552          case FWGeoTopNode::kCamera:
00553          {
00554             TGLViewer* v = FWGeoTopNode::s_pickedViewer;
00555             v->CurrentCamera().SetExternalCenter(true);
00556             v->CurrentCamera().SetCenterVec(FWGeoTopNode::s_pickedCamera3DCenter.X(), FWGeoTopNode::s_pickedCamera3DCenter.Y(), FWGeoTopNode::s_pickedCamera3DCenter.Z());
00557             v->SetDrawCameraCenter(true);
00558            // resetHome = true;
00559             break;
00560          }
00561          default:
00562             return;
00563       }
00564    }
00565    
00566    if (resetHome) gEve->FullRedraw3D(true, true);
00567    
00568 }
00569 //______________________________________________________________________________
00570 void FWGeometryTableViewBase::transparencyChanged()
00571 {
00572    getTableManager()->applyTransparencyFromEditor();
00573    refreshTable3D();
00574 }
00575 
00576 //______________________________________________________________________________
00577 
00578 void FWGeometryTableViewBase::refreshTable3D()
00579 {
00580    if (m_enableRedraw)
00581    {
00582       if (gEve->GetSelection()->HasChild(m_eveTopNode))
00583          gEve->GetSelection()->RemoveElement(m_eveTopNode);
00584 
00585       if (gEve->GetHighlight()->HasChild(m_eveTopNode))
00586          gEve->GetHighlight()->RemoveElement(m_eveTopNode);
00587 
00588       m_eveTopNode->m_scene->PadPaint(m_eveTopNode->m_scene->GetPad());
00589       gEve->Redraw3D(); 
00590 
00591       getTableManager()->redrawTable();
00592    }
00593 }
00594 
00595 //______________________________________________________________________________
00596 
00597 void FWGeometryTableViewBase::addTo(FWConfiguration& iTo) const
00598 {
00599    FWConfigurableParameterizable::addTo(iTo);
00600 
00601    FWConfiguration viewers(1);
00602    FWConfiguration tempArea;
00603 
00604    for(TEveElement::List_i k = gEve->GetViewers()->BeginChildren(); k!= gEve->GetViewers()->EndChildren(); ++k)
00605    {
00606       for (TEveElement::List_i eit = (*k)->BeginChildren(); eit != (*k)->EndChildren(); ++eit )
00607       {
00608          TEveScene* s = ((TEveSceneInfo*)*eit)->GetScene();
00609          if (s->GetGLScene() == m_eveTopNode->m_scene)
00610          {
00611             viewers.addKeyValue( (*k)->GetElementName(), tempArea);
00612             break;
00613          }
00614       }
00615    }
00616 
00617    iTo.addKeyValue("Viewers", viewers, true);
00618 }
00619 
00620 //______________________________________________________________________________
00621 
00622 void FWGeometryTableViewBase::setTopNodePathFromConfig(const FWConfiguration& iFrom)
00623 {
00624    int tn;
00625    const FWConfiguration* value = iFrom.valueForKey( m_topNodeIdx.name() );
00626    if (!value) return;
00627 
00628    std::istringstream s(value->value());
00629    s>> tn;
00630    int lastIdx = getTableManager()->refEntries().size() -1;
00631    if (tn >= lastIdx) { 
00632       fwLog(fwlog::kWarning) << Form("Ignoring node path from confugration file -- %s value larger than number of nodes \n", m_topNodeIdx.name().c_str());
00633       return;
00634    }
00635    //   std::cerr << "set top node " << ;
00636    m_topNodeIdx.set(tn);
00637 }
00638 
00639 //______________________________________________________________________________
00640 
00641 void FWGeometryTableViewBase::reloadColors()
00642 {
00643   // printf("relaodColors \n");
00644    for (FWGeometryTableManagerBase::Entries_i i = getTableManager()->refEntries().begin(); i !=  getTableManager()->refEntries().end(); ++i)
00645    {
00646       i->m_color = i->m_node->GetVolume()->GetLineColor();
00647    }
00648    
00649    refreshTable3D();
00650 }
00651 
00652 
00653 //______________________________________________________________________________
00654 
00655 void FWGeometryTableViewBase::populateController(ViewerParameterGUI& gui) const
00656 {
00657    gui.requestTab("Style").
00658    separator().
00659    //addParam(&m_parentTransparencyFactor).
00660   // addParam(&m_leafTransparencyFactor).
00661    addParam(&m_minParentTransparency).
00662    addParam(&m_minLeafTransparency).
00663    separator();
00664    TGTextButton* butt = new TGTextButton(gui.getTabContainer(), "ReloadColors");
00665    gui.getTabContainer()->AddFrame(butt);
00666    butt->Connect("Clicked()", "FWGeometryTableViewBase", (FWGeometryTableViewBase*)this, "reloadColors()");
00667 
00668 }
00669 
00670