Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:03

0001 #ifndef Fireworks_Core_FWProxyBuilderBase_h
0002 #define Fireworks_Core_FWProxyBuilderBase_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWProxyBuilderBase
0007 //
0008 /**\class FWProxyBuilderBase FWProxyBuilderBase.h Fireworks/Core/interface/FWProxyBuilderBase.h
0009 
0010  Description: [one line class summary]
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones, Matevz Tadel, Alja Mrak-Tadel
0018 //         Created:  Thu Mar 18 14:12:12 CET 2010
0019 //
0020 
0021 // system include files
0022 #include "sigc++/connection.h"
0023 
0024 // user include files
0025 
0026 // user include files
0027 #include "Fireworks/Core/interface/FWEvePtr.h"
0028 #include "Fireworks/Core/interface/FWViewType.h"
0029 #include "Fireworks/Core/interface/FWProxyBuilderFactory.h"
0030 #include "Fireworks/Core/interface/FWModelChangeSignal.h"
0031 #include "Fireworks/Core/interface/FWModelIdFromEveSelector.h"
0032 #include "Fireworks/Core/interface/FWViewContext.h"
0033 
0034 // forward declarations
0035 
0036 class FWEventItem;
0037 class TEveElementList;
0038 class TEveElement;
0039 class FWModelId;
0040 class FWInteractionList;
0041 
0042 namespace fireworks {
0043   class Context;
0044 }
0045 
0046 class FWProxyBuilderBase {
0047 public:
0048   struct Product {
0049     FWViewType::EType m_viewType;
0050     const FWViewContext* m_viewContext;
0051     TEveElementList* m_elements;
0052     sigc::connection m_scaleConnection;
0053 
0054     Product(FWViewType::EType t, const FWViewContext* c);
0055     ~Product();
0056   };
0057 
0058   FWProxyBuilderBase();
0059   virtual ~FWProxyBuilderBase();
0060 
0061   // ---------- const member functions ---------------------
0062 
0063   const fireworks::Context& context() const;
0064   const FWEventItem* item() const { return m_item; }
0065   // ---------- static member functions --------------------
0066   ///Used by the plugin system to determine how the proxy uses the data from FWEventItem
0067   static std::string typeOfBuilder();
0068 
0069   ///Used by the plugin system to determine precidence of different proxy builders for same type
0070   /// this returns 'true' if the proxy builder is specialized to only show a sub-part of the object
0071   /// as opposed to showing the object as a whole
0072   static bool representsSubPart();
0073   // ---------- member functions ---------------------------
0074   virtual void setItem(const FWEventItem* iItem);
0075   void setHaveWindow(bool iFlag);
0076   void build();
0077 
0078   void modelChanges(const FWModelIds&);
0079   void itemChanged(const FWEventItem*);
0080   void scaleChanged(const FWViewContext*);
0081 
0082   virtual bool canHandle(const FWEventItem&);  //note pass FWEventItem to see if type and container match
0083 
0084   virtual void setInteractionList(FWInteractionList*, const std::string&);
0085   virtual void itemBeingDestroyed(const FWEventItem*);
0086 
0087   // const member functions
0088   virtual bool haveSingleProduct() const { return true; }
0089   virtual bool havePerViewProduct(FWViewType::EType) const { return false; }
0090   virtual bool willHandleInteraction() const { return false; }
0091 
0092   TEveElementList* createProduct(FWViewType::EType, const FWViewContext*);
0093   void removePerViewProduct(FWViewType::EType, const FWViewContext* vc);
0094 
0095   bool getHaveWindow() const { return m_haveWindow; }
0096   void setupElement(TEveElement* el, bool color = true) const;
0097   void setupAddElement(TEveElement* el, TEveElement* parent, bool set_color = true) const;
0098   int layer() const;
0099 
0100 protected:
0101   // Override this if visibility changes can cause (re)-creation of proxies.
0102   // Returns true if new proxies were created.
0103   virtual bool visibilityModelChanges(const FWModelId&, TEveElement*, FWViewType::EType, const FWViewContext*);
0104 
0105   // Override this if you need special handling of selection or other changes.
0106   virtual void localModelChanges(const FWModelId& iId,
0107                                  TEveElement* iCompound,
0108                                  FWViewType::EType viewType,
0109                                  const FWViewContext* vc);
0110 
0111   virtual void modelChanges(const FWModelIds&, Product*);
0112 
0113   virtual void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc){};
0114 
0115   FWProxyBuilderBase(const FWProxyBuilderBase&);                   // stop default
0116   const FWProxyBuilderBase& operator=(const FWProxyBuilderBase&);  // stop default
0117 
0118   virtual void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*);
0119   virtual void buildViewType(const FWEventItem* iItem, TEveElementList*, FWViewType::EType, const FWViewContext*);
0120 
0121   virtual void clean();
0122   virtual void cleanLocal();
0123 
0124   void increaseComponentTransparency(unsigned int index,
0125                                      TEveElement* holder,
0126                                      const std::string& name,
0127                                      Char_t transpOffset);
0128 
0129   // utility
0130   TEveCompound* createCompound(bool set_color = true, bool propagate_color_to_all_children = false) const;
0131 
0132   // ---------- member data --------------------------------
0133   typedef std::vector<Product*>::iterator Product_it;
0134 
0135   std::vector<Product*> m_products;
0136 
0137 private:
0138   void cleanProduct(Product* p);
0139   void setProjectionLayer(float);
0140 
0141   // ---------- member data --------------------------------
0142 
0143   FWInteractionList* m_interactionList;
0144 
0145   const FWEventItem* m_item;
0146 
0147   bool m_modelsChanged;
0148   bool m_haveWindow;
0149   bool m_mustBuild;
0150 
0151   float m_layer;
0152 };
0153 
0154 #endif