CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWGeometryTableManagerBase.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWGeometryTableManagerBase_h
2 #define Fireworks_Core_FWGeometryTableManagerBase_h
3 // -*- C++ -*-
4 //
5 // Package: Core
6 // Class : FWGeometryTableManagerBase
7 //
16 //
17 // Original Author: Alja Mrak-Tadel, Matevz Tadel
18 // Created: Thu Jan 27 14:50:40 CET 2011
19 // $Id: FWGeometryTableManagerBase.h,v 1.8 2013/04/14 20:39:19 amraktad Exp $
20 //
21 
22 #include <sigc++/sigc++.h>
23 
25 
30 
31 #include "TGeoNode.h"
32 
34 class TGeoNode;
35 class TEvePointSet;
36 
38 {
40 
41 public:
42  // enum ESelectionState { kNone, kSelected, kHighlighted, kFiltered };
43 
44  enum Bits
45  {
46  kExpanded = BIT(0),
47 
48  kVisNodeSelf = BIT(1),
49  kVisNodeChld = BIT(2),
50 
51  kHighlighted = BIT(3),
52  kSelected = BIT(4)
53  };
54 
55  struct NodeInfo
56  {
57  NodeInfo():m_node(0), m_parent(-1), m_color(0), m_level(-1),
59 
60  NodeInfo(TGeoNode* n, Int_t p, Color_t col, Char_t l, UChar_t f = kVisNodeSelf|kVisNodeChld ):m_node(n), m_parent(p), m_color(col), m_level(l),
61  m_flags(f) {}
62 
63  TGeoNode* m_node;
64  Int_t m_parent;
65  Color_t m_color;
69 
70 
71  const char* name() const;
72  // const char* nameIndent() const;
73 
74  void setBit(UChar_t f) { m_flags |= f;}
75  void resetBit(UChar_t f) { m_flags &= ~f; }
76  void setBitVal(UChar_t f, bool x) { x ? setBit(f) : resetBit(f);}
77 
78  bool testBit(UChar_t f) const { return (m_flags & f) == f; }
79  bool testBitAny(UChar_t f) const { return (m_flags & f) != 0; }
80 
81  void switchBit(UChar_t f) { testBit(f) ? resetBit(f) : setBit(f); }
82  };
83 
84 
85  typedef std::vector<NodeInfo> Entries_v;
86  typedef Entries_v::iterator Entries_i;
87 
89 
90  //private:
91  // AMT: this could be a common base class with FWCollectionSummaryModelCellRenderer ..
93  {
94  public:
96  virtual ~ColorBoxRenderer();
97 
98  virtual UInt_t width() const { return m_width; }
99  virtual UInt_t height() const { return m_height; }
100  void setData(Color_t c, bool);
101  virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight);
102 
105  Pixel_t m_color;
108  };
109 
110 protected:
111  virtual bool nodeIsParent(const NodeInfo&) const { return false; }
112  // virtual ESelectionState nodeSelectionState(int idx) const;
113 
114 public:
116  virtual ~FWGeometryTableManagerBase();
117  // virtual std::string& cellName(const NodeInfo& ) const { return &std::string("ddd");}
118  virtual const char* cellName(const NodeInfo& ) const { return 0;}
119 
120  // virtual functions of FWTableManagerBase
121 
122  virtual int unsortedRowNumber(int unsorted) const;
123  virtual int numberOfRows() const;
124  virtual std::vector<std::string> getTitles() const;
125 
126  virtual const std::string title() const;
127 
128  //int selectedRow() const;
129  //int selectedColumn() const;
130  //virtual bool rowIsSelected(int row) const;
131 
132  std::vector<int> rowToIndex() { return m_row_to_index; }
133 
134  // void setSelection(int row, int column, int mask);
135  virtual void implSort(int, bool) {}
136 
137  bool nodeImported(int idx) const;
138  // geo stuff
139 
140  NodeInfo* getSelected();
141 
143  NodeInfo& refEntry(int i) {return m_entries[i];}
144 
145  void loadGeometry( TGeoNode* , TObjArray*);
146 
147  void setBackgroundToWhite(bool);
148  void getNodePath(int, std::string&) const;
149 
150  int getLevelOffset() const { return m_levelOffset; }
151  void setLevelOffset(int x) { m_levelOffset =x; }
152 
153  void setDaughtersSelfVisibility(bool);
154 
155  void getNodeMatrix(const NodeInfo& nodeInfo, TGeoHMatrix& mat) const;
156 
157 
158  virtual void setVisibility(NodeInfo&, bool );
159  virtual void setVisibilityChld(NodeInfo&, bool);
160  virtual void setDaughtersSelfVisibility(int selectedIdx, bool v);
161 
162  virtual bool getVisibilityChld(const NodeInfo& nodeInfo) const;
163  virtual bool getVisibility (const NodeInfo& nodeInfo) const;
164 
165  bool isNodeRendered(int idx, int top_node_idx) const;
166 
167  static void getNNodesTotal(TGeoNode* geoNode, int& off);
168 
169  void showEditor(int);
170  void cancelEditor(bool);
171  void setCellValueEditor(TGTextEntry *editor);
173  // protected:
175  const FWGeometryTableManagerBase& operator=(const FWGeometryTableManagerBase&); // stop default
176 
177 
178  bool firstColumnClicked(int row, int xPos);
179  // void changeSelection(int iRow, int iColumn);
180 
181  void redrawTable(bool setExpand = false);
182 
183  virtual void recalculateVisibility() = 0;
184 
185 
186  virtual bool cellDataIsSortable() const { return false ; }
187  // ---------- member data --------------------------------
188 
189 
190  // table stuff
191  mutable TGGC* m_highlightContext;
194 
195  std::vector<int> m_row_to_index;
196 
198 
200 
201  TGTextEntry* m_editor;
203 };
204 
205 
206 
207 inline void FWGeometryTableManagerBase::getNNodesTotal(TGeoNode* geoNode, int& off)
208 {
209  int nD = geoNode->GetNdaughters();
210  off += nD;
211  for (int i = 0; i < nD; ++i )
212  {
213  getNNodesTotal(geoNode->GetDaughter(i), off);
214  }
215 }
216 
217 #endif
int i
Definition: DBlmapReader.cc:9
bool isNodeRendered(int idx, int top_node_idx) const
virtual std::vector< std::string > getTitles() const
returns the title names for each column
virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
bool firstColumnClicked(int row, int xPos)
virtual bool nodeIsParent(const NodeInfo &) const
virtual bool getVisibility(const NodeInfo &nodeInfo) const
virtual const char * cellName(const NodeInfo &) const
virtual void recalculateVisibility()=0
virtual bool getVisibilityChld(const NodeInfo &nodeInfo) const
void getNodePath(int, std::string &) const
void getNodeMatrix(const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
virtual void setVisibilityChld(NodeInfo &, bool)
double xPos
bool nodeImported(int idx) const
virtual void implSort(int, bool)
Called by &#39;sort&#39; method to actually handle the sorting of the rows. Arguments are the same as &#39;sort&#39;...
unsigned char UChar_t
Definition: FUTypes.h:14
const FWGeometryTableManagerBase & operator=(const FWGeometryTableManagerBase &)
virtual const std::string title() const
double f[11][100]
void loadGeometry(TGeoNode *, TObjArray *)
void setDaughtersSelfVisibility(bool)
virtual void setVisibility(NodeInfo &, bool)
unsigned int UInt_t
Definition: FUTypes.h:12
static void getNNodesTotal(TGeoNode *geoNode, int &off)
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 und...
NodeInfo(TGeoNode *n, Int_t p, Color_t col, Char_t l, UChar_t f=kVisNodeSelf|kVisNodeChld)
tuple editor
Definition: idDealer.py:73
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
void setCellValueEditor(TGTextEntry *editor)
virtual UInt_t height() const
returns the minimum height of the cell to which the renderer is representing
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
Definition: DDAxes.h:10
virtual bool cellDataIsSortable() const
int col
Definition: cuy.py:1008
void redrawTable(bool setExpand=false)
virtual int numberOfRows() const
Number of rows in the table.