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