Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
REveShape.hxx
Go to the documentation of this file.
1 // @(#)root/eve7:$Id$
2 // Author: Matevz Tadel, 2010, 2018
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT7_REveShape
13 #define ROOT7_REveShape
14 
15 #include <ROOT/REveElement.hxx>
16 #include <ROOT/REveVector.hxx>
17 
18 #include "TAttBBox.h"
19 #include "TColor.h"
20 
21 namespace ROOT {
22 namespace Experimental {
23 
24 // =========================================================================
25 // REveShape
26 // Abstract base-class for 2D/3D shapes.
27 // =========================================================================
28 
29 class REveShape : public REveElement,
30  public TAttBBox
31 {
32 private:
33  REveShape(const REveShape &); // Not implemented
34  REveShape &operator=(const REveShape &); // Not implemented
35 
36 public:
37  typedef std::vector<REveVector2> vVector2_t;
38 
39 protected:
40  Color_t fFillColor; // fill color of polygons
41  Color_t fLineColor; // outline color of polygons
42  Float_t fLineWidth; // outline width of polygons
43 
44  Bool_t fDrawFrame; // draw frame
45  Bool_t fHighlightFrame; // highlight frame / all shape
46  Bool_t fMiniFrame; // draw minimal frame
47 
48 public:
49  REveShape(const std::string &n = "REveShape", const std::string &t = "");
50  virtual ~REveShape();
51 
52  Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
53 
54  // Rendering parameters.
55  void SetMainColor(Color_t color) override;
56 
57  virtual Color_t GetFillColor() const { return fFillColor; }
58  virtual Color_t GetLineColor() const { return fLineColor; }
59  virtual Float_t GetLineWidth() const { return fLineWidth; }
60  virtual Bool_t GetDrawFrame() const { return fDrawFrame; }
61  virtual Bool_t GetHighlightFrame() const { return fHighlightFrame; }
62  virtual Bool_t GetMiniFrame() const { return fMiniFrame; }
63 
64  virtual void SetFillColor(Color_t c) { fFillColor = c; }
65  virtual void SetLineColor(Color_t c) { fLineColor = c; }
66  virtual void SetLineWidth(Float_t lw) { fLineWidth = lw; }
67  virtual void SetDrawFrame(Bool_t f) { fDrawFrame = f; }
68  virtual void SetHighlightFrame(Bool_t f) { fHighlightFrame = f; }
69  virtual void SetMiniFrame(Bool_t r) { fMiniFrame = r; }
70 
71  // ----------------------------------------------------------------
72 
73  void CopyVizParams(const REveElement *el) override;
74  void WriteVizParams(std::ostream &out, const TString &var) override;
75 
76  // ----------------------------------------------------------------
77 
78  // Abstract function from TAttBBox:
79  // virtual void ComputeBBox();
80 
81  // ----------------------------------------------------------------
82 
83  static Int_t FindConvexHull(const vVector2_t &pin, vVector2_t &pout, REveElement *caller = nullptr);
84 
85  static Bool_t IsBoxOrientationConsistentEv(const REveVector box[8]);
86  static Bool_t IsBoxOrientationConsistentFv(const Float_t box[8][3]);
87 
88  static void CheckAndFixBoxOrientationEv(REveVector box[8]);
89  static void CheckAndFixBoxOrientationFv(Float_t box[8][3]);
90 };
91 
92 } // namespace Experimental
93 } // namespace ROOT
94 
95 #endif