4 // Class AliMpRowSegmentPainter
5 // ----------------------------
6 // Class for drawing a motif into canvas
8 // Authors: David Guez, IPN Orsay
10 #include "AliMpRowSegmentPainter.h"
11 #include "AliMpGraphContext.h"
12 #include "AliMpVRowSegment.h"
14 #include "AliMpMotifMap.h"
15 #include "AliMpMotifPosition.h"
17 ClassImp(AliMpRowSegmentPainter)
19 //_______________________________________________________________________
20 AliMpRowSegmentPainter::AliMpRowSegmentPainter()
24 // default dummy constructor
26 //_______________________________________________________________________
27 AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
34 //_______________________________________________________________________
35 TVector2 AliMpRowSegmentPainter::GetPosition() const
37 // Get the owned object's position
38 return fRowSegment->Position();
41 //_______________________________________________________________________
42 TVector2 AliMpRowSegmentPainter::GetDimensions() const
44 // Get the owned object's dimensions
45 return fRowSegment->Dimensions();
49 //_______________________________________________________________________
50 void AliMpRowSegmentPainter::DumpObject()
52 // Draw the owned object
57 //_______________________________________________________________________
58 void AliMpRowSegmentPainter::Draw(Option_t *option)
60 // Draw the sector on the current pad
61 // The first letter of <option> is treated as follows:
62 // case "S" : each row segments are drawn separately
63 // case "" : the whole row is drawn at once
64 // in both cases, the rest of the option is passed
65 // as argument to the Draw function of respectively
66 // zone or row objects.
68 AliMpGraphContext *gr = AliMpGraphContext::Instance();
69 if( !fRowSegment) return;
77 for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
80 Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
81 AliMpMotifPosition *motifPos =
82 fRowSegment->GetRow()->GetMotifMap()
83 ->FindMotifPosition(motifPositionId);
85 gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
86 gr->SetColor(GetColor());
87 DrawObject(motifPos,option+1);
93 default: AppendPad(option);
99 //_______________________________________________________________________
100 void AliMpRowSegmentPainter::Paint(Option_t *option)
103 AliMpGraphContext *gr = AliMpGraphContext::Instance();
104 if (!fRowSegment) return;
105 Int_t col=gVirtualX->GetFillColor();
107 gPad->Range(0.,0.,1.,1.);
109 PaintWholeBox(kTRUE);
111 // Float_t textSize = gVirtualX->GetTextSize();
112 // if (option[0]=='T')
113 // gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
114 // Form("%d",fRowSegment->GetMotif()->GetID()));
115 // gVirtualX->SetTextSize(textSize);
117 gVirtualX->SetFillColor(col);