]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpVPainter.h
905b61c81344071a779c381715f566f1d6c79b63
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpVPainter.h
1 // $Id$
2 // Category: graphics
3 //
4 // Class AliMpVPainter
5 // --------------
6 // Class for drawing objects into canvas
7 //
8 // Authors: David Guez, IPN Orsay
9
10 #ifndef ALI_MP_V_PAINTER_H
11 #define ALI_MP_V_PAINTER_H
12
13 #include <TObject.h>
14 #include <TVector2.h>
15
16 class TList;
17
18 class AliMpVPainter : public TObject
19 {
20  public:
21   AliMpVPainter();
22   virtual ~AliMpVPainter();
23   void DumpObject() const; // *MENU*
24   virtual void Paint(Option_t *option)=0;
25   virtual TObject* Clone(const char* newname="") const;
26   virtual TObject* DrawClone(Option_t* option) const; // *MENU*
27   // get methods
28   TVector2 GetPadPosition() const {return fPadPosition;}
29   TVector2 GetPadDimensions() const {return fPadDimensions;}
30   Int_t GetColor() const {return fColor;}
31
32   // set methods
33   void SetPadPosition(const TVector2 &padPosition){fPadPosition=padPosition;}
34   void SetPadDimension(const TVector2 &padDimensions){fPadDimensions=padDimensions;}
35   void SetColor(Int_t color){fColor=color;}
36
37   // methods
38   Bool_t IsInside(const TVector2 &point,const TVector2& pos,const TVector2& dim);
39   virtual TVector2 GetPosition() const=0;
40   virtual TVector2 GetDimensions() const=0;
41   void InitGraphContext();
42   void PaintWholeBox(Bool_t fill=kTRUE);
43   virtual Int_t DistancetoPrimitive(Int_t x, Int_t y);
44   TVector2 RealToPad(const TVector2& realPos);
45
46   static AliMpVPainter *CreatePainter(TObject *object);
47  protected:
48   void AddPainter(AliMpVPainter *painter);
49   AliMpVPainter *DrawObject(TObject *object,Option_t *option="");
50  private:
51   Int_t fColor;               //  color
52   TVector2 fPadPosition;      // position inside the graphics pad
53   TVector2 fPadDimensions;    // dimensions inside the graphics pad
54   TList *fTrashList;           // list of painter object created
55   ClassDef(AliMpVPainter,1) // abstract object painter
56 };
57
58 #endif //ALI_MP_V_PAINTER_H