Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:29:57

0001 // @(#)root/eve7:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007, 2018
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT7_REveViewer
0013 #define ROOT7_REveViewer
0014 
0015 #include <ROOT/REveElement.hxx>
0016 
0017 namespace ROOT {
0018 namespace Experimental {
0019 
0020 class REveScene;
0021 
0022 ////////////////////////////////////////////////////////////////////////////////
0023 /// REveViewer
0024 /// Reve representation of TGLViewer.
0025 ////////////////////////////////////////////////////////////////////////////////
0026 
0027 class REveViewer : public REveElement
0028 {
0029 public:
0030    enum ECameraType
0031    {
0032       // Perspective
0033       kCameraPerspXOZ,  // XOZ floor
0034       kCameraPerspYOZ,  // YOZ floor
0035       kCameraPerspXOY,  // XOY floor
0036       // Orthographic
0037       kCameraOrthoXOY,  // Looking down  Z axis,  X horz, Y vert
0038       kCameraOrthoXOZ,  // Looking along Y axis,  X horz, Z vert
0039       kCameraOrthoZOY,  // Looking along X axis,  Z horz, Y vert
0040       kCameraOrthoZOX,  // Looking along Y axis,  Z horz, X vert
0041       // nOrthographic
0042       kCameraOrthoXnOY, // Looking along Z axis, -X horz, Y vert
0043       kCameraOrthoXnOZ, // Looking down  Y axis, -X horz, Z vert
0044       kCameraOrthoZnOY, // Looking down  X axis, -Z horz, Y vert
0045       kCameraOrthoZnOX  // Looking down  Y axis, -Z horz, X vert
0046    };
0047 
0048    enum EAxesType {
0049       kAxesNone,
0050       kAxesOrigin,
0051       kAxesEdge
0052    };
0053 
0054    // For the moment REveCamera is internal class
0055    class REveCamera
0056    {
0057       ECameraType fType;
0058       std::string fName;
0059       REveVector fV2;
0060       REveVector fV1;
0061 
0062       public:
0063        REveCamera() { Setup(kCameraPerspXOZ, "PerspXOZ", REveVector(-1.0, 0.0, 0.0), REveVector(0.0, 1.0, 0.0));}
0064        ~REveCamera() {}
0065 
0066        void Setup(ECameraType type, const std::string& name, REveVector v1, REveVector v2);
0067 
0068        ECameraType GetType() const { return fType; }
0069 
0070        int WriteCoreJson(nlohmann::json &j, Int_t /*rnr_offset*/);
0071    };
0072 
0073 private:
0074    REveViewer(const REveViewer&) = delete;
0075    REveViewer& operator=(const REveViewer&) = delete;
0076 
0077    REveCamera fCamera;
0078    EAxesType fAxesType{kAxesNone};
0079    bool      fBlackBackground{false};
0080 
0081    bool fMandatory{true};
0082    std::string fPostStreamFlag;
0083 
0084 public:
0085    REveViewer(const std::string &n="REveViewer", const std::string &t="");
0086    ~REveViewer() override;
0087 
0088    void Redraw(Bool_t resetCameras=kFALSE);
0089 
0090    virtual void AddScene(REveScene* scene);
0091    // XXX Missing RemoveScene() ????
0092 
0093    void SetCameraType(ECameraType t);
0094    ECameraType GetCameraType() const { return fCamera.GetType(); }
0095 
0096    void SetAxesType(int);
0097    void SetBlackBackground(bool);
0098 
0099    void DisconnectClient();
0100    void ConnectClient();
0101 
0102    void SetMandatory(bool x);
0103    bool GetMandatory() { return fMandatory; }
0104 
0105    void RemoveElementLocal(REveElement *el) override;
0106    void RemoveElementsLocal() override;
0107    Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
0108 };
0109 
0110 
0111 ////////////////////////////////////////////////////////////////////////////////
0112 /// REveViewerList
0113 /// List of Viewers providing common operations on REveViewer collections.
0114 ////////////////////////////////////////////////////////////////////////////////
0115 
0116 class REveViewerList : public REveElement
0117 {
0118 private:
0119    REveViewerList(const REveViewerList&) = delete;
0120    REveViewerList& operator=(const REveViewerList&) = delete;
0121 
0122 protected:
0123    Bool_t        fShowTooltip;
0124 
0125    Float_t       fBrightness;
0126    Bool_t        fUseLightColorSet;
0127 
0128    void HandleTooltip();
0129 
0130 public:
0131    REveViewerList(const std::string &n="REveViewerList", const std::string &t="");
0132    ~REveViewerList() override;
0133 
0134    void AddElement(REveElement* el) override;
0135    void RemoveElementLocal(REveElement* el) override;
0136    void RemoveElementsLocal() override;
0137 
0138    // --------------------------------
0139 
0140    virtual void Connect();
0141    virtual void Disconnect();
0142 
0143    void RepaintChangedViewers(Bool_t resetCameras, Bool_t dropLogicals);
0144    void RepaintAllViewers(Bool_t resetCameras, Bool_t dropLogicals);
0145    void DeleteAnnotations();
0146 
0147    void SceneDestructing(REveScene* scene);
0148 
0149    // --------------------------------
0150 
0151    Bool_t  GetShowTooltip()     const { return fShowTooltip; }
0152    void    SetShowTooltip(Bool_t x)   { fShowTooltip = x; }
0153 
0154    Float_t GetColorBrightness() const { return fBrightness; }
0155    void    SetColorBrightness(Float_t b);
0156 
0157    Bool_t  UseLightColorSet()   const { return fUseLightColorSet; }
0158    void    SwitchColorSet();
0159  //  Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
0160 };
0161 
0162 } // namespace Experimental
0163 } // namespace ROOT
0164 
0165 #endif