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: AliMpRowPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
20 // Class AliMpRowPainter
21 // ---------------------
22 // Class for drawing a row into canvas
23 // Included in AliRoot: 2003/05/02
24 // Authors: David Guez, IPN Orsay
26 #include "AliMpRowPainter.h"
27 #include "AliMpGraphContext.h"
29 #include "AliMpRowSegment.h"
31 #include <TVirtualX.h>
35 ClassImp(AliMpRowPainter)
38 //_______________________________________________________________________
39 AliMpRowPainter::AliMpRowPainter()
43 /// Default constructor
46 //_______________________________________________________________________
47 AliMpRowPainter::AliMpRowPainter(AliMpRow *row)
51 /// Standard constructor
54 //_______________________________________________________________________
55 AliMpRowPainter::~AliMpRowPainter()
60 //_______________________________________________________________________
61 void AliMpRowPainter::DumpObject()
63 /// Draw the owned object
68 //_______________________________________________________________________
69 TVector2 AliMpRowPainter::GetPosition() const
71 /// Get the owned object's position
73 return fRow->Position();
76 //_______________________________________________________________________
77 TVector2 AliMpRowPainter::GetDimensions() const
79 /// Get the owned object's dimensions
81 return fRow->Dimensions();
84 //_______________________________________________________________________
85 void AliMpRowPainter::Draw(Option_t *option)
87 /// Draw the sector on the current pad
88 /// The first letter of \a option is treated as follows:
89 /// - case "S" : each row segments are drawn separately
90 /// - case "" : the whole row is drawn at once
91 /// in both cases, the rest of the option is passed
92 /// as argument to the Draw function of respectively
93 /// zone or row objects.
95 AliMpGraphContext *gr = AliMpGraphContext::Instance();
104 for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
105 AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
108 gr->SetPadPosForReal(rowSegment->Position(),rowSegment->Dimensions());
109 DrawObject(rowSegment,option+1);
115 default: AppendPad(option);
120 //_______________________________________________________________________
121 void AliMpRowPainter::Paint(Option_t *option)
125 AliMpGraphContext *gr = AliMpGraphContext::Instance();
127 Int_t col=gVirtualX->GetFillColor();
129 gPad->Range(0.,0.,1.,1.);
131 PaintWholeBox(kTRUE);
134 Float_t textSize = gVirtualX->GetTextSize();
135 gVirtualX->SetTextSize(12);
136 gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
137 Form("%d",fRow->GetID()));
138 gVirtualX->SetTextSize(textSize);
143 gVirtualX->SetFillColor(col);