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 //
20 
21 #include <sigc++/sigc++.h>
22 
24 
29 
30 #include "TGeoNode.h"
31 
33 class TGeoNode;
34 class TEvePointSet;
35 
37 {
39 
40 public:
41  // enum ESelectionState { kNone, kSelected, kHighlighted, kFiltered };
42 
43  enum Bits
44  {
45  kExpanded = BIT(0),
46 
47  kVisNodeSelf = BIT(1),
48  kVisNodeChld = BIT(2),
49 
50  kHighlighted = BIT(3),
51  kSelected = BIT(4)
52  };
53 
54  struct NodeInfo
55  {
56  NodeInfo():m_node(0), m_parent(-1), m_color(0), m_level(-1),
58 
59  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),
60  m_flags(f) {}
61 
62  TGeoNode* m_node;
63  Int_t m_parent;
64  Color_t m_color;
65  UChar_t m_level;
66  UChar_t m_flags;
67  UChar_t m_transparency;
68 
69 
70  const char* name() const;
71  // const char* nameIndent() const;
72 
73  void setBit(UChar_t f) { m_flags |= f;}
74  void resetBit(UChar_t f) { m_flags &= ~f; }
75  void setBitVal(UChar_t f, bool x) { x ? setBit(f) : resetBit(f);}
76 
77  bool testBit(UChar_t f) const { return (m_flags & f) == f; }
78  bool testBitAny(UChar_t f) const { return (m_flags & f) != 0; }
79 
80  void switchBit(UChar_t f) { testBit(f) ? resetBit(f) : setBit(f); }
81  };
82 
83 
84  typedef std::vector<NodeInfo> Entries_v;
85  typedef Entries_v::iterator Entries_i;
86 
88 
89  //private:
90  // AMT: this could be a common base class with FWCollectionSummaryModelCellRenderer ..
92  {
93  public:
95  virtual ~ColorBoxRenderer();
96 
97  virtual UInt_t width() const { return m_width; }
98  virtual UInt_t height() const { return m_height; }
99  void setData(Color_t c, bool);
100  virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight);
101 
102  UInt_t m_width;
103  UInt_t m_height;
104  Pixel_t m_color;
107  };
108 
109 protected:
110  virtual bool nodeIsParent(const NodeInfo&) const { return false; }
111  // virtual ESelectionState nodeSelectionState(int idx) const;
112 
113 public:
115  virtual ~FWGeometryTableManagerBase();
116  // virtual std::string& cellName(const NodeInfo& ) const { return &std::string("ddd");}
117  virtual const char* cellName(const NodeInfo& ) const { return 0;}
118 
119  // virtual functions of FWTableManagerBase
120 
121  virtual int unsortedRowNumber(int unsorted) const;
122  virtual int numberOfRows() const;
123  virtual std::vector<std::string> getTitles() const;
124 
125  virtual const std::string title() const;
126 
127  //int selectedRow() const;
128  //int selectedColumn() const;
129  //virtual bool rowIsSelected(int row) const;
130 
131  std::vector<int> rowToIndex() { return m_row_to_index; }
132 
133  // void setSelection(int row, int column, int mask);
134  virtual void implSort(int, bool) {}
135 
136  bool nodeImported(int idx) const;
137  // geo stuff
138 
139  NodeInfo* getSelected();
140 
142  NodeInfo& refEntry(int i) {return m_entries[i];}
143 
144  void loadGeometry( TGeoNode* , TObjArray*);
145 
146  void setBackgroundToWhite(bool);
147  void getNodePath(int, std::string&) const;
148 
149  int getLevelOffset() const { return m_levelOffset; }
150  void setLevelOffset(int x) { m_levelOffset =x; }
151 
152  void setDaughtersSelfVisibility(bool);
153 
154  void getNodeMatrix(const NodeInfo& nodeInfo, TGeoHMatrix& mat) const;
155 
156 
157  virtual void setVisibility(NodeInfo&, bool );
158  virtual void setVisibilityChld(NodeInfo&, bool);
159  virtual void setDaughtersSelfVisibility(int selectedIdx, bool v);
160 
161  virtual bool getVisibilityChld(const NodeInfo& nodeInfo) const;
162  virtual bool getVisibility (const NodeInfo& nodeInfo) const;
163 
164  bool isNodeRendered(int idx, int top_node_idx) const;
165 
166  static void getNNodesTotal(TGeoNode* geoNode, int& off);
167 
168  void showEditor(int);
169  void cancelEditor(bool);
170  void setCellValueEditor(TGTextEntry *editor);
172  // protected:
174  const FWGeometryTableManagerBase& operator=(const FWGeometryTableManagerBase&); // stop default
175 
176 
177  bool firstColumnClicked(int row, int xPos);
178  // void changeSelection(int iRow, int iColumn);
179 
180  void redrawTable(bool setExpand = false);
181 
182  virtual void recalculateVisibility() = 0;
183 
184 
185  virtual bool cellDataIsSortable() const { return false ; }
186  // ---------- member data --------------------------------
187 
188 
189  // table stuff
190  mutable TGGC* m_highlightContext;
193 
194  std::vector<int> m_row_to_index;
195 
197 
199 
200  TGTextEntry* m_editor;
202 };
203 
204 
205 
206 inline void FWGeometryTableManagerBase::getNNodesTotal(TGeoNode* geoNode, int& off)
207 {
208  int nD = geoNode->GetNdaughters();
209  off += nD;
210  for (int i = 0; i < nD; ++i )
211  {
212  getNNodesTotal(geoNode->GetDaughter(i), off);
213  }
214 }
215 
216 #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;...
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)
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
volatile std::atomic< bool > shutdown_flag false
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.