]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/NLTProjector.h
Record changes.
[u/mrichter/AliRoot.git] / EVE / Reve / NLTProjector.h
CommitLineData
debf9f47 1#ifndef REVE_NLTProjector
2#define REVE_NLTProjector
3
32e219c2 4#include <TAtt3D.h>
5#include <TAttBBox.h>
debf9f47 6
32e219c2 7#include <Reve/RenderElement.h>
66c5689e 8#include <Reve/PODs.h>
debf9f47 9
10namespace Reve {
32e219c2 11
32e219c2 12
debf9f47 13/**************************************************************************/
14// NLTProjections
15/**************************************************************************/
32e219c2 16
17class NLTProjection
18{
19public:
66c5689e 20 enum PType_e { PT_Unknown, PT_CFishEye, PT_RhoZ };
21 enum PProc_e { PP_Plane, PP_Distort, PP_Full };
22 enum GeoMode_e { GM_Unknown, GM_Polygons, GM_Segments };
32e219c2 23
24protected:
25 PType_e fType;
66c5689e 26 GeoMode_e fGeoMode;
32e219c2 27 const char* fName;
66c5689e 28
29 Vector fCenter;
30 Vector fProjectedZero;
31 Vector fZeroPosVal;
32
debf9f47 33 Float_t fDistortion; // sensible values from 0 to 0.01
32e219c2 34 Float_t fFixedRadius;
35 Float_t fScale;
a32c480d 36 Vector fUpLimit;
37 Vector fLowLimit;
38
66c5689e 39
32e219c2 40public:
66c5689e 41 NLTProjection(Vector& center);
42 virtual ~NLTProjection(){}
32e219c2 43
66c5689e 44 // virtual void ProjectPoint(Float_t&, Float_t&, Float_t&, PProc_e p = PP_Full ){p =p;}
45 virtual void ProjectPoint(Float_t&, Float_t&, Float_t&, PProc_e p = PP_Full ) = 0;
32e219c2 46 virtual void ProjectPointFv(Float_t* v){ ProjectPoint(v[0], v[1], v[2]); }
47 virtual void ProjectVector(Vector& v);
debf9f47 48 virtual Vector* Project(Vector* pnts, Int_t npnts, Bool_t create_new = kTRUE);
debf9f47 49
32e219c2 50 const char* GetName(){return fName;}
51 void SetName(const char* txt){ fName = txt; }
52
a32c480d 53 virtual void SetCenter(Vector& v){ fCenter = v; UpdateLimit();}
66c5689e 54 virtual Float_t* GetProjectedCenter() { return fCenter.c_vec(); }
55
32e219c2 56 void SetType(PType_e t){fType = t;}
57 PType_e GetType(){return fType;}
66c5689e 58
59 void SetGeoMode(GeoMode_e m){fGeoMode = m;}
60 GeoMode_e GetGeoMode(){return fGeoMode;}
61
a32c480d 62 void UpdateLimit();
32e219c2 63 void SetDistortion(Float_t d);
64 Float_t GetDistortion(){return fDistortion;}
a32c480d 65 void SetFixedRadius(Float_t x);
32e219c2 66 Float_t GetFixedRadius(){return fFixedRadius;}
67
68 virtual Bool_t AcceptSegment(Vector&, Vector&, Float_t /*tolerance*/) { return kTRUE; }
69 virtual void SetDirectionalVector(Int_t screenAxis, Vector& vec);
70
71 // utils to draw axis
72 virtual Float_t GetValForScreenPos(Int_t ax, Float_t value);
73 virtual Float_t GetScreenVal(Int_t ax, Float_t value);
a32c480d 74 Float_t GetLimit(Int_t i, Bool_t pos) { return pos ? fUpLimit[i] : fLowLimit[i]; }
32e219c2 75
76 static Float_t fgEps;
77
78 ClassDef(NLTProjection, 0);
debf9f47 79};
80
32e219c2 81class RhoZ: public NLTProjection
82{
66c5689e 83private:
84 Float_t fCenterR;
85 Vector fProjectedCenter;
debf9f47 86public:
66c5689e 87 RhoZ(Vector& center) : NLTProjection(center), fCenterR(0) { fType = PT_RhoZ; fName="RhoZ"; }
32e219c2 88 virtual ~RhoZ() {}
89
90 virtual Bool_t AcceptSegment(Vector& v1, Vector& v2, Float_t tolerance);
66c5689e 91 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, PProc_e proc = PP_Full);
32e219c2 92 virtual void SetDirectionalVector(Int_t screenAxis, Vector& vec);
93
66c5689e 94 virtual void SetCenter(Vector& center);
95 virtual Float_t* GetProjectedCenter() { return fProjectedCenter.c_vec(); }
32e219c2 96 ClassDef(RhoZ, 0);
debf9f47 97};
98
32e219c2 99class CircularFishEye : public NLTProjection
100{
debf9f47 101public:
66c5689e 102 CircularFishEye(Vector& center):NLTProjection(center) { fType = PT_CFishEye; fGeoMode = GM_Polygons; fName="CircularFishEye"; }
32e219c2 103 virtual ~CircularFishEye() {}
104
66c5689e 105 virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, PProc_e proc = PP_Full);
32e219c2 106
107 ClassDef(CircularFishEye, 0);
debf9f47 108};
109
110/**************************************************************************/
111// NLTProjector
112/**************************************************************************/
32e219c2 113class NLTProjector : public RenderElementList,
114 public TAttBBox,
115 public TAtt3D
debf9f47 116{
debf9f47 117private:
32e219c2 118 NLTProjector(const NLTProjector&); // Not implemented
119 NLTProjector& operator=(const NLTProjector&); // Not implemented
120
debf9f47 121 NLTProjection* fProjection;
122
66c5689e 123 Bool_t fDrawCenter;
124 Bool_t fDrawOrigin;
125 Vector fCenter;
126
32e219c2 127 Int_t fSplitInfoMode;
128 Int_t fSplitInfoLevel;
129 Color_t fAxisColor;
debf9f47 130
32e219c2 131 Float_t fCurrentDepth;
debf9f47 132
133public:
134 NLTProjector();
135 virtual ~NLTProjector();
136
32e219c2 137 void SetProjection(NLTProjection::PType_e type, Float_t distort=0);
138 void SetProjection(NLTProjection* p);
139 NLTProjection* GetProjection() { return fProjection; }
140
141 virtual void UpdateName();
142 // scale info
143 void SetSplitInfoMode(Int_t x) { fSplitInfoMode = x; }
144 Int_t GetSplitInfoMode() const { return fSplitInfoMode; }
145
146 void SetSplitInfoLevel(Int_t x) { fSplitInfoLevel = x; }
147 Int_t GetSplitInfoLevel() const { return fSplitInfoLevel; }
148
149 void SetAxisColor(Color_t col) { fAxisColor = col; }
150 Color_t GetAxisColor() const { return fAxisColor; }
151
152 void SetCurrentDepth(Float_t d) { fCurrentDepth = d; }
153 Float_t GetCurrentDepth() const { return fCurrentDepth; }
154
66c5689e 155 void SetCenter(Float_t x, Float_t y, Float_t z);
156 Vector& GetCenter(){return fCenter;}
157
158 void SetDrawCenter(Bool_t x){ fDrawCenter = x; }
159 Bool_t GetDrawCenter(){ return fDrawCenter; }
160
161 void SetDrawOrigin(Bool_t x){ fDrawOrigin = x; }
162 Bool_t GetDrawOrigin(){ return fDrawOrigin; }
163
32e219c2 164 virtual Bool_t HandleElementPaste(RenderElement* el);
165
166 virtual Bool_t ShouldImport(RenderElement* rnr_el);
167 virtual void ImportElementsRecurse(RenderElement* rnr_el, RenderElement* parent);
168 virtual void ImportElements(RenderElement* rnr_el);
169
170 virtual void ProjectChildrenRecurse(RenderElement* rnr_el);
171 virtual void ProjectChildren();
172
173 virtual void ComputeBBox();
174 virtual void Paint(Option_t* option = "");
175
176 ClassDef(NLTProjector, 0); //GUI for editing TGLViewer attributes
177};
debf9f47 178
debf9f47 179}
180#endif