File indexing completed on 2025-01-18 10:10:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT7_REveScene
0013 #define ROOT7_REveScene
0014
0015 #include <ROOT/REveElement.hxx>
0016
0017 #include "TClass.h"
0018
0019 #include <vector>
0020 #include <memory>
0021
0022 namespace ROOT {
0023 namespace Experimental {
0024
0025 class REveClient;
0026 class REveManager;
0027
0028
0029
0030
0031
0032
0033 class REveScene : public REveElement
0034 {
0035 friend class REveManager;
0036
0037 private:
0038 REveScene(const REveScene &) = delete;
0039 REveScene &operator=(const REveScene &) = delete;
0040
0041 protected:
0042 struct SceneCommand
0043 {
0044 std::string fName;
0045 std::string fIcon;
0046 std::string fElementClass;
0047 std::string fAction;
0048 ElementId_t fElementId{0};
0049
0050 SceneCommand(const std::string& name, const std::string& icon,
0051 const REveElement* element, const std::string& action) :
0052 fName(name),
0053 fIcon(icon),
0054 fElementClass(element->IsA()->GetName()),
0055 fAction(action),
0056 fElementId(element->GetElementId())
0057 {}
0058 };
0059
0060 Bool_t fSmartRefresh{kTRUE};
0061 Bool_t fHierarchical{kFALSE};
0062
0063 Bool_t fAcceptingChanges{kFALSE};
0064 Bool_t fChanged{kFALSE};
0065
0066
0067 List_t fChangedElements;
0068
0069
0070
0071
0072 std::vector<ElementId_t> fRemovedElements;
0073
0074 std::vector<std::unique_ptr<REveClient>> fSubscribers;
0075
0076 List_t fElsWithBinaryData;
0077 std::string fOutputJson;
0078 std::vector<char> fOutputBinary;
0079 Int_t fTotalBinarySize;
0080
0081 std::vector<SceneCommand> fCommands;
0082
0083 bool fMandatory{true};
0084
0085
0086 public:
0087 REveScene(const std::string &n = "REveScene", const std::string &t = "");
0088 ~REveScene() override;
0089
0090 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
0091 Bool_t SingleRnrState() const override { return kTRUE; }
0092
0093 void SetHierarchical(Bool_t h) { fHierarchical = h; }
0094 Bool_t GetHierarchical() const { return fHierarchical; }
0095
0096 void Changed() { fChanged = kTRUE; }
0097 Bool_t IsChanged() const;
0098
0099 Bool_t IsAcceptingChanges() const { return fAcceptingChanges; }
0100 void BeginAcceptingChanges();
0101 void SceneElementChanged(REveElement *element);
0102 void SceneElementRemoved(ElementId_t id);
0103 void EndAcceptingChanges();
0104
0105 void StreamElements();
0106 void StreamJsonRecurse(REveElement *el, nlohmann::json &jobj);
0107
0108
0109
0110
0111
0112
0113
0114
0115 void StreamRepresentationChanges();
0116 void SendChangesToSubscribers();
0117
0118 Bool_t HasSubscribers() const { return !fSubscribers.empty(); }
0119 void AddSubscriber(std::unique_ptr<REveClient> &&sub);
0120 void RemoveSubscriber(unsigned int);
0121
0122 bool GetMandatory() { return fMandatory; }
0123 void SetMandatory(bool x) { fMandatory = x; }
0124
0125 void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action);
0126 };
0127
0128
0129
0130
0131
0132
0133 class REveSceneList : public REveElement
0134 {
0135 private:
0136 REveSceneList(const REveSceneList &) = delete;
0137 REveSceneList &operator=(const REveSceneList &) = delete;
0138
0139 protected:
0140 public:
0141 REveSceneList(const std::string &n = "REveSceneList", const std::string &t = "");
0142 ~REveSceneList() override {}
0143
0144 void DestroyScenes();
0145
0146
0147
0148
0149
0150 void AcceptChanges(bool);
0151 bool AnyChanges() const;
0152 };
0153
0154 }
0155 }
0156
0157 #endif