00001 // @(#)root/eve:$Id: TEveShape.h 37228 2010-12-03 16:55:15Z matevz $ 00002 // Author: Matevz Tadel, 2010 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TEveShape 00013 #define ROOT_TEveShape 00014 00015 #include "TEveElement.h" 00016 #include "TEveVector.h" 00017 00018 #include "TAtt3D.h" 00019 #include "TAttBBox.h" 00020 #include "TColor.h" 00021 00022 class TEveShape : public TEveElementList, 00023 public TAtt3D, 00024 public TAttBBox 00025 { 00026 friend class TEveShapeEditor; 00027 00028 private: 00029 TEveShape(const TEveShape&); // Not implemented 00030 TEveShape& operator=(const TEveShape&); // Not implemented 00031 00032 public: 00033 typedef std::vector<TEveVector2> vVector2_t; 00034 typedef std::vector<TEveVector2>::iterator vVector2_i; 00035 00036 protected: 00037 Color_t fFillColor; // fill color of polygons 00038 Color_t fLineColor; // outline color of polygons 00039 Float_t fLineWidth; // outline width of polygons 00040 00041 Bool_t fDrawFrame; // draw frame 00042 Bool_t fHighlightFrame; // highlight frame / all shape 00043 Bool_t fMiniFrame; // draw minimal frame 00044 00045 public: 00046 TEveShape(const char* n="TEveShape", const char* t=""); 00047 virtual ~TEveShape(); 00048 00049 // Rendering parameters. 00050 virtual void SetMainColor(Color_t color); 00051 00052 virtual Color_t GetFillColor() const { return fFillColor; } 00053 virtual Color_t GetLineColor() const { return fLineColor; } 00054 virtual Float_t GetLineWidth() const { return fLineWidth;} 00055 virtual Bool_t GetDrawFrame() const { return fDrawFrame; } 00056 virtual Bool_t GetHighlightFrame() const { return fHighlightFrame; } 00057 virtual Bool_t GetMiniFrame() const { return fMiniFrame; } 00058 00059 virtual void SetFillColor(Color_t c) { fFillColor = c; } 00060 virtual void SetLineColor(Color_t c) { fLineColor = c; } 00061 virtual void SetLineWidth(Float_t lw) { fLineWidth = lw;} 00062 virtual void SetDrawFrame(Bool_t f) { fDrawFrame = f; } 00063 virtual void SetHighlightFrame(Bool_t f) { fHighlightFrame = f; } 00064 virtual void SetMiniFrame(Bool_t r) { fMiniFrame = r; } 00065 00066 // ---------------------------------------------------------------- 00067 00068 virtual void CopyVizParams(const TEveElement* el); 00069 virtual void WriteVizParams(ostream& out, const TString& var); 00070 00071 // ---------------------------------------------------------------- 00072 00073 // Virtual from TObject 00074 virtual void Paint(Option_t* option=""); 00075 00076 // Abstract function from TAttBBox: 00077 // virtual void ComputeBBox(); 00078 00079 // Abstract from TEveProjectable, overriden in TEveElementList: 00080 // virtual TClass* ProjectedClass(const TEveProjection* p) const; 00081 00082 // ---------------------------------------------------------------- 00083 00084 static Int_t FindConvexHull(const vVector2_t& pin, vVector2_t& pout, TEveElement* caller=0); 00085 00086 static Bool_t IsBoxOrientationConsistentEv(const TEveVector box[8]); 00087 static Bool_t IsBoxOrientationConsistentFv(const Float_t box[8][3]); 00088 00089 static void CheckAndFixBoxOrientationEv(TEveVector box[8]); 00090 static void CheckAndFixBoxOrientationFv(Float_t box[8][3]); 00091 00092 ClassDef(TEveShape, 0); // Abstract base-class for 2D/3D shapes. 00093 }; 00094 00095 #endif