1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // $MpId: AliMpRowSegmentPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
20 //-----------------------------------------------------------------------------
21 // Class AliMpRowSegmentPainter
22 // ----------------------------
23 // Class for drawing a motif into canvas
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, IPN Orsay
26 //-----------------------------------------------------------------------------
28 #include "AliMpRowSegmentPainter.h"
29 #include "AliMpGraphContext.h"
30 #include "AliMpVRowSegment.h"
32 #include "AliMpMotifMap.h"
33 #include "AliMpMotifPosition.h"
35 #include <TVirtualX.h>
39 ClassImp(AliMpRowSegmentPainter)
42 //_______________________________________________________________________
43 AliMpRowSegmentPainter::AliMpRowSegmentPainter()
47 /// Default constructor
50 //_______________________________________________________________________
51 AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
55 /// Standard constructor
59 //_______________________________________________________________________
60 AliMpRowSegmentPainter::~AliMpRowSegmentPainter()
65 //_______________________________________________________________________
66 TVector2 AliMpRowSegmentPainter::GetPosition() const
68 /// Get the owned object's position
70 return fRowSegment->Position();
73 //_______________________________________________________________________
74 TVector2 AliMpRowSegmentPainter::GetDimensions() const
76 /// Get the owned object's dimensions
78 return fRowSegment->Dimensions();
81 //_______________________________________________________________________
82 void AliMpRowSegmentPainter::DumpObject()
84 /// Draw the owned object
89 //_______________________________________________________________________
90 void AliMpRowSegmentPainter::Draw(Option_t *option)
92 /// Draw the sector on the current pad
93 /// The first letter of \a option is treated as follows:
94 /// - case "S" : each row segments are drawn separately
95 /// - case "" : the whole row is drawn at once
96 /// in both cases, the rest of the option is passed
97 /// as argument to the Draw function of respectively
98 /// zone or row objects.
100 AliMpGraphContext *gr = AliMpGraphContext::Instance();
101 if( !fRowSegment) return;
109 for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
112 Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
113 AliMpMotifPosition *motifPos =
114 fRowSegment->GetRow()->GetMotifMap()
115 ->FindMotifPosition(motifPositionId);
117 gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
118 gr->SetColor(GetColor());
119 DrawObject(motifPos,option+1);
125 default: AppendPad(option);
131 //_______________________________________________________________________
132 void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
136 AliMpGraphContext *gr = AliMpGraphContext::Instance();
137 if (!fRowSegment) return;
138 Int_t col=gVirtualX->GetFillColor();
140 gPad->Range(0.,0.,1.,1.);
142 PaintWholeBox(kTRUE);
144 // Float_t textSize = gVirtualX->GetTextSize();
145 // if (option[0]=='T')
146 // gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
147 // Form("%d",fRowSegment->GetMotif()->GetID()));
148 // gVirtualX->SetTextSize(textSize);
150 gVirtualX->SetFillColor(col);