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
64 // XXXX can change to vector (element checks if already registered now).
66 // For the following two have to re-think how the hierarchy will be handled.
67 // If I remove a parent, i have to remove all the children.
68 // So this has to be done right on both sides (on eve element and here).
69 // I might need a set, so i can easily check if parent is in the removed / added list already.
70 std::vector<ElementId_t> fRemovedElements; ///<!
71
72 std::vector<std::unique_ptr<REveClient>> fSubscribers; ///<!
73
75 std::string fOutputJson; ///<!
76 std::vector<char> fOutputBinary; ///<!
78
79 std::vector<SceneCommand> fCommands; ///<!
80
81 bool fMandatory{true};
82 bool fIsOverlay{false};
83 // void RetransHierarchicallyRecurse(REveElement* el, const REveTrans& tp);
84
85public:
86 REveScene(const std::string &n = "REveScene", const std::string &t = "");
87 ~REveScene() override;
88
89 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
90 Bool_t SingleRnrState() const override { return kTRUE; }
91
94
95 bool IsChanged() const;
96
99 void SceneElementChanged(REveElement *element);
101 void EndAcceptingChanges();
102
103 void StreamElements();
104 void StreamJsonRecurse(REveElement *el, nlohmann::json &jobj);
105
108
109 Bool_t HasSubscribers() const { return !fSubscribers.empty(); }
110 void AddSubscriber(std::unique_ptr<REveClient> &&sub);
111 void RemoveSubscriber(unsigned int);
112
113 bool GetMandatory() { return fMandatory; }
114 void SetMandatory(bool x) { fMandatory = x; }
115
116 bool GetIsOverlay() { return fIsOverlay; }
117 void SetIsOverlay(bool x) { fIsOverlay = x; }
118
119 void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action);
120};
121
122/******************************************************************************/
123// REveSceneList
124// List of Scenes providing common operations on REveScene collections.
125/******************************************************************************/
126
128{
129private:
130 REveSceneList(const REveSceneList &) = delete;
132
133protected:
134public:
135 REveSceneList(const std::string &n = "REveSceneList", const std::string &t = "");
136 ~REveSceneList() override {}
137
138 void DestroyScenes();
139
141 void EndAcceptingChanges();
142 bool AnyChanges() const;
143};
144
145} // namespace Experimental
146} // namespace ROOT
147
148#endif
#define h(i)
Definition RSha256.hxx:106
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
char name[80]
Definition TGX11.cxx:110
Central application manager for web-based REve.
const std::string & GetName() const
TClass * IsA() const
Return class for this element Return REveElement class in case dicitonary is not exisiting.
ElementId_t GetElementId() const
std::list< REveElement * > List_t
REveSceneList(const REveSceneList &)=delete
void BeginAcceptingChanges()
Loop-wrapers over Scene children, element type checked on insertion.
REveSceneList & operator=(const REveSceneList &)=delete
void DestroyScenes()
Destroy all scenes and their contents.
std::vector< std::unique_ptr< REveClient > > fSubscribers
!
Definition REveScene.hxx:72
REveScene(const REveScene &)=delete
void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
Definition REveScene.cxx:90
void AddSubscriber(std::unique_ptr< REveClient > &&sub)
Definition REveScene.cxx:69
std::vector< char > fOutputBinary
!
Definition REveScene.hxx:76
~REveScene() override
Destructor.
Definition REveScene.cxx:50
Bool_t IsAcceptingChanges() const
Definition REveScene.hxx:97
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:79
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:70
void SceneElementChanged(REveElement *element)
Bool_t SingleRnrState() const override
Definition REveScene.hxx:90
void RemoveSubscriber(unsigned int)
Definition REveScene.cxx:80
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
unsigned int ElementId_t
Definition REveTypes.hxx:27
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