]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpPCBPainter.cxx
- Removed not implemented methods AddData(), GetGlobalTriggerPattern
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpPCBPainter.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
16// $Id$
13985652 17// $MpId: AliMpPCBPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
85fec35d 18
19///
13985652 20/// \class AliMpPCBPainter
85fec35d 21///
22/// Class for drawing a PCB into canvas
23///
24/// \author L. Aphecetche
dee1d5f1 25
26#include "AliMpPCBPainter.h"
27
28#include "AliMpGraphContext.h"
29#include "AliMpMotifPosition.h"
30#include "AliMpPCB.h"
31
884a73f1 32#include "AliLog.h"
33
dee1d5f1 34#include "TVirtualX.h"
35#include "TPad.h"
36
37#include <iostream>
38
13985652 39/// \cond CLASSIMP
dee1d5f1 40ClassImp(AliMpPCBPainter)
13985652 41/// \endcond
dee1d5f1 42
43//_____________________________________________________________________________
44AliMpPCBPainter::AliMpPCBPainter(AliMpPCB* pcb)
45 : AliMpVPainter(), fPCB(pcb)
46{
47 //
48 // Default ctor.
49 //
50}
51
52//_____________________________________________________________________________
53AliMpPCBPainter::~AliMpPCBPainter()
54{
55 //
56 // Dtor.
57 //
58}
59
60//_____________________________________________________________________________
61TVector2
62AliMpPCBPainter::GetDimensions() const
63{
64 //
65 // Returns the half-sizes of the PCB.
66 //
67 return TVector2(fPCB->DX(),fPCB->DY());
68}
69
70//_____________________________________________________________________________
71TVector2
72AliMpPCBPainter::GetPosition() const
73{
74 //
75 // Returns the (x,y) position of the PCB.
76 //
77 return TVector2(fPCB->X(),fPCB->Y());
78}
79
80//_____________________________________________________________________________
81void
82AliMpPCBPainter::Draw(Option_t* option)
83{
84 //
85 // Draws the PCB.
86 //
87 AliMpGraphContext *gr = AliMpGraphContext::Instance();
88 if (!fPCB) return;
89
90 gr->Push();
91 InitGraphContext();
92
dee1d5f1 93 switch (option[0])
1422e21f 94 {
dee1d5f1 95 case 'M':
96 for ( AliMpPCB::Size_t i = 0; i < fPCB->GetSize(); ++i )
1422e21f 97 {
98 AliMpMotifPosition* pos = fPCB->GetMotifPosition(i);
99
100 gr->Push();
101 gr->SetPadPosForReal(pos->Position(),
102 pos->Dimensions());
103 gr->SetColor(gr->GetColor()+i);
104
105 DrawObject(pos,option+1);
106
107 gr->Pop();
108 }
dee1d5f1 109 break;
110 default:
111 AppendPad(option);
1422e21f 112 }
113
dee1d5f1 114 gr->Pop();
115}
116
117//_____________________________________________________________________________
118void
119AliMpPCBPainter::Paint(Option_t* /*option*/)
120{
121 //
122 // Paint the object.
123 //
124 AliMpGraphContext* gr = AliMpGraphContext::Instance();
125 if (!fPCB) return;
126 Int_t col=gVirtualX->GetFillColor();
127 gr->Push();
128 gPad->Range(0.,0.,1.,1.);
129 InitGraphContext();
130
131 PaintWholeBox(kTRUE);
132
133 gr->Pop();
134 gVirtualX->SetFillColor(col);
135}