Adding protected copy constructor and assignment operator
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpPCBPainter.cxx
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$
17 // $MpId: AliMpPCBPainter.cxx,v 1.4 2005/09/19 18:56:46 ivana Exp $
18 // Category: graphics
19 //
20 // Class AliMpSlatPainter
21 // -----------------------
22 // Class for drawing a PCB into canvas
23 // Authors: Laurent Aphecetche
24
25 #include "AliMpPCBPainter.h"
26
27 #include "AliMpGraphContext.h"
28 #include "AliMpMotifPosition.h"
29 #include "AliMpPCB.h"
30
31 #include "AliLog.h"
32
33 #include "TVirtualX.h"
34 #include "TPad.h"
35
36 #include <iostream>
37
38 ClassImp(AliMpPCBPainter)
39
40 //_____________________________________________________________________________
41 AliMpPCBPainter::AliMpPCBPainter(AliMpPCB* pcb)
42   : AliMpVPainter(), fPCB(pcb)
43 {
44     //
45     // Default ctor.
46     //
47 }
48
49 //______________________________________________________________________________
50 AliMpPCBPainter::AliMpPCBPainter(const AliMpPCBPainter& right) 
51   : AliMpVPainter(right) 
52 {  
53 /// Protected copy constructor (not implemented)
54
55   AliFatal("Copy constructor not provided.");
56 }
57
58 //_____________________________________________________________________________
59 AliMpPCBPainter::~AliMpPCBPainter()
60 {
61   //
62   // Dtor.
63   //
64 }
65
66 //______________________________________________________________________________
67 AliMpPCBPainter& 
68 AliMpPCBPainter::operator=(const AliMpPCBPainter& right)
69 {
70 /// Protected assignement operator (not implemented)
71
72   // check assignement to self
73   if (this == &right) return *this;
74
75   AliFatal("Assignement operator not provided.");
76     
77   return *this;  
78 }    
79
80 //_____________________________________________________________________________
81 TVector2
82 AliMpPCBPainter::GetDimensions() const
83 {
84   //
85   // Returns the half-sizes of the PCB.
86   //
87   return TVector2(fPCB->DX(),fPCB->DY());
88 }
89
90 //_____________________________________________________________________________
91 TVector2
92 AliMpPCBPainter::GetPosition() const
93 {
94   //
95   // Returns the (x,y) position of the PCB.
96   //
97   return TVector2(fPCB->X(),fPCB->Y());
98 }
99
100 //_____________________________________________________________________________
101 void
102 AliMpPCBPainter::Draw(Option_t* option)
103 {
104   //
105   // Draws the PCB.
106   //
107   AliMpGraphContext *gr = AliMpGraphContext::Instance();
108   if (!fPCB) return;
109
110   gr->Push();
111   InitGraphContext();
112
113   switch (option[0])
114   {
115     case 'M':
116       for ( AliMpPCB::Size_t i = 0; i < fPCB->GetSize(); ++i )
117       {
118         AliMpMotifPosition* pos = fPCB->GetMotifPosition(i);
119         
120         gr->Push();
121         gr->SetPadPosForReal(pos->Position(),
122                              pos->Dimensions());
123         gr->SetColor(gr->GetColor()+i);
124         
125         DrawObject(pos,option+1);
126         
127         gr->Pop();
128       }
129       break;
130     default:
131       AppendPad(option);
132   }
133   
134   gr->Pop();
135 }
136
137 //_____________________________________________________________________________
138 void
139 AliMpPCBPainter::Paint(Option_t* /*option*/)
140 {
141   //
142   // Paint the object.
143   //
144   AliMpGraphContext* gr = AliMpGraphContext::Instance();
145   if (!fPCB) return;
146   Int_t col=gVirtualX->GetFillColor();
147   gr->Push();
148   gPad->Range(0.,0.,1.,1.);
149   InitGraphContext();
150
151   PaintWholeBox(kTRUE);
152   
153   gr->Pop();
154   gVirtualX->SetFillColor(col);
155 }