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