Warning, file /include/root/ROOT/REveScene.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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
0065 List_t fChangedElements;
0066
0067
0068
0069
0070 std::vector<ElementId_t> fRemovedElements;
0071
0072 std::vector<std::unique_ptr<REveClient>> fSubscribers;
0073
0074 List_t fElsWithBinaryData;
0075 std::string fOutputJson;
0076 std::vector<char> fOutputBinary;
0077 Int_t fTotalBinarySize;
0078
0079 std::vector<SceneCommand> fCommands;
0080
0081 bool fMandatory{true};
0082 bool fIsOverlay{false};
0083
0084
0085 public:
0086 REveScene(const std::string &n = "REveScene", const std::string &t = "");
0087 ~REveScene() override;
0088
0089 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
0090 Bool_t SingleRnrState() const override { return kTRUE; }
0091
0092 void SetHierarchical(Bool_t h) { fHierarchical = h; }
0093 Bool_t GetHierarchical() const { return fHierarchical; }
0094
0095 bool IsChanged() const;
0096
0097 Bool_t IsAcceptingChanges() const { return fAcceptingChanges; }
0098 void BeginAcceptingChanges();
0099 void SceneElementChanged(REveElement *element);
0100 void SceneElementRemoved(ElementId_t id);
0101 void EndAcceptingChanges();
0102
0103 void StreamElements();
0104 void StreamJsonRecurse(REveElement *el, nlohmann::json &jobj);
0105
0106 void StreamRepresentationChanges();
0107 void SendChangesToSubscribers();
0108
0109 Bool_t HasSubscribers() const { return !fSubscribers.empty(); }
0110 void AddSubscriber(std::unique_ptr<REveClient> &&sub);
0111 void RemoveSubscriber(unsigned int);
0112
0113 bool GetMandatory() { return fMandatory; }
0114 void SetMandatory(bool x) { fMandatory = x; }
0115
0116 bool GetIsOverlay() { return fIsOverlay; }
0117 void SetIsOverlay(bool x) { fIsOverlay = x; }
0118
0119 void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action);
0120 };
0121
0122
0123
0124
0125
0126
0127 class REveSceneList : public REveElement
0128 {
0129 private:
0130 REveSceneList(const REveSceneList &) = delete;
0131 REveSceneList &operator=(const REveSceneList &) = delete;
0132
0133 protected:
0134 public:
0135 REveSceneList(const std::string &n = "REveSceneList", const std::string &t = "");
0136 ~REveSceneList() override {}
0137
0138 void DestroyScenes();
0139
0140 void BeginAcceptingChanges();
0141 void EndAcceptingChanges();
0142 bool AnyChanges() const;
0143 };
0144
0145 }
0146 }
0147
0148 #endif