Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:40

0001 // @(#)root/eve7:$Id$
0002 // Author: Matevz Tadel, 2010, 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_REveShape
0013 #define ROOT7_REveShape
0014 
0015 #include <ROOT/REveElement.hxx>
0016 #include <ROOT/REveVector.hxx>
0017 
0018 #include "TAttBBox.h"
0019 #include "TColor.h"
0020 
0021 namespace ROOT {
0022 namespace Experimental {
0023 
0024 // =========================================================================
0025 // REveShape
0026 // Abstract base-class for 2D/3D shapes.
0027 // =========================================================================
0028 
0029 class REveShape : public REveElement,
0030                   public TAttBBox
0031 {
0032 private:
0033    REveShape(const REveShape &) = delete;
0034    REveShape &operator=(const REveShape &) = delete;
0035 
0036 public:
0037    typedef std::vector<REveVector2> vVector2_t;
0038 
0039 protected:
0040    Color_t fFillColor; // fill color of polygons
0041    Color_t fLineColor; // outline color of polygons
0042    Float_t fLineWidth; // outline width of polygons
0043 
0044    Bool_t fDrawFrame;      // draw frame
0045    Bool_t fHighlightFrame; // highlight frame / all shape
0046    Bool_t fMiniFrame;      // draw minimal frame
0047 
0048 public:
0049    REveShape(const std::string &n = "REveShape", const std::string &t = "");
0050    ~REveShape() override;
0051 
0052    Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
0053 
0054    // Rendering parameters.
0055    void SetMainColor(Color_t color) override;
0056 
0057    virtual Color_t GetFillColor() const { return fFillColor; }
0058    virtual Color_t GetLineColor() const { return fLineColor; }
0059    virtual Float_t GetLineWidth() const { return fLineWidth; }
0060    virtual Bool_t GetDrawFrame() const { return fDrawFrame; }
0061    virtual Bool_t GetHighlightFrame() const { return fHighlightFrame; }
0062    virtual Bool_t GetMiniFrame() const { return fMiniFrame; }
0063 
0064    virtual void SetFillColor(Color_t c) { fFillColor = c; }
0065    virtual void SetLineColor(Color_t c) { fLineColor = c; }
0066    virtual void SetLineWidth(Float_t lw) { fLineWidth = lw; }
0067    virtual void SetDrawFrame(Bool_t f) { fDrawFrame = f; }
0068    virtual void SetHighlightFrame(Bool_t f) { fHighlightFrame = f; }
0069    virtual void SetMiniFrame(Bool_t r) { fMiniFrame = r; }
0070 
0071    // ----------------------------------------------------------------
0072 
0073    void CopyVizParams(const REveElement *el) override;
0074    void WriteVizParams(std::ostream &out, const TString &var) override;
0075 
0076    // ----------------------------------------------------------------
0077 
0078    // Abstract function from TAttBBox:
0079    // virtual void ComputeBBox();
0080 
0081    // ----------------------------------------------------------------
0082 
0083    static Int_t FindConvexHull(const vVector2_t &pin, vVector2_t &pout, REveElement *caller = nullptr);
0084 
0085    static Bool_t IsBoxOrientationConsistentEv(const REveVector box[8]);
0086    static Bool_t IsBoxOrientationConsistentFv(const Float_t box[8][3]);
0087 
0088    static void CheckAndFixBoxOrientationEv(REveVector box[8]);
0089    static void CheckAndFixBoxOrientationFv(Float_t box[8][3]);
0090 };
0091 
0092 } // namespace Experimental
0093 } // namespace ROOT
0094 
0095 #endif