File indexing completed on 2025-09-15 09:11:42
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::shared_ptr<RWebWindow> GetWindow() { return fWebWindow; }
0062
0063 std::string GetWindowAddr() const;
0064
0065 std::string GetWindowUrl(bool remote);
0066
0067 void SetGeometry(TGeoManager *mgr, const std::string &volname = "");
0068
0069 void SelectVolume(const std::string &volname);
0070
0071 void SetOnlyVolume(TGeoVolume *vol);
0072
0073
0074 void SetLimits(int nnodes = 5000, int nfaces = 100000)
0075 {
0076 fDesc.SetMaxVisNodes(nnodes);
0077 fDesc.SetMaxVisFaces(nfaces);
0078 }
0079
0080
0081 void SetVisLevel(int lvl = 3)
0082 {
0083 fDesc.SetVisLevel(lvl);
0084 }
0085
0086 void SetTopVisible(bool on = true)
0087 {
0088 fDesc.SetTopVisible(on);
0089 }
0090
0091
0092 void SetShowHierarchy(bool on = true) { fShowHierarchy = on; }
0093
0094
0095 bool GetShowHierarchy() const { return fShowHierarchy; }
0096
0097 void SetShowColumns(bool on = true) { fShowColumns = on; }
0098
0099 bool GetShowColumns() const { return fShowColumns; }
0100
0101 void SetDrawOptions(const std::string &opt);
0102
0103 void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
0104
0105 void Update();
0106
0107 void SaveImage(const std::string &fname = "geometry.png", int width = 0, int height = 0);
0108
0109 RGeomDescription &Description() { return fDesc; }
0110
0111 void SaveAsMacro(const std::string &fname);
0112
0113 void ClearOnClose(const std::shared_ptr<void> &handle);
0114
0115 };
0116
0117 }
0118
0119 #endif