]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpRowSegmentPainter.cxx
Updated comments for Doxygen - corrected warnings
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpRowSegmentPainter.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17 // $MpId: AliMpRowSegmentPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
18 // Category: graphics
19 //
20 // Class AliMpRowSegmentPainter
21 // ----------------------------
22 // Class for drawing a motif into canvas
23 // Included in AliRoot: 2003/05/02
24 // Authors: David Guez, IPN Orsay
25  
26 #include "AliMpRowSegmentPainter.h"
27 #include "AliMpGraphContext.h"
28 #include "AliMpVRowSegment.h"
29 #include "AliMpRow.h"
30 #include "AliMpMotifMap.h"
31 #include "AliMpMotifPosition.h"
32
33 #include <TVirtualX.h>
34 #include <TPad.h>
35
36 /// \cond CLASSIMP
37 ClassImp(AliMpRowSegmentPainter)
38 /// \endcond
39
40 //_______________________________________________________________________
41 AliMpRowSegmentPainter::AliMpRowSegmentPainter()
42   : AliMpVPainter(),
43     fRowSegment(0)
44 {
45   /// Default constructor
46 }
47
48 //_______________________________________________________________________
49 AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
50   : AliMpVPainter(),
51     fRowSegment(row)
52 {
53   /// Standard constructor 
54
55 }
56
57 //_____________________________________________________________________________
58 AliMpRowSegmentPainter::AliMpRowSegmentPainter(
59                                        const AliMpRowSegmentPainter& right) 
60   : AliMpVPainter(right) 
61 {  
62   /// Protected copy constructor (not provided)
63
64   Fatal("AliMpRowSegmentPainter", "Copy constructor not provided.");
65 }
66
67 //_______________________________________________________________________
68 AliMpRowSegmentPainter::~AliMpRowSegmentPainter()
69 {
70   /// Destructor
71 }
72
73 //_____________________________________________________________________________
74 AliMpRowSegmentPainter& 
75 AliMpRowSegmentPainter::operator=(const AliMpRowSegmentPainter& right)
76 {
77   /// Assignment operator (not provided)
78
79   // check assignment to self
80   if (this == &right) return *this;
81
82   Fatal("operator =", "Assignment operator not provided.");
83     
84   return *this;  
85 }    
86
87 //_______________________________________________________________________
88 TVector2 AliMpRowSegmentPainter::GetPosition() const
89 {
90 /// Get the owned object's position
91
92   return fRowSegment->Position();
93 }
94
95 //_______________________________________________________________________
96 TVector2 AliMpRowSegmentPainter::GetDimensions() const
97 {
98 /// Get the owned object's dimensions
99
100   return fRowSegment->Dimensions();
101 }
102
103 //_______________________________________________________________________
104 void AliMpRowSegmentPainter::DumpObject()
105 {
106 /// Draw the owned object
107
108   fRowSegment->Dump();
109 }
110
111 //_______________________________________________________________________
112 void AliMpRowSegmentPainter::Draw(Option_t *option)
113 {
114 /// Draw the sector on the current pad
115 /// The first letter of \a option is treated as follows:
116 /// - case "S" : each row segments are drawn separately
117 /// - case ""  : the whole row is drawn at once
118 /// in both cases, the rest of the option is passed
119 /// as argument to the Draw function of respectively
120 /// zone or row objects.
121
122   AliMpGraphContext *gr = AliMpGraphContext::Instance();
123   if( !fRowSegment) return;
124
125   gr->Push();
126   InitGraphContext();
127   switch (option[0]){
128   case 'M':
129     {
130
131       for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
132         gr->Push();
133
134         Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
135         AliMpMotifPosition *motifPos = 
136             fRowSegment->GetRow()->GetMotifMap()
137               ->FindMotifPosition(motifPositionId);
138                                      
139         gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
140         gr->SetColor(GetColor());
141         DrawObject(motifPos,option+1);
142
143         gr->Pop();
144       }
145     }
146     break;
147   default: AppendPad(option);
148   }
149   gr->Pop();
150 }
151
152
153 //_______________________________________________________________________
154 void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
155 {
156 /// Paint the object
157
158   AliMpGraphContext *gr = AliMpGraphContext::Instance();
159   if (!fRowSegment) return;
160   Int_t col=gVirtualX->GetFillColor();
161   gr->Push();
162   gPad->Range(0.,0.,1.,1.);
163   InitGraphContext();
164   PaintWholeBox(kTRUE);
165
166 //   Float_t textSize =   gVirtualX->GetTextSize();
167 //   if (option[0]=='T')
168 //     gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
169 //                   Form("%d",fRowSegment->GetMotif()->GetID()));
170 //   gVirtualX->SetTextSize(textSize);
171   gr->Pop();
172   gVirtualX->SetFillColor(col);
173 }