]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
82b3616d | 3 | |
d810d0de | 4 | /************************************************************************** |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
9 | ||
10 | #include "AliEveITSModuleStepper.h" | |
11 | #include "AliEveITSDigitsInfo.h" | |
12 | #include "AliEveITSScaledModule.h" | |
82b3616d | 13 | |
84aff7a4 | 14 | #include <TEveManager.h> |
15 | #include <TEveGedEditor.h> | |
16 | #include <TEveGridStepper.h> | |
84aff7a4 | 17 | #include <TEveTrans.h> |
09edeb17 | 18 | |
32e219c2 | 19 | #include <TGLRnrCtx.h> |
c87a8d78 | 20 | #include <TGLIncludes.h> |
32e219c2 | 21 | #include <TGLSelectRecord.h> |
a15e6d7d | 22 | #include <TGLUtil.h> |
32e219c2 | 23 | #include <TGLViewer.h> |
c87a8d78 | 24 | #include <TGLAxis.h> |
d810d0de | 25 | |
c87a8d78 | 26 | #include <TMath.h> |
27 | #include <THLimitsFinder.h> | |
28 | #include <TVirtualPad.h> | |
82b3616d | 29 | |
57ffa5fb | 30 | //______________________________________________________________________________ |
82b3616d | 31 | // |
698e2c9b | 32 | // Display scaled ITS modules in a paged layout, also providing |
33 | // GL-overaly control GUI. | |
34 | ||
82b3616d | 35 | |
d810d0de | 36 | ClassImp(AliEveITSModuleStepper) |
82b3616d | 37 | |
d810d0de | 38 | AliEveITSModuleStepper::AliEveITSModuleStepper(AliEveITSDigitsInfo* di) : |
39 | TEveElementList("ITS 2DStore", "AliEveITSModuleStepper", kTRUE), | |
32e219c2 | 40 | |
32e219c2 | 41 | fDigitsInfo(di), |
42 | fScaleInfo(0), | |
c87a8d78 | 43 | fStepper(0), |
32e219c2 | 44 | |
c87a8d78 | 45 | fModuleIDs(), |
46 | fPosition(0), | |
32e219c2 | 47 | fSubDet(-1), |
09edeb17 | 48 | |
32e219c2 | 49 | fAxis(0), |
c87a8d78 | 50 | |
51 | fMenuHeight(0.13), | |
52 | fTextSize(64), | |
53 | fTextCol(kGray+1), | |
54 | fActiveCol(kRed-4), | |
55 | ||
56 | fActiveID(-1) | |
82b3616d | 57 | { |
698e2c9b | 58 | // Constructor. |
59 | ||
c87a8d78 | 60 | SetMainColorPtr(&fTextCol); |
61 | fAxis = new TGLAxis(); | |
62 | ||
84aff7a4 | 63 | // override member from base TEveElementList |
d810d0de | 64 | fChildClass = AliEveITSScaledModule::Class(); |
32e219c2 | 65 | |
32e219c2 | 66 | fDigitsInfo->IncRefCount(); |
67 | ||
84aff7a4 | 68 | fStepper = new TEveGridStepper(); |
32e219c2 | 69 | fStepper->SetNs(5, 4); |
70 | ||
d810d0de | 71 | fScaleInfo = new AliEveDigitScaleInfo(); |
32e219c2 | 72 | fScaleInfo->IncRefCount(); |
64c42545 | 73 | |
84aff7a4 | 74 | gEve->GetGLViewer()->AddOverlayElement(this); |
82b3616d | 75 | } |
76 | ||
d810d0de | 77 | AliEveITSModuleStepper::~AliEveITSModuleStepper() |
82b3616d | 78 | { |
698e2c9b | 79 | // Destructor. |
80 | ||
84aff7a4 | 81 | gEve->GetGLViewer()->RemoveOverlayElement(this); |
32e219c2 | 82 | |
c87a8d78 | 83 | fScaleInfo->DecRefCount(); |
32e219c2 | 84 | fDigitsInfo->DecRefCount(); |
85 | ||
82b3616d | 86 | delete fStepper; |
32e219c2 | 87 | delete fAxis; |
82b3616d | 88 | } |
89 | ||
57ffa5fb | 90 | /******************************************************************************/ |
d7e36bcf | 91 | |
d810d0de | 92 | void AliEveITSModuleStepper::Capacity() |
82b3616d | 93 | { |
698e2c9b | 94 | // Make sure we have just enough children (module representations) |
95 | // to store as many modules as required by the grid-stepper | |
96 | // configuration. | |
97 | ||
a15e6d7d | 98 | Int_t n = fStepper->GetNx()*fStepper->GetNy(); |
99 | if (n != GetNChildren()) | |
82b3616d | 100 | { |
32e219c2 | 101 | DestroyElements(); |
a15e6d7d | 102 | for (Int_t m=0; m<n; ++m) |
32e219c2 | 103 | { |
d810d0de | 104 | AddElement(new AliEveITSScaledModule(m, fDigitsInfo, fScaleInfo)); |
32e219c2 | 105 | } |
82b3616d | 106 | } |
82b3616d | 107 | } |
108 | ||
57ffa5fb | 109 | /******************************************************************************/ |
d7e36bcf | 110 | |
d810d0de | 111 | void AliEveITSModuleStepper::SetFirst(Int_t first) |
09edeb17 | 112 | { |
c87a8d78 | 113 | // Se module ID which apply to first item in stepper. |
114 | ||
115 | Int_t lastpage = fModuleIDs.size()/Nxy(); | |
ba5a649d | 116 | if (fModuleIDs.size() % Nxy() ) lastpage++; |
51346b82 | 117 | |
698e2c9b | 118 | Int_t firstLastpage = (lastpage - 1)*Nxy(); |
ba5a649d | 119 | if (first > firstLastpage) first = firstLastpage; |
120 | if (first < 0) first = 0; | |
09edeb17 | 121 | fPosition = first; |
09edeb17 | 122 | Apply(); |
123 | } | |
124 | ||
d810d0de | 125 | void AliEveITSModuleStepper::Start() |
82b3616d | 126 | { |
698e2c9b | 127 | // Go to first page. |
128 | ||
09edeb17 | 129 | fPosition = 0; |
82b3616d | 130 | Apply(); |
131 | } | |
132 | ||
d810d0de | 133 | void AliEveITSModuleStepper::Next() |
82b3616d | 134 | { |
698e2c9b | 135 | // Go to next page. |
136 | ||
32e219c2 | 137 | SetFirst(fPosition + Nxy()); |
09edeb17 | 138 | } |
139 | ||
d810d0de | 140 | void AliEveITSModuleStepper::Previous() |
09edeb17 | 141 | { |
698e2c9b | 142 | // Go to previous page. |
143 | ||
32e219c2 | 144 | SetFirst(fPosition - Nxy()); |
09edeb17 | 145 | } |
146 | ||
d810d0de | 147 | void AliEveITSModuleStepper::End() |
51346b82 | 148 | { |
698e2c9b | 149 | // Go to last page. |
150 | ||
c87a8d78 | 151 | Int_t lastpage = fModuleIDs.size()/Nxy(); |
152 | if (fModuleIDs.size() % Nxy()) lastpage++; | |
698e2c9b | 153 | fPosition = (lastpage - 1)*Nxy(); |
09edeb17 | 154 | |
51346b82 | 155 | fStepper->Reset(); |
82b3616d | 156 | Apply(); |
157 | } | |
158 | ||
57ffa5fb | 159 | /******************************************************************************/ |
d7e36bcf | 160 | |
d810d0de | 161 | void AliEveITSModuleStepper::DisplayDet(Int_t det, Int_t layer) |
32e219c2 | 162 | { |
c87a8d78 | 163 | // Select modules to display by sub-det type / layer. |
698e2c9b | 164 | |
32e219c2 | 165 | fSubDet = det; |
c87a8d78 | 166 | fModuleIDs.clear(); |
d810d0de | 167 | AliEveITSModuleSelection sel = AliEveITSModuleSelection(); |
51346b82 | 168 | sel.SetType (det); |
169 | sel.SetLayer(layer); | |
c87a8d78 | 170 | fDigitsInfo->GetModuleIDs(&sel, fModuleIDs); |
32e219c2 | 171 | //in reder menu define a space between left and right pager |
32e219c2 | 172 | Start(); |
173 | } | |
174 | ||
57ffa5fb | 175 | /******************************************************************************/ |
32e219c2 | 176 | |
a15e6d7d | 177 | Int_t AliEveITSModuleStepper::GetCurrentPage() const |
32e219c2 | 178 | { |
698e2c9b | 179 | // Get number of current page. |
180 | ||
181 | Int_t idx = fPosition + 1; | |
182 | Int_t n = idx/Nxy(); | |
183 | if (idx % Nxy()) n++; | |
32e219c2 | 184 | return n; |
185 | } | |
186 | ||
57ffa5fb | 187 | /******************************************************************************/ |
32e219c2 | 188 | |
d810d0de | 189 | Int_t AliEveITSModuleStepper::GetPages() |
32e219c2 | 190 | { |
698e2c9b | 191 | // Get number of all pages. |
192 | ||
c87a8d78 | 193 | Int_t n = fModuleIDs.size()/Nxy(); |
ba5a649d | 194 | if (fModuleIDs.size() % Nxy()) n++; |
32e219c2 | 195 | return n; |
196 | } | |
51346b82 | 197 | |
57ffa5fb | 198 | /******************************************************************************/ |
32e219c2 | 199 | |
d810d0de | 200 | void AliEveITSModuleStepper::Apply() |
82b3616d | 201 | { |
698e2c9b | 202 | // Apply current settings to children modules. |
203 | ||
84aff7a4 | 204 | gEve->DisableRedraw(); |
32e219c2 | 205 | Capacity(); |
09edeb17 | 206 | |
207 | UInt_t idx = fPosition; | |
32e219c2 | 208 | for(List_i childit=fChildren.begin(); childit!=fChildren.end(); ++childit) |
82b3616d | 209 | { |
ba5a649d | 210 | if (idx < fModuleIDs.size()) |
82b3616d | 211 | { |
d810d0de | 212 | AliEveITSScaledModule* mod = dynamic_cast<AliEveITSScaledModule*>(*childit); |
c87a8d78 | 213 | mod->SetID(fModuleIDs[idx], kFALSE); |
a15e6d7d | 214 | TEveTrans& tr = mod->RefMainTrans(); |
32e219c2 | 215 | tr.UnitTrans(); |
216 | tr.RotateLF(3,2,TMath::PiOver2()); | |
51346b82 | 217 | tr.RotateLF(1,3,TMath::PiOver2()); |
82b3616d | 218 | |
51346b82 | 219 | // scaling |
32e219c2 | 220 | Float_t mz, mx; |
d7e36bcf | 221 | Float_t* fp = mod->GetFrame()->GetFramePoints(); |
222 | // switch x,z it will be rotated afterwards | |
32e219c2 | 223 | mx = -2*fp[0]; |
224 | mz = -2*fp[2]; | |
d7e36bcf | 225 | |
32e219c2 | 226 | // fit width first |
84aff7a4 | 227 | Double_t sx = fStepper->GetDx(); |
228 | Double_t sy = (mx*fStepper->GetDx())/mz; | |
ba5a649d | 229 | if (sy > fStepper->GetDy()) |
82b3616d | 230 | { |
84aff7a4 | 231 | sy = fStepper->GetDy(); |
232 | sx = (mz*fStepper->GetDx())/mx; | |
82b3616d | 233 | } |
c87a8d78 | 234 | Float_t scale = (0.85*sx)/mz; |
32e219c2 | 235 | tr.Scale(scale, scale, scale); |
64c42545 | 236 | |
32e219c2 | 237 | Float_t p[3]; |
238 | fStepper->GetPosition(p); | |
84aff7a4 | 239 | tr.SetPos(p[0]+0.5*fStepper->GetDx(), p[1]+0.5*fStepper->GetDy(), p[2]+0.5*fStepper->GetDz()); |
51346b82 | 240 | |
ba5a649d | 241 | if (mod->GetSubDetID() == 2) |
b3ffcccb | 242 | mod->SetName(Form("SSD %d", idx)); |
ba5a649d | 243 | else if (mod->GetSubDetID() == 1) |
b3ffcccb | 244 | mod->SetName(Form("SDD %d", idx)); |
d7e36bcf | 245 | else |
b3ffcccb | 246 | mod->SetName(Form("SPD %d", idx)); |
32e219c2 | 247 | mod->SetRnrSelf(kTRUE); |
d7e36bcf | 248 | mod->UpdateItems(); |
249 | ||
09edeb17 | 250 | fStepper->Step(); |
251 | idx++; | |
82b3616d | 252 | } |
253 | else { | |
254 | (*childit)->SetRnrSelf(kFALSE); | |
255 | } | |
256 | } | |
09edeb17 | 257 | |
32e219c2 | 258 | fStepper->Reset(); |
259 | ElementChanged(); | |
84aff7a4 | 260 | gEve->EnableRedraw(); |
82b3616d | 261 | } |
09edeb17 | 262 | |
32e219c2 | 263 | |
57ffa5fb | 264 | /******************************************************************************/ |
32e219c2 | 265 | // Virtual event handlers from TGLOverlayElement |
57ffa5fb | 266 | /******************************************************************************/ |
09edeb17 | 267 | |
57ffa5fb | 268 | //______________________________________________________________________________ |
d810d0de | 269 | Bool_t AliEveITSModuleStepper::Handle(TGLRnrCtx & /*rnrCtx*/, |
698e2c9b | 270 | TGLOvlSelectRecord & rec, |
271 | Event_t * event) | |
09edeb17 | 272 | { |
32e219c2 | 273 | // Handle overlay event. |
274 | // Return TRUE if event was handled. | |
275 | ||
276 | switch (event->fType) | |
51346b82 | 277 | { |
32e219c2 | 278 | case kMotionNotify: |
279 | { | |
280 | Int_t item = rec.GetN() < 2 ? -1 : (Int_t)rec.GetItem(1); | |
c87a8d78 | 281 | if (fActiveID != item) { |
282 | fActiveID = item; | |
32e219c2 | 283 | return kTRUE; |
284 | } else { | |
285 | return kFALSE; | |
286 | } | |
287 | break; | |
288 | } | |
289 | case kButtonPress: | |
290 | { | |
291 | if (event->fCode != kButton1) { | |
292 | return kFALSE; | |
293 | } | |
294 | switch (rec.GetItem(1)) | |
295 | { | |
296 | case 1: | |
297 | Previous(); | |
298 | break; | |
299 | case 2: | |
300 | Start(); | |
301 | break; | |
302 | case 3: | |
303 | Next(); | |
304 | break; | |
305 | case 4: | |
306 | End(); | |
307 | break; | |
308 | case 5: | |
309 | { | |
d810d0de | 310 | AliEveDigitScaleInfo* si = fScaleInfo; |
ba5a649d | 311 | if (si->GetScale() < 5) |
32e219c2 | 312 | { |
51346b82 | 313 | si->ScaleChanged(si->GetScale() + 1); |
32e219c2 | 314 | ElementChanged(kTRUE, kTRUE); |
315 | } | |
316 | break; | |
317 | } | |
318 | case 6: | |
319 | { | |
d810d0de | 320 | AliEveDigitScaleInfo* si = fScaleInfo; |
ba5a649d | 321 | if (si->GetScale() > 1) |
32e219c2 | 322 | { |
51346b82 | 323 | si->ScaleChanged(si->GetScale() - 1); |
32e219c2 | 324 | ElementChanged(kTRUE, kTRUE); |
325 | } | |
326 | break; | |
327 | } | |
328 | case 7: | |
84aff7a4 | 329 | gEve->GetEditor()->DisplayElement(*BeginChildren()); |
32e219c2 | 330 | break; |
331 | ||
332 | case 8: | |
c87a8d78 | 333 | DisplayDet(0, -1); |
32e219c2 | 334 | break; |
51346b82 | 335 | case 9: |
c87a8d78 | 336 | DisplayDet(1, -1); |
32e219c2 | 337 | break; |
51346b82 | 338 | case 10: |
c87a8d78 | 339 | DisplayDet(2, -1); |
32e219c2 | 340 | break; |
341 | default: | |
342 | break; | |
343 | } | |
344 | return kTRUE; | |
345 | break; | |
346 | } | |
347 | default: | |
348 | break; | |
349 | } // end switch | |
350 | return kFALSE; | |
09edeb17 | 351 | } |
32e219c2 | 352 | |
57ffa5fb | 353 | //______________________________________________________________________________ |
d810d0de | 354 | Bool_t AliEveITSModuleStepper::MouseEnter(TGLOvlSelectRecord& /*rec*/) |
32e219c2 | 355 | { |
698e2c9b | 356 | // Mouse has entered overlay area. |
357 | ||
32e219c2 | 358 | return kTRUE; |
359 | } | |
360 | ||
57ffa5fb | 361 | //______________________________________________________________________________ |
d810d0de | 362 | void AliEveITSModuleStepper::MouseLeave() |
32e219c2 | 363 | { |
698e2c9b | 364 | // Mouse has left overlay area. |
32e219c2 | 365 | |
c87a8d78 | 366 | fActiveID = -1; |
367 | } | |
368 | ||
369 | ||
370 | /******************************************************************************/ | |
371 | // Protected sub-renderers | |
372 | /******************************************************************************/ | |
373 | ||
374 | //______________________________________________________________________________ | |
ba5a649d | 375 | void AliEveITSModuleStepper::RenderText(const char* txt, Int_t id, const TGLFont &font, Float_t step) |
c87a8d78 | 376 | { |
377 | // Render text for button id. | |
378 | ||
379 | Float_t llx, lly, llz, urx, ury, urz; | |
c87a8d78 | 380 | font.BBox(txt, llx, lly, llz, urx, ury, urz); |
ba5a649d | 381 | (fActiveID == id && id > 0) ? TGLUtil::Color(fActiveCol) :TGLUtil::Color(fTextCol); |
382 | ||
383 | if (step > 0) | |
384 | { | |
385 | // center text in the step interval | |
386 | glPushMatrix(); | |
387 | if (step>urx) | |
388 | glTranslatef((step-urx+llx)*0.5f-llx, 0, 0); | |
389 | glLoadName(id); | |
390 | font.Render(txt); | |
391 | glPopMatrix(); | |
392 | glTranslatef(step, 0, 0); | |
393 | } | |
394 | else | |
395 | { | |
396 | glLoadName(id); | |
397 | glPushMatrix(); | |
398 | font.Render(txt); | |
399 | glPopMatrix(); | |
400 | glTranslatef(urx, 0, 0); | |
401 | } | |
c87a8d78 | 402 | } |
403 | ||
404 | //______________________________________________________________________________ | |
405 | void AliEveITSModuleStepper::RenderPalette(TEveRGBAPalette* p) | |
406 | { | |
407 | // Render color palette with number axis. | |
408 | ||
409 | Float_t length = 7*fTextSize; | |
410 | Float_t x = 1.5*fTextSize; | |
411 | Float_t y = 0.2*fTextSize; | |
412 | ||
413 | glTranslatef(x, 0.8*fTextSize, 0); | |
414 | ||
415 | TGLCapabilitySwitch lights_off(GL_LIGHTING, kFALSE); | |
416 | ||
417 | glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT); | |
418 | glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); | |
419 | glDisable(GL_CULL_FACE); | |
420 | glEnable(GL_BLEND); | |
421 | glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | |
422 | ||
423 | glBegin(GL_QUAD_STRIP); | |
424 | TGLUtil::Color4ubv(p->ColorFromValue(p->GetMinVal())); | |
425 | glVertex2f(0, 0); | |
426 | glVertex2f(0, y); | |
427 | if (p->GetMaxVal() > p->GetMinVal() + 1) | |
428 | { | |
429 | Float_t xs = length/(p->GetMaxVal() - p->GetMinVal()); | |
430 | Float_t x0 = xs; | |
431 | for(Int_t i=p->GetMinVal() + 1; i<p->GetMaxVal(); i++) | |
432 | { | |
433 | TGLUtil::Color4ubv(p->ColorFromValue(i)); | |
434 | glVertex2f(x0, 0); | |
435 | glVertex2f(x0, y); | |
436 | x0+=xs; | |
437 | } | |
438 | } | |
439 | TGLUtil::Color4ubv(p->ColorFromValue(p->GetMaxVal())); | |
440 | glVertex2f(length, 0); | |
441 | glVertex2f(length, y); | |
442 | glEnd(); | |
443 | ||
ba5a649d | 444 | glRotatef(-90, 1, 0, 0 ); |
c87a8d78 | 445 | Double_t v1[3] = {0., 0., 0.}; |
446 | Double_t v2[3] = {length, 0, 0.}; | |
ba5a649d | 447 | fAxis->SetTextColor(kGray+1); |
448 | fAxis->SetLineColor(kGray+1); | |
c87a8d78 | 449 | fAxis->PaintGLAxis(v1, v2, p->GetMinVal(), p->GetMaxVal(), 5); |
450 | glPopAttrib(); | |
451 | } | |
452 | ||
453 | //______________________________________________________________________________ | |
454 | void AliEveITSModuleStepper::RenderMenu(Int_t curP, Int_t maxP, Int_t scaleX, Int_t scaleZ) | |
455 | { | |
456 | // Make UI to set page in stepper and UI to scale in the AliEveITSScaledModule. | |
457 | ||
458 | TGLUtil::Color(fTextCol); | |
459 | fTextFont.PreRender(); | |
460 | glTranslatef(0, fTextSize*0.3, 0); | |
ba5a649d | 461 | { |
462 | // pager | |
463 | glTranslatef(fTextSize*0.2, 0 , 0); | |
464 | RenderText("9", 2, fSymbolFont); // last page | |
465 | RenderText("3", 1, fSymbolFont);//last page | |
466 | RenderText(Form("%d/%d", curP, maxP),-1, fTextFont, 2.7*fTextSize); //status | |
467 | { | |
468 | // bugg in webdings font , bbox does not give realistic value | |
469 | Float_t llx, lly, llz, urx, ury, urz; | |
470 | fSymbolFont.BBox("4", llx, lly, llz, urx, ury, urz); | |
471 | glTranslatef(-llx, 0, 0); | |
472 | } | |
473 | RenderText("4", 3, fSymbolFont); // next page | |
474 | RenderText(":",4, fSymbolFont); // last page | |
475 | } | |
476 | { | |
477 | // scale | |
478 | glTranslatef(fTextSize,0, 0); | |
479 | RenderText(Form("Zoom:"), -1, fTextFont); | |
480 | RenderText("6", 6, fSymbolFont); | |
481 | RenderText("5", 5, fSymbolFont); | |
482 | RenderText(Form("%dx%d", scaleX, scaleZ), -1, fTextFont, 2*fTextSize); | |
483 | } | |
484 | { | |
485 | // detectors | |
486 | glTranslatef(fTextSize, 0, 0); | |
487 | RenderText("SPD ", 8, fTextFont); | |
488 | RenderText("SDD ", 9, fTextFont); | |
489 | RenderText("SSD ", 10, fTextFont); | |
490 | fTextFont.PostRender(); | |
491 | } | |
c87a8d78 | 492 | } |
493 | ||
494 | //______________________________________________________________________________ | |
495 | void AliEveITSModuleStepper::RenderModuleIDs() | |
496 | { | |
497 | // Render module-ids. | |
498 | ||
499 | Double_t x, y, z; | |
500 | UInt_t idx = fPosition; | |
501 | Float_t llx, lly, llz, urx, ury, urz; | |
502 | fModuleFont.PreRender(); | |
503 | TGLUtil::Color(kWhite); | |
504 | for (List_i childit=fChildren.begin(); childit!=fChildren.end(); ++childit) | |
505 | { | |
ba5a649d | 506 | if (idx < fModuleIDs.size()) |
c87a8d78 | 507 | { |
508 | AliEveITSScaledModule* mod = dynamic_cast<AliEveITSScaledModule*>(*childit); | |
509 | TEveTrans& tr = mod->RefMainTrans(); | |
510 | tr.GetPos(x,y,z); | |
511 | x += fStepper->GetDx()*0.5; | |
512 | y -= fStepper->GetDy()*0.5; | |
513 | z += 0.4; // !!! MT hack - cross check with overlay rendering. | |
514 | const char* txt = Form("%d",mod->GetID()); | |
515 | fModuleFont.BBox(txt, llx, lly, llz, urx, ury, urz); | |
516 | glRasterPos3f(x, y, z); | |
517 | glBitmap(0, 0, 0, 0,-urx, 0, 0); | |
518 | fModuleFont.Render(txt); | |
519 | idx++; | |
520 | } | |
521 | } | |
522 | fModuleFont.PostRender(); | |
523 | } | |
524 | ||
525 | /******************************************************************************/ | |
526 | ||
527 | void AliEveITSModuleStepper::Render(TGLRnrCtx& rnrCtx) | |
528 | { | |
529 | // Render the overlay elements. | |
530 | ||
531 | AliEveITSScaledModule* sm = dynamic_cast<AliEveITSScaledModule*>(*BeginChildren()); | |
532 | Int_t scale = fScaleInfo->GetScale() - 1; | |
533 | Int_t cnx = 0, cnz = 0; | |
534 | switch(sm->GetSubDetID()) | |
535 | { | |
536 | case 0: | |
537 | cnx = fDigitsInfo->fSPDScaleX[scale], cnz = fDigitsInfo->fSPDScaleZ[scale]; | |
538 | break; | |
539 | case 1: | |
540 | cnx = fDigitsInfo->fSDDScaleX[scale], cnz = fDigitsInfo->fSDDScaleZ[scale]; | |
541 | break; | |
542 | case 2: | |
543 | cnx = fDigitsInfo->fSSDScale[scale], cnz = 1; | |
544 | break; | |
545 | } | |
546 | ||
547 | // init fonts | |
ba5a649d | 548 | if (fTextFont.GetMode() == TGLFont::kUndef) |
c87a8d78 | 549 | { |
75522c26 | 550 | fTextFont = rnrCtx.GetFont(fTextSize, 4, TGLFont::kTexture); |
551 | fSymbolFont = rnrCtx.GetFont(72, 31, TGLFont::kTexture); | |
552 | fModuleFont = rnrCtx.GetFont(14, 4, TGLFont::kPixmap); | |
c87a8d78 | 553 | } |
554 | ||
555 | { | |
556 | // toolbar | |
557 | glMatrixMode(GL_PROJECTION); | |
558 | glPushMatrix(); | |
559 | glLoadIdentity(); | |
560 | if (rnrCtx.Selection()) | |
561 | { | |
562 | TGLRect rect(*rnrCtx.GetPickRectangle()); | |
563 | rnrCtx.GetCamera()->WindowToViewport(rect); | |
564 | gluPickMatrix(rect.X(), rect.Y(), rect.Width(), rect.Height(), | |
565 | (Int_t*) rnrCtx.GetCamera()->RefViewport().CArr()); | |
566 | } | |
567 | glMatrixMode(GL_MODELVIEW); | |
568 | glPushMatrix(); | |
569 | glLoadIdentity(); | |
570 | glTranslatef(-1, -1, 0); // translate to lower left corner | |
571 | Float_t scale = fMenuHeight/fTextSize*0.5; // scale text | |
572 | glScalef(scale, scale, 1.); | |
573 | ||
574 | //menu | |
575 | glPushName(0); | |
576 | RenderMenu(GetCurrentPage(), GetPages(), cnx, cnz); | |
577 | glPopName(); | |
578 | //palette | |
579 | Double_t ls = 1.6*scale*fTextSize; | |
580 | fAxis->SetLabelsSize(ls); | |
581 | fAxis->SetLabelsOffset(ls*1.2); | |
582 | RenderPalette(sm->GetPalette()); | |
583 | ||
584 | glPopMatrix(); | |
585 | glMatrixMode(GL_PROJECTION); | |
586 | glPopMatrix(); | |
587 | glMatrixMode(GL_MODELVIEW); | |
588 | } | |
589 | RenderModuleIDs(); | |
51346b82 | 590 | } |