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