]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/NLTPolygonSet.h
Record changes.
[u/mrichter/AliRoot.git] / EVE / Reve / NLTPolygonSet.h
CommitLineData
debf9f47 1#ifndef REVE_NLTPolygonSet_H
2#define REVE_NLTPolygonSet_H
3
4#include <Reve/RenderElement.h>
32e219c2 5#include <Reve/NLTBases.h>
debf9f47 6
7#include "TNamed.h"
8#include "TAtt3D.h"
9#include "TAttBBox.h"
10#include "TColor.h"
32e219c2 11#include "PODs.h"
12
13class TBuffer3D;
14
15namespace std {
16 template<typename _Tp> class allocator;
17 template<typename _Tp, typename _Alloc > class list;
18}
debf9f47 19
20namespace Reve {
21
22class Vector;
23
24class NLTPolygon
25{
26public:
27 Int_t fNPnts;
28 Int_t* fPnts;
29
30 NLTPolygon() : fNPnts(0), fPnts(0) {}
31 NLTPolygon(Int_t n, Int_t* p) : fNPnts(n), fPnts(p) {}
f36b73bd 32 NLTPolygon(const NLTPolygon& x) : fNPnts(x.fNPnts), fPnts(x.fPnts) {}
32e219c2 33 virtual ~NLTPolygon() {}
34
f36b73bd 35 NLTPolygon& operator=(const NLTPolygon& x)
36 { fNPnts = x.fNPnts; fPnts = x.fPnts; return *this; }
37
32e219c2 38 Int_t FindPoint(Int_t pi)
39 { for (Int_t i=0; i<fNPnts; ++i) if (fPnts[i] == pi) return i; return -1; }
debf9f47 40
41 ClassDef(NLTPolygon, 0)
42};
43
44
32e219c2 45class NLTPolygonSet : public RenderElementList,
46 public NLTProjected,
debf9f47 47 public TAtt3D,
48 public TAttBBox
49{
50 friend class NLTPolygonSetGL;
51 friend class NLTPolygonSetEditor;
32e219c2 52private:
f36b73bd 53 NLTPolygonSet(const NLTPolygonSet&); // Not implemented
54 NLTPolygonSet& operator=(const NLTPolygonSet&); // Not implemented
55
32e219c2 56public:
57 typedef std::list<Reve::NLTPolygon> vpPolygon_t;
58 typedef vpPolygon_t::iterator vpPolygon_i;
59 typedef vpPolygon_t::const_iterator vpPolygon_ci;
60
61private:
62 TBuffer3D* fBuff;
63 Int_t* fIdxMap; // map from original to projected and reduced point needed oly for geometry
64
65 Bool_t IsFirstIdxHead(Int_t s0, Int_t s1);
66 void AddPolygon(std::list<Int_t, std::allocator<Int_t> >& pp);
debf9f47 67
32e219c2 68 void ProjectAndReducePoints();
69 void MakePolygonsFromBP();
70 void MakePolygonsFromBS();
71 void ClearPolygonSet();
72
73protected:
74 vpPolygon_t fPols; // NLT polygons
75
76 Float_t fEps; // distance accounted in reducing the ponts
77 Int_t fNPnts; // number of reduced and projected points
78 Vector* fPnts; // reduced and projected points
debf9f47 79
80 Color_t fFillColor;
81 Color_t fLineColor;
82 Float_t fLineWidth;
32e219c2 83
84 UChar_t fTransparency;
debf9f47 85
86public:
87 NLTPolygonSet(const Text_t* n="NLTPolygonSet", const Text_t* t="");
88 virtual ~NLTPolygonSet();
89
32e219c2 90 virtual void SetProjection(NLTProjector* proj, NLTProjectable* model);
91 virtual void UpdateProjection();
debf9f47 92
32e219c2 93 void ProjectBuffer3D();
debf9f47 94
32e219c2 95 virtual void ComputeBBox();
96 virtual void Paint(Option_t* option = "");
debf9f47 97
32e219c2 98 virtual void DumpPolys() const;
99 void DumpBuffer3D();
debf9f47 100
32e219c2 101 //rendering
102 virtual Bool_t CanEditMainColor() { return kTRUE; }
103 virtual Color_t GetLineColor() const { return fLineColor; }
104
105 virtual Bool_t CanEditMainTransparency() { return kTRUE; }
106 virtual UChar_t GetMainTransparency() const { return fTransparency; }
107 virtual void SetMainTransparency(UChar_t t) { fTransparency = t; }
debf9f47 108
32e219c2 109 virtual void SetFillColor(Pixel_t pixel) { fFillColor = Color_t(TColor::GetColor(pixel));}
110 virtual void SetLineColor(Pixel_t pixel) { fLineColor = Color_t(TColor::GetColor(pixel));}
debf9f47 111
32e219c2 112 virtual void SetFillColor(Color_t c) { fFillColor = c; }
113 virtual void SetLineColor(Color_t c) { fLineColor = c; }
114 virtual void SetLineWidth(Double_t lw){fLineWidth = lw;}
debf9f47 115
116 ClassDef(NLTPolygonSet,0)
32e219c2 117
118 }; // endclass NLTPolygonSet
debf9f47 119} // namespace Reve
120
121#endif