CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

FWGeometryTableViewBase Class Reference

#include <FWGeometryTableViewBase.h>

Inheritance diagram for FWGeometryTableViewBase:
FWViewBase FWParameterSetterEditorBase FWConfigurableParameterizable FWParameterizable FWConfigurable FWGeometryTableView FWOverlapTableView

List of all members.

Classes

class  FWViewCombo

Public Types

enum  EMode { kNode, kVolume }

Public Member Functions

virtual void addTo (FWConfiguration &) const
void cdNode (int)
virtual void cdTop ()
virtual void cdUp ()
virtual void cellClicked (Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY)
void checkExpandLevel ()
 FWGeometryTableViewBase (TEveWindowSlot *, FWViewType::EType, FWColorManager *)
bool getEnableHighlight ()
virtual
FWGeometryTableManagerBase
getTableManager ()
int getTopNodeIdx () const
void nodeColorChangeRequested (Color_t)
void populate3DViewsFromConfig ()
virtual void refreshTable3D ()
virtual void saveImageTo (const std::string &iName) const
void selectView (int)
void setBackgroundColor ()
virtual void setFrom (const FWConfiguration &)
virtual void setPath (int, std::string &)
virtual ~FWGeometryTableViewBase ()

Protected Member Functions

void enableHighlight ()
void postConst ()

Protected Attributes

FWLongParameter m_autoExpand
FWColorManagerm_colorManager
FWColorPopupm_colorPopup
FWBoolParameter m_enableHighlight
bool m_enableRedraw
TEveScene * m_eveScene
FWGeoTopNodem_eveTopNode
TEveWindowFrame * m_eveWindow
TGCompositeFrame * m_frame
TEvePointSet * m_marker
FWTableWidgetm_tableWidget
FWLongParameter m_topNodeIdx
FWViewCombom_viewBox
const FWConfigurationm_viewersConfig

Private Member Functions

 ClassDef (FWGeometryTableViewBase, 0)
 FWGeometryTableViewBase (const FWGeometryTableViewBase &)
const FWGeometryTableViewBaseoperator= (const FWGeometryTableViewBase &)
void setColumnSelected (int idx)

Private Attributes

int m_tableRowIndexForColorPopup

Detailed Description

Definition at line 46 of file FWGeometryTableViewBase.h.


Member Enumeration Documentation

Enumerator:
kNode 
kVolume 

Definition at line 54 of file FWGeometryTableViewBase.h.


Constructor & Destructor Documentation

FWGeometryTableViewBase::FWGeometryTableViewBase ( TEveWindowSlot *  iParent,
FWViewType::EType  type,
FWColorManager colMng 
)

Definition at line 115 of file FWGeometryTableViewBase.cc.

References m_eveWindow, and m_frame.

   : FWViewBase(type),
     m_topNodeIdx(this, "TopNodeIndex", -1l, 0, 1e7),
     m_autoExpand(this,"ExpandList:", 1l, 0l, 100l),
     m_enableHighlight(this,"EnableHighlight", true),
     m_colorManager(colMng),
     m_colorPopup(0),
     m_eveWindow(0),
     m_frame(0),
     m_viewBox(0),
     m_viewersConfig(0),
     m_enableRedraw(true),
     m_marker(0),
     m_eveTopNode(0),
     m_eveScene(0),
     m_tableRowIndexForColorPopup(-1)
{
   m_eveWindow = iParent->MakeFrame(0);
   TGCompositeFrame* xf = m_eveWindow->GetGUICompositeFrame();

   m_frame = new TGVerticalFrame(xf);


   xf->AddFrame(m_frame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));   
}
FWGeometryTableViewBase::~FWGeometryTableViewBase ( ) [virtual]

Definition at line 162 of file FWGeometryTableViewBase.cc.

References getTableManager(), m_eveWindow, and m_frame.

{
   // take out composite frame and delete it directly (zwithout the timeout)
   TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
   frame->RemoveFrame( m_frame );
   delete m_frame;



   m_eveWindow->DestroyWindowAndSlot();
   delete getTableManager();
}
FWGeometryTableViewBase::FWGeometryTableViewBase ( const FWGeometryTableViewBase ) [private]

Member Function Documentation

void FWGeometryTableViewBase::addTo ( FWConfiguration iTo) const [virtual]

Reimplemented from FWConfigurableParameterizable.

Definition at line 445 of file FWGeometryTableViewBase.cc.

References FWConfiguration::addKeyValue(), FWGeoTopNode::fSceneJebo, gen::k, m_eveTopNode, and alignCSCRings::s.

{
   FWConfigurableParameterizable::addTo(iTo);

   FWConfiguration viewers(1);
   FWConfiguration tempArea;

   for(TEveElement::List_i k = gEve->GetViewers()->BeginChildren(); k!= gEve->GetViewers()->EndChildren(); ++k)
   {
      for (TEveElement::List_i eit = (*k)->BeginChildren(); eit != (*k)->EndChildren(); ++eit )
      {
         TEveScene* s = ((TEveSceneInfo*)*eit)->GetScene();
         if (s->GetGLScene() == m_eveTopNode->fSceneJebo)
         {
            viewers.addKeyValue( (*k)->GetElementName(), tempArea);
            break;
         }
      }
   }

   iTo.addKeyValue("Viewers", viewers, true);
}
void FWGeometryTableViewBase::cdNode ( int  idx)
void FWGeometryTableViewBase::cdTop ( ) [virtual]

Reimplemented in FWOverlapTableView.

Definition at line 196 of file FWGeometryTableViewBase.cc.

References getTableManager(), getHLTPrescaleColumns::path, FWGeometryTableManagerBase::refEntries(), and setPath().

Referenced by FWGeometryTableView::FWGeometryTableView().

{
   std::string path = "/" ;
   path += getTableManager()->refEntries().at(0).name();
   setPath(-1, path ); 
}
void FWGeometryTableViewBase::cdUp ( ) [virtual]
void FWGeometryTableViewBase::cellClicked ( Int_t  iRow,
Int_t  iColumn,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  iGlobalX,
Int_t  iGlobalY 
) [virtual]

Definition at line 333 of file FWGeometryTableViewBase.cc.

References FWColorManager::backgroundColorIndex(), colors, FWColorManager::fillLimitedColors(), FWGeometryTableManagerBase::firstColumnClicked(), getTableManager(), UserOptions_cff::idx, FWColorPopup::InitContent(), FWColorManager::kBlackIndex, FWGeometryTableManagerBase::kVisNodeChld, FWGeometryTableManagerBase::kVisNodeSelf, m_colorManager, m_colorPopup, m_eveTopNode, m_tableRowIndexForColorPopup, m_tableWidget, FWColorPopup::PlacePopup(), FWGeoTopNode::popupMenu(), FWGeometryTableManagerBase::refEntries(), refreshTable3D(), FWColorPopup::ResetColors(), FWGeometryTableManagerBase::rowToIndex(), setColumnSelected(), FWColorPopup::SetName(), FWGeometryTableManagerBase::NodeInfo::switchBit(), x, and detailsBasic3DVector::y.

{
   int idx = getTableManager()->rowToIndex()[iRow];
   FWGeometryTableManagerBase::NodeInfo& ni = getTableManager()->refEntries()[idx];

   bool elementChanged = false;
   if (iButton == kButton1) 
   {
      if (iColumn == 0)
      {
         Window_t wdummy;
         Int_t xLoc,yLoc;
         gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), m_tableWidget->GetId(),  x, y, xLoc, yLoc, wdummy);

         if (getTableManager()->firstColumnClicked(iRow, xLoc))
            setColumnSelected(idx);
      }
      else if (iColumn == 1)
      { 
         std::vector<Color_t> colors;
         m_colorManager->fillLimitedColors(colors);
      
         if (!m_colorPopup) {
            m_colorPopup = new FWColorPopup(gClient->GetDefaultRoot(), colors.front());
            m_colorPopup->InitContent("", colors);
            m_colorPopup->Connect("ColorSelected(Color_t)","FWGeometryTableViewBase", const_cast<FWGeometryTableViewBase*>(this), "nodeColorChangeRequested(Color_t");
         }
         m_tableRowIndexForColorPopup = idx;
         m_colorPopup->SetName("Selected");
         m_colorPopup->ResetColors(colors, m_colorManager->backgroundColorIndex()==FWColorManager::kBlackIndex);
         m_colorPopup->PlacePopup(x, y, m_colorPopup->GetDefaultWidth(), m_colorPopup->GetDefaultHeight());
         return;
      }
      else if (iColumn == 2)
      {
         ni.switchBit(FWGeometryTableManagerBase::kVisNodeSelf);
         elementChanged = true;
      }
      else if (iColumn == 3)
      { 
         ni.switchBit(FWGeometryTableManagerBase::kVisNodeChld); 
         elementChanged = true;
      }
      else if (iColumn == 5)
      {
         // used in overlaps for RnrMarker column
         ni.switchBit(BIT(5));
         elementChanged = true;
      }
      else
      {setColumnSelected(idx);
      }

      if (elementChanged) {
         refreshTable3D();
         // getTableManager()->dataChanged();
      }
   }
   else if (iColumn == 0)
   {
      setColumnSelected(idx);
      m_eveTopNode->popupMenu(x, y);
   }
}
void FWGeometryTableViewBase::checkExpandLevel ( )
FWGeometryTableViewBase::ClassDef ( FWGeometryTableViewBase  ,
 
) [private]
void FWGeometryTableViewBase::enableHighlight ( ) [protected]
bool FWGeometryTableViewBase::getEnableHighlight ( ) [inline]

Definition at line 80 of file FWGeometryTableViewBase.h.

References m_enableHighlight, and FWGenericParameter< T >::value().

{ return m_enableHighlight.value(); } 
virtual FWGeometryTableManagerBase* FWGeometryTableViewBase::getTableManager ( ) [inline, virtual]
int FWGeometryTableViewBase::getTopNodeIdx ( ) const [inline]
void FWGeometryTableViewBase::nodeColorChangeRequested ( Color_t  col)
const FWGeometryTableViewBase& FWGeometryTableViewBase::operator= ( const FWGeometryTableViewBase ) [private]
void FWGeometryTableViewBase::populate3DViewsFromConfig ( )

Definition at line 249 of file FWGeometryTableViewBase.cc.

References fwLog, fwlog::kError, FWConfiguration::keyValues(), m_eveScene, m_eveTopNode, m_marker, m_viewBox, m_viewersConfig, FWGeometryTableViewBase::FWViewCombo::setElement(), and lumiContext::sname.

Referenced by FWGUIManager::setFrom().

{
   // post-config 
   if (m_viewersConfig) {
      TEveElementList* viewers = gEve->GetViewers();
      const FWConfiguration::KeyValues* keyVals = m_viewersConfig->keyValues();

      if(0!=keyVals)  
      {
         for(FWConfiguration::KeyValuesIt it = keyVals->begin(); it!= keyVals->end(); ++it) {
    
            TString sname = it->first;
            TEveViewer* v = dynamic_cast<TEveViewer*>(viewers->FindChild(sname.Data()));
            if (!v)
            {
               fwLog(fwlog::kError)  << "FWGeometryTableViewBase::populate3DViewsFromConfig no viewer found " << it->first << std::endl;
               return;
            }
            v->AddScene(m_eveScene);  
            m_viewBox->setElement(m_eveTopNode);
            if (m_marker) getMarkerScene(v)->AddElement(m_marker);

            gEve->FullRedraw3D(false, true);
         }   
      }
   }
}
void FWGeometryTableViewBase::postConst ( ) [protected]

Definition at line 141 of file FWGeometryTableViewBase.cc.

References FWTableWidget::disableGrowInWidth(), getTableManager(), m_eveWindow, m_frame, m_tableWidget, FWTableWidget::SetBackgroundColor(), FWTableWidget::SetHeaderBackgroundColor(), and FWTableWidget::SetLineSeparatorColor().

Referenced by FWGeometryTableView::FWGeometryTableView(), and FWOverlapTableView::FWOverlapTableView().

{
   m_tableWidget = new FWTableWidget(getTableManager(), m_frame); 
   m_frame->AddFrame(m_tableWidget,new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,2,2,0,0));
   m_tableWidget->SetBackgroundColor(0xffffff);
   m_tableWidget->SetLineSeparatorColor(0x000000);
   m_tableWidget->SetHeaderBackgroundColor(0xececec);
   m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
                          "FWGeometryTableViewBase",this,
                          "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
   m_tableWidget->disableGrowInWidth();
   //   resetSetters();


   m_frame->MapSubwindows();
   m_frame->Layout();
  m_eveWindow->GetGUICompositeFrame()->Layout();
   m_frame->MapWindow();
}
void FWGeometryTableViewBase::refreshTable3D ( ) [virtual]
virtual void FWGeometryTableViewBase::saveImageTo ( const std::string &  iName) const [inline, virtual]

Implements FWViewBase.

Definition at line 87 of file FWGeometryTableViewBase.h.

{}
void FWGeometryTableViewBase::selectView ( int  idx)

Definition at line 280 of file FWGeometryTableViewBase.cc.

References m_eveScene, m_eveTopNode, m_marker, m_viewBox, and FWGeometryTableViewBase::FWViewCombo::setElement().

{
   // callback from sleclect view popup menu

   m_viewBox->setElement(m_eveTopNode);

   TEveElement::List_i it = gEve->GetViewers()->BeginChildren();
   std::advance(it, idx);
   TEveViewer* v = (TEveViewer*)(*it);

   for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit )
   {
      if ((((TEveSceneInfo*)(*eit))->GetScene()) == m_eveScene)
      {
        v->RemoveElement(*eit);
        if (m_marker) getMarkerScene(v)->RemoveElement(m_marker);
        gEve->Redraw3D();
        return;
      }
   }

   if (m_marker) getMarkerScene(v)->AddElement(m_marker); 
   v->AddScene(m_eveScene);
   gEve->Redraw3D();
}
void FWGeometryTableViewBase::setBackgroundColor ( )
void FWGeometryTableViewBase::setColumnSelected ( int  idx) [private]

Definition at line 309 of file FWGeometryTableViewBase.cc.

References getTableManager(), FWGeometryTableManagerBase::kSelected, m_eveTopNode, FWGeometryTableManagerBase::redrawTable(), FWGeometryTableManagerBase::refEntry(), FWGeoTopNode::selectPhysicalFromTable(), FWGeoTopNode::UnHighlighted(), and FWGeoTopNode::UnSelected().

Referenced by cellClicked().

{
   // printf("cell clicled top node %p\n", (void*)m_eveTopNode);
   if (gEve->GetSelection()->HasChild( m_eveTopNode))
      gEve->GetSelection()->RemoveElement( m_eveTopNode);

   if (gEve->GetHighlight()->HasChild( m_eveTopNode))
      gEve->GetHighlight()->RemoveElement( m_eveTopNode);

   // reset bits and sets for old selected table entry
   m_eveTopNode->UnSelected();
   m_eveTopNode->UnHighlighted();


   if (m_eveTopNode->selectPhysicalFromTable(idx))
      gEve->GetSelection()->AddElement(m_eveTopNode);

   getTableManager()->refEntry(idx).setBit(FWGeometryTableManagerBase::kSelected);
   getTableManager()->redrawTable();
   gEve->Redraw3D();
}
void FWGeometryTableViewBase::setFrom ( const FWConfiguration iFrom) [virtual]

Reimplemented from FWConfigurableParameterizable.

Reimplemented in FWGeometryTableView, and FWOverlapTableView.

Definition at line 470 of file FWGeometryTableViewBase.cc.

References FWParameterizable::begin(), FWParameterizable::end(), m_enableRedraw, m_viewersConfig, refreshTable3D(), and FWConfiguration::valueForKey().

{ 
   m_enableRedraw = false;
   for(const_iterator it =begin(), itEnd = end();
       it != itEnd;
       ++it) {

      //      printf("set from %s \n",(*it)->name().c_str() );
      (*it)->setFrom(iFrom);

   }  
   m_viewersConfig = iFrom.valueForKey("Viewers");

   m_enableRedraw = true;
   refreshTable3D();
}
void FWGeometryTableViewBase::setPath ( int  parentIdx,
std::string &   
) [virtual]

Reimplemented in FWGeometryTableView.

Definition at line 214 of file FWGeometryTableViewBase.cc.

References asciidump::at, checkExpandLevel(), FWGeoTopNode::clearSelection(), getTableManager(), getTopNodeIdx(), m_eveTopNode, m_topNodeIdx, refreshTable3D(), FWGenericParameter< T >::set(), and FWGeometryTableManagerBase::setLevelOffset().

Referenced by cdNode(), cdTop(), and cdUp().

{
   m_eveTopNode->clearSelection();

   // printf("set path %d \n", parentIdx);
   m_topNodeIdx.set(parentIdx);
   // getTableManager()->refEntries().at(getTopNodeIdx()).setBitVal(FWGeometryTableManagerBase::kVisNodeSelf,!m_disableTopNode.value() );
   getTableManager()->setLevelOffset(getTableManager()->refEntries().at(getTopNodeIdx()).m_level);
 

   checkExpandLevel();
   refreshTable3D(); 
}

Member Data Documentation

Definition at line 112 of file FWGeometryTableViewBase.h.

Referenced by cellClicked(), and setBackgroundColor().

Definition at line 117 of file FWGeometryTableViewBase.h.

Referenced by cellClicked().

Definition at line 109 of file FWGeometryTableViewBase.h.

Referenced by getEnableHighlight().

TEveScene* FWGeometryTableViewBase::m_eveScene [protected]
TEveWindowFrame* FWGeometryTableViewBase::m_eveWindow [protected]
TGCompositeFrame* FWGeometryTableViewBase::m_frame [protected]
TEvePointSet* FWGeometryTableViewBase::m_marker [protected]

Definition at line 145 of file FWGeometryTableViewBase.h.

Referenced by cellClicked(), and nodeColorChangeRequested().

Definition at line 113 of file FWGeometryTableViewBase.h.

Referenced by cellClicked(), postConst(), and setBackgroundColor().