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.7 2006/03/17 11:35:29 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>
34 ClassImp(AliMpRowPainter)
36 //_______________________________________________________________________
37 AliMpRowPainter::AliMpRowPainter()
41 /// Default constructor
44 //_______________________________________________________________________
45 AliMpRowPainter::AliMpRowPainter(AliMpRow *row)
49 /// Standard constructor
52 //_____________________________________________________________________________
53 AliMpRowPainter::AliMpRowPainter(const AliMpRowPainter& right)
54 : AliMpVPainter(right) {
56 /// Protected copy constructor (not provided)
58 Fatal("AliMpRowPainter", "Copy constructor not provided.");
61 //_______________________________________________________________________
62 AliMpRowPainter::~AliMpRowPainter()
67 //_____________________________________________________________________________
68 AliMpRowPainter& AliMpRowPainter::operator=(const AliMpRowPainter& right)
70 /// Assignment operator (not provided)
72 // check assignment to self
73 if (this == &right) return *this;
75 Fatal("operator =", "Assignment operator not provided.");
80 //_______________________________________________________________________
81 void AliMpRowPainter::DumpObject()
83 /// Draw the owned object
88 //_______________________________________________________________________
89 TVector2 AliMpRowPainter::GetPosition() const
91 /// Get the owned object's position
93 return fRow->Position();
96 //_______________________________________________________________________
97 TVector2 AliMpRowPainter::GetDimensions() const
99 /// Get the owned object's dimensions
101 return fRow->Dimensions();
104 //_______________________________________________________________________
105 void AliMpRowPainter::Draw(Option_t *option)
107 /// Draw the sector on the current pad
108 /// The first letter of <option> is treated as follows:
109 /// - case "S" : each row segments are drawn separately
110 /// - case "" : the whole row is drawn at once
111 /// in both cases, the rest of the option is passed
112 /// as argument to the Draw function of respectively
113 /// zone or row objects.
115 AliMpGraphContext *gr = AliMpGraphContext::Instance();
124 for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
125 AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
128 gr->SetPadPosForReal(rowSegment->Position(),rowSegment->Dimensions());
129 DrawObject(rowSegment,option+1);
135 default: AppendPad(option);
140 //_______________________________________________________________________
141 void AliMpRowPainter::Paint(Option_t *option)
145 AliMpGraphContext *gr = AliMpGraphContext::Instance();
147 Int_t col=gVirtualX->GetFillColor();
149 gPad->Range(0.,0.,1.,1.);
151 PaintWholeBox(kTRUE);
154 Float_t textSize = gVirtualX->GetTextSize();
155 gVirtualX->SetTextSize(12);
156 gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
157 Form("%d",fRow->GetID()));
158 gVirtualX->SetTextSize(textSize);
163 gVirtualX->SetFillColor(col);