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: AliMpPCBPainter.cxx,v 1.4 2005/09/19 18:56:46 ivana Exp $
20 /// \class AliMpSlatPainter
22 /// Class for drawing a PCB into canvas
24 /// \author L. Aphecetche
26 #include "AliMpPCBPainter.h"
28 #include "AliMpGraphContext.h"
29 #include "AliMpMotifPosition.h"
34 #include "TVirtualX.h"
39 ClassImp(AliMpPCBPainter)
41 //_____________________________________________________________________________
42 AliMpPCBPainter::AliMpPCBPainter(AliMpPCB* pcb)
43 : AliMpVPainter(), fPCB(pcb)
50 //______________________________________________________________________________
51 AliMpPCBPainter::AliMpPCBPainter(const AliMpPCBPainter& right)
52 : AliMpVPainter(right)
54 /// Protected copy constructor (not implemented)
56 AliFatal("Copy constructor not provided.");
59 //_____________________________________________________________________________
60 AliMpPCBPainter::~AliMpPCBPainter()
67 //______________________________________________________________________________
69 AliMpPCBPainter::operator=(const AliMpPCBPainter& right)
71 /// Protected assignement operator (not implemented)
73 // check assignement to self
74 if (this == &right) return *this;
76 AliFatal("Assignement operator not provided.");
81 //_____________________________________________________________________________
83 AliMpPCBPainter::GetDimensions() const
86 // Returns the half-sizes of the PCB.
88 return TVector2(fPCB->DX(),fPCB->DY());
91 //_____________________________________________________________________________
93 AliMpPCBPainter::GetPosition() const
96 // Returns the (x,y) position of the PCB.
98 return TVector2(fPCB->X(),fPCB->Y());
101 //_____________________________________________________________________________
103 AliMpPCBPainter::Draw(Option_t* option)
108 AliMpGraphContext *gr = AliMpGraphContext::Instance();
117 for ( AliMpPCB::Size_t i = 0; i < fPCB->GetSize(); ++i )
119 AliMpMotifPosition* pos = fPCB->GetMotifPosition(i);
122 gr->SetPadPosForReal(pos->Position(),
124 gr->SetColor(gr->GetColor()+i);
126 DrawObject(pos,option+1);
138 //_____________________________________________________________________________
140 AliMpPCBPainter::Paint(Option_t* /*option*/)
145 AliMpGraphContext* gr = AliMpGraphContext::Instance();
147 Int_t col=gVirtualX->GetFillColor();
149 gPad->Range(0.,0.,1.,1.);
152 PaintWholeBox(kTRUE);
155 gVirtualX->SetFillColor(col);