Logo ROOT  
Reference Guide
REveScene.hxx
Go to the documentation of this file.
1 // @(#)root/eve7:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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_REveScene
13 #define ROOT7_REveScene
14 
15 #include <ROOT/REveElement.hxx>
16 
17 #include "TClass.h"
18 
19 #include <vector>
20 #include <memory>
21 
22 namespace ROOT {
23 namespace Experimental {
24 
25 class REveClient;
26 class REveManager;
27 
28 /******************************************************************************/
29 // REveScene
30 // REve representation of TGLScene.
31 /******************************************************************************/
32 
33 class REveScene : public REveElement
34 {
35  friend class REveManager;
36 
37 private:
38  REveScene(const REveScene &) = delete;
39  REveScene &operator=(const REveScene &) = delete;
40 
41 protected:
42  struct SceneCommand
43  {
44  std::string fName;
45  std::string fIcon;
46  std::string fElementClass;
47  std::string fAction;
49 
50  SceneCommand(const std::string& name, const std::string& icon,
51  const REveElement* element, const std::string& action) :
52  fName(name),
53  fIcon(icon),
54  fElementClass(element->IsA()->GetName()),
55  fAction(action),
56  fElementId(element->GetElementId())
57  {}
58  };
59 
62 
65  // Changed or/and added.
66  // XXXX can change to vector (element checks if already registered now).
68  // For the following two have to re-think how the hierarchy will be handled.
69  // If I remove a parent, i have to remove all the children.
70  // So this has to be done right on both sides (on eve element and here).
71  // I might need a set, so i can easily check if parent is in the removed / added list already.
72  std::vector<ElementId_t> fRemovedElements; ///<!
73 
74  std::vector<std::unique_ptr<REveClient>> fSubscribers; ///<!
75 
77  std::string fOutputJson; ///<!
78  std::vector<char> fOutputBinary; ///<!
80 
81  std::vector<SceneCommand> fCommands; ///<!
82 
83  // void RetransHierarchicallyRecurse(REveElement* el, const REveTrans& tp);
84 
85 public:
86  REveScene(const std::string &n = "REveScene", const std::string &t = "");
87  virtual ~REveScene();
88 
89  Bool_t SingleRnrState() const override { return kTRUE; }
90 
92  Bool_t GetHierarchical() const { return fHierarchical; }
93 
94  void Changed() { fChanged = kTRUE; } // AMT ??? depricated
95  Bool_t IsChanged() const;
96 
98  void BeginAcceptingChanges();
99  void SceneElementChanged(REveElement *element);
101  void EndAcceptingChanges();
102  void ProcessChanges();
103 
104  void StreamElements();
105  void StreamJsonRecurse(REveElement *el, nlohmann::json &jobj);
106 
107  // void Repaint(Bool_t dropLogicals=kFALSE);
108  // void RetransHierarchically();
109 
110  // virtual void Paint(Option_t* option = "");
111 
112  // void DestroyElementRenderers(REveElement* element);
113  // void DestroyElementRenderers(TObject* rnrObj);
116 
117  Bool_t HasSubscribers() const { return !fSubscribers.empty(); }
118  void AddSubscriber(std::unique_ptr<REveClient> &&sub);
119  void RemoveSubscriber(unsigned int);
120 
121  void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
122  { fCommands.emplace_back(name, icon, element, action); }
123 };
124 
125 /******************************************************************************/
126 // REveSceneList
127 // List of Scenes providing common operations on REveScene collections.
128 /******************************************************************************/
129 
131 {
132 private:
133  REveSceneList(const REveSceneList &) = delete;
135 
136 protected:
137 public:
138  REveSceneList(const std::string &n = "REveSceneList", const std::string &t = "");
139  virtual ~REveSceneList() {}
140 
141  void DestroyScenes();
142 
143  // void RepaintChangedScenes(Bool_t dropLogicals);
144  // void RepaintAllScenes(Bool_t dropLogicals);
145 
146  // void DestroyElementRenderers(REveElement* element);
147  void AcceptChanges(bool);
148 
149  void ProcessSceneChanges();
150 };
151 
152 } // namespace Experimental
153 } // namespace ROOT
154 
155 #endif
ROOT::Experimental::REveSceneList::ProcessSceneChanges
void ProcessSceneChanges()
Definition: REveScene.cxx:543
n
const Int_t n
Definition: legend1.C:16
ROOT::Experimental::REveScene::fElsWithBinaryData
List_t fElsWithBinaryData
Definition: REveScene.hxx:76
ROOT::Experimental::REveScene::operator=
REveScene & operator=(const REveScene &)=delete
ROOT::Experimental::REveSceneList::REveSceneList
REveSceneList(const REveSceneList &)=delete
ROOT::Experimental::REveScene::SceneCommand::fElementId
ElementId_t fElementId
Definition: REveScene.hxx:48
ROOT::Experimental::REveScene::fOutputJson
std::string fOutputJson
!
Definition: REveScene.hxx:77
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
ROOT::Experimental::REveScene::SceneCommand::SceneCommand
SceneCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
Definition: REveScene.hxx:50
ROOT::Experimental::REveScene::BeginAcceptingChanges
void BeginAcceptingChanges()
Definition: REveScene.cxx:81
ROOT::Experimental::REveScene::SceneCommand
Definition: REveScene.hxx:43
ROOT::Experimental::ElementId_t
unsigned int ElementId_t
Definition: REveTypes.hxx:25
ROOT::Experimental::REveScene::SingleRnrState
Bool_t SingleRnrState() const override
Definition: REveScene.hxx:89
ROOT::Experimental::REveScene::StreamRepresentationChanges
void StreamRepresentationChanges()
Prepare data for sending element changes.
Definition: REveScene.cxx:216
ROOT::Experimental::REveScene::StreamElements
void StreamElements()
Definition: REveScene.cxx:116
ROOT::Experimental::REveScene::fOutputBinary
std::vector< char > fOutputBinary
!
Definition: REveScene.hxx:78
TClass.h
ROOT::Experimental::REveSceneList::~REveSceneList
virtual ~REveSceneList()
Definition: REveScene.hxx:139
ROOT::Experimental::REveElement::IsA
TClass * IsA() const
Return class for this element.
Definition: REveElement.cxx:558
ROOT::Experimental::REveScene::SetHierarchical
void SetHierarchical(Bool_t h)
Definition: REveScene.hxx:91
ROOT::Experimental::REveScene::EndAcceptingChanges
void EndAcceptingChanges()
Definition: REveScene.cxx:100
ROOT::Experimental::REveElement
Definition: REveElement.hxx:41
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
ROOT::Experimental::REveScene::fRemovedElements
std::vector< ElementId_t > fRemovedElements
!
Definition: REveScene.hxx:72
ROOT::Experimental::REveScene::fCommands
std::vector< SceneCommand > fCommands
!
Definition: REveScene.hxx:81
ROOT::Experimental::REveScene::SceneElementChanged
void SceneElementChanged(REveElement *element)
Definition: REveScene.cxx:88
bool
ROOT::Experimental::REveScene::SceneCommand::fName
std::string fName
Definition: REveScene.hxx:44
ROOT::Experimental::REveScene::AddCommand
void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
Definition: REveScene.hxx:121
ROOT::Experimental::REveScene::SceneCommand::fIcon
std::string fIcon
Definition: REveScene.hxx:45
ROOT::Experimental::REveScene::fSmartRefresh
Bool_t fSmartRefresh
!
Definition: REveScene.hxx:60
ROOT::Experimental::REveScene::SceneElementRemoved
void SceneElementRemoved(ElementId_t id)
Definition: REveScene.cxx:95
ROOT::Experimental::REveElement::List_t
std::list< REveElement * > List_t
Definition: REveElement.hxx:48
ROOT::Experimental::REveScene
Definition: REveScene.hxx:34
ROOT::Experimental::REveScene::SendChangesToSubscribers
void SendChangesToSubscribers()
Definition: REveScene.cxx:307
h
#define h(i)
Definition: RSha256.hxx:106
REveElement.hxx
ROOT::Experimental::REveScene::IsChanged
Bool_t IsChanged() const
Definition: REveScene.cxx:321
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
ROOT::Experimental::REveSceneList::operator=
REveSceneList & operator=(const REveSceneList &)=delete
ROOT::Experimental::REveScene::fHierarchical
Bool_t fHierarchical
!
Definition: REveScene.hxx:61
ROOT::Experimental::REveScene::fChangedElements
List_t fChangedElements
!
Definition: REveScene.hxx:67
ROOT::Experimental::REveScene::REveScene
REveScene(const REveScene &)=delete
ROOT::Experimental::REveScene::IsAcceptingChanges
Bool_t IsAcceptingChanges() const
Definition: REveScene.hxx:97
ROOT::Experimental::REveSceneList::AcceptChanges
void AcceptChanges(bool)
Set accept changes flag on all scenes.
Definition: REveScene.cxx:483
ROOT::Experimental::REveScene::Changed
void Changed()
Definition: REveScene.hxx:94
ROOT::Experimental::REveSceneList
Definition: REveScene.hxx:131
ROOT::Experimental::REveElement::GetElementId
ElementId_t GetElementId() const
Definition: REveElement.hxx:107
unsigned int
ROOT::Experimental::REveScene::StreamJsonRecurse
void StreamJsonRecurse(REveElement *el, nlohmann::json &jobj)
Definition: REveScene.cxx:166
ROOT::Experimental::REveScene::fSubscribers
std::vector< std::unique_ptr< REveClient > > fSubscribers
!
Definition: REveScene.hxx:74
ROOT::Experimental::REveScene::ProcessChanges
void ProcessChanges()
Definition: REveScene.cxx:107
ROOT::Experimental::REveElement::REveScene
friend class REveScene
Definition: REveElement.hxx:43
ROOT::Experimental::REveScene::SceneCommand::fAction
std::string fAction
Definition: REveScene.hxx:47
ROOT::Experimental::REveElement::GetName
const std::string & GetName() const
Definition: REveElement.hxx:113
ROOT::Experimental::REveScene::fChanged
Bool_t fChanged
!
Definition: REveScene.hxx:64
ROOT::Experimental::REveScene::SceneCommand::fElementClass
std::string fElementClass
Definition: REveScene.hxx:46
ROOT::Experimental::REveScene::AddSubscriber
void AddSubscriber(std::unique_ptr< REveClient > &&sub)
Definition: REveScene.cxx:59
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Experimental::REveManager
Definition: REveManager.hxx:44
ROOT::Experimental::REveScene::HasSubscribers
Bool_t HasSubscribers() const
Definition: REveScene.hxx:117
ROOT::Experimental::REveScene::fTotalBinarySize
Int_t fTotalBinarySize
!
Definition: REveScene.hxx:79
ROOT::Experimental::REveSceneList::DestroyScenes
void DestroyScenes()
Destroy all scenes and their contents.
Definition: REveScene.cxx:469
ROOT::Experimental::REveScene::~REveScene
virtual ~REveScene()
Destructor.
Definition: REveScene.cxx:49
ROOT
VSD Structures.
Definition: StringConv.hxx:21
int
ROOT::Experimental::REveScene::RemoveSubscriber
void RemoveSubscriber(unsigned int)
Definition: REveScene.cxx:70
ROOT::Experimental::REveScene::fAcceptingChanges
Bool_t fAcceptingChanges
!
Definition: REveScene.hxx:63
ROOT::Experimental::REveScene::GetHierarchical
Bool_t GetHierarchical() const
Definition: REveScene.hxx:92