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.6 2005/08/26 15:43:36 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 <TVirtualX.h>
30 #include "AliMpRowPainter.h"
31 #include "AliMpGraphContext.h"
33 #include "AliMpRowSegment.h"
35 ClassImp(AliMpRowPainter)
37 //_______________________________________________________________________
38 AliMpRowPainter::AliMpRowPainter()
42 /// Default constructor
45 //_______________________________________________________________________
46 AliMpRowPainter::AliMpRowPainter(AliMpRow *row)
50 /// Standard constructor
53 //_____________________________________________________________________________
54 AliMpRowPainter::AliMpRowPainter(const AliMpRowPainter& right)
55 : AliMpVPainter(right) {
57 /// Protected copy constructor (not provided)
59 Fatal("AliMpRowPainter", "Copy constructor not provided.");
62 //_______________________________________________________________________
63 AliMpRowPainter::~AliMpRowPainter()
68 //_____________________________________________________________________________
69 AliMpRowPainter& AliMpRowPainter::operator=(const AliMpRowPainter& right)
71 /// Assignment operator (not provided)
73 // check assignment to self
74 if (this == &right) return *this;
76 Fatal("operator =", "Assignment operator not provided.");
81 //_______________________________________________________________________
82 void AliMpRowPainter::DumpObject()
84 /// Draw the owned object
89 //_______________________________________________________________________
90 TVector2 AliMpRowPainter::GetPosition() const
92 /// Get the owned object's position
94 return fRow->Position();
97 //_______________________________________________________________________
98 TVector2 AliMpRowPainter::GetDimensions() const
100 /// Get the owned object's dimensions
102 return fRow->Dimensions();
105 //_______________________________________________________________________
106 void AliMpRowPainter::Draw(Option_t *option)
108 /// Draw the sector on the current pad
109 /// The first letter of <option> is treated as follows:
110 /// - case "S" : each row segments are drawn separately
111 /// - case "" : the whole row is drawn at once
112 /// in both cases, the rest of the option is passed
113 /// as argument to the Draw function of respectively
114 /// zone or row objects.
116 AliMpGraphContext *gr = AliMpGraphContext::Instance();
125 for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
126 AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
129 gr->SetPadPosForReal(rowSegment->Position(),rowSegment->Dimensions());
130 DrawObject(rowSegment,option+1);
136 default: AppendPad(option);
141 //_______________________________________________________________________
142 void AliMpRowPainter::Paint(Option_t *option)
146 AliMpGraphContext *gr = AliMpGraphContext::Instance();
148 Int_t col=gVirtualX->GetFillColor();
150 gPad->Range(0.,0.,1.,1.);
152 PaintWholeBox(kTRUE);
155 Float_t textSize = gVirtualX->GetTextSize();
156 gVirtualX->SetTextSize(12);
157 gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
158 Form("%d",fRow->GetID()));
159 gVirtualX->SetTextSize(textSize);
164 gVirtualX->SetFillColor(col);