4 // Class AliMpRowSegmentPainter
5 // ----------------------------
6 // Class for drawing a motif into canvas
8 // Authors: David Guez, IPN Orsay
10 #include <TVirtualX.h>
14 #include "AliMpRowSegmentPainter.h"
15 #include "AliMpGraphContext.h"
16 #include "AliMpVRowSegment.h"
18 #include "AliMpMotifMap.h"
19 #include "AliMpMotifPosition.h"
21 ClassImp(AliMpRowSegmentPainter)
23 //_______________________________________________________________________
24 AliMpRowSegmentPainter::AliMpRowSegmentPainter()
28 // default dummy constructor
31 //_______________________________________________________________________
32 AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
40 //_____________________________________________________________________________
41 AliMpRowSegmentPainter::AliMpRowSegmentPainter(
42 const AliMpRowSegmentPainter& right)
43 : AliMpVPainter(right)
45 // copy constructor (not implemented)
47 Fatal("AliMpRowSegmentPainter", "Copy constructor not provided.");
50 //_______________________________________________________________________
51 AliMpRowSegmentPainter::~AliMpRowSegmentPainter()
56 //_____________________________________________________________________________
57 AliMpRowSegmentPainter&
58 AliMpRowSegmentPainter::operator=(const AliMpRowSegmentPainter& right)
60 // assignement operator (not implemented)
62 // check assignement to self
63 if (this == &right) return *this;
65 Fatal("operator =", "Assignement operator not provided.");
70 //_______________________________________________________________________
71 TVector2 AliMpRowSegmentPainter::GetPosition() const
73 // Get the owned object's position
74 return fRowSegment->Position();
77 //_______________________________________________________________________
78 TVector2 AliMpRowSegmentPainter::GetDimensions() const
80 // Get the owned object's dimensions
81 return fRowSegment->Dimensions();
85 //_______________________________________________________________________
86 void AliMpRowSegmentPainter::DumpObject()
88 // Draw the owned object
93 //_______________________________________________________________________
94 void AliMpRowSegmentPainter::Draw(Option_t *option)
96 // Draw the sector on the current pad
97 // The first letter of <option> is treated as follows:
98 // case "S" : each row segments are drawn separately
99 // case "" : the whole row is drawn at once
100 // in both cases, the rest of the option is passed
101 // as argument to the Draw function of respectively
102 // zone or row objects.
104 AliMpGraphContext *gr = AliMpGraphContext::Instance();
105 if( !fRowSegment) return;
113 for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
116 Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
117 AliMpMotifPosition *motifPos =
118 fRowSegment->GetRow()->GetMotifMap()
119 ->FindMotifPosition(motifPositionId);
121 gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
122 gr->SetColor(GetColor());
123 DrawObject(motifPos,option+1);
129 default: AppendPad(option);
135 //_______________________________________________________________________
136 void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
139 AliMpGraphContext *gr = AliMpGraphContext::Instance();
140 if (!fRowSegment) return;
141 Int_t col=gVirtualX->GetFillColor();
143 gPad->Range(0.,0.,1.,1.);
145 PaintWholeBox(kTRUE);
147 // Float_t textSize = gVirtualX->GetTextSize();
148 // if (option[0]=='T')
149 // gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
150 // Form("%d",fRowSegment->GetMotif()->GetID()));
151 // gVirtualX->SetTextSize(textSize);
153 gVirtualX->SetFillColor(col);