File indexing completed on 2025-01-18 10:10:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT7_RGeomViewer
0012 #define ROOT7_RGeomViewer
0013
0014 #include <ROOT/RWebDisplayArgs.hxx>
0015 #include <ROOT/RGeomData.hxx>
0016
0017 #include <memory>
0018
0019 class TGeoManager;
0020 class TGeoVolume;
0021
0022 namespace ROOT {
0023
0024 class RWebWindow;
0025 class RGeomHierarchy;
0026
0027 class RGeomViewer {
0028
0029 protected:
0030
0031 TGeoManager *fGeoManager{nullptr};
0032 std::string fSelectedVolume;
0033 RGeomDescription fDesc;
0034 bool fShowHierarchy{true};
0035 bool fShowColumns{true};
0036 std::string fTitle;
0037 bool fInfoActive{false};
0038
0039 std::shared_ptr<RWebWindow> fWebWindow;
0040
0041 std::shared_ptr<RGeomHierarchy> fWebHierarchy;
0042
0043 void WebWindowCallback(unsigned connid, const std::string &arg);
0044
0045 void WebWindowDisconnect(unsigned connid);
0046
0047 std::vector<int> GetStackFromJson(const std::string &json, bool node_ids = false);
0048
0049 void SendGeometry(unsigned connid = 0, bool first_time = false);
0050
0051 void ProcessSignal(const std::string &);
0052
0053 public:
0054
0055 RGeomViewer(TGeoManager *mgr = nullptr, const std::string &volname = "");
0056 virtual ~RGeomViewer();
0057
0058 void SetTitle(const std::string &title) { fTitle = title; }
0059 const std::string &GetTitle() const { return fTitle; }
0060
0061 std::string GetWindowAddr() const;
0062
0063 std::string GetWindowUrl(bool remote);
0064
0065 void SetGeometry(TGeoManager *mgr, const std::string &volname = "");
0066
0067 void SelectVolume(const std::string &volname);
0068
0069 void SetOnlyVolume(TGeoVolume *vol);
0070
0071
0072 void SetLimits(int nnodes = 5000, int nfaces = 100000)
0073 {
0074 fDesc.SetMaxVisNodes(nnodes);
0075 fDesc.SetMaxVisFaces(nfaces);
0076 }
0077
0078
0079 void SetVisLevel(int lvl = 3)
0080 {
0081 fDesc.SetVisLevel(lvl);
0082 }
0083
0084 void SetTopVisible(bool on = true)
0085 {
0086 fDesc.SetTopVisible(on);
0087 }
0088
0089
0090 void SetShowHierarchy(bool on = true) { fShowHierarchy = on; }
0091
0092
0093 bool GetShowHierarchy() const { return fShowHierarchy; }
0094
0095 void SetShowColumns(bool on = true) { fShowColumns = on; }
0096
0097 bool GetShowColumns() const { return fShowColumns; }
0098
0099 void SetDrawOptions(const std::string &opt);
0100
0101 void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
0102
0103 void Update();
0104
0105 void SaveImage(const std::string &fname = "geometry.png", int width = 0, int height = 0);
0106
0107 RGeomDescription &Description() { return fDesc; }
0108
0109 void SaveAsMacro(const std::string &fname);
0110
0111 void ClearOnClose(const std::shared_ptr<void> &handle);
0112
0113 };
0114
0115 }
0116
0117 #endif