CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends
FWGeometryTableManagerBase Class Referenceabstract

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

Inheritance diagram for FWGeometryTableManagerBase:
FWTableManagerBase FWGeometryTableManager FWOverlapTableManager

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 More...
 
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'. More...
 
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. More...
 
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 More...
 
virtual ~FWGeometryTableManagerBase ()
 
- Public Member Functions inherited from FWTableManagerBase
virtual void buttonPressedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 Called if mouse button pressed in Row Header, defaults is to do nothing. More...
 
virtual void buttonReleasedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 
virtual unsigned int cellHeight () const
 require all cells to be the same height More...
 
virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const =0
 
 ClassDef (FWTableManagerBase, 0)
 
void dataChanged ()
 Classes which inherit from FWTableManagerBase must call this when their underlying data changes. More...
 
 FWTableManagerBase ()
 
virtual bool hasLabelHeaders () const
 
virtual bool hasRowHeaders () const
 Returns 'true' if this table has row headers. Defaults return value is false. More...
 
virtual std::vector< unsigned int > maxWidthForColumns () const
 for each column in the table this returns the present maximum width for that column More...
 
virtual int numberOfColumns () const =0
 Number of columns in the table. More...
 
virtual FWTableCellRendererBaserowHeader (int iSortedRowNumber) const
 Returns the renderer for the row header for the sorted row number iSortedRowNumber. More...
 
void sort (int iCol, bool iSortOrder)
 Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder is 'true'. More...
 
int sortColumn (void)
 The current sort column. More...
 
bool sortOrder (void)
 The current sort order for the table. More...
 
void visualPropertiesChanged ()
 Classes which inherit from FWTableManagerBase must call this when how the data is shown (e.g. color) changes. More...
 
virtual ~FWTableManagerBase ()
 

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 36 of file FWGeometryTableManagerBase.h.

Member Typedef Documentation

typedef Entries_v::iterator FWGeometryTableManagerBase::Entries_i

Definition at line 85 of file FWGeometryTableManagerBase.h.

Definition at line 84 of file FWGeometryTableManagerBase.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

FWGeometryTableManagerBase::FWGeometryTableManagerBase ( )

Definition at line 102 of file FWGeometryTableManagerBase.cc.

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

103  :
104  m_highlightIdx(-1),
105  m_levelOffset(0),
106  m_editor(0),
108 {
111 
112  GCValues_t gval;
113  gval.fMask = kGCForeground | kGCBackground | kGCStipple | kGCFillStyle | kGCGraphicsExposures;
114  gval.fForeground = gVirtualX->GetPixel(kGray);//gClient->GetResourcePool()->GetFrameHiliteColor();
115  gval.fBackground = gVirtualX->GetPixel(kWhite);//gClient->GetResourcePool()->GetFrameBgndColor();
116  gval.fFillStyle = kFillOpaqueStippled; // kFillTiled;
117  gval.fStipple = gClient->GetResourcePool()->GetCheckeredBitmap();
118  gval.fGraphicsExposures = kFALSE;
119  m_highlightContext = gClient->GetGC(&gval, kTRUE);
120 
122 }
virtual UInt_t height() const
returns the minimum height of the cell to which the renderer is representing
void setHighlightContext(const TGGC *context)
FWGeometryTableManagerBase::~FWGeometryTableManagerBase ( )
virtual

Definition at line 124 of file FWGeometryTableManagerBase.cc.

125 {
126 }
FWGeometryTableManagerBase::FWGeometryTableManagerBase ( const FWGeometryTableManagerBase )

Member Function Documentation

void FWGeometryTableManagerBase::applyTransparencyFromEditor ( )

Definition at line 277 of file FWGeometryTableManagerBase.cc.

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

Referenced by FWGeometryTableViewBase::transparencyChanged().

278 {
279  printf("transparency idx %d opaci %s \n",m_editTransparencyIdx, m_editor->GetText() );
280  if ( m_editTransparencyIdx >= 0)
281  {
282  using boost::lexical_cast;
283  using boost::bad_lexical_cast;
284  try {
285  int t = lexical_cast<int>(m_editor->GetText());
286  if (t > 100 || t < 0 )
287  {
288  fwLog(fwlog::kError) << "Transparency must be set in procentage [0-100].";
289  return;
290  }
291  m_entries[m_editTransparencyIdx].m_transparency = 100 - t;
292  printf("SET !! \n");
293  cancelEditor(true);
294  }
295  catch (bad_lexical_cast &) {
296  fwLog(fwlog::kError) << "Bad Lexical cast. Transparency must be set in procentage [0-100].";
297  }
298  }
299 }
#define fwLog(_level_)
Definition: fwLog.h:50
void FWGeometryTableManagerBase::cancelEditor ( bool  redraw)

Definition at line 301 of file FWGeometryTableManagerBase.cc.

References m_editor, m_editTransparencyIdx, and redrawTable().

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

302 {
304 
305  if ( m_editor->IsMapped())
306  {
307  m_editor->UnmapWindow();
308  if (redraw) redrawTable();
309  }
310 }
void redrawTable(bool setExpand=false)
virtual bool FWGeometryTableManagerBase::cellDataIsSortable ( ) const
inlinevirtual

Reimplemented from FWTableManagerBase.

Definition at line 185 of file FWGeometryTableManagerBase.h.

References edm::false.

185 { return false ; }
volatile std::atomic< bool > shutdown_flag false
virtual const char* FWGeometryTableManagerBase::cellName ( const NodeInfo ) const
inlinevirtual

Reimplemented in FWGeometryTableManager.

Definition at line 117 of file FWGeometryTableManagerBase.h.

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

Definition at line 171 of file FWGeometryTableManagerBase.cc.

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

Referenced by FWGeometryTableViewBase::cellClicked().

172 {
173  if (row == -1)
174  return false;
175 
176  int idx = rowToIndex()[row];
177  // printf("click %s \n", m_entries[idx].name());
178 
179  int off = 0;
180  if (idx >= 0)
181  off = (m_entries[idx].m_level - m_levelOffset)* 20;
182 
183  // printf("compare %d %d level %d\n" , xPos, off, idx);
184  if (xPos > off && xPos < (off + 20))
185  {
186  m_entries[idx].switchBit(kExpanded);
187 
189  dataChanged();
191  return false;
192  }
193 
194  return true;
195 }
virtual void recalculateVisibility()=0
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
double xPos
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
int FWGeometryTableManagerBase::getLevelOffset ( ) const
inline

Definition at line 149 of file FWGeometryTableManagerBase.h.

References m_levelOffset.

Referenced by FWEveDetectorGeo::Paint().

void FWGeometryTableManagerBase::getNNodesTotal ( TGeoNode *  geoNode,
int &  off 
)
inlinestatic
void FWGeometryTableManagerBase::getNodeMatrix ( const NodeInfo nodeInfo,
TGeoHMatrix &  mat 
) const

Definition at line 202 of file FWGeometryTableManagerBase.cc.

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

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

203 {
204  // utility used by browser and FWGeoNode
205  // printf("================ FWGeometryTableManagerBase::getNodeMatri \n");
206  int pIdx = data.m_parent;
207 
208  while (pIdx > 0)
209  {
210  // printf("%s [%d]\n",m_entries.at(pIdx).name(), m_entries.at(pIdx).m_level );
211  mtx.MultiplyLeft(m_entries.at(pIdx).m_node->GetMatrix());
212  pIdx = m_entries.at(pIdx).m_parent;
213  }
214 
215  // printf("right %s [%d]\n",data.name(), data.m_level );
216  mtx.Multiply(data.m_node->GetMatrix());
217 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FWGeometryTableManagerBase::getNodePath ( int  idx,
std::string &  path 
) const

Definition at line 237 of file FWGeometryTableManagerBase.cc.

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

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

238 {
239  std::vector<std::string> relPath;
240  while(idx >= 0)
241  {
242  relPath.push_back( m_entries[idx].name());
243  // printf("push %s \n",m_entries[idx].name() );
244  idx = m_entries[idx].m_parent;
245  }
246 
247  size_t ns = relPath.size();
248  for (size_t i = 1; i < ns; ++i )
249  {
250  path +="/";
251  path += relPath[ns-i -1];
252  // printf("push_back add to path %s\n", path.c_str());
253  }
254 }
int i
Definition: DBlmapReader.cc:9
tuple path
else: Piece not in the list, fine.
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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 140 of file FWGeometryTableManagerBase.cc.

References FWTableManagerBase::numberOfColumns().

141 {
142  std::vector<std::string> returnValue;
143  returnValue.reserve(numberOfColumns());
144 
145  returnValue.push_back("Name");
146  returnValue.push_back("Color");
147  returnValue.push_back("Opcty");
148  returnValue.push_back("RnrSelf");
149  returnValue.push_back("RnrChildren");
150  returnValue.push_back("Material");
151  return returnValue;
152 }
virtual int numberOfColumns() const =0
Number of columns in the table.
bool FWGeometryTableManagerBase::getVisibility ( const NodeInfo nodeInfo) const
virtual

Reimplemented in FWGeometryTableManager.

Definition at line 347 of file FWGeometryTableManagerBase.cc.

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

348 {
349  return data.testBit(kVisNodeSelf);
350 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool FWGeometryTableManagerBase::getVisibilityChld ( const NodeInfo nodeInfo) const
virtual

Reimplemented in FWGeometryTableManager.

Definition at line 352 of file FWGeometryTableManagerBase.cc.

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

353 {
354  return data.testBit(kVisNodeChld);
355 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual void FWGeometryTableManagerBase::implSort ( int  iCol,
bool  iSortOrder 
)
inlinevirtual

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

Implements FWTableManagerBase.

Definition at line 134 of file FWGeometryTableManagerBase.h.

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

Definition at line 358 of file FWGeometryTableManagerBase.cc.

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

Referenced by FWOverlapTableView::refreshTable3D().

359 {
360  const NodeInfo& data = m_entries[idx];
361  bool foundParent = false;
362 
363  if (data.testBit(kVisNodeSelf))
364  {
365  int pidx = data.m_parent;
366  while (pidx >= 0 )
367  {
368  if (!m_entries[pidx].testBit(kVisNodeChld)) {
369  // printf ("parent disallow not visible !!! \n");
370  return false;
371  }
372 
373  if (pidx == topNodeIdx) { foundParent = true;
374  // printf("parent found \n");
375  break;
376  }
377  pidx = m_entries[pidx].m_parent;
378  }
379 
380  return foundParent;
381  }
382  return false;
383 }
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FWGeometryTableManagerBase::loadGeometry ( TGeoNode *  ,
TObjArray *   
)
bool FWGeometryTableManagerBase::nodeImported ( int  idx) const
virtual bool FWGeometryTableManagerBase::nodeIsParent ( const NodeInfo ) const
inlineprotectedvirtual

Reimplemented in FWGeometryTableManager, and FWOverlapTableManager.

Definition at line 110 of file FWGeometryTableManagerBase.h.

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

Number of rows in the table.

Implements FWTableManagerBase.

Definition at line 134 of file FWGeometryTableManagerBase.cc.

References m_row_to_index.

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

Definition at line 220 of file FWGeometryTableManagerBase.cc.

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

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

221 {
222  // std::cerr << "GeometryTableManagerBase::redrawTable ------------------------------------- \n";
223  if (m_entries.empty()) return;
224 
225  // if (setExpand) checkExpandLevel();
226 
228 
229 
230  dataChanged();
232 }
virtual void recalculateVisibility()=0
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
Entries_v& FWGeometryTableManagerBase::refEntries ( )
inline
NodeInfo& FWGeometryTableManagerBase::refEntry ( int  i)
inline
std::vector<int> FWGeometryTableManagerBase::rowToIndex ( )
inline

Definition at line 131 of file FWGeometryTableManagerBase.h.

References m_row_to_index.

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

131 { return m_row_to_index; }
void FWGeometryTableManagerBase::setBackgroundToWhite ( bool  iToWhite)

Definition at line 160 of file FWGeometryTableManagerBase.cc.

References m_renderer, FWTextTreeCellRenderer::setBlackIcon(), and FWTextTableCellRenderer::setGraphicsContext().

Referenced by FWGeometryTableViewBase::setBackgroundColor().

161 {
162  if(iToWhite) {
163  m_renderer.setGraphicsContext(&TGFrame::GetBlackGC());
164  } else {
165  m_renderer.setGraphicsContext(&TGFrame::GetWhiteGC());
166  }
167  m_renderer.setBlackIcon(iToWhite);
168 }
void setGraphicsContext(const TGGC *iContext)
void FWGeometryTableManagerBase::setCellValueEditor ( TGTextEntry *  editor)
void FWGeometryTableManagerBase::setDaughtersSelfVisibility ( bool  )
void FWGeometryTableManagerBase::setDaughtersSelfVisibility ( int  selectedIdx,
bool  v 
)
virtual

Reimplemented in FWOverlapTableManager, and FWGeometryTableManager.

Definition at line 328 of file FWGeometryTableManagerBase.cc.

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

329 {
330  TGeoNode *parentNode = m_entries[selectedIdx].m_node;
331  int nD = parentNode->GetNdaughters();
332  int dOff = 0;
333  for (int n = 0; n != nD; ++n)
334  {
335  int idx = selectedIdx + 1 + n + dOff;
336  NodeInfo& data = m_entries[idx];
337 
338  setVisibility(data, v);
339  setVisibilityChld(data, v);
340 
341  getNNodesTotal(parentNode->GetDaughter(n), dOff);
342  }
343 }
virtual void setVisibilityChld(NodeInfo &, bool)
virtual void setVisibility(NodeInfo &, bool)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
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 265 of file FWGeometryTableManagerBase.cc.

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

Referenced by FWGeometryTableViewBase::cellClicked().

266 {
267  m_editTransparencyIdx = row;
268  m_editor->UnmapWindow();
269  m_editor->SetText(Form("%d", 100 - m_entries[row].m_transparency));
270  m_editor->Resize(40, 17);
271  m_editor->SetCursorPosition(2);
272  redrawTable();
273 }
void redrawTable(bool setExpand=false)
const std::string FWGeometryTableManagerBase::title ( ) const
virtual
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 129 of file FWGeometryTableManagerBase.cc.

130 {
131  return unsorted;
132 }

Friends And Related Function Documentation

friend class FWGeometryTableViewBase
friend

Definition at line 38 of file FWGeometryTableManagerBase.h.

Member Data Documentation

ColorBoxRenderer FWGeometryTableManagerBase::m_colorBoxRenderer
mutable
TGTextEntry* FWGeometryTableManagerBase::m_editor
int FWGeometryTableManagerBase::m_editTransparencyIdx
Entries_v FWGeometryTableManagerBase::m_entries
TGGC* FWGeometryTableManagerBase::m_highlightContext
mutable
int FWGeometryTableManagerBase::m_highlightIdx

Definition at line 87 of file FWGeometryTableManagerBase.h.

int FWGeometryTableManagerBase::m_levelOffset
FWTextTreeCellRenderer FWGeometryTableManagerBase::m_renderer
mutable
std::vector<int> FWGeometryTableManagerBase::m_row_to_index