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 //-----------------------------------------------------------------------------
21 // Class AliMpRowPainter
22 // ---------------------
23 // Class for drawing a row into canvas
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, IPN Orsay
26 //-----------------------------------------------------------------------------
28 #include "AliMpRowPainter.h"
29 #include "AliMpGraphContext.h"
31 #include "AliMpRowSegment.h"
33 #include <TVirtualX.h>
37 ClassImp(AliMpRowPainter)
40 //_______________________________________________________________________
41 AliMpRowPainter::AliMpRowPainter()
45 /// Default constructor
48 //_______________________________________________________________________
49 AliMpRowPainter::AliMpRowPainter(AliMpRow *row)
53 /// Standard constructor
56 //_______________________________________________________________________
57 AliMpRowPainter::~AliMpRowPainter()
62 //_______________________________________________________________________
63 void AliMpRowPainter::DumpObject()
65 /// Draw the owned object
70 //_______________________________________________________________________
71 TVector2 AliMpRowPainter::GetPosition() const
73 /// Get the owned object's position
75 return fRow->Position();
78 //_______________________________________________________________________
79 TVector2 AliMpRowPainter::GetDimensions() const
81 /// Get the owned object's dimensions
83 return fRow->Dimensions();
86 //_______________________________________________________________________
87 void AliMpRowPainter::Draw(Option_t *option)
89 /// Draw the sector on the current pad
90 /// The first letter of \a option is treated as follows:
91 /// - case "S" : each row segments are drawn separately
92 /// - case "" : the whole row is drawn at once
93 /// in both cases, the rest of the option is passed
94 /// as argument to the Draw function of respectively
95 /// zone or row objects.
97 AliMpGraphContext *gr = AliMpGraphContext::Instance();
106 for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
107 AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
110 gr->SetPadPosForReal(rowSegment->Position(),rowSegment->Dimensions());
111 DrawObject(rowSegment,option+1);
117 default: AppendPad(option);
122 //_______________________________________________________________________
123 void AliMpRowPainter::Paint(Option_t *option)
127 AliMpGraphContext *gr = AliMpGraphContext::Instance();
129 Int_t col=gVirtualX->GetFillColor();
131 gPad->Range(0.,0.,1.,1.);
133 PaintWholeBox(kTRUE);
136 Float_t textSize = gVirtualX->GetTextSize();
137 gVirtualX->SetTextSize(12);
138 gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
139 Form("%d",fRow->GetID()));
140 gVirtualX->SetTextSize(textSize);
145 gVirtualX->SetFillColor(col);