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 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

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().

104  :
105  m_highlightIdx(-1),
106  m_levelOffset(0),
107  m_editor(0),
109 {
112 
113  GCValues_t gval;
114  gval.fMask = kGCForeground | kGCBackground | kGCStipple | kGCFillStyle | kGCGraphicsExposures;
115  gval.fForeground = gVirtualX->GetPixel(kGray);//gClient->GetResourcePool()->GetFrameHiliteColor();
116  gval.fBackground = gVirtualX->GetPixel(kWhite);//gClient->GetResourcePool()->GetFrameBgndColor();
117  gval.fFillStyle = kFillOpaqueStippled; // kFillTiled;
118  gval.fStipple = gClient->GetResourcePool()->GetCheckeredBitmap();
119  gval.fGraphicsExposures = kFALSE;
120  m_highlightContext = gClient->GetGC(&gval, kTRUE);
121 
123 }
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 125 of file FWGeometryTableManagerBase.cc.

126 {
127 }
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().

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

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

Reimplemented from FWTableManagerBase.

Definition at line 186 of file FWGeometryTableManagerBase.h.

References funct::false.

186 { return false ; }
virtual const char* FWGeometryTableManagerBase::cellName ( const NodeInfo ) const
inlinevirtual

Reimplemented in FWGeometryTableManager.

Definition at line 118 of file FWGeometryTableManagerBase.h.

118 { 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().

173 {
174  if (row == -1)
175  return false;
176 
177  int idx = rowToIndex()[row];
178  // printf("click %s \n", m_entries[idx].name());
179 
180  int off = 0;
181  if (idx >= 0)
182  off = (m_entries[idx].m_level - m_levelOffset)* 20;
183 
184  // printf("compare %d %d level %d\n" , xPos, off, idx);
185  if (xPos > off && xPos < (off + 20))
186  {
187  m_entries[idx].switchBit(kExpanded);
188 
190  dataChanged();
192  return false;
193  }
194 
195  return true;
196 }
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 150 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 203 of file FWGeometryTableManagerBase.cc.

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

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

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

239 {
240  std::vector<std::string> relPath;
241  while(idx >= 0)
242  {
243  relPath.push_back( m_entries[idx].name());
244  // printf("push %s \n",m_entries[idx].name() );
245  idx = m_entries[idx].m_parent;
246  }
247 
248  size_t ns = relPath.size();
249  for (size_t i = 1; i < ns; ++i )
250  {
251  path +="/";
252  path += relPath[ns-i -1];
253  // printf("push_back add to path %s\n", path.c_str());
254  }
255 }
int i
Definition: DBlmapReader.cc:9
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 141 of file FWGeometryTableManagerBase.cc.

References FWTableManagerBase::numberOfColumns().

142 {
143  std::vector<std::string> returnValue;
144  returnValue.reserve(numberOfColumns());
145 
146  returnValue.push_back("Name");
147  returnValue.push_back("Color");
148  returnValue.push_back("Opcty");
149  returnValue.push_back("RnrSelf");
150  returnValue.push_back("RnrChildren");
151  returnValue.push_back("Material");
152  return returnValue;
153 }
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 348 of file FWGeometryTableManagerBase.cc.

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

349 {
350  return data.testBit(kVisNodeSelf);
351 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
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().

354 {
355  return data.testBit(kVisNodeChld);
356 }
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 135 of file FWGeometryTableManagerBase.h.

135 {}
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().

360 {
361  const NodeInfo& data = m_entries[idx];
362  bool foundParent = false;
363 
364  if (data.testBit(kVisNodeSelf))
365  {
366  int pidx = data.m_parent;
367  while (pidx >= 0 )
368  {
369  if (!m_entries[pidx].testBit(kVisNodeChld)) {
370  // printf ("parent disallow not visible !!! \n");
371  return false;
372  }
373 
374  if (pidx == topNodeIdx) { foundParent = true;
375  // printf("parent found \n");
376  break;
377  }
378  pidx = m_entries[pidx].m_parent;
379  }
380 
381  return foundParent;
382  }
383  return false;
384 }
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 111 of file FWGeometryTableManagerBase.h.

111 { 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.

136 {
137  return m_row_to_index.size();
138 }
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().

222 {
223  // std::cerr << "GeometryTableManagerBase::redrawTable ------------------------------------- \n";
224  if (m_entries.empty()) return;
225 
226  // if (setExpand) checkExpandLevel();
227 
229 
230 
231  dataChanged();
233 }
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 132 of file FWGeometryTableManagerBase.h.

References m_row_to_index.

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

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

Definition at line 161 of file FWGeometryTableManagerBase.cc.

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

Referenced by FWGeometryTableViewBase::setBackgroundColor().

162 {
163  if(iToWhite) {
164  m_renderer.setGraphicsContext(&TGFrame::GetBlackGC());
165  } else {
166  m_renderer.setGraphicsContext(&TGFrame::GetWhiteGC());
167  }
168  m_renderer.setBlackIcon(iToWhite);
169 }
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 329 of file FWGeometryTableManagerBase.cc.

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

330 {
331  TGeoNode *parentNode = m_entries[selectedIdx].m_node;
332  int nD = parentNode->GetNdaughters();
333  int dOff = 0;
334  for (int n = 0; n != nD; ++n)
335  {
336  int idx = selectedIdx + 1 + n + dOff;
337  NodeInfo& data = m_entries[idx];
338 
339  setVisibility(data, v);
340  setVisibilityChld(data, v);
341 
342  getNNodesTotal(parentNode->GetDaughter(n), dOff);
343  }
344 }
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 266 of file FWGeometryTableManagerBase.cc.

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

Referenced by FWGeometryTableViewBase::cellClicked().

267 {
268  m_editTransparencyIdx = row;
269  m_editor->UnmapWindow();
270  m_editor->SetText(Form("%d", 100 - m_entries[row].m_transparency));
271  m_editor->Resize(40, 17);
272  m_editor->SetCursorPosition(2);
273  redrawTable();
274 }
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 130 of file FWGeometryTableManagerBase.cc.

131 {
132  return unsorted;
133 }

Friends And Related Function Documentation

friend class FWGeometryTableViewBase
friend

Definition at line 39 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 88 of file FWGeometryTableManagerBase.h.

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