]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/mapping/AliMpRowPainter.cxx
Fixing display of data at pad level (pads were hollow)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpRowPainter.cxx
... / ...
CommitLineData
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
16// $Id$
17// $MpId: AliMpRowPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
18// Category: graphics
19
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//-----------------------------------------------------------------------------
27
28#include "AliMpRowPainter.h"
29#include "AliMpGraphContext.h"
30#include "AliMpRow.h"
31#include "AliMpRowSegment.h"
32
33#include <TVirtualX.h>
34#include <TPad.h>
35
36/// \cond CLASSIMP
37ClassImp(AliMpRowPainter)
38/// \endcond
39
40//_______________________________________________________________________
41AliMpRowPainter::AliMpRowPainter()
42 : AliMpVPainter(),
43 fRow(0)
44{
45 /// Default constructor
46}
47
48//_______________________________________________________________________
49AliMpRowPainter::AliMpRowPainter(AliMpRow *row)
50 : AliMpVPainter(),
51 fRow(row)
52{
53 /// Standard constructor
54}
55
56//_______________________________________________________________________
57AliMpRowPainter::~AliMpRowPainter()
58{
59 /// Destructor
60}
61
62//_______________________________________________________________________
63void AliMpRowPainter::DumpObject()
64{
65/// Draw the owned object
66
67 fRow->Dump();
68}
69
70//_______________________________________________________________________
71TVector2 AliMpRowPainter::GetPosition() const
72{
73/// Get the owned object's position
74
75 return TVector2(fRow->GetPositionX(), fRow->GetPositionY());
76}
77
78//_______________________________________________________________________
79TVector2 AliMpRowPainter::GetDimensions() const
80{
81/// Get the owned object's dimensions
82
83 return TVector2(fRow->GetDimensionX(), fRow->GetDimensionY());
84}
85
86//_______________________________________________________________________
87void AliMpRowPainter::Draw(Option_t *option)
88{
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.
96
97 AliMpGraphContext *gr = AliMpGraphContext::Instance();
98 if( !fRow) return;
99
100 gr->Push();
101 InitGraphContext();
102
103 switch (option[0]){
104 case 'S':
105 {
106 for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
107 AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
108 gr->Push();
109
110 gr->SetPadPosForReal(TVector2(rowSegment->GetPositionX(),rowSegment->GetPositionY()),
111 TVector2(rowSegment->GetDimensionX(),rowSegment->GetDimensionY()));
112 DrawObject(rowSegment,option+1);
113
114 gr->Pop();
115 }
116 }
117 break;
118 default: AppendPad(option);
119 }
120 gr->Pop();
121}
122
123//_______________________________________________________________________
124void AliMpRowPainter::Paint(Option_t *option)
125{
126 /// Paint the object
127
128 AliMpGraphContext *gr = AliMpGraphContext::Instance();
129 if( !fRow) return;
130 Int_t col=gVirtualX->GetFillColor();
131 gr->Push();
132 gPad->Range(0.,0.,1.,1.);
133 InitGraphContext();
134 PaintWholeBox(kTRUE);
135
136 if (option[0]=='T'){
137 Float_t textSize = gVirtualX->GetTextSize();
138 gVirtualX->SetTextSize(12);
139 gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
140 Form("%d",fRow->GetID()));
141 gVirtualX->SetTextSize(textSize);
142 }
143
144
145 gr->Pop();
146 gVirtualX->SetFillColor(col);
147}