CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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/src/FWEveDigitSetScalableMarker.cc"
00018 #include "Fireworks/Core/interface/CmsShowViewPopup.h"
00019 
00020 
00021 #include "TGFileDialog.h"
00022 #include "TGeoNode.h"
00023 #include "TGeoMatrix.h"
00024 #include "TGStatusBar.h"
00025 #include "TGButton.h"
00026 #include "TGLabel.h"
00027 #include "TGLPhysicalShape.h"
00028 #include "TGMenu.h"
00029 #include "TGComboBox.h"
00030 // #define PERFTOOL_BROWSER
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", type == FWViewType::kOverlapTable ? 0l : 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 - EventScene %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(5));
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 %d\n", ni.name(), menuIdx);
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             break;
00518             
00519          case FWGeoTopNode::kVisChldOff:
00520             getTableManager()->setDaughtersSelfVisibility(selectedIdx, false);
00521             refreshTable3D();
00522             break;
00523             
00524          case FWGeoTopNode::kVisChldOn:
00525             getTableManager()->setDaughtersSelfVisibility(selectedIdx,  true);
00526             refreshTable3D();
00527             break;
00528             
00529          case FWGeoTopNode::kPrintMaterial:
00530             gv->InspectMaterial();
00531             break;
00532             
00533          case FWGeoTopNode::kPrintShape:
00534             gv->InspectShape();
00535             break;
00536             
00537          case FWGeoTopNode::kPrintPath:
00538          {
00539             std::string ps;
00540              getTableManager()->getNodePath(selectedIdx, ps);
00541             std::cout << ps << std::endl;
00542             break;
00543          }  
00544          case FWGeoTopNode::kSetTopNode:
00545             cdNode(selectedIdx);
00546             break;         
00547             
00548          case FWGeoTopNode::kSetTopNodeCam:
00549             cdNode(selectedIdx);
00550             resetHome = true;
00551             break;
00552             
00553          case FWGeoTopNode::kCamera:
00554          {
00555             TGLViewer* v = FWGeoTopNode::s_pickedViewer;
00556             v->CurrentCamera().SetExternalCenter(true);
00557             v->CurrentCamera().SetCenterVec(FWGeoTopNode::s_pickedCamera3DCenter.X(), FWGeoTopNode::s_pickedCamera3DCenter.Y(), FWGeoTopNode::s_pickedCamera3DCenter.Z());
00558             v->SetDrawCameraCenter(true);
00559            // resetHome = true;
00560             break;
00561          }
00562          default:
00563             return;
00564       }
00565    }
00566    
00567    if (resetHome) gEve->FullRedraw3D(true, true);
00568    
00569 }
00570 //______________________________________________________________________________
00571 void FWGeometryTableViewBase::transparencyChanged()
00572 {
00573    getTableManager()->applyTransparencyFromEditor();
00574    refreshTable3D();
00575 }
00576 
00577 //______________________________________________________________________________
00578 
00579 void FWGeometryTableViewBase::refreshTable3D()
00580 {
00581    if (m_enableRedraw)
00582    {
00583       if (gEve->GetSelection()->HasChild(m_eveTopNode))
00584          gEve->GetSelection()->RemoveElement(m_eveTopNode);
00585 
00586       if (gEve->GetHighlight()->HasChild(m_eveTopNode))
00587          gEve->GetHighlight()->RemoveElement(m_eveTopNode);
00588 
00589       m_eveTopNode->m_scene->PadPaint(m_eveTopNode->m_scene->GetPad());
00590       gEve->Redraw3D(); 
00591 
00592       getTableManager()->redrawTable();
00593    }
00594 }
00595 
00596 //______________________________________________________________________________
00597 
00598 void FWGeometryTableViewBase::addTo(FWConfiguration& iTo) const
00599 {
00600    FWConfigurableParameterizable::addTo(iTo);
00601 
00602    FWConfiguration viewers(1);
00603    FWConfiguration tempArea;
00604 
00605    for(TEveElement::List_i k = gEve->GetViewers()->BeginChildren(); k!= gEve->GetViewers()->EndChildren(); ++k)
00606    {
00607       for (TEveElement::List_i eit = (*k)->BeginChildren(); eit != (*k)->EndChildren(); ++eit )
00608       {
00609          TEveScene* s = ((TEveSceneInfo*)*eit)->GetScene();
00610          if (s->GetGLScene() == m_eveTopNode->m_scene)
00611          {
00612             viewers.addKeyValue( (*k)->GetElementName(), tempArea);
00613             break;
00614          }
00615       }
00616    }
00617 
00618    iTo.addKeyValue("Viewers", viewers, true);
00619 }
00620 
00621 //______________________________________________________________________________
00622 
00623 void FWGeometryTableViewBase::setTopNodePathFromConfig(const FWConfiguration& iFrom)
00624 {
00625    int tn;
00626    const FWConfiguration* value = iFrom.valueForKey( m_topNodeIdx.name() );
00627    if (!value) return;
00628 
00629    std::istringstream s(value->value());
00630    s>> tn;
00631    int lastIdx = getTableManager()->refEntries().size() -1;
00632    if (tn >= lastIdx) { 
00633       fwLog(fwlog::kWarning) << Form("Ignoring node path from confugration file -- %s value larger than number of nodes \n", m_topNodeIdx.name().c_str());
00634       return;
00635    }
00636    //   std::cerr << "set top node " << ;
00637    m_topNodeIdx.set(tn);
00638 }
00639 
00640 //______________________________________________________________________________
00641 
00642 void FWGeometryTableViewBase::reloadColors()
00643 {
00644   // printf("relaodColors \n");
00645    for (FWGeometryTableManagerBase::Entries_i i = getTableManager()->refEntries().begin(); i !=  getTableManager()->refEntries().end(); ++i)
00646    {
00647       i->m_color = i->m_node->GetVolume()->GetLineColor();
00648    }
00649    
00650    refreshTable3D();
00651 }
00652 
00653 
00654 //______________________________________________________________________________
00655 
00656 void FWGeometryTableViewBase::populateController(ViewerParameterGUI& gui) const
00657 {
00658    gui.requestTab("Style").
00659    separator().
00660    //addParam(&m_parentTransparencyFactor).
00661   // addParam(&m_leafTransparencyFactor).
00662    addParam(&m_minParentTransparency).
00663    addParam(&m_minLeafTransparency).
00664    separator();
00665    TGTextButton* butt = new TGTextButton(gui.getTabContainer(), "ReloadColors");
00666    gui.getTabContainer()->AddFrame(butt);
00667    butt->Connect("Clicked()", "FWGeometryTableViewBase", (FWGeometryTableViewBase*)this, "reloadColors()");
00668 
00669 }
00670 
00671