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.8 2006/05/24 13:58:32 ivana Exp $
20 //-----------------------------------------------------------------------------
21 /// \class AliMpPCBPainter
23 /// Class for drawing a PCB into canvas
25 /// \author L. Aphecetche
26 //-----------------------------------------------------------------------------
28 #include "AliMpPCBPainter.h"
30 #include "AliMpGraphContext.h"
31 #include "AliMpMotifPosition.h"
36 #include "TVirtualX.h"
42 ClassImp(AliMpPCBPainter)
45 //_____________________________________________________________________________
46 AliMpPCBPainter::AliMpPCBPainter(AliMpPCB* pcb)
47 : AliMpVPainter(), fPCB(pcb)
54 //_____________________________________________________________________________
55 AliMpPCBPainter::~AliMpPCBPainter()
62 //_____________________________________________________________________________
64 AliMpPCBPainter::GetDimensions() const
67 /// Returns the half-sizes of the PCB.
69 return TVector2(fPCB->DX(),fPCB->DY());
72 //_____________________________________________________________________________
74 AliMpPCBPainter::GetPosition() const
77 /// Returns the (x,y) position of the PCB.
79 return TVector2(fPCB->X(),fPCB->Y());
82 //_____________________________________________________________________________
84 AliMpPCBPainter::Draw(Option_t* option)
89 AliMpGraphContext *gr = AliMpGraphContext::Instance();
98 for ( AliMpPCB::Size_t i = 0; i < fPCB->GetSize(); ++i )
100 AliMpMotifPosition* pos = fPCB->GetMotifPosition(i);
103 gr->SetPadPosForReal(pos->Position(),
105 gr->SetColor(gr->GetColor()+i);
107 DrawObject(pos,option+1);
119 //_____________________________________________________________________________
121 AliMpPCBPainter::Paint(Option_t* /*option*/)
124 /// Paint the object.
126 AliMpGraphContext* gr = AliMpGraphContext::Instance();
128 Int_t col=gVirtualX->GetFillColor();
130 gPad->Range(0.,0.,1.,1.);
133 PaintWholeBox(kTRUE);
136 gVirtualX->SetFillColor(col);