CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends

FWGeometryTableManagerBase Class Reference

#include <Fireworks/Core/interface/FWGeometryTableManagerBase.h>

Inheritance diagram for FWGeometryTableManagerBase:
FWTableManagerBase FWGeometryTableManager FWOverlapTableManager

List of all members.

Classes

class  ColorBoxRenderer
struct  NodeInfo

Public Types

enum  Bits {
  kExpanded = BIT(0), kVisNodeSelf = BIT(1), kVisNodeChld = BIT(2), kHighlighted = BIT(3),
  kSelected = BIT(4)
}
typedef Entries_v::iterator Entries_i
typedef std::vector< NodeInfoEntries_v

Public Member Functions

void applyTransparencyFromEditor ()
void cancelEditor (bool)
virtual bool cellDataIsSortable () const
virtual const char * cellName (const NodeInfo &) const
bool firstColumnClicked (int row, int xPos)
 FWGeometryTableManagerBase ()
 FWGeometryTableManagerBase (const FWGeometryTableManagerBase &)
int getLevelOffset () const
void getNodeMatrix (const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
void getNodePath (int, std::string &) const
NodeInfogetSelected ()
virtual std::vector< std::string > getTitles () const
 returns the title names for each column
virtual bool getVisibility (const NodeInfo &nodeInfo) const
virtual bool getVisibilityChld (const NodeInfo &nodeInfo) const
virtual void implSort (int, bool)
 Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.
bool isNodeRendered (int idx, int top_node_idx) const
void loadGeometry (TGeoNode *, TObjArray *)
bool nodeImported (int idx) const
virtual int numberOfRows () const
 Number of rows in the table.
const FWGeometryTableManagerBaseoperator= (const FWGeometryTableManagerBase &)
virtual void recalculateVisibility ()=0
void redrawTable (bool setExpand=false)
Entries_vrefEntries ()
NodeInforefEntry (int i)
std::vector< int > rowToIndex ()
void setBackgroundToWhite (bool)
void setCellValueEditor (TGTextEntry *editor)
void setDaughtersSelfVisibility (bool)
virtual void setDaughtersSelfVisibility (int selectedIdx, bool v)
void setLevelOffset (int x)
virtual void setVisibility (NodeInfo &, bool)
virtual void setVisibilityChld (NodeInfo &, bool)
void showEditor (int)
virtual const std::string title () const
virtual int unsortedRowNumber (int unsorted) const
 when passed the index to the sorted order of the rows it returns the original row number from the underlying data
virtual ~FWGeometryTableManagerBase ()

Static Public Member Functions

static void getNNodesTotal (TGeoNode *geoNode, int &off)

Public Attributes

ColorBoxRenderer m_colorBoxRenderer
TGTextEntry * m_editor
int m_editTransparencyIdx
Entries_v m_entries
TGGC * m_highlightContext
int m_highlightIdx
int m_levelOffset
FWTextTreeCellRenderer m_renderer
std::vector< int > m_row_to_index

Protected Member Functions

virtual bool nodeIsParent (const NodeInfo &) const

Friends

class FWGeometryTableViewBase

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 37 of file FWGeometryTableManagerBase.h.


Member Typedef Documentation

typedef Entries_v::iterator FWGeometryTableManagerBase::Entries_i

Definition at line 86 of file FWGeometryTableManagerBase.h.

Definition at line 85 of file FWGeometryTableManagerBase.h.


Member Enumeration Documentation

Enumerator:
kExpanded 
kVisNodeSelf 
kVisNodeChld 
kHighlighted 
kSelected 

Definition at line 44 of file FWGeometryTableManagerBase.h.

   {
      kExpanded        =  BIT(0),

      kVisNodeSelf     =  BIT(1),
      kVisNodeChld     =  BIT(2),

      kHighlighted   =  BIT(3),
      kSelected      =  BIT(4)
   };

Constructor & Destructor Documentation

FWGeometryTableManagerBase::FWGeometryTableManagerBase ( )

Definition at line 103 of file FWGeometryTableManagerBase.cc.

References FWTextTableCellRenderer::height(), m_colorBoxRenderer, FWGeometryTableManagerBase::ColorBoxRenderer::m_height, m_highlightContext, m_renderer, FWGeometryTableManagerBase::ColorBoxRenderer::m_width, and FWTextTableCellRenderer::setHighlightContext().

   :   
   m_highlightIdx(-1),
   m_levelOffset(0),
   m_editor(0),
   m_editTransparencyIdx(-1)
{ 
   m_colorBoxRenderer.m_width  =  50;
   m_colorBoxRenderer.m_height =  m_renderer.height();

   GCValues_t gval;
   gval.fMask = kGCForeground | kGCBackground | kGCStipple | kGCFillStyle  | kGCGraphicsExposures;
   gval.fForeground = gVirtualX->GetPixel(kGray);//gClient->GetResourcePool()->GetFrameHiliteColor();
   gval.fBackground = gVirtualX->GetPixel(kWhite);//gClient->GetResourcePool()->GetFrameBgndColor();
   gval.fFillStyle  = kFillOpaqueStippled; // kFillTiled;
   gval.fStipple    = gClient->GetResourcePool()->GetCheckeredBitmap();
   gval.fGraphicsExposures = kFALSE;
   m_highlightContext = gClient->GetGC(&gval, kTRUE);

   m_renderer.setHighlightContext( m_highlightContext);
}
FWGeometryTableManagerBase::~FWGeometryTableManagerBase ( ) [virtual]

Definition at line 125 of file FWGeometryTableManagerBase.cc.

{
}
FWGeometryTableManagerBase::FWGeometryTableManagerBase ( const FWGeometryTableManagerBase )

Member Function Documentation

void FWGeometryTableManagerBase::applyTransparencyFromEditor ( )

Definition at line 278 of file FWGeometryTableManagerBase.cc.

References cancelEditor(), fwLog, fwlog::kError, m_editor, m_editTransparencyIdx, m_entries, and lumiQTWidget::t.

Referenced by FWGeometryTableViewBase::transparencyChanged().

{
   printf("transparency idx %d opaci %s \n",m_editTransparencyIdx, m_editor->GetText() );
   if ( m_editTransparencyIdx >= 0)
   {
      using boost::lexical_cast;
      using boost::bad_lexical_cast;
      try {
         int t = lexical_cast<int>(m_editor->GetText());
         if (t > 100 || t < 0 )
         {
            fwLog(fwlog::kError) << "Transparency must be set in procentage [0-100].";
            return;
         }
         m_entries[m_editTransparencyIdx].m_transparency = 100 - t;
         printf("SET !! \n");
         cancelEditor(true);
      }
      catch (bad_lexical_cast &) {
         fwLog(fwlog::kError) << "Bad Lexical cast. Transparency must be set in procentage [0-100].";
      }
   }
}
void FWGeometryTableManagerBase::cancelEditor ( bool  redraw)

Definition at line 302 of file FWGeometryTableManagerBase.cc.

References m_editor, m_editTransparencyIdx, and redrawTable().

Referenced by applyTransparencyFromEditor(), and FWGeometryTableViewBase::cellClicked().

{
   m_editTransparencyIdx = -1;

   if ( m_editor->IsMapped())
   {
      m_editor->UnmapWindow(); 
      if (redraw) redrawTable();
   }
}
virtual bool FWGeometryTableManagerBase::cellDataIsSortable ( ) const [inline, virtual]

Reimplemented from FWTableManagerBase.

Definition at line 186 of file FWGeometryTableManagerBase.h.

References funct::false.

{ return false ; }
virtual const char* FWGeometryTableManagerBase::cellName ( const NodeInfo ) const [inline, virtual]

Reimplemented in FWGeometryTableManager.

Definition at line 118 of file FWGeometryTableManagerBase.h.

{ return 0;} 
bool FWGeometryTableManagerBase::firstColumnClicked ( int  row,
int  xPos 
)

Definition at line 172 of file FWGeometryTableManagerBase.cc.

References FWTableManagerBase::dataChanged(), customizeTrackingMonitorSeedNumber::idx, kExpanded, m_entries, m_levelOffset, recalculateVisibility(), rowToIndex(), and FWTableManagerBase::visualPropertiesChanged().

Referenced by FWGeometryTableViewBase::cellClicked().

{
   if (row == -1)
      return false;

   int idx = rowToIndex()[row];
   // printf("click %s \n", m_entries[idx].name());

   int off = 0;
   if (idx >= 0)
      off = (m_entries[idx].m_level - m_levelOffset)* 20;

   //   printf("compare %d %d level %d\n" , xPos, off, idx);
   if (xPos >  off &&  xPos < (off + 20))
   {
      m_entries[idx].switchBit(kExpanded);
 
      recalculateVisibility();
      dataChanged();
      visualPropertiesChanged();
      return false;
   }

   return true;
}
int FWGeometryTableManagerBase::getLevelOffset ( ) const [inline]

Definition at line 150 of file FWGeometryTableManagerBase.h.

References m_levelOffset.

Referenced by FWEveDetectorGeo::Paint().

{ return m_levelOffset; }
void FWGeometryTableManagerBase::getNNodesTotal ( TGeoNode *  geoNode,
int &  off 
) [inline, static]
void FWGeometryTableManagerBase::getNodeMatrix ( const NodeInfo nodeInfo,
TGeoHMatrix &  mat 
) const

Definition at line 203 of file FWGeometryTableManagerBase.cc.

References m_entries, FWGeometryTableManagerBase::NodeInfo::m_node, and FWGeometryTableManagerBase::NodeInfo::m_parent.

Referenced by FWEveOverlap::Paint(), and FWEveDetectorGeo::Paint().

{
   // utility used by browser and FWGeoNode
   //   printf("================ FWGeometryTableManagerBase::getNodeMatri \n");
   int pIdx  = data.m_parent;

   while (pIdx > 0)
   {
      // printf("%s [%d]\n",m_entries.at(pIdx).name(), m_entries.at(pIdx).m_level );
      mtx.MultiplyLeft(m_entries.at(pIdx).m_node->GetMatrix());
      pIdx = m_entries.at(pIdx).m_parent;
   }

   //   printf("right %s [%d]\n",data.name(), data.m_level );
   mtx.Multiply(data.m_node->GetMatrix());
}
void FWGeometryTableManagerBase::getNodePath ( int  idx,
std::string &  path 
) const

Definition at line 238 of file FWGeometryTableManagerBase.cc.

References i, customizeTrackingMonitorSeedNumber::idx, m_entries, and mergeVDriftHistosByStation::name.

Referenced by FWGeometryTableViewBase::cdNode(), FWGeometryTableViewBase::cdUp(), and FWGeometryTableViewBase::chosenItem().

{
   std::vector<std::string> relPath;
   while(idx >= 0)
   { 
      relPath.push_back( m_entries[idx].name());
      // printf("push %s \n",m_entries[idx].name() );
      idx  =  m_entries[idx].m_parent;
   }

   size_t ns = relPath.size();
   for (size_t i = 1; i < ns; ++i )
   {
      path +="/";
      path += relPath[ns-i -1];
      // printf("push_back add to path %s\n", path.c_str());
   }
}
NodeInfo* FWGeometryTableManagerBase::getSelected ( )
std::vector< std::string > FWGeometryTableManagerBase::getTitles ( ) const [virtual]

returns the title names for each column

Implements FWTableManagerBase.

Reimplemented in FWOverlapTableManager.

Definition at line 141 of file FWGeometryTableManagerBase.cc.

References FWTableManagerBase::numberOfColumns().

{
   std::vector<std::string> returnValue;
   returnValue.reserve(numberOfColumns());

   returnValue.push_back("Name");
   returnValue.push_back("Color");
   returnValue.push_back("Opcty");
   returnValue.push_back("RnrSelf");
   returnValue.push_back("RnrChildren");
   returnValue.push_back("Material");
   return returnValue;
}
bool FWGeometryTableManagerBase::getVisibility ( const NodeInfo nodeInfo) const [virtual]

Reimplemented in FWGeometryTableManager.

Definition at line 348 of file FWGeometryTableManagerBase.cc.

References kVisNodeSelf, and FWGeometryTableManagerBase::NodeInfo::testBit().

{
   return data.testBit(kVisNodeSelf);
}
bool FWGeometryTableManagerBase::getVisibilityChld ( const NodeInfo nodeInfo) const [virtual]

Reimplemented in FWGeometryTableManager.

Definition at line 353 of file FWGeometryTableManagerBase.cc.

References kVisNodeChld, and FWGeometryTableManagerBase::NodeInfo::testBit().

{
   return data.testBit(kVisNodeChld);
}
virtual void FWGeometryTableManagerBase::implSort ( int  iCol,
bool  iSortOrder 
) [inline, virtual]

Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.

Implements FWTableManagerBase.

Definition at line 135 of file FWGeometryTableManagerBase.h.

{}
bool FWGeometryTableManagerBase::isNodeRendered ( int  idx,
int  top_node_idx 
) const

Definition at line 359 of file FWGeometryTableManagerBase.cc.

References data, customizeTrackingMonitorSeedNumber::idx, kVisNodeChld, kVisNodeSelf, m_entries, FWGeometryTableManagerBase::NodeInfo::m_parent, and FWGeometryTableManagerBase::NodeInfo::testBit().

Referenced by FWOverlapTableView::refreshTable3D().

{
   const NodeInfo& data = m_entries[idx];
   bool foundParent = false;

   if (data.testBit(kVisNodeSelf))
   {
      int pidx = data.m_parent;
      while (pidx >= 0 ) 
      {
         if (!m_entries[pidx].testBit(kVisNodeChld)) {
            // printf ("parent disallow not visible !!! \n");
            return false;
         }

         if (pidx == topNodeIdx) { foundParent = true; 
            // printf("parent found \n"); 
            break;
         }
         pidx = m_entries[pidx].m_parent;
      }

      return foundParent;
   }
   return false;
}
void FWGeometryTableManagerBase::loadGeometry ( TGeoNode *  ,
TObjArray *   
)

Reimplemented in FWGeometryTableManager.

bool FWGeometryTableManagerBase::nodeImported ( int  idx) const
virtual bool FWGeometryTableManagerBase::nodeIsParent ( const NodeInfo ) const [inline, protected, virtual]

Reimplemented in FWGeometryTableManager, and FWOverlapTableManager.

Definition at line 111 of file FWGeometryTableManagerBase.h.

{ return false; }
int FWGeometryTableManagerBase::numberOfRows ( ) const [virtual]

Number of rows in the table.

Implements FWTableManagerBase.

Definition at line 135 of file FWGeometryTableManagerBase.cc.

References m_row_to_index.

{
   return m_row_to_index.size();
}
const FWGeometryTableManagerBase& FWGeometryTableManagerBase::operator= ( const FWGeometryTableManagerBase )
virtual void FWGeometryTableManagerBase::recalculateVisibility ( ) [pure virtual]
void FWGeometryTableManagerBase::redrawTable ( bool  setExpand = false)

Definition at line 221 of file FWGeometryTableManagerBase.cc.

References FWTableManagerBase::dataChanged(), m_entries, recalculateVisibility(), and FWTableManagerBase::visualPropertiesChanged().

Referenced by FWGeometryTableView::autoExpandCallback(), cancelEditor(), FWGeometryTableViewBase::refreshTable3D(), FWGeometryTableViewBase::setColumnSelected(), and showEditor().

{
   //   std::cerr << "GeometryTableManagerBase::redrawTable ------------------------------------- \n";
   if (m_entries.empty()) return;

   //   if (setExpand) checkExpandLevel();

   recalculateVisibility();


   dataChanged();
   visualPropertiesChanged();
}
Entries_v& FWGeometryTableManagerBase::refEntries ( ) [inline]
NodeInfo& FWGeometryTableManagerBase::refEntry ( int  i) [inline]
std::vector<int> FWGeometryTableManagerBase::rowToIndex ( ) [inline]

Definition at line 132 of file FWGeometryTableManagerBase.h.

References m_row_to_index.

Referenced by FWGeometryTableViewBase::cellClicked(), and firstColumnClicked().

{ return m_row_to_index; }
void FWGeometryTableManagerBase::setBackgroundToWhite ( bool  iToWhite)
void FWGeometryTableManagerBase::setCellValueEditor ( TGTextEntry *  editor)
void FWGeometryTableManagerBase::setDaughtersSelfVisibility ( bool  )
void FWGeometryTableManagerBase::setDaughtersSelfVisibility ( int  selectedIdx,
bool  v 
) [virtual]

Reimplemented in FWGeometryTableManager, and FWOverlapTableManager.

Definition at line 329 of file FWGeometryTableManagerBase.cc.

References data, getNNodesTotal(), customizeTrackingMonitorSeedNumber::idx, m_entries, n, setVisibility(), and setVisibilityChld().

{
   TGeoNode  *parentNode = m_entries[selectedIdx].m_node;
   int nD   = parentNode->GetNdaughters();
   int dOff = 0;
   for (int n = 0; n != nD; ++n)
   {
      int idx = selectedIdx + 1 + n + dOff;
      NodeInfo& data = m_entries[idx];
      
      setVisibility(data, v);
      setVisibilityChld(data, v);
      
      getNNodesTotal(parentNode->GetDaughter(n), dOff);
   }
}
void FWGeometryTableManagerBase::setLevelOffset ( int  x) [inline]
void FWGeometryTableManagerBase::setVisibility ( NodeInfo data,
bool  x 
) [virtual]
void FWGeometryTableManagerBase::setVisibilityChld ( NodeInfo data,
bool  x 
) [virtual]
void FWGeometryTableManagerBase::showEditor ( int  row)

Definition at line 266 of file FWGeometryTableManagerBase.cc.

References m_editor, m_editTransparencyIdx, m_entries, and redrawTable().

Referenced by FWGeometryTableViewBase::cellClicked().

{
   m_editTransparencyIdx = row;
   m_editor->UnmapWindow();
   m_editor->SetText(Form("%d", 100 - m_entries[row].m_transparency));
   m_editor->Resize(40, 17);
   m_editor->SetCursorPosition(2);
   redrawTable();
}
const std::string FWGeometryTableManagerBase::title ( ) const [virtual]

Definition at line 155 of file FWGeometryTableManagerBase.cc.

{
   return "Geometry";
}
int FWGeometryTableManagerBase::unsortedRowNumber ( int  iSortedRowNumber) const [virtual]

when passed the index to the sorted order of the rows it returns the original row number from the underlying data

Implements FWTableManagerBase.

Definition at line 130 of file FWGeometryTableManagerBase.cc.

{
   return unsorted;
}

Friends And Related Function Documentation

friend class FWGeometryTableViewBase [friend]

Definition at line 39 of file FWGeometryTableManagerBase.h.


Member Data Documentation

Definition at line 88 of file FWGeometryTableManagerBase.h.