]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpRowPainter.cxx
Adding new libraries
[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$
13985652 17// $MpId: AliMpRowPainter.cxx,v 1.8 2006/05/24 13:58:32 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
26#include "AliMpRowPainter.h"
27#include "AliMpGraphContext.h"
28#include "AliMpRow.h"
29#include "AliMpRowSegment.h"
30
2c605e66 31#include <TVirtualX.h>
32#include <TPad.h>
33
13985652 34/// \cond CLASSIMP
5f91c9e8 35ClassImp(AliMpRowPainter)
13985652 36/// \endcond
5f91c9e8 37
38//_______________________________________________________________________
39AliMpRowPainter::AliMpRowPainter()
40 : AliMpVPainter(),
41 fRow(0)
42{
dee1d5f1 43 /// Default constructor
5f91c9e8 44}
45
46//_______________________________________________________________________
47AliMpRowPainter::AliMpRowPainter(AliMpRow *row)
fb1bf5c0 48 : AliMpVPainter(),
49 fRow(row)
5f91c9e8 50{
dee1d5f1 51 /// Standard constructor
5f91c9e8 52}
53
2998a151 54//_______________________________________________________________________
55AliMpRowPainter::~AliMpRowPainter()
56{
dee1d5f1 57 /// Destructor
2998a151 58}
59
5f91c9e8 60//_______________________________________________________________________
61void AliMpRowPainter::DumpObject()
62{
dee1d5f1 63/// Draw the owned object
5f91c9e8 64
dee1d5f1 65 fRow->Dump();
5f91c9e8 66}
67
68//_______________________________________________________________________
69TVector2 AliMpRowPainter::GetPosition() const
70{
dee1d5f1 71/// Get the owned object's position
5f91c9e8 72
dee1d5f1 73 return fRow->Position();
5f91c9e8 74}
75
76//_______________________________________________________________________
77TVector2 AliMpRowPainter::GetDimensions() const
78{
dee1d5f1 79/// Get the owned object's dimensions
5f91c9e8 80
dee1d5f1 81 return fRow->Dimensions();
5f91c9e8 82}
83
84//_______________________________________________________________________
85void AliMpRowPainter::Draw(Option_t *option)
86{
dee1d5f1 87/// Draw the sector on the current pad
13985652 88/// The first letter of \a option is treated as follows:
dee1d5f1 89/// - case "S" : each row segments are drawn separately
90/// - case "" : the whole row is drawn at once
91/// in both cases, the rest of the option is passed
92/// as argument to the Draw function of respectively
93/// zone or row objects.
94
5f91c9e8 95 AliMpGraphContext *gr = AliMpGraphContext::Instance();
96 if( !fRow) return;
97
98 gr->Push();
99 InitGraphContext();
100
101 switch (option[0]){
102 case 'S':
103 {
104 for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
105 AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
106 gr->Push();
107
108 gr->SetPadPosForReal(rowSegment->Position(),rowSegment->Dimensions());
109 DrawObject(rowSegment,option+1);
110
111 gr->Pop();
112 }
113 }
114 break;
115 default: AppendPad(option);
116 }
117 gr->Pop();
118}
119
120//_______________________________________________________________________
121void AliMpRowPainter::Paint(Option_t *option)
122{
dee1d5f1 123 /// Paint the object
5f91c9e8 124
125 AliMpGraphContext *gr = AliMpGraphContext::Instance();
126 if( !fRow) return;
127 Int_t col=gVirtualX->GetFillColor();
128 gr->Push();
129 gPad->Range(0.,0.,1.,1.);
130 InitGraphContext();
131 PaintWholeBox(kTRUE);
132
133 if (option[0]=='T'){
134 Float_t textSize = gVirtualX->GetTextSize();
135 gVirtualX->SetTextSize(12);
136 gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
137 Form("%d",fRow->GetID()));
138 gVirtualX->SetTextSize(textSize);
139 }
140
141
142 gr->Pop();
143 gVirtualX->SetFillColor(col);
144}