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 //
20 
21 // system include files
22 #include "sigc++/connection.h"
23 
24 // user include files
25 
26 // user include files
33 
34 // forward declarations
35 
36 class FWEventItem;
37 class TEveElementList;
38 class TEveElement;
39 class FWModelId;
40 class FWInteractionList;
41 
42 namespace fireworks {
43  class Context;
44 }
45 
47 {
48 public:
49 
50  struct Product
51  {
54  TEveElementList* m_elements;
55  sigc::connection m_scaleConnection;
56 
58  ~Product();
59  };
60 
62  virtual ~FWProxyBuilderBase();
63 
64  // ---------- const member functions ---------------------
65 
66  const fireworks::Context& context() const;
67  const FWEventItem* item() const {
68  return m_item;
69  }
70  // ---------- static member functions --------------------
72  static std::string typeOfBuilder();
73 
77  static bool representsSubPart();
78  // ---------- member functions ---------------------------
79  virtual void setItem(const FWEventItem* iItem);
80  void setHaveWindow(bool iFlag);
81  void build();
82 
83  void modelChanges(const FWModelIds&);
84  void itemChanged(const FWEventItem*);
85  void scaleChanged(const FWViewContext*);
86 
87  virtual bool canHandle(const FWEventItem&);//note pass FWEventItem to see if type and container match
88 
89 
90  virtual void setInteractionList(FWInteractionList*, const std::string&);
91  virtual void itemBeingDestroyed(const FWEventItem*);
92 
93  // const member functions
94  virtual bool haveSingleProduct() const { return true; }
95  virtual bool havePerViewProduct(FWViewType::EType) const { return false; }
96  virtual bool willHandleInteraction() const { return false; }
97 
98  TEveElementList* createProduct(FWViewType::EType, const FWViewContext*);
100 
101  bool getHaveWindow() const { return m_haveWindow; }
102  void setupElement(TEveElement* el, bool color = true) const;
103  void setupAddElement(TEveElement* el, TEveElement* parent, bool set_color = true) const;
104  int layer() const;
105 
106 
107 protected:
108  // Override this if visibility changes can cause (re)-creation of proxies.
109  // Returns true if new proxies were created.
110  virtual bool visibilityModelChanges(const FWModelId&, TEveElement*, FWViewType::EType,
111  const FWViewContext*);
112 
113  // Override this if you need special handling of selection or other changes.
114  virtual void localModelChanges(const FWModelId& iId, TEveElement* iCompound,
115  FWViewType::EType viewType, const FWViewContext* vc);
116 
117  virtual void modelChanges(const FWModelIds&, Product*);
118 
119  virtual void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc) {};
120 
121  FWProxyBuilderBase(const FWProxyBuilderBase&); // stop default
122  const FWProxyBuilderBase& operator=(const FWProxyBuilderBase&); // stop default
123 
124  virtual void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*);
125  virtual void buildViewType(const FWEventItem* iItem, TEveElementList*, FWViewType::EType, const FWViewContext*);
126 
127  virtual void clean();
128  virtual void cleanLocal();
129 
130  void increaseComponentTransparency(unsigned int index, TEveElement* holder,
131  const std::string& name, Char_t transpOffset);
132 
133  // utility
134  TEveCompound* createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const;
135 
136  // ---------- member data --------------------------------
137  typedef std::vector<Product*>::iterator Product_it;
138 
139  std::vector<Product*> m_products;
140 
141 private:
142  void cleanProduct(Product* p);
143  void setProjectionLayer(float);
144 
145  // ---------- member data --------------------------------
146 
148 
150 
154 
155  float m_layer;
156 };
157 
158 #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
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 *)
parent
Definition: confdb.py:1052
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
static bool representsSubPart()
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 &)
std::set< FWModelId > FWModelIds
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