]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpRowSegmentPainter.cxx
Coding conventions corrections only
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpRowSegmentPainter.cxx
CommitLineData
5f91c9e8 1// $Id$
2// Category: graphics
3//
4// Class AliMpRowSegmentPainter
5// ----------------------------
6// Class for drawing a motif into canvas
7//
8// Authors: David Guez, IPN Orsay
9
2998a151 10#include <TVirtualX.h>
11#include <TPad.h>
12
5f91c9e8 13#include "AliMpRowSegmentPainter.h"
14#include "AliMpGraphContext.h"
15#include "AliMpVRowSegment.h"
16#include "AliMpRow.h"
17#include "AliMpMotifMap.h"
18#include "AliMpMotifPosition.h"
19
20ClassImp(AliMpRowSegmentPainter)
21
22//_______________________________________________________________________
23AliMpRowSegmentPainter::AliMpRowSegmentPainter()
24 : AliMpVPainter(),
25 fRowSegment(0)
26{
27 // default dummy constructor
28}
29//_______________________________________________________________________
30AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
31 : AliMpVPainter(),
32 fRowSegment(row)
33{
34 // normal constructor
35
36}
37//_______________________________________________________________________
2998a151 38AliMpRowSegmentPainter::~AliMpRowSegmentPainter()
39{
40 // destructor
41}
42//_______________________________________________________________________
5f91c9e8 43TVector2 AliMpRowSegmentPainter::GetPosition() const
44{
45// Get the owned object's position
46 return fRowSegment->Position();
47
48}
49//_______________________________________________________________________
50TVector2 AliMpRowSegmentPainter::GetDimensions() const
51{
52// Get the owned object's dimensions
53 return fRowSegment->Dimensions();
54
55}
56
57//_______________________________________________________________________
58void AliMpRowSegmentPainter::DumpObject()
59{
60// Draw the owned object
61 fRowSegment->Dump();
62
63}
64
65//_______________________________________________________________________
66void AliMpRowSegmentPainter::Draw(Option_t *option)
67{
68// Draw the sector on the current pad
69// The first letter of <option> is treated as follows:
70// case "S" : each row segments are drawn separately
71// case "" : the whole row is drawn at once
72// in both cases, the rest of the option is passed
73// as argument to the Draw function of respectively
74// zone or row objects.
75// ---
76 AliMpGraphContext *gr = AliMpGraphContext::Instance();
77 if( !fRowSegment) return;
78
79 gr->Push();
80 InitGraphContext();
81 switch (option[0]){
82 case 'M':
83 {
84
85 for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
86 gr->Push();
87
88 Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
89 AliMpMotifPosition *motifPos =
90 fRowSegment->GetRow()->GetMotifMap()
91 ->FindMotifPosition(motifPositionId);
92
93 gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
94 gr->SetColor(GetColor());
95 DrawObject(motifPos,option+1);
96
97 gr->Pop();
98 }
99 }
100 break;
101 default: AppendPad(option);
102 }
103 gr->Pop();
104}
105
106
107//_______________________________________________________________________
2998a151 108void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
5f91c9e8 109{
110// Paint the object
111 AliMpGraphContext *gr = AliMpGraphContext::Instance();
112 if (!fRowSegment) return;
113 Int_t col=gVirtualX->GetFillColor();
114 gr->Push();
115 gPad->Range(0.,0.,1.,1.);
116 InitGraphContext();
117 PaintWholeBox(kTRUE);
118
119// Float_t textSize = gVirtualX->GetTextSize();
120// if (option[0]=='T')
121// gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
122// Form("%d",fRowSegment->GetMotif()->GetID()));
123// gVirtualX->SetTextSize(textSize);
124 gr->Pop();
125 gVirtualX->SetFillColor(col);
126}