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