1 #ifndef REVE_NLTPolygonSet_H
2 #define REVE_NLTPolygonSet_H
4 #include <Reve/RenderElement.h>
5 #include <Reve/NLTBases.h>
16 template<typename _Tp> class allocator;
17 template<typename _Tp, typename _Alloc > class list;
30 NLTPolygon() : fNPnts(0), fPnts(0) {}
31 NLTPolygon(Int_t n, Int_t* p) : fNPnts(n), fPnts(p) {}
32 NLTPolygon(const NLTPolygon& x) : fNPnts(x.fNPnts), fPnts(x.fPnts) {}
33 virtual ~NLTPolygon() {}
35 NLTPolygon& operator=(const NLTPolygon& x)
36 { fNPnts = x.fNPnts; fPnts = x.fPnts; return *this; }
38 Int_t FindPoint(Int_t pi)
39 { for (Int_t i=0; i<fNPnts; ++i) if (fPnts[i] == pi) return i; return -1; }
41 ClassDef(NLTPolygon, 0)
45 class NLTPolygonSet : public RenderElementList,
50 friend class NLTPolygonSetGL;
51 friend class NLTPolygonSetEditor;
53 NLTPolygonSet(const NLTPolygonSet&); // Not implemented
54 NLTPolygonSet& operator=(const NLTPolygonSet&); // Not implemented
57 typedef std::list<Reve::NLTPolygon> vpPolygon_t;
58 typedef vpPolygon_t::iterator vpPolygon_i;
59 typedef vpPolygon_t::const_iterator vpPolygon_ci;
63 Int_t* fIdxMap; // map from original to projected and reduced point needed oly for geometry
65 Bool_t IsFirstIdxHead(Int_t s0, Int_t s1);
66 void AddPolygon(std::list<Int_t, std::allocator<Int_t> >& pp);
68 void ProjectAndReducePoints();
69 void MakePolygonsFromBP();
70 void MakePolygonsFromBS();
71 void ClearPolygonSet();
74 vpPolygon_t fPols; // NLT polygons
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
84 UChar_t fTransparency;
87 NLTPolygonSet(const Text_t* n="NLTPolygonSet", const Text_t* t="");
88 virtual ~NLTPolygonSet();
90 virtual void SetProjection(NLTProjector* proj, NLTProjectable* model);
91 virtual void UpdateProjection();
93 void ProjectBuffer3D();
95 virtual void ComputeBBox();
96 virtual void Paint(Option_t* option = "");
98 virtual void DumpPolys() const;
102 virtual Bool_t CanEditMainColor() { return kTRUE; }
103 virtual Color_t GetLineColor() const { return fLineColor; }
105 virtual Bool_t CanEditMainTransparency() { return kTRUE; }
106 virtual UChar_t GetMainTransparency() const { return fTransparency; }
107 virtual void SetMainTransparency(UChar_t t) { fTransparency = t; }
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));}
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;}
116 ClassDef(NLTPolygonSet,0)
118 }; // endclass NLTPolygonSet