]>
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 | ||
5f91c9e8 | 16 | // $Id$ |
2c605e66 | 17 | // $MpId: AliMpRowSegmentPainter.cxx,v 1.7 2006/03/17 11:35:29 ivana Exp $ |
5f91c9e8 | 18 | // Category: graphics |
19 | // | |
20 | // Class AliMpRowSegmentPainter | |
21 | // ---------------------------- | |
22 | // Class for drawing a motif into canvas | |
dbe945cc | 23 | // Included in AliRoot: 2003/05/02 |
5f91c9e8 | 24 | // Authors: David Guez, IPN Orsay |
25 | ||
26 | #include "AliMpRowSegmentPainter.h" | |
27 | #include "AliMpGraphContext.h" | |
28 | #include "AliMpVRowSegment.h" | |
29 | #include "AliMpRow.h" | |
30 | #include "AliMpMotifMap.h" | |
31 | #include "AliMpMotifPosition.h" | |
32 | ||
2c605e66 | 33 | #include <TVirtualX.h> |
34 | #include <TPad.h> | |
35 | ||
5f91c9e8 | 36 | ClassImp(AliMpRowSegmentPainter) |
37 | ||
38 | //_______________________________________________________________________ | |
39 | AliMpRowSegmentPainter::AliMpRowSegmentPainter() | |
40 | : AliMpVPainter(), | |
41 | fRowSegment(0) | |
42 | { | |
dee1d5f1 | 43 | /// Default constructor |
5f91c9e8 | 44 | } |
fb1bf5c0 | 45 | |
5f91c9e8 | 46 | //_______________________________________________________________________ |
47 | AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row) | |
48 | : AliMpVPainter(), | |
49 | fRowSegment(row) | |
50 | { | |
dee1d5f1 | 51 | /// Standard constructor |
5f91c9e8 | 52 | |
53 | } | |
fb1bf5c0 | 54 | |
55 | //_____________________________________________________________________________ | |
56 | AliMpRowSegmentPainter::AliMpRowSegmentPainter( | |
57 | const AliMpRowSegmentPainter& right) | |
58 | : AliMpVPainter(right) | |
59 | { | |
dee1d5f1 | 60 | /// Protected copy constructor (not provided) |
fb1bf5c0 | 61 | |
62 | Fatal("AliMpRowSegmentPainter", "Copy constructor not provided."); | |
63 | } | |
64 | ||
5f91c9e8 | 65 | //_______________________________________________________________________ |
2998a151 | 66 | AliMpRowSegmentPainter::~AliMpRowSegmentPainter() |
67 | { | |
dee1d5f1 | 68 | /// Destructor |
2998a151 | 69 | } |
fb1bf5c0 | 70 | |
71 | //_____________________________________________________________________________ | |
72 | AliMpRowSegmentPainter& | |
73 | AliMpRowSegmentPainter::operator=(const AliMpRowSegmentPainter& right) | |
74 | { | |
dee1d5f1 | 75 | /// Assignment operator (not provided) |
fb1bf5c0 | 76 | |
dee1d5f1 | 77 | // check assignment to self |
fb1bf5c0 | 78 | if (this == &right) return *this; |
79 | ||
dee1d5f1 | 80 | Fatal("operator =", "Assignment operator not provided."); |
fb1bf5c0 | 81 | |
82 | return *this; | |
83 | } | |
84 | ||
2998a151 | 85 | //_______________________________________________________________________ |
5f91c9e8 | 86 | TVector2 AliMpRowSegmentPainter::GetPosition() const |
87 | { | |
dee1d5f1 | 88 | /// Get the owned object's position |
5f91c9e8 | 89 | |
dee1d5f1 | 90 | return fRowSegment->Position(); |
5f91c9e8 | 91 | } |
dee1d5f1 | 92 | |
5f91c9e8 | 93 | //_______________________________________________________________________ |
94 | TVector2 AliMpRowSegmentPainter::GetDimensions() const | |
95 | { | |
dee1d5f1 | 96 | /// Get the owned object's dimensions |
5f91c9e8 | 97 | |
dee1d5f1 | 98 | return fRowSegment->Dimensions(); |
5f91c9e8 | 99 | } |
100 | ||
101 | //_______________________________________________________________________ | |
102 | void AliMpRowSegmentPainter::DumpObject() | |
103 | { | |
dee1d5f1 | 104 | /// Draw the owned object |
5f91c9e8 | 105 | |
dee1d5f1 | 106 | fRowSegment->Dump(); |
5f91c9e8 | 107 | } |
108 | ||
109 | //_______________________________________________________________________ | |
110 | void AliMpRowSegmentPainter::Draw(Option_t *option) | |
111 | { | |
dee1d5f1 | 112 | /// Draw the sector on the current pad |
113 | /// The first letter of <option> is treated as follows: | |
114 | /// - case "S" : each row segments are drawn separately | |
115 | /// - case "" : the whole row is drawn at once | |
116 | /// in both cases, the rest of the option is passed | |
117 | /// as argument to the Draw function of respectively | |
118 | /// zone or row objects. | |
119 | ||
5f91c9e8 | 120 | AliMpGraphContext *gr = AliMpGraphContext::Instance(); |
121 | if( !fRowSegment) return; | |
122 | ||
123 | gr->Push(); | |
124 | InitGraphContext(); | |
125 | switch (option[0]){ | |
126 | case 'M': | |
127 | { | |
128 | ||
129 | for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){ | |
130 | gr->Push(); | |
131 | ||
132 | Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif); | |
133 | AliMpMotifPosition *motifPos = | |
134 | fRowSegment->GetRow()->GetMotifMap() | |
135 | ->FindMotifPosition(motifPositionId); | |
136 | ||
137 | gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions()); | |
138 | gr->SetColor(GetColor()); | |
139 | DrawObject(motifPos,option+1); | |
140 | ||
141 | gr->Pop(); | |
142 | } | |
143 | } | |
144 | break; | |
145 | default: AppendPad(option); | |
146 | } | |
147 | gr->Pop(); | |
148 | } | |
149 | ||
150 | ||
151 | //_______________________________________________________________________ | |
2998a151 | 152 | void AliMpRowSegmentPainter::Paint(Option_t* /*option*/) |
5f91c9e8 | 153 | { |
dee1d5f1 | 154 | /// Paint the object |
155 | ||
5f91c9e8 | 156 | AliMpGraphContext *gr = AliMpGraphContext::Instance(); |
157 | if (!fRowSegment) return; | |
158 | Int_t col=gVirtualX->GetFillColor(); | |
159 | gr->Push(); | |
160 | gPad->Range(0.,0.,1.,1.); | |
161 | InitGraphContext(); | |
162 | PaintWholeBox(kTRUE); | |
163 | ||
164 | // Float_t textSize = gVirtualX->GetTextSize(); | |
165 | // if (option[0]=='T') | |
166 | // gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01, | |
167 | // Form("%d",fRowSegment->GetMotif()->GetID())); | |
168 | // gVirtualX->SetTextSize(textSize); | |
169 | gr->Pop(); | |
170 | gVirtualX->SetFillColor(col); | |
171 | } |