Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
REveDataProxyBuilderBase.hxx
Go to the documentation of this file.
1 // @(#)root/eve7:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel, 2018
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT7_REveDataProxyBuilderBase
13 #define ROOT7_REveDataProxyBuilderBase
14 
15 #include <ROOT/REveElement.hxx>
16 #include <ROOT/REveCompound.hxx>
17 #include <ROOT/REveDataClasses.hxx>
18 
19 namespace ROOT {
20 namespace Experimental {
21 
22 class REveViewContext;
23 class REveTrackPropagator;
24 
25 class REveDataProxyBuilderBase
26 {
27 public:
28  struct Product
29  {
30  std::string m_viewType;
31  const REveViewContext *m_viewContext{nullptr};
32  REveCompound *m_elements{nullptr};
33 
34  Product(std::string viewType, const REveViewContext* c);
35  virtual ~Product();
36  };
37 
38  // ---------- const member functions ---------------------
39 
40  const REveViewContext& Context() const;
41  const REveDataCollection* Collection() const { return m_collection; }
42 
43  // ---------- constructor/destructor ---------------------
44 
45  REveDataProxyBuilderBase(const std::string &type);
46  virtual ~REveDataProxyBuilderBase() {}
47 
48  virtual void SetCollection(REveDataCollection*);
49  // virtual void SetInteractionList(REveDataInteractionList*, const std::string&);
50 
51  virtual void CollectionBeingDestroyed(const REveDataCollection*);
52 
53  void Build();
54  // virtual void Build(REveElement* product);
55 
56  REveElement* CreateProduct(std::string viewType, const REveViewContext*);
57  // void removePerViewProduct(const REveViewContext* vc);
58 
59  void ModelChanges(const REveDataCollection::Ids_t&);
60  void CollectionChanged(const REveDataCollection*);
61 
62  void SetupElement(REveElement* el, bool color = true) const;
63  void SetupAddElement(REveElement* el, REveElement* parent, bool set_color = true) const;
64 
65  bool GetHaveAWindow() const { return m_haveWindow; }
66  void SetHaveAWindow(bool);
67 
68  std::string Type() const { return m_type; }
69 
70  // const member functions
71  virtual bool HaveSingleProduct() const { return true; }
72 
73 protected:
74  // Override this if visibility changes can cause (re)-creation of proxies.
75  // Returns true if new proxies were created.
76  virtual bool VisibilityModelChanges(int idx, REveElement*, const REveViewContext*);
77 
78  virtual void Build(const REveDataCollection* iItem, REveElement* product, const REveViewContext*);
79  virtual void BuildViewType(const REveDataCollection* iItem, REveElement* product, std::string viewType, const REveViewContext*);
80 
81  virtual void ModelChanges(const REveDataCollection::Ids_t&, Product*);
82  virtual void LocalModelChanges(int idx, REveElement* el, const REveViewContext* ctx);
83 
84  // Utility
85  REveCompound* CreateCompound(bool set_color=true, bool propagate_color_to_all_children=false) const;
86  virtual void Clean();
87  virtual void CleanLocal();
88 
89  std::vector<Product*> m_products;
90 
91 private:
92  std::string m_type;
93  const REveDataCollection *m_collection{nullptr};
94 
95  float m_layer;
96  // REveDataInteractionList* m_interactionList;
97  bool m_haveWindow;
98  bool m_modelsChanged;
99 };
100 
101 } // namespace Experimental
102 } // namespace ROOT
103 #endif