Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
22namespace ROOT {
23namespace Experimental {
24
25class REveClient;
26class REveManager;
27
28/******************************************************************************/
29// REveScene
30// REve representation of TGLScene.
31/******************************************************************************/
32
33class REveScene : public REveElement
34{
35 friend class REveManager;
36
37private:
38 REveScene(const REveScene &) = delete;
39 REveScene &operator=(const REveScene &) = delete;
40
41protected:
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 bool fMandatory{true};
84 // void RetransHierarchicallyRecurse(REveElement* el, const REveTrans& tp);
85
86public:
87 REveScene(const std::string &n = "REveScene", const std::string &t = "");
88 ~REveScene() override;
89
90 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
91 Bool_t SingleRnrState() const override { return kTRUE; }
92
95
96 void Changed() { fChanged = kTRUE; } // AMT ??? depricated
97 Bool_t IsChanged() const;
98
101 void SceneElementChanged(REveElement *element);
103 void EndAcceptingChanges();
104
105 void StreamElements();
106 void StreamJsonRecurse(REveElement *el, nlohmann::json &jobj);
107
108 // void Repaint(Bool_t dropLogicals=kFALSE);
109 // void RetransHierarchically();
110
111 // virtual void Paint(Option_t* option = "");
112
113 // void DestroyElementRenderers(REveElement* element);
114 // void DestroyElementRenderers(TObject* rnrObj);
117
118 Bool_t HasSubscribers() const { return !fSubscribers.empty(); }
119 void AddSubscriber(std::unique_ptr<REveClient> &&sub);
120 void RemoveSubscriber(unsigned int);
121
122 bool GetMandatory() { return fMandatory; }
123 void SetMandatory(bool x) { fMandatory = x; }
124
125 void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action);
126};
127
128/******************************************************************************/
129// REveSceneList
130// List of Scenes providing common operations on REveScene collections.
131/******************************************************************************/
132
134{
135private:
136 REveSceneList(const REveSceneList &) = delete;
138
139protected:
140public:
141 REveSceneList(const std::string &n = "REveSceneList", const std::string &t = "");
142 ~REveSceneList() override {}
143
144 void DestroyScenes();
145
146 // void RepaintChangedScenes(Bool_t dropLogicals);
147 // void RepaintAllScenes(Bool_t dropLogicals);
148
149 // void DestroyElementRenderers(REveElement* element);
150 void AcceptChanges(bool);
151 bool AnyChanges() const;
152};
153
154} // namespace Experimental
155} // namespace ROOT
156
157#endif
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
char name[80]
Definition TGX11.cxx:110
Central application manager for Eve.
const std::string & GetName() const
TClass * IsA() const
Return class for this element.
ElementId_t GetElementId() const
std::list< REveElement * > List_t
REveSceneList(const REveSceneList &)=delete
REveSceneList & operator=(const REveSceneList &)=delete
void DestroyScenes()
Destroy all scenes and their contents.
void AcceptChanges(bool)
Set accept changes flag on all scenes.
std::vector< std::unique_ptr< REveClient > > fSubscribers
!
Definition REveScene.hxx:74
REveScene(const REveScene &)=delete
void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
Definition REveScene.cxx:88
void AddSubscriber(std::unique_ptr< REveClient > &&sub)
Definition REveScene.cxx:67
std::vector< char > fOutputBinary
!
Definition REveScene.hxx:78
~REveScene() override
Destructor.
Definition REveScene.cxx:50
Bool_t IsAcceptingChanges() const
Definition REveScene.hxx:99
void SceneElementRemoved(ElementId_t id)
void StreamRepresentationChanges()
Prepare data for sending element changes.
void StreamJsonRecurse(REveElement *el, nlohmann::json &jobj)
std::vector< SceneCommand > fCommands
!
Definition REveScene.hxx:81
REveScene & operator=(const REveScene &)=delete
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
Definition REveScene.cxx:59
std::vector< ElementId_t > fRemovedElements
!
Definition REveScene.hxx:72
void SceneElementChanged(REveElement *element)
Bool_t SingleRnrState() const override
Definition REveScene.hxx:91
void RemoveSubscriber(unsigned int)
Definition REveScene.cxx:78
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
unsigned int ElementId_t
Definition REveTypes.hxx:25
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
SceneCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
Definition REveScene.hxx:50