]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpRowPainter.cxx
Reordering includes, forward declarations from most specific to more
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpRowPainter.cxx
CommitLineData
dee1d5f1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
5f91c9e8 16// $Id$
dee1d5f1 17// $MpId: AliMpRowPainter.cxx,v 1.6 2005/08/26 15:43:36 ivana Exp $
5f91c9e8 18// Category: graphics
19//
20// Class AliMpRowPainter
21// ---------------------
22// Class for drawing a row into canvas
dbe945cc 23// Included in AliRoot: 2003/05/02
5f91c9e8 24// Authors: David Guez, IPN Orsay
25
2998a151 26#include <TVirtualX.h>
27#include <TPad.h>
fb1bf5c0 28#include <TError.h>
2998a151 29
5f91c9e8 30#include "AliMpRowPainter.h"
31#include "AliMpGraphContext.h"
32#include "AliMpRow.h"
33#include "AliMpRowSegment.h"
34
35ClassImp(AliMpRowPainter)
36
37//_______________________________________________________________________
38AliMpRowPainter::AliMpRowPainter()
39 : AliMpVPainter(),
40 fRow(0)
41{
dee1d5f1 42 /// Default constructor
5f91c9e8 43}
44
45//_______________________________________________________________________
46AliMpRowPainter::AliMpRowPainter(AliMpRow *row)
fb1bf5c0 47 : AliMpVPainter(),
48 fRow(row)
5f91c9e8 49{
dee1d5f1 50 /// Standard constructor
5f91c9e8 51}
52
fb1bf5c0 53//_____________________________________________________________________________
54AliMpRowPainter::AliMpRowPainter(const AliMpRowPainter& right)
55 : AliMpVPainter(right) {
56//
dee1d5f1 57 /// Protected copy constructor (not provided)
fb1bf5c0 58
59 Fatal("AliMpRowPainter", "Copy constructor not provided.");
60}
61
2998a151 62//_______________________________________________________________________
63AliMpRowPainter::~AliMpRowPainter()
64{
dee1d5f1 65 /// Destructor
2998a151 66}
67
fb1bf5c0 68//_____________________________________________________________________________
69AliMpRowPainter& AliMpRowPainter::operator=(const AliMpRowPainter& right)
70{
dee1d5f1 71 /// Assignment operator (not provided)
fb1bf5c0 72
dee1d5f1 73 // check assignment to self
fb1bf5c0 74 if (this == &right) return *this;
75
dee1d5f1 76 Fatal("operator =", "Assignment operator not provided.");
fb1bf5c0 77
78 return *this;
79}
80
5f91c9e8 81//_______________________________________________________________________
82void AliMpRowPainter::DumpObject()
83{
dee1d5f1 84/// Draw the owned object
5f91c9e8 85
dee1d5f1 86 fRow->Dump();
5f91c9e8 87}
88
89//_______________________________________________________________________
90TVector2 AliMpRowPainter::GetPosition() const
91{
dee1d5f1 92/// Get the owned object's position
5f91c9e8 93
dee1d5f1 94 return fRow->Position();
5f91c9e8 95}
96
97//_______________________________________________________________________
98TVector2 AliMpRowPainter::GetDimensions() const
99{
dee1d5f1 100/// Get the owned object's dimensions
5f91c9e8 101
dee1d5f1 102 return fRow->Dimensions();
5f91c9e8 103}
104
105//_______________________________________________________________________
106void AliMpRowPainter::Draw(Option_t *option)
107{
dee1d5f1 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.
115
5f91c9e8 116 AliMpGraphContext *gr = AliMpGraphContext::Instance();
117 if( !fRow) return;
118
119 gr->Push();
120 InitGraphContext();
121
122 switch (option[0]){
123 case 'S':
124 {
125 for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
126 AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
127 gr->Push();
128
129 gr->SetPadPosForReal(rowSegment->Position(),rowSegment->Dimensions());
130 DrawObject(rowSegment,option+1);
131
132 gr->Pop();
133 }
134 }
135 break;
136 default: AppendPad(option);
137 }
138 gr->Pop();
139}
140
141//_______________________________________________________________________
142void AliMpRowPainter::Paint(Option_t *option)
143{
dee1d5f1 144 /// Paint the object
5f91c9e8 145
146 AliMpGraphContext *gr = AliMpGraphContext::Instance();
147 if( !fRow) return;
148 Int_t col=gVirtualX->GetFillColor();
149 gr->Push();
150 gPad->Range(0.,0.,1.,1.);
151 InitGraphContext();
152 PaintWholeBox(kTRUE);
153
154 if (option[0]=='T'){
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);
160 }
161
162
163 gr->Pop();
164 gVirtualX->SetFillColor(col);
165}