4 // Class AliMpRowSegmentPainter
5 // ----------------------------
6 // Class for drawing a motif into canvas
8 // Authors: David Guez, IPN Orsay
10 #include <TVirtualX.h>
13 #include "AliMpRowSegmentPainter.h"
14 #include "AliMpGraphContext.h"
15 #include "AliMpVRowSegment.h"
17 #include "AliMpMotifMap.h"
18 #include "AliMpMotifPosition.h"
20 ClassImp(AliMpRowSegmentPainter)
22 //_______________________________________________________________________
23 AliMpRowSegmentPainter::AliMpRowSegmentPainter()
27 // default dummy constructor
29 //_______________________________________________________________________
30 AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
37 //_______________________________________________________________________
38 AliMpRowSegmentPainter::~AliMpRowSegmentPainter()
42 //_______________________________________________________________________
43 TVector2 AliMpRowSegmentPainter::GetPosition() const
45 // Get the owned object's position
46 return fRowSegment->Position();
49 //_______________________________________________________________________
50 TVector2 AliMpRowSegmentPainter::GetDimensions() const
52 // Get the owned object's dimensions
53 return fRowSegment->Dimensions();
57 //_______________________________________________________________________
58 void AliMpRowSegmentPainter::DumpObject()
60 // Draw the owned object
65 //_______________________________________________________________________
66 void AliMpRowSegmentPainter::Draw(Option_t *option)
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.
76 AliMpGraphContext *gr = AliMpGraphContext::Instance();
77 if( !fRowSegment) return;
85 for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
88 Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
89 AliMpMotifPosition *motifPos =
90 fRowSegment->GetRow()->GetMotifMap()
91 ->FindMotifPosition(motifPositionId);
93 gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
94 gr->SetColor(GetColor());
95 DrawObject(motifPos,option+1);
101 default: AppendPad(option);
107 //_______________________________________________________________________
108 void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
111 AliMpGraphContext *gr = AliMpGraphContext::Instance();
112 if (!fRowSegment) return;
113 Int_t col=gVirtualX->GetFillColor();
115 gPad->Range(0.,0.,1.,1.);
117 PaintWholeBox(kTRUE);
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);
125 gVirtualX->SetFillColor(col);