TEveStraightLineSet.h

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveStraightLineSet.h 36938 2010-11-25 13:57:45Z matevz $
00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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_TEveStraightLineSet
00013 #define ROOT_TEveStraightLineSet
00014 
00015 #include "TEveUtil.h"
00016 
00017 #include <Gtypes.h>
00018 #include "TNamed.h"
00019 #include "TQObject.h"
00020 #include "TAtt3D.h"
00021 #include "TAttMarker.h"
00022 #include "TAttLine.h"
00023 #include "TAttBBox.h"
00024 
00025 #include "TEveUtil.h"
00026 #include "TEveElement.h"
00027 #include "TEveProjectionBases.h"
00028 #include "TEveChunkManager.h"
00029 #include "TEveTrans.h"
00030 
00031 class TRandom;
00032 
00033 class TEveStraightLineSet : public TEveElement,
00034                             public TEveProjectable,
00035                             public TNamed,
00036                             public TQObject,
00037                             public TAtt3D,
00038                             public TAttLine,
00039                             public TAttMarker,
00040                             public TAttBBox
00041 {
00042 private:
00043    TEveStraightLineSet(const TEveStraightLineSet&);            // Not implemented
00044    TEveStraightLineSet& operator=(const TEveStraightLineSet&); // Not implemented
00045 
00046 public:
00047    struct Line_t
00048    {
00049       Int_t          fId;
00050       Float_t        fV1[3];
00051       Float_t        fV2[3];
00052       TRef           fRef;
00053 
00054       Line_t(Float_t x1, Float_t y1, Float_t z1,
00055              Float_t x2, Float_t y2, Float_t z2) : fId(-1), fRef()
00056       {
00057          fV1[0] = x1, fV1[1] = y1, fV1[2] = z1;
00058          fV2[0] = x2, fV2[1] = y2, fV2[2] = z2;
00059       }
00060    };
00061 
00062    struct Marker_t
00063    {
00064       Float_t      fV[3];
00065       Int_t        fLineId;
00066       TRef         fRef;
00067 
00068       Marker_t(Float_t x, Float_t y, Float_t z, Int_t line_id) : fLineId(line_id), fRef()
00069       {
00070          fV[0] = x, fV[1] = y, fV[2] = z;
00071       }
00072    };
00073 
00074 protected:
00075    TEveChunkManager  fLinePlex;
00076    TEveChunkManager  fMarkerPlex;
00077 
00078    Bool_t            fOwnLinesIds;    // Flag specifying if id-objects are owned by the line-set
00079    Bool_t            fOwnMarkersIds;  // Flag specifying if id-objects are owned by the line-set
00080 
00081    Bool_t            fRnrMarkers;
00082    Bool_t            fRnrLines;
00083 
00084    Bool_t            fDepthTest;
00085 
00086    Line_t*           fLastLine; //!
00087 
00088 public:
00089    TEveStraightLineSet(const char* n="StraightLineSet", const char* t="");
00090    virtual ~TEveStraightLineSet() {}
00091 
00092    virtual void SetLineColor(Color_t col) { SetMainColor(col); }
00093 
00094    Line_t*   AddLine(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
00095    Line_t*   AddLine(const TEveVector& p1, const TEveVector& p2);
00096    Marker_t* AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id=-1);
00097    Marker_t* AddMarker(const TEveVector& p, Int_t line_id=-1);
00098    Marker_t* AddMarker(Int_t line_id, Float_t pos);
00099 
00100    void      SetLine(int idx, Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
00101    void      SetLine(int idx, const TEveVector& p1, const TEveVector& p2);
00102 
00103    TEveChunkManager& GetLinePlex()   { return fLinePlex;   }
00104    TEveChunkManager& GetMarkerPlex() { return fMarkerPlex; }
00105 
00106    virtual Bool_t GetRnrMarkers() { return fRnrMarkers; }
00107    virtual Bool_t GetRnrLines()   { return fRnrLines;   }
00108    virtual Bool_t GetDepthTest()  { return fDepthTest;   }
00109 
00110    virtual void SetRnrMarkers(Bool_t x) { fRnrMarkers = x; }
00111    virtual void SetRnrLines(Bool_t x)   { fRnrLines   = x; }
00112    virtual void SetDepthTest(Bool_t x)  { fDepthTest   = x; }
00113    
00114    virtual void CopyVizParams(const TEveElement* el);
00115    virtual void WriteVizParams(ostream& out, const TString& var);
00116 
00117    virtual TClass* ProjectedClass(const TEveProjection* p) const;
00118 
00119    virtual void ComputeBBox();
00120    virtual void Paint(Option_t* option="");
00121 
00122    ClassDef(TEveStraightLineSet, 1); // Set of straight lines with optional markers along the lines.
00123 };
00124 
00125 
00126 /******************************************************************************/
00127 
00128 class TEveStraightLineSetProjected : public TEveStraightLineSet,
00129                                      public TEveProjected
00130 {
00131 private:
00132    TEveStraightLineSetProjected(const TEveStraightLineSetProjected&);            // Not implemented
00133    TEveStraightLineSetProjected& operator=(const TEveStraightLineSetProjected&); // Not implemented
00134 
00135 protected:
00136    virtual void SetDepthLocal(Float_t d);
00137 
00138 public:
00139    TEveStraightLineSetProjected();
00140    virtual ~TEveStraightLineSetProjected() {}
00141 
00142    virtual void SetProjection(TEveProjectionManager* mng, TEveProjectable* model);
00143    virtual void UpdateProjection();
00144    virtual TEveElement* GetProjectedAsElement() { return this; }
00145 
00146    ClassDef(TEveStraightLineSetProjected, 1); // Projected copy of a TEveStraightLineSet.
00147 };
00148 
00149 #endif

Generated on Tue Jul 5 14:15:00 2011 for ROOT_528-00b_version by  doxygen 1.5.1