]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpRowPainter.cxx
Extendened class description to include at least 5 subsequent lines required by rule...
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpRowPainter.cxx
1 // $Id$
2 // Category: graphics
3 //
4 // Class AliMpRowPainter
5 // ---------------------
6 // Class for drawing a row into canvas
7 // Included in AliRoot: 2003/05/02
8 // Authors: David Guez, IPN Orsay
9   
10 #include <TVirtualX.h>
11 #include <TPad.h>
12 #include <TError.h>
13  
14 #include "AliMpRowPainter.h"
15 #include "AliMpGraphContext.h"
16 #include "AliMpRow.h"
17 #include "AliMpRowSegment.h"
18
19 ClassImp(AliMpRowPainter)
20
21 //_______________________________________________________________________
22 AliMpRowPainter::AliMpRowPainter()
23   : AliMpVPainter(),
24     fRow(0)
25 {
26   // default dummy constructor
27 }
28
29 //_______________________________________________________________________
30 AliMpRowPainter::AliMpRowPainter(AliMpRow *row)
31   : AliMpVPainter(),
32     fRow(row)
33 {
34   // normal constructor 
35 }
36
37 //_____________________________________________________________________________
38 AliMpRowPainter::AliMpRowPainter(const AliMpRowPainter& right) 
39   : AliMpVPainter(right) {
40 // 
41   // copy constructor (not implemented)
42
43   Fatal("AliMpRowPainter", "Copy constructor not provided.");
44 }
45
46 //_______________________________________________________________________
47 AliMpRowPainter::~AliMpRowPainter()
48 {
49   // destructor
50 }
51
52 //_____________________________________________________________________________
53 AliMpRowPainter& AliMpRowPainter::operator=(const AliMpRowPainter& right)
54 {
55   // assignement operator (not implemented)
56
57   // check assignement to self
58   if (this == &right) return *this;
59
60   Fatal("operator =", "Assignement operator not provided.");
61     
62   return *this;  
63 }    
64
65 //_______________________________________________________________________
66 void AliMpRowPainter::DumpObject()
67 {
68 // Draw the owned object
69   fRow->Dump();
70
71 }
72
73 //_______________________________________________________________________
74 TVector2 AliMpRowPainter::GetPosition() const
75 {
76 // Get the owned object's position
77   return fRow->Position();
78
79 }
80
81 //_______________________________________________________________________
82 TVector2 AliMpRowPainter::GetDimensions() const
83 {
84 // Get the owned object's dimensions
85   return fRow->Dimensions();
86
87 }
88
89 //_______________________________________________________________________
90 void AliMpRowPainter::Draw(Option_t *option)
91 {
92 // Draw the sector on the current pad
93 // The first letter of <option> is treated as follows:
94 // case "S" : each row segments are drawn separately
95 // case ""  : the whole row is drawn at once
96 // in both cases, the rest of the option is passed
97 // as argument to the Draw function of respectively
98 // zone or row objects.
99 // ---
100   AliMpGraphContext *gr = AliMpGraphContext::Instance();
101   if( !fRow) return;
102
103   gr->Push();
104   InitGraphContext();
105
106   switch (option[0]){
107   case 'S':
108     {
109       for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
110         AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
111         gr->Push();
112
113         gr->SetPadPosForReal(rowSegment->Position(),rowSegment->Dimensions());
114         DrawObject(rowSegment,option+1);
115       
116         gr->Pop();
117       }
118     }
119     break;
120   default: AppendPad(option);
121   }
122   gr->Pop();
123 }
124
125 //_______________________________________________________________________
126 void AliMpRowPainter::Paint(Option_t *option)
127 {
128   // Paint the object
129
130   AliMpGraphContext *gr = AliMpGraphContext::Instance();
131   if( !fRow) return;
132   Int_t col=gVirtualX->GetFillColor();
133   gr->Push();
134   gPad->Range(0.,0.,1.,1.);
135   InitGraphContext();  
136   PaintWholeBox(kTRUE);
137
138   if (option[0]=='T'){
139     Float_t textSize =   gVirtualX->GetTextSize();
140     gVirtualX->SetTextSize(12);
141     gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
142                     Form("%d",fRow->GetID()));
143     gVirtualX->SetTextSize(textSize);
144   }
145
146
147   gr->Pop();
148   gVirtualX->SetFillColor(col);
149 }