Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveShape.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel, 2010
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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 ROOT_TEveShape
13 #define ROOT_TEveShape
14 
15 #include "TEveElement.h"
16 #include "TEveVector.h"
17 
18 #include "TAtt3D.h"
19 #include "TAttBBox.h"
20 #include "TColor.h"
21 
22 class TEveShape : public TEveElementList,
23  public TAtt3D,
24  public TAttBBox
25 {
26  friend class TEveShapeEditor;
27 
28 private:
29  TEveShape(const TEveShape&); // Not implemented
30  TEveShape& operator=(const TEveShape&); // Not implemented
31 
32 public:
33  typedef std::vector<TEveVector2> vVector2_t;
34  typedef std::vector<TEveVector2>::iterator vVector2_i;
35 
36 protected:
37  Color_t fFillColor; // fill color of polygons
38  Color_t fLineColor; // outline color of polygons
39  Float_t fLineWidth; // outline width of polygons
40 
41  Bool_t fDrawFrame; // draw frame
42  Bool_t fHighlightFrame; // highlight frame / all shape
43  Bool_t fMiniFrame; // draw minimal frame
44 
45 public:
46  TEveShape(const char* n="TEveShape", const char* t="");
47  virtual ~TEveShape();
48 
49  // Rendering parameters.
50  virtual void SetMainColor(Color_t color);
51 
52  virtual Color_t GetFillColor() const { return fFillColor; }
53  virtual Color_t GetLineColor() const { return fLineColor; }
54  virtual Float_t GetLineWidth() const { return fLineWidth;}
55  virtual Bool_t GetDrawFrame() const { return fDrawFrame; }
56  virtual Bool_t GetHighlightFrame() const { return fHighlightFrame; }
57  virtual Bool_t GetMiniFrame() const { return fMiniFrame; }
58 
59  virtual void SetFillColor(Color_t c) { fFillColor = c; }
60  virtual void SetLineColor(Color_t c) { fLineColor = c; }
61  virtual void SetLineWidth(Float_t lw) { fLineWidth = lw;}
62  virtual void SetDrawFrame(Bool_t f) { fDrawFrame = f; }
63  virtual void SetHighlightFrame(Bool_t f) { fHighlightFrame = f; }
64  virtual void SetMiniFrame(Bool_t r) { fMiniFrame = r; }
65 
66  // ----------------------------------------------------------------
67 
68  virtual void CopyVizParams(const TEveElement* el);
69  virtual void WriteVizParams(std::ostream& out, const TString& var);
70 
71  // ----------------------------------------------------------------
72 
73  // Virtual from TObject
74  virtual void Paint(Option_t* option="");
75 
76  // Abstract function from TAttBBox:
77  // virtual void ComputeBBox();
78 
79  // Abstract from TEveProjectable, overriden in TEveElementList:
80  // virtual TClass* ProjectedClass(const TEveProjection* p) const;
81 
82  // ----------------------------------------------------------------
83 
84  static Int_t FindConvexHull(const vVector2_t& pin, vVector2_t& pout, TEveElement* caller=0);
85 
86  static Bool_t IsBoxOrientationConsistentEv(const TEveVector box[8]);
87  static Bool_t IsBoxOrientationConsistentFv(const Float_t box[8][3]);
88 
89  static void CheckAndFixBoxOrientationEv(TEveVector box[8]);
90  static void CheckAndFixBoxOrientationFv(Float_t box[8][3]);
91 
92  ClassDef(TEveShape, 0); // Abstract base-class for 2D/3D shapes.
93 };
94 
95 #endif