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