Changeset 1275 for trunk/MagicSoft/Cosy/gui
- Timestamp:
- 04/12/02 16:59:23 (23 years ago)
- Location:
- trunk/MagicSoft/Cosy/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r1273 r1275 206 206 TGCompositeFrame *tf1 = fTab->AddTab("Position Zd/Az"); 207 207 TGCompositeFrame *tf2 = fTab->AddTab("Track Ra/Dec"); 208 TGCompositeFrame *tf3 = fTab->AddTab("Demo Mode"); 208 209 209 210 fCZdAz = new MGCoordinates(tf1, kETypeZdAz); … … 467 468 cout << "Closing window - waiting until all nodes are stopped." << endl; 468 469 fQueue->PostMsg(WM_QUIT, 0, 0); 470 cout << "Closing window - done." << endl; 469 471 // gApplication->Terminate(0); 470 472 } … … 497 499 cout << "PostMsg (WM_Position) returned." << endl; 498 500 } 501 502 // 503 // ************************** For demo purpose ********************** 504 // 505 #include <TRandom.h> 506 class MDemo : public MThread 507 { 508 private: 509 MsgQueue *fQueue; 510 TRandom fRand; 511 512 public: 513 MDemo() : MThread(false) {} 514 515 void SetQueue(MsgQueue *q) { fQueue = q; } 516 517 virtual void *Thread() 518 { 519 while (1) 520 { 521 Timer tm; 522 tm.Now(); 523 524 Float_t h = 2.+tm.H()+(8.+tm.M())/60.; 525 RaDec dest(h*15, 130); 526 527 cout << dest.Ra()/15 << "h " << dest.Dec() << "°" << endl; 528 529 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest)); 530 531 int i = 0; 532 while (!HasStopFlag() && i++<130) // 2.5min 533 usleep(1000000); 534 if (HasStopFlag()) 535 break; 536 537 //fQueue->PostMsg(WM_STOP, 0, 0); 538 539 ZdAz dest1(fRand.Integer(56)+5, fRand.Integer(360)); 540 541 cout << "Demo: Zd=" << dest1.Zd() << "° Az=" << dest1.Az() << "°" << endl; 542 543 fQueue->PostMsg(WM_POSITION, &dest1, sizeof(dest1)); 544 545 i = 0; 546 while (!HasStopFlag() && i++<30) // 30s 547 usleep(1000000); 548 if (HasStopFlag()) 549 break; 550 551 //ZdAz dest2(5, 30); 552 //fQueue->PostMsg(WM_POSITION, &dest2, sizeof(dest2)); 553 /* 554 i = 0; 555 while (!HasStopFlag() && i++<30) // 30s 556 usleep(1000000); 557 */ 558 //if (HasStopFlag()) 559 // break; 560 } 561 cout << "Demo Thread: done." << endl; 562 return NULL; 563 } 564 }; 565 566 MDemo demo; 567 568 void MGCosy::StartDemo() 569 { 570 cout << "Start Demo." << endl; 571 572 demo.SetQueue(fQueue); 573 demo.Start(); 574 575 cout << "PostMsg (WM_Demo) returned." << endl; 576 } 577 578 void StopDemo() 579 { 580 cout << "Stopping demo." << endl; 581 demo.Stop(); 582 } 583 // 584 // ****************************************************************** 585 // 499 586 500 587 Bool_t MGCosy::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2) … … 526 613 */ 527 614 case kPB_START: 528 fTab->GetCurrent() ? StartTrack() : StartPos(); 615 switch (fTab->GetCurrent()) 616 { 617 case 0: 618 StartPos(); 619 return kTRUE; 620 case 1: 621 StartTrack(); 622 return kTRUE; 623 case 2: 624 StartDemo(); 625 return kTRUE; 626 } 529 627 return kTRUE; 530 628 531 629 case kPB_STOP: 532 630 cout << "Sending stop movement msg." << endl; 631 StopDemo(); 533 632 fQueue->PostMsg(WM_STOP, 0, 0); 633 534 634 cout << "PostMsg (WM_Stop) returned." << endl; 535 635 return kTRUE; … … 563 663 { 564 664 case IDM_EXIT: 665 cout << "IDM_EXIT: Posting WM_QUIT." << endl; 565 666 fQueue->PostMsg(WM_QUIT, 0, 0); 667 cout << "IDM_EXIT: WM_QUIT done." << endl; 566 668 //cout << "Idm_Exit." << endl; 567 669 //CloseWindow(); -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r1111 r1275 73 73 void StartPos(); 74 74 void StartTrack(); 75 void StartDemo(); 75 76 76 77 void EnableLabel(TGLabel *label, Bool_t stat); -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc
r1111 r1275 6 6 7 7 #include "MGEmbeddedCanvas.h" 8 9 #include <iostream.h> 8 10 9 11 #include <TList.h> … … 17 19 fModified(kFALSE), fWidth(width), fRange(range), fPix(2.*range/width) 18 20 { 21 cout << "MGEmbeddedCanvas: Initializing." << endl; 19 22 fCanvas = GetCanvas(); 20 23 24 cout << "MGEmbeddedCanvas: fCanvas = 0x" << fCanvas << endl; 25 26 cout << "MGEmbeddedCanvas: SetFillColor." << endl; 21 27 fCanvas->SetFillColor(39); // s. TAttFill 22 fCanvas->Range(-fRange, -fRange, fRange, fRange); 28 cout << "MGEmbeddedCanvas: fRange=" << fRange << endl; 29 if (fRange>0) 30 fCanvas->Range(-fRange, -fRange, fRange, fRange); 23 31 24 32 fList = new TList; 25 33 fList->SetOwner(); 34 35 cout << "MGEmbeddedCanvas: Initializing done." << endl; 26 36 } 27 37 -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r1273 r1275 208 208 { 209 209 RaDec rd(radec.Ra()+off*360/24*kDeg2Rad, radec.Dec()); 210 ZdAz zdaz = fSlaStar->CalcZdAz (rd);210 ZdAz zdaz = fSlaStar->CalcZdAzFast(rd); 211 211 212 212 const float s = sin(zdaz.Az()); … … 319 319 UpdatePlanet(kEMars, fMars); 320 320 321 RaDec radec = fSlaStar->CalcRaDec (pos*kDeg2Rad);321 RaDec radec = fSlaStar->CalcRaDecFast(pos*kDeg2Rad); 322 322 323 323 UpdatePosition(radec, pos.Zd(), pos.Az());
Note:
See TracChangeset
for help on using the changeset viewer.