]>
Commit | Line | Data |
---|---|---|
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$ | |
17 | // $MpId: AliMpSlatPainter.cxx,v 1.6 2005/09/19 18:56:46 ivana Exp $ | |
85fec35d | 18 | |
19 | /// | |
20 | /// \class AliMpSlatPainter | |
21 | /// | |
22 | /// Class for drawing a slat into canvas | |
23 | /// | |
24 | /// \author Laurent Aphecetche | |
dee1d5f1 | 25 | |
26 | #include "AliMpSlatPainter.h" | |
27 | ||
28 | #include "AliLog.h" | |
29 | #include "AliMpGraphContext.h" | |
30 | #include "AliMpPCB.h" | |
31 | #include "AliMpSlat.h" | |
32 | ||
33 | #include "TVirtualX.h" | |
34 | #include "TPad.h" | |
35 | #include <iostream> | |
36 | ||
37 | ClassImp(AliMpSlatPainter) | |
38 | ||
39 | //_____________________________________________________________________________ | |
40 | AliMpSlatPainter::AliMpSlatPainter() | |
884a73f1 | 41 | : AliMpVPainter(), |
42 | fkSlat(0) | |
dee1d5f1 | 43 | { |
44 | // | |
45 | // Empty ctor. | |
46 | // | |
47 | } | |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | AliMpSlatPainter::AliMpSlatPainter(const AliMpSlat* slat) | |
884a73f1 | 51 | : AliMpVPainter(), |
52 | fkSlat(slat) | |
dee1d5f1 | 53 | { |
54 | // | |
55 | // Normal ctor. | |
56 | // | |
57 | } | |
58 | ||
884a73f1 | 59 | //______________________________________________________________________________ |
60 | AliMpSlatPainter::AliMpSlatPainter(const AliMpSlatPainter& right) | |
61 | : AliMpVPainter(right) | |
62 | { | |
63 | /// Protected copy constructor (not implemented) | |
64 | ||
65 | AliFatal("Copy constructor not provided."); | |
66 | } | |
67 | ||
dee1d5f1 | 68 | //_____________________________________________________________________________ |
69 | AliMpSlatPainter::~AliMpSlatPainter() | |
70 | { | |
71 | // | |
72 | // Dtor. | |
73 | // | |
74 | } | |
75 | ||
884a73f1 | 76 | //______________________________________________________________________________ |
77 | AliMpSlatPainter& | |
78 | AliMpSlatPainter::operator=(const AliMpSlatPainter& right) | |
79 | { | |
80 | /// Protected assignement operator (not implemented) | |
81 | ||
82 | // check assignement to self | |
83 | if (this == &right) return *this; | |
84 | ||
85 | AliFatal("Assignement operator not provided."); | |
86 | ||
87 | return *this; | |
88 | } | |
89 | ||
dee1d5f1 | 90 | //_____________________________________________________________________________ |
91 | TVector2 | |
92 | AliMpSlatPainter::GetDimensions() const | |
93 | { | |
94 | // | |
95 | // Returns the half-sizes of the slat. | |
96 | // | |
97 | return TVector2(fkSlat->DX(),fkSlat->DY()); | |
98 | } | |
99 | ||
100 | //_____________________________________________________________________________ | |
101 | TVector2 | |
102 | AliMpSlatPainter::GetPosition() const | |
103 | { | |
104 | // | |
105 | // Returns the (x,y) position of the slat. | |
106 | // | |
107 | return TVector2(fkSlat->DX(),fkSlat->DY()); | |
108 | } | |
109 | ||
110 | //_____________________________________________________________________________ | |
111 | void | |
112 | AliMpSlatPainter::Draw(Option_t* option) | |
113 | { | |
114 | // | |
115 | // Draws the slat. | |
116 | // | |
117 | // If option[0] is 'P' then PCB are drawn too. | |
118 | // | |
119 | AliMpGraphContext *gr = AliMpGraphContext::Instance(); | |
120 | ||
121 | gr->Push(); | |
122 | InitGraphContext(); | |
123 | ||
dee1d5f1 | 124 | GetPosition().Print(); |
125 | GetDimensions().Print(); | |
126 | ||
127 | switch (option[0]) | |
128 | { | |
129 | case 'P': | |
130 | for ( AliMpSlat::Size_t i = 0; i < fkSlat->GetSize(); ++i ) | |
131 | { | |
132 | AliMpPCB* pcb = fkSlat->GetPCB(i); | |
133 | ||
134 | gr->Push(); | |
135 | ||
dee1d5f1 | 136 | gr->SetPadPosForReal(TVector2(pcb->X(),pcb->Y()), |
137 | TVector2(pcb->DX(),pcb->DY())); | |
138 | gr->SetColor(i+2); | |
139 | ||
140 | DrawObject(pcb,option+1); | |
141 | ||
142 | gr->Pop(); | |
143 | } | |
144 | break; | |
145 | default: | |
146 | AppendPad(option); | |
147 | } | |
148 | ||
149 | gr->Pop(); | |
150 | } | |
151 | ||
152 | //_____________________________________________________________________________ | |
153 | void | |
154 | AliMpSlatPainter::Paint(Option_t* /*option*/) | |
155 | { | |
156 | // | |
157 | // Paint the object. | |
158 | // | |
159 | AliMpGraphContext* gr = AliMpGraphContext::Instance(); | |
160 | ||
161 | Int_t col=gVirtualX->GetFillColor(); | |
162 | gr->Push(); | |
163 | gPad->Range(0.,0.,1.,1.); | |
164 | InitGraphContext(); | |
165 | ||
166 | PaintWholeBox(kTRUE); | |
167 | ||
168 | gr->Pop(); | |
169 | gVirtualX->SetFillColor(col); | |
170 | } | |
171 | ||
172 |