Changeset 9369 for trunk/MagicSoft/Mars/mtools
- Timestamp:
- 03/01/09 21:54:27 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mtools
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtools/MagicCivilization.cc
r2173 r9369 2 2 ! 3 3 ! * 4 ! * This file is part of MARS, the MAGICAnalysis and Reconstruction4 ! * This file is part of CheObs, the Modular Analysis and Reconstruction 5 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. … … 9 9 ! * Permission to use, copy, modify and distribute this software and its 10 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and11 ! * provided that the above copyright notice appears in all copies and 12 12 ! * that both that copyright notice and this permission notice appear 13 13 ! * in supporting documentation. It is provided "as is" without express … … 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 07/2002 <mailto:tbretz@astro.uni-wuerzburg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-200218 ! Author(s): Thomas Bretz, 7/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: CheObs Software Development, 2000-2009 21 21 ! 22 22 ! … … 65 65 #include <TInterpreter.h> 66 66 67 #include "MH exagon.h"67 #include "MH.h" 68 68 69 69 #include "MGeomPix.h" … … 80 80 return; 81 81 82 fPixels->Delete();83 84 delete fPixels;85 86 82 delete fGeomCam; 87 }88 89 // ------------------------------------------------------------------------90 //91 // Draw all pixels of the camera92 // (means apend all pixelobjects to the current pad)93 //94 void MagicCivilization::DrawHexagons()95 {96 for (UInt_t i=0; i<fNumPixels; i++)97 (*this)[i].Draw();98 83 } 99 84 … … 111 96 ct1 = !ct1; 112 97 113 DrawHexagons();98 AppendPad(); 114 99 } 115 100 … … 117 102 { 118 103 Free(); 119 120 //121 // Reset the display geometry122 //123 fW=0;124 fH=0;125 104 126 105 // … … 135 114 fRange = fGeomCam->GetMaxRadius(); 136 115 137 // 138 // Construct all hexagons. Use new-operator with placement 139 // 140 fPixels = new TClonesArray("MHexagon", fNumPixels); 141 142 for (UInt_t i=0; i<fNumPixels; i++) 143 { 144 MHexagon &h = *new ((*fPixels)[i]) MHexagon((*fGeomCam)[i]); 145 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 146 h.SetBit(kNoContextMenu|kCannotPick); 147 #endif 148 } 116 fColors.Set(fNumPixels); 149 117 } 150 118 … … 154 122 // 155 123 MagicCivilization::MagicCivilization(Byte_t lim, UShort_t init) 156 : fTimer(this, 500, kTRUE), fGeomCam(NULL), fNumInit(init), fLimit(lim) , fW(0), fH(0)124 : fTimer(this, 500, kTRUE), fGeomCam(NULL), fNumInit(init), fLimit(lim) 157 125 { 158 126 SetNewCamera(new MGeomCamMagic); … … 179 147 fTimer.TurnOff(); 180 148 Free(); 181 182 if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this)183 {184 fDrawingPad->RecursiveRemove(this);185 delete fDrawingPad;186 }187 149 } 188 150 … … 195 157 void MagicCivilization::Paint(Option_t *opt) 196 158 { 197 const UInt_t w = (UInt_t)(gPad->GetWw()*gPad->GetAbsWNDC()); 198 const UInt_t h = (UInt_t)(gPad->GetWh()*gPad->GetAbsHNDC()); 199 200 // 201 // Check for a change in width or height, and make sure, that the 202 // first call also sets the range 203 // 204 if (w*fH == h*fW && fW && fH) 205 return; 206 207 // 208 // Calculate aspect ratio (5/4=1.25 recommended) 209 // 210 const Double_t ratio = (Double_t)w/h; 211 212 Float_t x; 213 Float_t y; 214 215 if (ratio>1.0) 216 { 217 x = fRange*(ratio*2-1); 218 y = fRange; 219 } 220 else 221 { 222 x = fRange; 223 y = fRange/ratio; 224 } 225 226 fH = h; 227 fW = w; 228 229 // 230 // Set new range 231 // 232 fDrawingPad->Range(-fRange, -y, x, y); 159 const Float_t r = fGeomCam->GetMaxRadius(); 160 161 MH::SetPadRange(-r, -r, r, r*1.1); 162 163 TAttLine line; 164 TAttFill fill; 165 166 // FIXME: 167 for (UInt_t i=0; i<fNumPixels; i++) 168 { 169 const MGeom &pix = (*fGeomCam)[i]; 170 171 fill.SetFillColor(fColors[i]); 172 pix.PaintPrimitive(line, fill); 173 } 174 /* 175 for (int i=0; i<6; i++) 176 fText[i]->Paint(); 177 */ 233 178 } 234 179 … … 266 211 fStep = 0; 267 212 213 fColors.Reset(); 214 268 215 Update(); 269 216 270 fDrawingPad->Modified();271 fDrawingPad->Update();217 gPad->Modified(); 218 gPad->Update(); 272 219 } 273 220 … … 284 231 // if no canvas is yet existing to draw into, create a new one 285 232 // 286 /*TCanvas *c =*/ new TCanvas("MagicCivilization", "Magic Civilization", 0, 0, 800, 800); 287 //c->ToggleEventStatus(); 288 289 fDrawingPad = gPad; 290 fDrawingPad->SetBorderMode(0); 291 fDrawingPad->SetFillColor(22); 233 new TCanvas("MagicCivilization", "Magic Civilization", 0, 0, 800, 800); 234 235 gPad->SetBorderMode(0); 236 gPad->SetFillColor(22); 292 237 293 238 // … … 296 241 // 297 242 AppendPad(option); 298 299 //300 // Reset the game pad301 //302 DrawHexagons();303 243 304 244 fCivilization.SetTextAlign(23); // centered/bottom … … 349 289 fAuto = !fAuto; 350 290 Update(); 351 fDrawingPad->Update();291 gPad->Update(); 352 292 return; 353 293 … … 395 335 for (int i=0; i<fNumPixels; i++) 396 336 { 397 MGeom Pix&pix = (*fGeomCam)[i];337 MGeom &pix = (*fGeomCam)[i]; 398 338 399 339 Byte_t cnt=0; … … 411 351 for (int i=0; i<fNumPixels; i++) 412 352 { 413 MGeomPix &pix = (*fGeomCam)[i]; 414 MHexagon &hex = (*this)[i]; 353 MGeom &pix = (*fGeomCam)[i]; 415 354 416 355 if (pix.TestBit(kHasCreation)) 417 356 { 418 357 pix.SetBit(kHasFlag); 419 hex.SetFillColor(kBlack);358 fColors[i] = kBlack; 420 359 fNumCivilizations++; 421 360 } … … 423 362 { 424 363 pix.ResetBit(kHasFlag); 425 hex.SetFillColor(kBackground);364 fColors[i] = kBackground; 426 365 } 427 366 pix.ResetBit(kHasCreation); … … 435 374 Update(); 436 375 437 fDrawingPad->Update();376 gPad->Update(); 438 377 439 378 return kTRUE; -
trunk/MagicSoft/Mars/mtools/MagicCivilization.h
r1440 r9369 14 14 #ifndef ROOT_TClonesArray 15 15 #include <TClonesArray.h> 16 #endif 17 #ifndef ROOT_TArrayI 18 #include <TArrayI.h> 16 19 #endif 17 20 … … 50 53 TText fCivilization; // TText showing the numbers of pixels and bombs 51 54 52 UInt_t fW; // Width of canvas 53 UInt_t fH; // Height of canvas 54 55 TClonesArray *fPixels; // array of all hexagons 56 TVirtualPad *fDrawingPad; // pad in which we are drawing 57 58 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); } 55 TArrayI fColors; 59 56 60 57 void Update(); 61 58 void Free(); 62 void DrawHexagons();63 59 void SetNewCamera(MGeomCam *); 64 60 -
trunk/MagicSoft/Mars/mtools/MagicDomino.cc
r8910 r9369 2 2 ! 3 3 ! * 4 ! * This file is part of MARS, the MAGICAnalysis and Reconstruction4 ! * This file is part of CheObs, the Modular Analysis and Reconstruction 5 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. … … 9 9 ! * Permission to use, copy, modify and distribute this software and its 10 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and11 ! * provided that the above copyright notice appears in all copies and 12 12 ! * that both that copyright notice and this permission notice appear 13 13 ! * in supporting documentation. It is provided "as is" without express … … 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 07/2002 <mailto:tbretz@astro.uni-wuerzburg.de>18 ! Author(s): Thomas Bretz, 7/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200820 ! Copyright: CheObs Software Development, 2000-2009 21 21 ! 22 22 ! … … 68 68 #include <TInterpreter.h> 69 69 70 #include "MH exagon.h"70 #include "MH.h" 71 71 72 72 #include "MGeomPix.h" … … 87 87 return; 88 88 89 fPixels->Delete();90 91 delete fPixels;92 93 89 delete fGeomCam; 94 }95 96 // ------------------------------------------------------------------------97 //98 // Draw all pixels of the camera99 // (means apend all pixelobjects to the current pad)100 //101 void MagicDomino::DrawHexagons()102 {103 for (UInt_t i=0; i<fNumPixels; i++)104 (*this)[i].Draw();105 90 } 106 91 … … 123 108 124 109 Reset(); 125 DrawHexagons();110 AppendPad(); 126 111 } 127 112 … … 133 118 { 134 119 Free(); 135 136 //137 // Reset the display geometry138 //139 fW=0;140 fH=0;141 120 142 121 // … … 151 130 fRange = fGeomCam->GetMaxRadius(); 152 131 153 // 154 // Construct all hexagons. Use new-operator with placement 155 // 156 fPixels = new TClonesArray("MHexagon", fNumPixels); 157 132 fColors.Set(fNumPixels); 133 } 134 135 // ------------------------------------------------------------------------ 136 // 137 // remove the pixel numbers in the tile from the pad 138 // 139 void MagicDomino::RemoveNumbers() 140 { 141 for (int i=0; i<6; i++) 142 fText[i]->SetText(0, 0, ""); 143 } 144 145 // ------------------------------------------------------------------------ 146 // 147 // Reset/restart the game 148 // 149 void MagicDomino::Reset() 150 { 158 151 for (UInt_t i=0; i<fNumPixels; i++) 159 152 { 160 MHexagon &h = *new ((*fPixels)[i]) MHexagon((*fGeomCam)[i]); 153 fColors[i] = kBackground; 154 (*fGeomCam)[i].ResetBit(kUserBits); 155 } 156 157 161 158 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 162 h.SetBit(kNoContextMenu|kCannotPick);163 #endif164 }165 }166 167 // ------------------------------------------------------------------------168 //169 // remove the pixel numbers in the tile from the pad170 //171 void MagicDomino::RemoveNumbers()172 {173 for (int i=0; i<6; i++)174 if (fText[i])175 {176 delete fText[i];177 fText[i] = NULL;178 }179 }180 181 // ------------------------------------------------------------------------182 //183 // Reset/restart the game184 //185 void MagicDomino::Reset()186 {187 for (UInt_t i=0; i<fNumPixels; i++)188 {189 MHexagon &h = (*this)[i];190 h.SetFillColor(kBackground);191 h.ResetBit(kUserBits);192 }193 194 195 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06)196 fDrawingPad->SetBit(kNoContextMenu);197 159 SetBit(kNoContextMenu); 198 160 #endif … … 205 167 206 168 207 fDrawingPad->SetFillColor(22);169 gPad->SetFillColor(22); 208 170 209 171 fNumPixel = -1; … … 218 180 void MagicDomino::Init() 219 181 { 220 memset(fText, 0, sizeof(fText)); 182 for (int i=0; i<6; i++) 183 { 184 fText[i] = new TText(0, 0, ""); 185 fText[i]->SetTextFont(122); 186 fText[i]->SetTextAlign(22); // centered/centered 187 } 221 188 222 189 // … … 260 227 261 228 RemoveNumbers(); 262 263 if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this)264 {265 fDrawingPad->RecursiveRemove(this);266 delete fDrawingPad;267 }268 269 229 } 270 230 … … 277 237 void MagicDomino::Paint(Option_t *opt) 278 238 { 279 const UInt_t w = (UInt_t)(gPad->GetWw()*gPad->GetAbsWNDC()); 280 const UInt_t h = (UInt_t)(gPad->GetWh()*gPad->GetAbsHNDC()); 281 282 // 283 // Check for a change in width or height, and make sure, that the 284 // first call also sets the range 285 // 286 if (w*fH == h*fW && fW && fH) 287 return; 288 289 // 290 // Calculate aspect ratio (5/4=1.25 recommended) 291 // 292 const Double_t ratio = (Double_t)w/h; 293 294 Float_t x; 295 Float_t y; 296 297 if (ratio>1.0) 298 { 299 x = fRange*(ratio*2-1); 300 y = fRange; 301 } 302 else 303 { 304 x = fRange; 305 y = fRange/ratio; 306 } 307 308 fH = h; 309 fW = w; 310 311 // 312 // Set new range 313 // 314 fDrawingPad->Range(-fRange, -y, x, y); 239 const Float_t r = fGeomCam->GetMaxRadius(); 240 241 MH::SetPadRange(-r, -r, r, r*1.1); 242 243 TAttLine line; 244 TAttFill fill; 245 246 // FIXME: 247 for (UInt_t i=0; i<fNumPixels; i++) 248 { 249 const MGeom &pix = (*fGeomCam)[i]; 250 251 fill.SetFillColor(fColors[i]); 252 pix.PaintPrimitive(line, fill); 253 } 254 255 for (int i=0; i<6; i++) 256 fText[i]->Paint(); 315 257 } 316 258 … … 327 269 // if no canvas is yet existing to draw into, create a new one 328 270 // 329 /*TCanvas *c =*/ new TCanvas("MagicDomino", "Magic Domino Next Neighbours", 0, 0, 800, 800); 330 //c->ToggleEventStatus(); 331 332 fDrawingPad = gPad; 333 fDrawingPad->SetBorderMode(0); 271 new TCanvas("MagicDomino", "Magic Domino Next Neighbours", 0, 0, 800, 800); 272 273 gPad->SetBorderMode(0); 334 274 335 275 // … … 343 283 // 344 284 Reset(); 345 DrawHexagons();346 347 /*348 TPave *p = new TPave(-0.66*fRange, 0.895*fRange, 0.66*fRange, 0.995*fRange, 4, "br");349 p->ConvertNDCtoPad();350 p->SetFillColor(12);351 p->SetBit(kCanDelete);352 p->Draw();353 */354 285 355 286 fDomino.SetTextAlign(23); // centered/bottom … … 408 339 if (fNumPixel>=0) 409 340 { 410 const MGeomPix&pix=(*fGeomCam)[fNumPixel];411 (*this)[fNumPixel].ResetBit(kIsTile);341 MGeom &pix=(*fGeomCam)[fNumPixel]; 342 pix.ResetBit(kIsTile); 412 343 for (int i=0; i<pix.GetNumNeighbors(); i++) 413 (* this)[pix.GetNeighbor(i)].ResetBit(kIsTile);344 (*fGeomCam)[pix.GetNeighbor(i)].ResetBit(kIsTile); 414 345 415 346 fPoints += pix.GetNumNeighbors(); … … 425 356 Update(); 426 357 427 fDrawingPad->Update();358 gPad->Update(); 428 359 } 429 360 … … 444 375 445 376 Int_t cnt=0; 446 const MGeom Pix&pix1=(*fGeomCam)[fNumPixel];377 const MGeom &pix1=(*fGeomCam)[fNumPixel]; 447 378 for (int i=0; i<pix1.GetNumNeighbors(); i++) 448 379 { 449 380 const Int_t idx1 = pix1.GetNeighbor(i); 450 const MGeom Pix&pix2 = (*fGeomCam)[idx1];381 const MGeom &pix2 = (*fGeomCam)[idx1]; 451 382 452 383 Byte_t ignored = 0; … … 454 385 for (int j=0; j<pix2.GetNumNeighbors(); j++) 455 386 { 456 const Int_t 457 const M Hexagon &hex = (*this)[idx2];458 459 if (hex.TestBit(kIsTile) || hex.GetFillColor()==kBackground)387 const Int_t idx2 = pix2.GetNeighbor(j); 388 const MGeom &hex = (*fGeomCam)[idx2]; 389 390 if (hex.TestBit(kIsTile) || fColors[idx2]==kBackground) 460 391 { 461 392 ignored++; … … 463 394 } 464 395 465 if ( hex.GetFillColor()==(*this)[idx1].GetFillColor())396 if (fColors[idx2]==fColors[idx1]) 466 397 found++; 467 398 } … … 487 418 fDomino.SetTextColor(kBlue); 488 419 489 fDrawingPad->SetFillColor(kRed);420 gPad->SetFillColor(kRed); 490 421 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 491 422 fDone->SetBit(kNoContextMenu|kCannotPick); 492 fDrawingPad->ResetBit(kNoContextMenu);493 423 ResetBit(kNoContextMenu); 494 424 #endif 495 425 496 fDrawingPad->Modified();497 fDrawingPad->Update();426 gPad->Modified(); 427 gPad->Update(); 498 428 } 499 429 … … 572 502 Update(); 573 503 574 fDrawingPad->Modified();575 fDrawingPad->Update();504 gPad->Modified(); 505 gPad->Update(); 576 506 } 577 507 … … 585 515 return; 586 516 587 MagicDomino &This = *this;588 589 517 RemoveNumbers(); 590 518 591 const MGeomPix&pix1=(*fGeomCam)[fNumPixel];592 This[fNumPixel].SetFillColor(fOldColors[6]);593 This[fNumPixel].ResetBit(kIsTile);519 MGeom &pix1=(*fGeomCam)[fNumPixel]; 520 fColors[fNumPixel] = fOldColors[6]; 521 pix1.ResetBit(kIsTile); 594 522 for (int i=0; i<pix1.GetNumNeighbors(); i++) 595 523 { 596 524 Int_t idx = pix1.GetNeighbor(i); 597 525 598 This[idx].SetFillColor(fOldColors[i]);599 This[idx].ResetBit(kIsTile);526 fColors[idx] = fOldColors[i]; 527 (*fGeomCam)[idx].ResetBit(kIsTile); 600 528 } 601 529 } … … 609 537 if (fNumPixel<0) 610 538 return; 611 612 MagicDomino &This = *this;613 539 614 540 Int_t indices[6]; … … 617 543 RemoveNumbers(); 618 544 619 const MGeomPix&pix2=(*fGeomCam)[fNumPixel];620 fOldColors[6] = This[fNumPixel].GetFillColor();621 This[fNumPixel].SetFillColor(kBlack);622 This[fNumPixel].SetBit(kIsTile);545 MGeom &pix2=(*fGeomCam)[fNumPixel]; 546 fOldColors[6] = fColors[fNumPixel]; 547 fColors[fNumPixel] = kBlack; 548 pix2.SetBit(kIsTile); 623 549 for (int i=0; i<pix2.GetNumNeighbors(); i++) 624 550 { 625 551 Int_t idx = pix2.GetNeighbor(i); 626 552 627 fOldColors[i] = This[idx].GetFillColor();553 fOldColors[i] = fColors[idx]; 628 554 629 555 int j=0; … … 631 557 j++; 632 558 633 This[idx].SetFillColor(fNewColors[(j+fPosition)%6]); 634 This[idx].SetBit(kIsTile); 559 MGeom &pix = (*fGeomCam)[idx]; 560 561 fColors[idx] = fNewColors[(j+fPosition)%6]; 562 pix.SetBit(kIsTile); 635 563 636 564 TString num; 637 565 num += idx; 638 566 639 fText[i] = new TText(This[idx].GetX(), This[idx].GetY(), num); 640 fText[i]->SetTextSize(0.3*This[idx].GetD()/fGeomCam->GetMaxRadius()); 641 fText[i]->SetTextFont(122); 642 fText[i]->SetTextAlign(22); // centered/centered 643 fText[i]->Draw(); 567 fText[i]->SetText(pix.GetX(), pix.GetY(), num); 568 fText[i]->SetTextSize(0.3*pix.GetT()/fGeomCam->GetMaxRadius()); 644 569 } 645 570 } … … 659 584 Update(); 660 585 661 fDrawingPad->Update();586 gPad->Update(); 662 587 } 663 588 … … 668 593 Short_t MagicDomino::AnalysePixel(Int_t dir) 669 594 { 670 const MGeom Pix&pix=(*fGeomCam)[fNumPixel<0?0:fNumPixel];595 const MGeom &pix=(*fGeomCam)[fNumPixel<0?0:fNumPixel]; 671 596 672 597 Double_t fAngle[6] = { -10, -10, -10, -10, -10, -10 }; … … 674 599 for (int i=0; i<pix.GetNumNeighbors(); i++) 675 600 { 676 MGeom Pix&next = (*fGeomCam)[pix.GetNeighbor(i)];601 MGeom &next = (*fGeomCam)[pix.GetNeighbor(i)]; 677 602 fAngle[i] = atan2(next.GetY()-pix.GetY(), next.GetX()-pix.GetX()); 678 603 } … … 714 639 void MagicDomino::GetSortedNeighbors(Int_t indices[6]) 715 640 { 716 const MGeom Pix&pix=(*fGeomCam)[fNumPixel<0?0:fNumPixel];641 const MGeom &pix=(*fGeomCam)[fNumPixel<0?0:fNumPixel]; 717 642 718 643 Double_t fAngle[6] = { -10, -10, -10, -10, -10, -10 }; … … 720 645 for (int i=0; i<pix.GetNumNeighbors(); i++) 721 646 { 722 MGeom Pix&next = (*fGeomCam)[pix.GetNeighbor(i)];647 MGeom &next = (*fGeomCam)[pix.GetNeighbor(i)]; 723 648 fAngle[i] = atan2(next.GetY()-pix.GetY(), next.GetX()-pix.GetX()); 724 649 } -
trunk/MagicSoft/Mars/mtools/MagicDomino.h
r8755 r9369 11 11 #ifndef ROOT_TClonesArray 12 12 #include <TClonesArray.h> 13 #endif 14 #ifndef ROOT_TArrayI 15 #include <TArrayI.h> 13 16 #endif 14 17 … … 59 62 TText *fDone; // game over text 60 63 61 UInt_t fW; // Width of canvas 62 UInt_t fH; // Height of canvas 63 64 TClonesArray *fPixels; // array of all hexagons 65 TVirtualPad *fDrawingPad; // pad in which we are drawing 66 67 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); } 64 TArrayI fColors; 68 65 69 66 Bool_t CheckTile(); … … 77 74 void Done(); 78 75 void RemoveNumbers(); 79 void DrawHexagons();80 76 void SetNewCamera(MGeomCam *); 81 77 void ChangePixel(Int_t add); -
trunk/MagicSoft/Mars/mtools/MagicJam.cc
r9312 r9369 2 2 ! 3 3 ! * 4 ! * This file is part of MARS, the MAGICAnalysis and Reconstruction4 ! * This file is part of CheObs, the Modular Analysis and Reconstruction 5 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. … … 9 9 ! * Permission to use, copy, modify and distribute this software and its 10 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and11 ! * provided that the above copyright notice appears in all copies and 12 12 ! * that both that copyright notice and this permission notice appear 13 13 ! * in supporting documentation. It is provided "as is" without express … … 141 141 Float_t x0 = TMath::Odd(y) ? x-0.25 : x+0.25; 142 142 143 cam[x + y*fWidth].Set(x0-dx, (y-dy)*0.866, 1); 144 } 143 cam.SetAt(x + y*fWidth, MGeomPix(x0-dx, (y-dy)*0.866, 1)); 144 } 145 146 147 cam.InitGeometry(); 145 148 146 149 SetGeometry(cam); … … 442 445 443 446 TVirtualPad *p = dynamic_cast<TVirtualPad*>(o); 444 if (p && p->GetPad(1))445 { 446 p-> GetPad(1)->Modified();447 p-> GetPad(1)->Update();447 if (p) 448 { 449 p->Modified(); 450 p->Update(); 448 451 } 449 452 } … … 508 511 const Int_t newval = fBinEntries[idx+1]+1; 509 512 510 const MGeom Pix&gpix = (*fGeomCam)[idx];513 const MGeom &gpix = (*fGeomCam)[idx]; 511 514 const Int_t n = gpix.GetNumNeighbors(); 512 515 … … 721 724 dy += y; 722 725 723 cam [i].Set(dx, dy*0.866);726 cam.SetAt(i, MGeomPix(dx, dy*0.866)); 724 727 } 725 728 -
trunk/MagicSoft/Mars/mtools/MagicReversi.cc
r8756 r9369 2 2 ! 3 3 ! * 4 ! * This file is part of MARS, the MAGICAnalysis and Reconstruction4 ! * This file is part of CheObs, the Modular Analysis and Reconstruction 5 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. … … 9 9 ! * Permission to use, copy, modify and distribute this software and its 10 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and11 ! * provided that the above copyright notice appears in all copies and 12 12 ! * that both that copyright notice and this permission notice appear 13 13 ! * in supporting documentation. It is provided "as is" without express … … 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 03/2003 <mailto:tbretz@astro.uni-wuerzburg.de>18 ! Author(s): Thomas Bretz, 3/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200320 ! Copyright: CheObs Software Development, 2000-2009 21 21 ! 22 22 ! … … 62 62 #include <TInterpreter.h> 63 63 64 #include "MH exagon.h"64 #include "MH.h" 65 65 66 66 #include "MGeomPix.h" … … 88 88 return; 89 89 90 fPixels->Delete();91 90 fText->Delete(); 92 91 fFlags->Delete(); … … 94 93 delete fText; 95 94 delete fFlags; 96 delete fPixels;97 95 98 96 delete fGeomCam; … … 113 111 114 112 Reset(); 115 DrawHexagons();116 113 } 117 114 … … 119 116 { 120 117 Free(); 121 122 //123 // Reset the display geometry124 //125 fW=0;126 fH=0;127 118 128 119 // … … 144 135 fText = new TClonesArray("TText", fNumPixels); 145 136 fFlags = new TClonesArray("TMarker", fNumPixels); 146 f Pixels = new TClonesArray("MHexagon",fNumPixels);137 fColors.Set(fNumPixels); 147 138 148 139 for (UInt_t i=0; i<fNumPixels; i++) 149 140 { 150 MHexagon &h = *new ((*fPixels)[i]) MHexagon((*fGeomCam)[i]); 151 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 152 h.SetBit(kNoContextMenu|kCannotPick); 153 #endif 141 const MGeom &pix = (*fGeomCam)[i]; 154 142 155 143 TText &t = *new ((*fText)[i]) TText; 156 144 t.SetTextFont(122); 157 145 t.SetTextAlign(22); // centered/centered 158 t.SetTextSize(0.3* h.GetD()/fRange);146 t.SetTextSize(0.3*pix.GetT()/fRange); 159 147 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 160 148 t.SetBit(kNoContextMenu|kCannotPick); 161 149 #endif 162 163 const MGeomPix &pix = (*fGeomCam)[i];164 150 165 151 TMarker &m = *new ((*fFlags)[i]) TMarker(pix.GetX(), pix.GetY(), kOpenStar); … … 170 156 } 171 157 158 /* 172 159 // ------------------------------------------------------------------------ 173 160 // … … 180 167 (*this)[i].Draw(); 181 168 } 169 */ 182 170 183 171 void MagicReversi::Init() … … 201 189 // 202 190 MagicReversi::MagicReversi() 203 : fGeomCam(NULL), fDone(NULL) , fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)191 : fGeomCam(NULL), fDone(NULL) 204 192 { 205 193 SetNewCamera(new MGeomCamMagic); … … 209 197 210 198 MagicReversi::MagicReversi(const MGeomCam &geom) 211 : fGeomCam(NULL), fDone(NULL) , fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)199 : fGeomCam(NULL), fDone(NULL) 212 200 { 213 201 SetNewCamera(static_cast<MGeomCam*>(geom.Clone())); … … 229 217 if (fDone) 230 218 delete fDone; 231 232 if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this)233 {234 fDrawingPad->RecursiveRemove(this);235 delete fDrawingPad;236 }237 219 } 238 220 … … 245 227 void MagicReversi::Paint(Option_t *opt) 246 228 { 247 const UInt_t w = (UInt_t)(gPad->GetWw()*gPad->GetAbsWNDC()); 248 const UInt_t h = (UInt_t)(gPad->GetWh()*gPad->GetAbsHNDC()); 249 250 // 251 // Check for a change in width or height, and make sure, that the 252 // first call also sets the range 253 // 254 if (w*fH == h*fW && fW && fH) 255 return; 256 257 // 258 // Calculate aspect ratio (5/4=1.25 recommended) 259 // 260 const Double_t ratio = (Double_t)w/h; 261 262 Float_t x; 263 Float_t y; 264 265 if (ratio>1.0) 266 { 267 x = fRange*(ratio*2-1); 268 y = fRange; 269 } 270 else 271 { 272 x = fRange; 273 y = fRange/ratio; 274 } 275 276 fH = h; 277 fW = w; 278 279 // 280 // Set new range 281 // 282 fDrawingPad->Range(-fRange, -y, x, y); 283 284 // 285 // Adopt absolute sized of markers to relative range 286 // 229 const Float_t r = fGeomCam->GetMaxRadius(); 230 231 MH::SetPadRange(-r, -r, r, r*1.1); 232 233 TAttLine line; 234 TAttFill fill; 235 236 // FIXME: 287 237 for (UInt_t i=0; i<fNumPixels; i++) 288 238 { 289 Float_t r = (*this)[i].GetD()*gPad->XtoAbsPixel(1)/325; 239 const MGeom &pix = (*fGeomCam)[i]; 240 241 fill.SetFillColor(fColors[i]); 242 pix.PaintPrimitive(line, fill); 243 244 // 245 // Adopt absolute sized of markers to relative range 246 // 247 Float_t r = (*fGeomCam)[i].GetT()*gPad->XtoAbsPixel(1)/325; 290 248 GetFlag(i)->SetMarkerSize(20.0*r/fRange); 249 250 if (pix.TestBit(kHasFlag)) 251 GetFlag(i)->Paint(); 252 253 GetText(i)->Paint(); 291 254 } 292 255 } … … 301 264 void MagicReversi::Draw(Option_t *option) 302 265 { 303 // root 3.02:304 // gPad->SetFixedAspectRatio()305 306 if (fDrawingPad)307 return;308 309 266 // 310 267 // if no canvas is yet existing to draw into, create a new one 311 268 // 312 269 if (!gPad) 313 { 314 /*TCanvas *c =*/ new TCanvas("MagicReversi", "Magic Reversi", 0, 0, 800, 800); 315 //c->ToggleEventStatus(); 316 fIsAllocated = kTRUE; 317 } 318 else 319 fIsAllocated = kFALSE; 320 321 fDrawingPad = gPad; 322 fDrawingPad->SetBorderMode(0); 270 new TCanvas("MagicReversi", "Magic Reversi", 0, 0, 800, 800); 271 272 gPad->SetBorderMode(0); 323 273 324 274 // … … 347 297 // 348 298 Reset(); 349 DrawHexagons();350 299 } 351 300 … … 411 360 for (UInt_t i=0; i<fNumPixels; i++) 412 361 { 413 Remove(GetText(i)); 414 Remove(GetFlag(i)); 415 416 (*this)[i].SetFillColor(kEmpty); 362 fColors[i] = kEmpty; 417 363 (*fGeomCam)[i].ResetBit(kUserBits); 418 364 419 365 GetFlag(i)->SetMarkerColor(kBlack); 366 GetText(i)->SetText(0, 0, ""); 420 367 } 421 368 … … 427 374 for (int i=1; i<5*fNumUsers; i++) 428 375 { 429 (*this)[i-1].SetFillColor(i%fNumUsers+kRed);376 fColors[i-1] = i%fNumUsers+kRed; 430 377 fUsrPts[i%fNumUsers]++; 431 378 } … … 433 380 Update(); 434 381 435 fDrawingPad->SetFillColor(22);382 gPad->SetFillColor(22); 436 383 437 384 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 438 fDrawingPad->SetBit(kNoContextMenu);439 385 SetBit(kNoContextMenu); 440 386 #endif … … 468 414 fDone->Draw(); 469 415 470 fDrawingPad->SetFillColor(winner+kRed);416 gPad->SetFillColor(winner+kRed); 471 417 472 418 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 473 fDrawingPad->ResetBit(kNoContextMenu);474 419 ResetBit(kNoContextMenu); 475 420 #endif 476 }477 478 void MagicReversi::Remove(TObject *obj)479 {480 fDrawingPad->RecursiveRemove(obj);481 421 } 482 422 … … 495 435 { 496 436 idx = fGeomCam->GetNeighbor(idx, dir); 497 if (idx<0 || (*this)[idx].GetFillColor()==kEmpty)437 if (idx<0 || fColors[idx]==kEmpty) 498 438 break; 499 439 500 if ( (*this)[idx].GetFillColor()==col)440 if (fColors[idx]==col) 501 441 { 502 442 if (length!=0) … … 523 463 idx = fGeomCam->GetNeighbor(idx, dir); 524 464 525 fUsrPts[ (*this)[idx].GetFillColor()-kRed]--;465 fUsrPts[fColors[idx]-kRed]--; 526 466 fUsrPts[fNumUser]++; 527 467 528 (*this)[idx].SetFillColor(col);468 fColors[idx] = col; 529 469 } 530 470 } … … 536 476 { 537 477 for (unsigned int i=0; i<fNumPixels; i++) 538 if ( (*this)[i].GetFillColor()==kEmpty && Flip(i, kFALSE))478 if (fColors[i]==kEmpty && Flip(i, kFALSE)) 539 479 return kTRUE; 540 480 return kFALSE; … … 557 497 { 558 498 Done(); 559 fDrawingPad->Modified();560 fDrawingPad->Update();499 gPad->Modified(); 500 gPad->Update(); 561 501 return; 562 502 } … … 564 504 UInt_t idx; 565 505 for (idx=0; idx<fNumPixels; idx++) 566 if ((*f Pixels)[idx]->DistancetoPrimitive(px, py)==0)506 if ((*fGeomCam)[idx].DistancetoPrimitive(px, py)<=0) 567 507 break; 568 508 … … 570 510 return; 571 511 572 if (event==kButton1Down && (*this)[idx].GetFillColor()==kEmpty)512 if (event==kButton1Down && fColors[idx]==kEmpty) 573 513 { 574 514 if (!Flip(idx, kTRUE)) … … 577 517 fUsrPts[fNumUser]++; 578 518 579 (*this)[idx].SetFillColor(kRed+fNumUser);519 fColors[idx] = kRed+fNumUser; 580 520 581 521 Int_t start = fNumUser; … … 600 540 } 601 541 602 fDrawingPad->Modified();603 } 542 gPad->Modified(); 543 } -
trunk/MagicSoft/Mars/mtools/MagicReversi.h
r8756 r9369 7 7 #ifndef ROOT_TClonesArray 8 8 #include <TClonesArray.h> 9 #endif 10 #ifndef ROOT_TArrayI 11 #include <TArrayI.h> 9 12 #endif 10 13 … … 24 27 Float_t fRange; // the range in millimeters of the present geometry 25 28 26 TClonesArray *fPixels; // array of all hexagons27 29 TClonesArray *fText; // array of all texts 28 30 TClonesArray *fFlags; // array of all texts 29 31 32 TArrayI fColors; 33 30 34 TText *fDone; // TText showing the 'Game over' 31 35 TText *fUsrTxt[6]; // TText showing the numbers of pixels and bombs 32 33 UInt_t fW; // Width of canvas34 UInt_t fH; // Height of canvas35 TVirtualPad *fDrawingPad; // pad in which we are drawing36 Bool_t fIsAllocated;37 36 38 37 Int_t fNumUsers; … … 49 48 }; 50 49 51 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }52 53 50 TText *GetText(Int_t i) { return (TText*)fText->At(i); } 54 51 TMarker *GetFlag(Int_t i) { return (TMarker*)fFlags->At(i); } 55 52 56 void Remove(TObject *);57 53 void Done(); 58 54 void Update(); 59 55 void SetNewCamera(MGeomCam *); 60 void DrawHexagons();61 56 void Free(); 62 57 void Init(); -
trunk/MagicSoft/Mars/mtools/MagicShow.cc
r8755 r9369 64 64 #include <TInterpreter.h> 65 65 66 #include "MH exagon.h"66 #include "MH.h" 67 67 68 68 #include "MGeomPix.h" … … 83 83 return; 84 84 85 fPixels->Delete();86 87 delete fPixels;88 89 85 delete fGeomCam; 90 }91 92 // ------------------------------------------------------------------------93 //94 // Draw all pixels of the camera95 // (means apend all pixelobjects to the current pad)96 //97 void MagicShow::DrawHexagons()98 {99 for (UInt_t i=0; i<fNumPixels; i++)100 {101 MHexagon &h = (*this)[i];102 103 h.SetFillColor(kBackground);104 h.Draw();105 }106 86 } 107 87 … … 123 103 ct1 = !ct1; 124 104 125 DrawHexagons(); 105 Update(); 106 107 fColors.Reset(); 108 109 // FIXME: Reset all texts 110 111 AppendPad(); 126 112 } 127 113 … … 133 119 { 134 120 Free(); 135 136 //137 // Reset the display geometry138 //139 fW=0;140 fH=0;141 121 142 122 // … … 151 131 fRange = fGeomCam->GetMaxRadius(); 152 132 153 fNumPixel = fNumPixels-1; 154 155 // 156 // Construct all hexagons. Use new-operator with placement 157 // 158 fPixels = new TClonesArray("MHexagon", fNumPixels); 159 160 for (UInt_t i=0; i<fNumPixels; i++) 161 { 162 MHexagon &h = *new ((*fPixels)[i]) MHexagon((*fGeomCam)[i]); 163 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 164 h.SetBit(kNoContextMenu|kCannotPick); 165 #endif 166 } 133 fNumPixel = 0;//fNumPixels-1; 134 135 fColors.Set(fNumPixels); 136 137 for (int i=0; i<6; i++) 138 { 139 fText[i] = new TText(0, 0, ""); 140 fText[i]->SetTextFont(122); 141 fText[i]->SetTextAlign(22); // centered/centered 142 } 143 167 144 } 168 145 169 146 void MagicShow::Init() 170 147 { 171 memset(fText, 0, sizeof(fText));172 173 148 // 174 149 // Make sure, that the object is destroyed when the canvas/pad is … … 189 164 // 190 165 MagicShow::MagicShow() 191 : fTimer(this, 250, kTRUE), fGeomCam(NULL), fNumPixel(-1), fAuto(kTRUE) , fW(0), fH(0)166 : fTimer(this, 250, kTRUE), fGeomCam(NULL), fNumPixel(-1), fAuto(kTRUE) 192 167 { 193 168 SetNewCamera(new MGeomCamMagic); … … 200 175 // 201 176 MagicShow::MagicShow(const MGeomCam &geom) 202 : fTimer(this, 250, kTRUE), fGeomCam(NULL), fNumPixel(-1), fAuto(kTRUE) , fW(0), fH(0)177 : fTimer(this, 250, kTRUE), fGeomCam(NULL), fNumPixel(-1), fAuto(kTRUE) 203 178 { 204 179 SetNewCamera(static_cast<MGeomCam*>(geom.Clone())); … … 215 190 216 191 for (int i=0; i<6; i++) 217 if (fText[i]) 218 delete fText[i]; 219 220 if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this) 221 { 222 fDrawingPad->RecursiveRemove(this); 223 delete fDrawingPad; 224 } 192 delete fText[i]; 225 193 } 226 194 … … 233 201 void MagicShow::Paint(Option_t *opt) 234 202 { 235 const UInt_t w = (UInt_t)(gPad->GetWw()*gPad->GetAbsWNDC()); 236 const UInt_t h = (UInt_t)(gPad->GetWh()*gPad->GetAbsHNDC()); 237 238 // 239 // Check for a change in width or height, and make sure, that the 240 // first call also sets the range 241 // 242 if (w*fH == h*fW && fW && fH) 243 return; 244 245 // 246 // Calculate aspect ratio (5/4=1.25 recommended) 247 // 248 const Double_t ratio = (Double_t)w/h; 249 250 Float_t x; 251 Float_t y; 252 253 if (ratio>1.0) 254 { 255 x = fRange*(ratio*2-1); 256 y = fRange; 257 } 258 else 259 { 260 x = fRange; 261 y = fRange/ratio; 262 } 263 264 fH = h; 265 fW = w; 266 267 // 268 // Set new range 269 // 270 fDrawingPad->Range(-fRange, -y, x, y); 203 const Float_t r = fGeomCam->GetMaxRadius(); 204 205 MH::SetPadRange(-r, -r, r, r*1.1); 206 207 TAttLine line; 208 TAttFill fill; 209 210 // FIXME: 211 for (UInt_t i=0; i<fNumPixels; i++) 212 { 213 const MGeom &pix = (*fGeomCam)[i]; 214 215 fill.SetFillColor(fColors[i]); 216 pix.PaintPrimitive(line, fill); 217 } 218 219 for (int i=0; i<6; i++) 220 fText[i]->Paint(); 271 221 } 272 222 … … 283 233 // if no canvas is yet existing to draw into, create a new one 284 234 // 285 /*TCanvas *c =*/ new TCanvas("MagicShow", "Magic Show Next Neighbours", 0, 0, 800, 800); 286 //c->ToggleEventStatus(); 287 288 fDrawingPad = gPad; 289 fDrawingPad->SetBorderMode(0); 290 fDrawingPad->SetFillColor(22); 235 new TCanvas("MagicShow", "Magic Show Next Neighbours", 0, 0, 800, 800); 236 237 gPad->SetBorderMode(0); 238 gPad->SetFillColor(22); 291 239 292 240 // … … 295 243 // 296 244 AppendPad(option); 297 298 //299 // Reset the game pad300 //301 DrawHexagons();302 245 303 246 fShow.SetTextAlign(23); // centered/bottom … … 339 282 fAuto = !fAuto; 340 283 Update(); 341 fDrawingPad->Update();284 gPad->Update(); 342 285 return; 343 286 … … 382 325 void MagicShow::ChangePixel(Int_t add) 383 326 { 384 MagicShow &This = *this; 385 386 const MGeomPix &pix1=(*fGeomCam)[fNumPixel]; 387 This[fNumPixel].SetFillColor(kBackground); 327 const MGeom &pix1=(*fGeomCam)[fNumPixel]; 328 329 fColors[fNumPixel] = kBackground; 388 330 for (int i=0; i<pix1.GetNumNeighbors(); i++) 389 331 { 390 This[pix1.GetNeighbor(i)].SetFillColor(kBackground);391 if ( !fText[i])332 fColors[pix1.GetNeighbor(i)] = kBackground; 333 if (TString(fText[i]->GetTitle()).IsNull()) 392 334 continue; 393 335 394 delete fText[i]; 395 fText[i] = NULL; 336 fText[i]->SetText(0, 0, ""); 396 337 } 397 338 … … 403 344 fNumPixel = fNumPixels-1; 404 345 405 const MGeomPix &pix2=(*fGeomCam)[fNumPixel]; 406 This[fNumPixel].SetFillColor(kBlue); 346 const MGeom &pix2=(*fGeomCam)[fNumPixel]; 347 348 fColors[fNumPixel] = kBlue; 349 407 350 for (int i=0; i<pix2.GetNumNeighbors(); i++) 408 351 { 409 352 Int_t idx = pix2.GetNeighbor(i); 410 353 411 This[idx].SetFillColor(kMagenta);354 fColors[idx] = kMagenta; 412 355 413 356 TString num; 414 357 num += idx; 415 358 416 fText[i] = new TText(This[idx].GetX(), This[idx].GetY(), num); 417 fText[i]->SetTextSize(0.3*This[idx].GetD()/fGeomCam->GetMaxRadius()); 418 fText[i]->SetTextFont(122); 419 fText[i]->SetTextAlign(22); // centered/centered 420 fText[i]->Draw(); 359 const MGeom &pix=(*fGeomCam)[idx]; 360 361 fText[i]->SetText(pix.GetX(), pix.GetY(), num); 362 fText[i]->SetTextSize(0.3*pix.GetT()/fGeomCam->GetMaxRadius()); 421 363 } 422 364 423 365 Update(); 424 366 425 fDrawingPad->Update();367 gPad->Update(); 426 368 } 427 369 -
trunk/MagicSoft/Mars/mtools/MagicShow.h
r8755 r9369 14 14 #ifndef ROOT_TClonesArray 15 15 #include <TClonesArray.h> 16 #endif 17 #ifndef ROOT_TArrayI 18 #include <TArrayI.h> 16 19 #endif 17 20 … … 45 48 TText *fText[6]; // ttext showing the pixel numbers of the neighbors 46 49 47 UInt_t fW; // Width of canvas 48 UInt_t fH; // Height of canvas 49 50 TClonesArray *fPixels; // array of all hexagons 51 TVirtualPad *fDrawingPad; // pad in which we are drawing 52 53 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); } 50 TArrayI fColors; 54 51 55 52 void Update(); 56 53 void Free(); 57 void DrawHexagons();58 54 void SetNewCamera(MGeomCam *); 59 55 void ChangePixel(Int_t add); -
trunk/MagicSoft/Mars/mtools/MagicSnake.cc
r8755 r9369 2 2 ! 3 3 ! * 4 ! * This file is part of MARS, the MAGICAnalysis and Reconstruction4 ! * This file is part of CheObs, the Modular Analysis and Reconstruction 5 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. … … 9 9 ! * Permission to use, copy, modify and distribute this software and its 10 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and11 ! * provided that the above copyright notice appears in all copies and 12 12 ! * that both that copyright notice and this permission notice appear 13 13 ! * in supporting documentation. It is provided "as is" without express … … 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 07/2002 <mailto:tbretz@astro.uni-wuerzburg.de>18 ! Author(s): Thomas Bretz, 7/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200220 ! Copyright: CheObs Software Development, 2000-2009 21 21 ! 22 22 ! … … 63 63 #include <TInterpreter.h> 64 64 65 #include "MH exagon.h"65 #include "MH.h" 66 66 67 67 #include "MGeomPix.h" … … 78 78 return; 79 79 80 fPixels->Delete();81 82 delete fPixels;83 84 80 delete fGeomCam; 85 81 86 82 delete fArray; 87 }88 89 // ------------------------------------------------------------------------90 //91 // Draw all pixels of the camera92 // (means apend all pixelobjects to the current pad)93 //94 void MagicSnake::DrawHexagons()95 {96 for (UInt_t i=0; i<fNumPixels; i++)97 (*this)[i].Draw();98 83 } 99 84 … … 115 100 116 101 Reset(); 117 DrawHexagons();102 AppendPad(); 118 103 } 119 104 … … 121 106 { 122 107 Free(); 123 124 //125 // Reset the display geometry126 //127 fW=0;128 fH=0;129 108 130 109 // … … 139 118 fRange = fGeomCam->GetMaxRadius(); 140 119 141 // 142 // Construct all hexagons. Use new-operator with placement 143 // 144 fPixels = new TClonesArray("MHexagon", fNumPixels); 145 146 for (UInt_t i=0; i<fNumPixels; i++) 147 { 148 MHexagon &h = *new ((*fPixels)[i]) MHexagon((*fGeomCam)[i]); 149 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 150 h.SetBit(kNoContextMenu|kCannotPick); 151 #endif 152 } 120 fColors.Set(fNumPixels); 153 121 } 154 122 … … 175 143 // 176 144 MagicSnake::MagicSnake() 177 : fTimer(this, 500, kTRUE), fGeomCam(NULL), fDone(NULL), fPaused(NULL) , fW(0), fH(0)145 : fTimer(this, 500, kTRUE), fGeomCam(NULL), fDone(NULL), fPaused(NULL) 178 146 { 179 147 SetNewCamera(new MGeomCamMagic); … … 186 154 // 187 155 MagicSnake::MagicSnake(const MGeomCam &geom) 188 : fTimer(this, 500, kTRUE), fGeomCam(NULL), fDone(NULL), fPaused(NULL) , fW(0), fH(0)156 : fTimer(this, 500, kTRUE), fGeomCam(NULL), fDone(NULL), fPaused(NULL) 189 157 { 190 158 SetNewCamera(static_cast<MGeomCam*>(geom.Clone())); … … 203 171 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 204 172 fPaused->SetBit(kNoContextMenu|kCannotPick); 205 fDrawingPad->ResetBit(kNoContextMenu);206 173 ResetBit(kNoContextMenu); 207 174 #endif 208 fDrawingPad->Update();175 //fDrawingPad->Update(); 209 176 } 210 177 … … 215 182 { 216 183 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 217 fDrawingPad->SetBit(kNoContextMenu);184 //fDrawingPad->SetBit(kNoContextMenu); 218 185 SetBit(kNoContextMenu); 219 186 #endif … … 222 189 return; 223 190 224 Remove(fPaused); 225 226 fDrawingPad->Update(); 191 //fDrawingPad->Update(); 227 192 228 193 delete fPaused; … … 241 206 if (fDone) 242 207 delete fDone; 243 208 /* 244 209 if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this) 245 210 { 246 211 fDrawingPad->RecursiveRemove(this); 247 212 delete fDrawingPad; 248 } 213 }*/ 249 214 } 250 215 … … 257 222 void MagicSnake::Paint(Option_t *opt) 258 223 { 259 const UInt_t w = (UInt_t)(gPad->GetWw()*gPad->GetAbsWNDC()); 260 const UInt_t h = (UInt_t)(gPad->GetWh()*gPad->GetAbsHNDC()); 261 262 // 263 // Check for a change in width or height, and make sure, that the 264 // first call also sets the range 265 // 266 if (w*fH == h*fW && fW && fH) 267 return; 268 269 // 270 // Calculate aspect ratio (5/4=1.25 recommended) 271 // 272 const Double_t ratio = (Double_t)w/h; 273 274 Float_t x; 275 Float_t y; 276 277 if (ratio>1.0) 278 { 279 x = fRange*(ratio*2-1); 280 y = fRange; 281 } 282 else 283 { 284 x = fRange; 285 y = fRange/ratio; 286 } 287 288 fH = h; 289 fW = w; 290 291 // 292 // Set new range 293 // 294 fDrawingPad->Range(-fRange, -y, x, y); 224 const Float_t r = fGeomCam->GetMaxRadius(); 225 226 MH::SetPadRange(-r, -r, r, r*1.1); 227 228 TAttLine line; 229 TAttFill fill; 230 231 for (UInt_t i=0; i<fNumPixels; i++) 232 { 233 const MGeom &pix = (*fGeomCam)[i]; 234 235 fill.SetFillColor(fColors[i]); 236 pix.PaintPrimitive(line, fill); 237 } 295 238 } 296 239 … … 307 250 // if no canvas is yet existing to draw into, create a new one 308 251 // 309 /*TCanvas *c =*/ new TCanvas("MagicSnake", "Magic Snake", 0, 0, 800, 800); 310 //c->ToggleEventStatus(); 311 312 fDrawingPad = gPad; 313 fDrawingPad->SetBorderMode(0); 252 new TCanvas("MagicSnake", "Magic Snake", 0, 0, 800, 800); 253 254 //fDrawingPad = gPad; 255 gPad->SetBorderMode(0); 314 256 315 257 // … … 323 265 // 324 266 Reset(); 325 DrawHexagons();326 267 327 268 fShow.SetTextAlign(23); // centered/bottom … … 355 296 for (UInt_t i=0; i<fNumPixels; i++) 356 297 { 357 (*this)[i].SetFillColor(kBackground);298 fColors[i] = kBackground; 358 299 (*fGeomCam)[i].ResetBit(kUserBits); 359 300 } … … 372 313 373 314 (*fGeomCam)[idx].SetBit(kHasBomb); 374 (*this)[idx].SetFillColor(kRed);315 fColors[idx] = kRed; 375 316 } 376 317 377 318 fNumFood = fNumPixels/6; 319 // FIXME. gROOT->GetColor doesn't allow more than 100 colors! 320 if (fNumFood>46) 321 fNumFood=46; 378 322 379 323 fArray = new Int_t[fNumFood+3]; … … 395 339 396 340 (*fGeomCam)[idx].SetBit(kHasFood); 397 (*this)[idx].SetFillColor(kGreen);341 fColors[idx] = kGreen; 398 342 } 399 343 … … 409 353 fTransport[i] = idx; 410 354 (*fGeomCam)[idx].SetBit(kHasTransport); 411 (*this)[idx].SetFillColor(kYellow);412 } 413 414 fDrawingPad->SetFillColor(22);355 fColors[idx] = kYellow; 356 } 357 358 gPad->SetFillColor(22); 415 359 416 360 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 417 fDrawingPad->SetBit(kNoContextMenu);361 //fDrawingPad->SetBit(kNoContextMenu); 418 362 SetBit(kNoContextMenu); 419 363 #endif … … 435 379 fDone->SetTextSize(0.05); // white 436 380 fDone->Draw(); 437 fDrawingPad->SetFillColor(col);381 gPad->SetFillColor(col); 438 382 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 439 383 fDone->SetBit(kNoContextMenu|kCannotPick); 440 fDrawingPad->ResetBit(kNoContextMenu);441 384 ResetBit(kNoContextMenu); 442 385 #endif 443 }444 445 void MagicSnake::Remove(TObject *obj)446 {447 fDrawingPad->RecursiveRemove(obj);448 386 } 449 387 … … 500 438 if ((*fGeomCam)[newpix].TestBit(kHasTransport)) 501 439 { 502 (*this)[fArray[0]].SetFillColor(kBackground);440 fColors[fArray[0]] = kBackground; 503 441 (*fGeomCam)[fArray[0]].ResetBit(kHasWorm); 504 442 … … 513 451 if (!(*fGeomCam)[newpix].TestBit(kHasFood)) 514 452 { 515 MGeom Pix&pix = (*fGeomCam)[fArray[0]];453 MGeom &pix = (*fGeomCam)[fArray[0]]; 516 454 517 455 if (!pix.TestBit(kHasTransport)) 456 { 518 457 if (pix.TestBit(kHasDoor)) 519 (*this)[fArray[0]].SetFillColor(kMagenta);458 fColors[fArray[0]] = kMagenta; 520 459 else 521 (*this)[fArray[0]].SetFillColor(kBackground); 460 fColors[fArray[0]] = kBackground; 461 } 522 462 523 463 pix.ResetBit(kHasWorm); … … 538 478 for (int i=1; i<7; i++) 539 479 { 540 (*this)[i].SetFillColor(kMagenta);480 fColors[i] = kMagenta; 541 481 (*fGeomCam)[i].SetBit(kHasDoor); 542 482 } … … 552 492 const Int_t idx = fArray[i]; 553 493 554 MGeom Pix&pix = (*fGeomCam)[idx];494 MGeom &pix = (*fGeomCam)[idx]; 555 495 556 496 if (pix.TestBit(kHasTransport)) … … 559 499 pix.SetBit(kHasWorm); 560 500 561 Int_t color = 51+fLength-i; 562 (*this)[idx].SetFillColor(color); 501 fColors[idx] = 51+fLength-i; 563 502 } 564 503 } … … 568 507 const Int_t first = fArray[fLength-1]; 569 508 570 const MGeom Pix&pix=(*fGeomCam)[first];509 const MGeom &pix=(*fGeomCam)[first]; 571 510 572 511 Double_t dx = pix.GetX(); … … 577 516 { 578 517 const Int_t idx = pix.GetNeighbor(i); 579 const MGeom Pix&next = (*fGeomCam)[idx];518 const MGeom &next = (*fGeomCam)[idx]; 580 519 581 520 const Double_t x = next.GetX(); … … 596 535 return -1; 597 536 598 const MGeom Pix&np = (*fGeomCam)[newpix];537 const MGeom &np = (*fGeomCam)[newpix]; 599 538 600 539 if (fNumFood==0 && np.TestBit(kHasDoor)) … … 611 550 612 551 Bool_t MagicSnake::HandleTimer(TTimer *timer) 613 { 552 { 614 553 if (fDone || fPaused) 615 554 return kTRUE; … … 637 576 Update(); 638 577 639 //cout << "Update " << flush; 640 641 fDrawingPad->Modified(); 642 fDrawingPad->Update(); 643 644 //cout << "Done." << endl; 578 gPad->Modified(); 579 gPad->Update(); 645 580 646 581 return kTRUE; -
trunk/MagicSoft/Mars/mtools/MagicSnake.h
r8755 r9369 14 14 #ifndef ROOT_TClonesArray 15 15 #include <TClonesArray.h> 16 #endif 17 #ifndef ROOT_TArrayI 18 #include <TArrayI.h> 16 19 #endif 17 20 … … 60 63 Float_t fRange; // the range in millimeters of the present geometry 61 64 65 TArrayI fColors; 66 62 67 TText *fDone; // TText showing the 'Game over' 63 68 TText *fPaused; // TText showing the 'Game over' 64 69 TText fShow; // TText showing the numbers of pixels and bombs 65 70 66 UInt_t fW; // Width of canvas67 UInt_t fH; // Height of canvas68 69 TClonesArray *fPixels; // array of all hexagons70 71 TVirtualPad *fDrawingPad; // pad in which we are drawing 71 72 72 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }73 74 void Remove(TObject *);75 73 void Done(TString, Int_t col); 76 74 void Step(Int_t newpix); -
trunk/MagicSoft/Mars/mtools/MineSweeper.cc
r8755 r9369 2 2 ! 3 3 ! * 4 ! * This file is part of MARS, the MAGICAnalysis and Reconstruction4 ! * This file is part of CheObs, the Modular Analysis and Reconstruction 5 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. … … 9 9 ! * Permission to use, copy, modify and distribute this software and its 10 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and11 ! * provided that the above copyright notice appears in all copies and 12 12 ! * that both that copyright notice and this permission notice appear 13 13 ! * in supporting documentation. It is provided "as is" without express … … 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 07/2002 <mailto:tbretz@astro.uni-wuerzburg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-200218 ! Author(s): Thomas Bretz, 7/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: CheObs Software Development, 2000-2009 21 21 ! 22 22 ! … … 57 57 #include <TInterpreter.h> 58 58 59 #include "MH exagon.h"59 #include "MH.h" 60 60 61 61 #include "MGeomPix.h" … … 82 82 return; 83 83 84 fPixels->Delete();85 84 fText->Delete(); 86 85 fFlags->Delete(); … … 88 87 delete fText; 89 88 delete fFlags; 90 delete fPixels;91 89 92 90 delete fGeomCam; … … 107 105 108 106 Reset(); 109 DrawHexagons();107 AppendPad(); 110 108 } 111 109 … … 113 111 { 114 112 Free(); 115 116 //117 // Reset the display geometry118 //119 fW=0;120 fH=0;121 113 122 114 // … … 138 130 fText = new TClonesArray("TText", fNumPixels); 139 131 fFlags = new TClonesArray("TMarker", fNumPixels); 140 fPixels = new TClonesArray("MHexagon", fNumPixels); 132 fColors.Set(fNumPixels); 133 //fPixels = new TClonesArray("MHexagon", fNumPixels); 141 134 142 135 for (UInt_t i=0; i<fNumPixels; i++) 143 136 { 144 MHexagon &h = *new ((*fPixels)[i]) MHexagon((*fGeomCam)[i]); 145 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 146 h.SetBit(kNoContextMenu|kCannotPick); 147 #endif 137 const MGeom &pix = (*fGeomCam)[i]; 148 138 149 139 TText &t = *new ((*fText)[i]) TText; 150 140 t.SetTextFont(122); 151 141 t.SetTextAlign(22); // centered/centered 152 t.SetTextSize(0.3* h.GetD()/fRange);142 t.SetTextSize(0.3*pix.GetT()/fRange); 153 143 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 154 144 t.SetBit(kNoContextMenu|kCannotPick); 155 145 #endif 156 146 157 const MGeomPix &pix = (*fGeomCam)[i];158 159 147 TMarker &m = *new ((*fFlags)[i]) TMarker(pix.GetX(), pix.GetY(), kOpenStar); 160 148 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) … … 162 150 #endif 163 151 } 164 }165 166 // ------------------------------------------------------------------------167 //168 // Draw all pixels of the camera169 // (means apend all pixelobjects to the current pad)170 //171 void MineSweeper::DrawHexagons()172 {173 for (UInt_t i=0; i<fNumPixels; i++)174 (*this)[i].Draw();175 152 } 176 153 … … 193 170 // 194 171 MineSweeper::MineSweeper() 195 : fGeomCam(NULL), fDone(NULL), fShow(NULL) , fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)172 : fGeomCam(NULL), fDone(NULL), fShow(NULL) 196 173 { 197 174 SetNewCamera(new MGeomCamMagic); … … 200 177 201 178 MineSweeper::MineSweeper(const MGeomCam &geom) 202 : fGeomCam(NULL), fDone(NULL), fShow(NULL) , fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)179 : fGeomCam(NULL), fDone(NULL), fShow(NULL) 203 180 { 204 181 SetNewCamera(static_cast<MGeomCam*>(geom.Clone())); … … 218 195 if (fDone) 219 196 delete fDone; 220 221 if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this)222 {223 fDrawingPad->RecursiveRemove(this);224 delete fDrawingPad;225 }226 197 } 227 198 … … 234 205 void MineSweeper::Paint(Option_t *opt) 235 206 { 236 const UInt_t w = (UInt_t)(gPad->GetWw()*gPad->GetAbsWNDC()); 237 const UInt_t h = (UInt_t)(gPad->GetWh()*gPad->GetAbsHNDC()); 238 239 // 240 // Check for a change in width or height, and make sure, that the 241 // first call also sets the range 242 // 243 if (w*fH == h*fW && fW && fH) 244 return; 245 246 // 247 // Calculate aspect ratio (5/4=1.25 recommended) 248 // 249 const Double_t ratio = (Double_t)w/h; 250 251 Float_t x; 252 Float_t y; 253 254 if (ratio>1.0) 255 { 256 x = fRange*(ratio*2-1); 257 y = fRange; 258 } 259 else 260 { 261 x = fRange; 262 y = fRange/ratio; 263 } 264 265 fH = h; 266 fW = w; 267 268 // 269 // Set new range 270 // 271 fDrawingPad->Range(-fRange, -y, x, y); 272 273 // 274 // Adopt absolute sized of markers to relative range 275 // 207 const Float_t r = fGeomCam->GetMaxRadius(); 208 209 MH::SetPadRange(-r, -r, r, r*1.1); 210 211 TAttLine line; 212 TAttFill fill; 213 214 // FIXME: 276 215 for (UInt_t i=0; i<fNumPixels; i++) 277 216 { 278 Float_t r = (*this)[i].GetD()*gPad->XtoAbsPixel(1)/325; 217 const MGeom &pix = (*fGeomCam)[i]; 218 219 fill.SetFillColor(fColors[i]); 220 pix.PaintPrimitive(line, fill); 221 222 // 223 // Adopt absolute sized of markers to relative range 224 // 225 Float_t r = (*fGeomCam)[i].GetT()*gPad->XtoAbsPixel(1)/325; 279 226 GetFlag(i)->SetMarkerSize(20.0*r/fRange); 227 228 if (pix.TestBit(kHasFlag)) 229 GetFlag(i)->Paint(); 230 231 GetText(i)->Paint(); 280 232 } 281 233 } … … 293 245 // gPad->SetFixedAspectRatio() 294 246 295 if (fDrawingPad)296 return;297 298 247 // 299 248 // if no canvas is yet existing to draw into, create a new one 300 249 // 301 250 if (!gPad) 302 { 303 /*TCanvas *c =*/ new TCanvas("MineSweeper", "Magic Mine Sweeper", 0, 0, 800, 800); 304 //c->ToggleEventStatus(); 305 fIsAllocated = kTRUE; 306 } 307 else 308 fIsAllocated = kFALSE; 309 310 fDrawingPad = gPad; 311 fDrawingPad->SetBorderMode(0); 251 new TCanvas("MineSweeper", "Magic Mine Sweeper", 0, 0, 800, 800); 252 253 gPad->SetBorderMode(0); 312 254 313 255 // … … 330 272 // 331 273 Reset(); 332 DrawHexagons();333 274 } 334 275 … … 357 298 for (UInt_t i=0; i<fNumPixels; i++) 358 299 { 359 Remove(GetText(i)); 360 Remove(GetFlag(i)); 361 362 (*this)[i].SetFillColor(kHidden); 300 fColors[i] = kHidden; 363 301 (*fGeomCam)[i].ResetBit(kUserBits); 364 302 365 303 GetFlag(i)->SetMarkerColor(kBlack); 304 GetText(i)->SetText(0, 0, ""); 366 305 } 367 306 Update(fNumBombs); … … 378 317 } 379 318 380 fDrawingPad->SetFillColor(22);381 382 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 383 fDrawingPad->SetBit(kNoContextMenu);319 gPad->SetFillColor(22); 320 321 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 322 gPad->SetBit(kNoContextMenu); 384 323 SetBit(kNoContextMenu); 385 324 #endif … … 391 330 if ((*fGeomCam)[j].TestBit(kHasBomb)) 392 331 { 393 (*this)[j].SetFillColor(kBlack);332 fColors[j] = kBlack; 394 333 GetFlag(j)->SetMarkerColor(kWhite); 395 334 } … … 404 343 fDone->Draw(); 405 344 406 fDrawingPad->SetFillColor(col);407 408 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 409 fDrawingPad->ResetBit(kNoContextMenu);345 gPad->SetFillColor(col); 346 347 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 348 gPad->ResetBit(kNoContextMenu); 410 349 ResetBit(kNoContextMenu); 411 350 #endif … … 419 358 void MineSweeper::OpenHexagon(Int_t idx) 420 359 { 421 MGeom Pix&pix=(*fGeomCam)[idx];360 MGeom &pix=(*fGeomCam)[idx]; 422 361 423 362 if (pix.TestBit(kIsVisible)) 424 363 return; 425 426 if (pix.TestBit(kHasFlag))427 Remove(GetFlag(idx));428 364 429 365 pix.SetBit(kIsVisible); … … 435 371 cnt++; 436 372 437 (*this)[idx].SetFillColor(fColorBombs[cnt]); 438 373 fColors[idx] = fColorBombs[cnt]; 374 375 TString str; 439 376 if (cnt) 440 {441 TText *txt = GetText(idx);442 TString str;443 377 str += cnt; 444 txt->SetText(pix.GetX(), pix.GetY(), str); 445 txt->Draw(); 446 return; 447 } 378 379 TText *txt = GetText(idx); 380 txt->SetText(pix.GetX(), pix.GetY(), str); 381 382 if (cnt) 383 return; 448 384 449 385 for (int j=0; j<pix.GetNumNeighbors(); j++) 450 386 OpenHexagon(pix.GetNeighbor(j)); 451 }452 453 void MineSweeper::Remove(TObject *obj)454 {455 fDrawingPad->RecursiveRemove(obj);456 387 } 457 388 … … 479 410 UInt_t idx; 480 411 for (idx=0; idx<fNumPixels; idx++) 481 if ((*f Pixels)[idx]->DistancetoPrimitive(px, py)==0)412 if ((*fGeomCam)[idx].DistancetoPrimitive(px, py)<=0) 482 413 break; 483 414 … … 485 416 return; 486 417 487 MGeom Pix&pix=(*fGeomCam)[idx];418 MGeom &pix=(*fGeomCam)[idx]; 488 419 489 420 if (event==kButton1Double) … … 496 427 497 428 if (event==kButton1Down && !pix.TestBit(kIsVisible)) 498 {499 if (pix.TestBit(kHasFlag))500 Remove(GetFlag(idx));501 else502 GetFlag(idx)->Draw();503 504 429 pix.InvertBit(kHasFlag); 505 }506 430 507 431 UInt_t vis=fNumBombs; … … 520 444 Done("Great! Congratulations, you did it!", kGreen); 521 445 522 fDrawingPad->Modified();446 gPad->Modified(); 523 447 524 448 /* -
trunk/MagicSoft/Mars/mtools/MineSweeper.h
r8755 r9369 8 8 #include <TClonesArray.h> 9 9 #endif 10 #ifndef ROOT_TArrayI 11 #include <TArrayI.h> 12 #endif 10 13 11 14 class TText; … … 13 16 class TVirtualPad; 14 17 18 class MGeom; 15 19 class MGeomCam; 16 20 class MHexagon; … … 27 31 Float_t fRange; // the range in millimeters of the present geometry 28 32 29 TClonesArray *fPixels; // array of all hexagons30 33 TClonesArray *fText; // array of all texts 31 34 TClonesArray *fFlags; // array of all texts 32 35 36 TArrayI fColors; 37 33 38 TText *fDone; // TText showing the 'Game over' 34 39 TText *fShow; // TText showing the numbers of pixels and bombs 35 36 UInt_t fW; // Width of canvas37 UInt_t fH; // Height of canvas38 TVirtualPad *fDrawingPad; // pad in which we are drawing39 Bool_t fIsAllocated;40 40 41 41 enum … … 48 48 }; 49 49 50 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }51 52 50 TText *GetText(Int_t i) { return (TText*)fText->At(i); } 53 51 TMarker *GetFlag(Int_t i) { return (TMarker*)fFlags->At(i); } 54 52 55 void Remove(TObject *);56 53 void OpenHexagon(Int_t idx); 57 54 void Done(TString, Int_t); 58 55 void Update(Int_t); 59 56 void SetNewCamera(MGeomCam *); 60 void DrawHexagons();57 void PaintPrimitives(); 61 58 void Free(); 62 59 void Init();
Note:
See TracChangeset
for help on using the changeset viewer.