Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveStraightLineSet.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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_TEveStraightLineSet
13 #define ROOT_TEveStraightLineSet
14 
15 #include "TEveUtil.h"
16 
17 #include "TNamed.h"
18 #include "TQObject.h"
19 #include "TAtt3D.h"
20 #include "TAttMarker.h"
21 #include "TAttLine.h"
22 #include "TAttBBox.h"
23 
24 #include "TEveUtil.h"
25 #include "TEveElement.h"
26 #include "TEveProjectionBases.h"
27 #include "TEveChunkManager.h"
28 #include "TEveTrans.h"
29 
30 class TRandom;
31 
32 class TEveStraightLineSet : public TEveElement,
33  public TEveProjectable,
34  public TNamed,
35  public TQObject,
36  public TAtt3D,
37  public TAttLine,
38  public TAttMarker,
39  public TAttBBox
40 {
41 private:
42  TEveStraightLineSet(const TEveStraightLineSet&); // Not implemented
43  TEveStraightLineSet& operator=(const TEveStraightLineSet&); // Not implemented
44 
45 public:
46  struct Line_t
47  {
48  Int_t fId;
49  Float_t fV1[3];
50  Float_t fV2[3];
51  TRef fRef;
52 
53  Line_t(Float_t x1, Float_t y1, Float_t z1,
54  Float_t x2, Float_t y2, Float_t z2) : fId(-1), fRef()
55  {
56  fV1[0] = x1, fV1[1] = y1, fV1[2] = z1;
57  fV2[0] = x2, fV2[1] = y2, fV2[2] = z2;
58  }
59  };
60 
61  struct Marker_t
62  {
63  Float_t fV[3];
64  Int_t fLineId;
65  TRef fRef;
66 
67  Marker_t(Float_t x, Float_t y, Float_t z, Int_t line_id) : fLineId(line_id), fRef()
68  {
69  fV[0] = x, fV[1] = y, fV[2] = z;
70  }
71  };
72 
73 protected:
74  TEveChunkManager fLinePlex;
75  TEveChunkManager fMarkerPlex;
76 
77  Bool_t fOwnLinesIds; // Flag specifying if id-objects are owned by the line-set
78  Bool_t fOwnMarkersIds; // Flag specifying if id-objects are owned by the line-set
79 
80  Bool_t fRnrMarkers;
81  Bool_t fRnrLines;
82 
83  Bool_t fDepthTest;
84 
85  Line_t* fLastLine; //!
86 
87 public:
88  TEveStraightLineSet(const char* n="StraightLineSet", const char* t="");
89  virtual ~TEveStraightLineSet() {}
90 
91  virtual void SetLineColor(Color_t col) { SetMainColor(col); }
92 
93  Line_t* AddLine(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
94  Line_t* AddLine(const TEveVector& p1, const TEveVector& p2);
95  Marker_t* AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id=-1);
96  Marker_t* AddMarker(const TEveVector& p, Int_t line_id=-1);
97  Marker_t* AddMarker(Int_t line_id, Float_t pos);
98 
99  void SetLine(int idx, Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
100  void SetLine(int idx, const TEveVector& p1, const TEveVector& p2);
101 
102  TEveChunkManager& GetLinePlex() { return fLinePlex; }
103  TEveChunkManager& GetMarkerPlex() { return fMarkerPlex; }
104 
105  virtual Bool_t GetRnrMarkers() { return fRnrMarkers; }
106  virtual Bool_t GetRnrLines() { return fRnrLines; }
107  virtual Bool_t GetDepthTest() { return fDepthTest; }
108 
109  virtual void SetRnrMarkers(Bool_t x) { fRnrMarkers = x; }
110  virtual void SetRnrLines(Bool_t x) { fRnrLines = x; }
111  virtual void SetDepthTest(Bool_t x) { fDepthTest = x; }
112 
113  virtual void CopyVizParams(const TEveElement* el);
114  virtual void WriteVizParams(std::ostream& out, const TString& var);
115 
116  virtual TClass* ProjectedClass(const TEveProjection* p) const;
117 
118  virtual void ComputeBBox();
119  virtual void Paint(Option_t* option="");
120 
121  ClassDef(TEveStraightLineSet, 0); // Set of straight lines with optional markers along the lines.
122 };
123 
124 
125 /******************************************************************************/
126 
127 class TEveStraightLineSetProjected : public TEveStraightLineSet,
128  public TEveProjected
129 {
130 private:
131  TEveStraightLineSetProjected(const TEveStraightLineSetProjected&); // Not implemented
132  TEveStraightLineSetProjected& operator=(const TEveStraightLineSetProjected&); // Not implemented
133 
134 protected:
135  virtual void SetDepthLocal(Float_t d);
136 
137 public:
138  TEveStraightLineSetProjected();
139  virtual ~TEveStraightLineSetProjected() {}
140 
141  virtual void SetProjection(TEveProjectionManager* mng, TEveProjectable* model);
142  virtual void UpdateProjection();
143  virtual TEveElement* GetProjectedAsElement() { return this; }
144 
145  ClassDef(TEveStraightLineSetProjected, 0); // Projected copy of a TEveStraightLineSet.
146 };
147 
148 #endif