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
21 // -----------------------
22 // Class for drawing a PCB into canvas
23 // Authors: Laurent Aphecetche
25 #include "AliMpPCBPainter.h"
27 #include "AliMpGraphContext.h"
28 #include "AliMpMotifPosition.h"
31 #include "TVirtualX.h"
36 ClassImp(AliMpPCBPainter)
38 //_____________________________________________________________________________
39 AliMpPCBPainter::AliMpPCBPainter(AliMpPCB* pcb)
40 : AliMpVPainter(), fPCB(pcb)
47 //_____________________________________________________________________________
48 AliMpPCBPainter::~AliMpPCBPainter()
55 //_____________________________________________________________________________
57 AliMpPCBPainter::GetDimensions() const
60 // Returns the half-sizes of the PCB.
62 return TVector2(fPCB->DX(),fPCB->DY());
65 //_____________________________________________________________________________
67 AliMpPCBPainter::GetPosition() const
70 // Returns the (x,y) position of the PCB.
72 return TVector2(fPCB->X(),fPCB->Y());
75 //_____________________________________________________________________________
77 AliMpPCBPainter::Draw(Option_t* option)
82 AliMpGraphContext *gr = AliMpGraphContext::Instance();
88 std::cout << "PCB Position and Dimensions:" << std::endl;
89 GetPosition().Print();
90 GetDimensions().Print();
95 for ( AliMpPCB::Size_t i = 0; i < fPCB->GetSize(); ++i )
97 AliMpMotifPosition* pos = fPCB->GetMotifPosition(i);
100 gr->SetPadPosForReal(pos->Position(),
103 std::cout << "Motif Position " << pos->GetID()
105 pos->GetMotif()->Print("");
106 std::cout << "Motif dimension:" << std::endl;
107 pos->GetMotif()->Dimensions().Print();
108 std::cout << "MotifPosition position:" << std::endl;
109 pos->Position().Print();
110 std::cout << "MotifPosition dimensions:" << std::endl;
111 pos->Dimensions().Print();
112 // int id = atoi(pos->GetMotif()->GetID().Data());
115 DrawObject(pos,option+1);
127 //_____________________________________________________________________________
129 AliMpPCBPainter::Paint(Option_t* /*option*/)
134 AliMpGraphContext* gr = AliMpGraphContext::Instance();
136 Int_t col=gVirtualX->GetFillColor();
138 gPad->Range(0.,0.,1.,1.);
141 PaintWholeBox(kTRUE);
144 gVirtualX->SetFillColor(col);