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.7 2012/05/10 23:57:52 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 
84  };
85 
86 
87  typedef std::vector<NodeInfo> Entries_v;
88  typedef Entries_v::iterator Entries_i;
89 
91 
92  //private:
93  // AMT: this could be a common base class with FWCollectionSummaryModelCellRenderer ..
95  {
96  public:
98  virtual ~ColorBoxRenderer();
99 
100  virtual UInt_t width() const { return m_width; }
101  virtual UInt_t height() const { return m_height; }
102  void setData(Color_t c, bool);
103  virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight);
104 
107  Pixel_t m_color;
110  };
111 
112 protected:
113  virtual bool nodeIsParent(const NodeInfo&) const { return false; }
114  // virtual ESelectionState nodeSelectionState(int idx) const;
115 
116 public:
118  virtual ~FWGeometryTableManagerBase();
119  // virtual std::string& cellName(const NodeInfo& ) const { return &std::string("ddd");}
120  virtual const char* cellName(const NodeInfo& ) const { return 0;}
121 
122  // virtual functions of FWTableManagerBase
123 
124  virtual int unsortedRowNumber(int unsorted) const;
125  virtual int numberOfRows() const;
126  virtual std::vector<std::string> getTitles() const;
127 
128  virtual const std::string title() const;
129 
130  //int selectedRow() const;
131  //int selectedColumn() const;
132  //virtual bool rowIsSelected(int row) const;
133 
134  std::vector<int> rowToIndex() { return m_row_to_index; }
135 
136  // void setSelection(int row, int column, int mask);
137  virtual void implSort(int, bool) {}
138 
139  bool nodeImported(int idx) const;
140  // geo stuff
141 
142  NodeInfo* getSelected();
143 
145  NodeInfo& refEntry(int i) {return m_entries[i];}
146 
147  void loadGeometry( TGeoNode* , TObjArray*);
148 
149  void setBackgroundToWhite(bool);
150  void getNodePath(int, std::string&) const;
151 
152  int getLevelOffset() const { return m_levelOffset; }
153  void setLevelOffset(int x) { m_levelOffset =x; }
154 
155  void setDaughtersSelfVisibility(bool);
156 
157  void getNodeMatrix(const NodeInfo& nodeInfo, TGeoHMatrix& mat) const;
158 
159 
160  virtual void setVisibility(NodeInfo&, bool );
161  virtual void setVisibilityChld(NodeInfo&, bool);
162  virtual void setDaughtersSelfVisibility(int selectedIdx, bool v);
163 
164  virtual bool getVisibilityChld(const NodeInfo& nodeInfo) const;
165  virtual bool getVisibility (const NodeInfo& nodeInfo) const;
166 
167  virtual void applyColorTranspToDaughters(int selectedIdx, bool recurse);
168 
169  bool isNodeRendered(int idx, int top_node_idx) const;
170 
171  static void getNNodesTotal(TGeoNode* geoNode, int& off);
172 
173  void showEditor(int);
174  void cancelEditor(bool);
175  void setCellValueEditor(TGTextEntry *editor);
177  // protected:
179  const FWGeometryTableManagerBase& operator=(const FWGeometryTableManagerBase&); // stop default
180 
181 
182  bool firstColumnClicked(int row, int xPos);
183  // void changeSelection(int iRow, int iColumn);
184 
185  void redrawTable(bool setExpand = false);
186 
187  virtual void recalculateVisibility() = 0;
188 
189 
190  virtual bool cellDataIsSortable() const { return false ; }
191  // ---------- member data --------------------------------
192 
193 
194  // table stuff
195  mutable TGGC* m_highlightContext;
198 
199  std::vector<int> m_row_to_index;
200 
202 
204 
205  TGTextEntry* m_editor;
207 };
208 
209 
210 
211 inline void FWGeometryTableManagerBase::getNNodesTotal(TGeoNode* geoNode, int& off)
212 {
213  int nD = geoNode->GetNdaughters();
214  off += nD;
215  for (int i = 0; i < nD; ++i )
216  {
217  getNNodesTotal(geoNode->GetDaughter(i), off);
218  }
219 }
220 
221 #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 applyColorTranspToDaughters(int selectedIdx, bool recurse)
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
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
virtual bool cellDataIsSortable() const
x
Definition: VDTMath.h:216
void redrawTable(bool setExpand=false)
mathSSE::Vec4< T > v
virtual int numberOfRows() const
Number of rows in the table.