CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWProxyBuilderBase.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWProxyBuilderBase_h
2 #define Fireworks_Core_FWProxyBuilderBase_h
3 // -*- C++ -*-
4 //
5 // Package: Core
6 // Class : FWProxyBuilderBase
7 //
16 //
17 // Original Author: Chris Jones, Matevz Tadel, Alja Mrak-Tadel
18 // Created: Thu Mar 18 14:12:12 CET 2010
19 // $Id: FWProxyBuilderBase.h,v 1.17 2011/07/30 04:55:46 amraktad Exp $
20 //
21 
22 // system include files
23 #include "sigc++/connection.h"
24 
25 // user include files
26 
27 // user include files
34 
35 // forward declarations
36 
37 class FWEventItem;
38 class TEveElementList;
39 class TEveElement;
40 class FWModelId;
41 class FWInteractionList;
42 
43 namespace fireworks {
44  class Context;
45 }
46 
48 {
49 public:
50 
51  struct Product
52  {
55  TEveElementList* m_elements;
56  sigc::connection m_scaleConnection;
57 
59  ~Product();
60  };
61 
63  virtual ~FWProxyBuilderBase();
64 
65  // ---------- const member functions ---------------------
66 
67  const fireworks::Context& context() const;
68  const FWEventItem* item() const {
69  return m_item;
70  }
71  // ---------- static member functions --------------------
73  static std::string typeOfBuilder();
74 
78  static bool representsSubPart();
79  // ---------- member functions ---------------------------
80  virtual void setItem(const FWEventItem* iItem);
81  void setHaveWindow(bool iFlag);
82  void build();
83 
84  void modelChanges(const FWModelIds&);
85  void itemChanged(const FWEventItem*);
86  void scaleChanged(const FWViewContext*);
87 
88  virtual bool canHandle(const FWEventItem&);//note pass FWEventItem to see if type and container match
89 
90 
91  virtual void setInteractionList(FWInteractionList*, const std::string&);
92  virtual void itemBeingDestroyed(const FWEventItem*);
93 
94  // const member functions
95  virtual bool haveSingleProduct() const { return true; }
96  virtual bool havePerViewProduct(FWViewType::EType) const { return false; }
97  virtual bool willHandleInteraction() const { return false; }
98 
99  TEveElementList* createProduct(FWViewType::EType, const FWViewContext*);
101 
102  bool getHaveWindow() const { return m_haveWindow; }
103  void setupElement(TEveElement* el, bool color = true) const;
104  void setupAddElement(TEveElement* el, TEveElement* parent, bool set_color = true) const;
105  int layer() const;
106 
107 
108 protected:
109  // Override this if visibility changes can cause (re)-creation of proxies.
110  // Returns true if new proxies were created.
111  virtual bool visibilityModelChanges(const FWModelId&, TEveElement*, FWViewType::EType,
112  const FWViewContext*);
113 
114  // Override this if you need special handling of selection or other changes.
115  virtual void localModelChanges(const FWModelId& iId, TEveElement* iCompound,
116  FWViewType::EType viewType, const FWViewContext* vc);
117 
118  virtual void modelChanges(const FWModelIds&, Product*);
119 
120  virtual void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc) {};
121 
122  FWProxyBuilderBase(const FWProxyBuilderBase&); // stop default
123  const FWProxyBuilderBase& operator=(const FWProxyBuilderBase&); // stop default
124 
125  virtual void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*);
126  virtual void buildViewType(const FWEventItem* iItem, TEveElementList*, FWViewType::EType, const FWViewContext*);
127 
128  virtual void clean();
129  virtual void cleanLocal();
130 
131  void increaseComponentTransparency(unsigned int index, TEveElement* holder,
132  const std::string& name, Char_t transpOffset);
133 
134  // utility
135  TEveCompound* createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const;
136 
137  // ---------- member data --------------------------------
138  typedef std::vector<Product*>::iterator Product_it;
139 
140  std::vector<Product*> m_products;
141 
142 private:
143  void cleanProduct(Product* p);
144  void setProjectionLayer(float);
145 
146  // ---------- member data --------------------------------
147 
149 
151 
155 
156  float m_layer;
157 };
158 
159 #endif
const fireworks::Context & context() const
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
std::vector< Product * >::iterator Product_it
virtual void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
static std::string typeOfBuilder()
Used by the plugin system to determine how the proxy uses the data from FWEventItem.
std::vector< Product * > m_products
list parent
Definition: dbtoconf.py:74
virtual bool willHandleInteraction() const
virtual void itemBeingDestroyed(const FWEventItem *)
virtual bool havePerViewProduct(FWViewType::EType) const
virtual bool visibilityModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
static bool representsSubPart()
std::set< FWModelId > FWModelIds
const FWViewContext * m_viewContext
virtual void cleanLocal()
void scaleChanged(const FWViewContext *)
const FWEventItem * m_item
const FWEventItem * item() const
sigc::connection m_scaleConnection
virtual void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
Product(FWViewType::EType t, const FWViewContext *c)
const FWProxyBuilderBase & operator=(const FWProxyBuilderBase &)
void set_color(TEveElement *element, Color_t color, float alpha, unsigned int levels)
Definition: eve_macros.cc:154
virtual void setItem(const FWEventItem *iItem)
void removePerViewProduct(FWViewType::EType, const FWViewContext *vc)
void setHaveWindow(bool iFlag)
virtual bool haveSingleProduct() const
void cleanProduct(Product *p)
virtual bool canHandle(const FWEventItem &)
FWInteractionList * m_interactionList
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
bool getHaveWindow() const
TEveElementList * createProduct(FWViewType::EType, const FWViewContext *)
void setProjectionLayer(float)
void increaseComponentTransparency(unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
void itemChanged(const FWEventItem *)
void modelChanges(const FWModelIds &)
virtual void setInteractionList(FWInteractionList *, const std::string &)
void setupElement(TEveElement *el, bool color=true) const