Changeset 1531 for trunk/MagicSoft/Cosy/catalog
- Timestamp:
- 09/24/02 14:35:10 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy/catalog
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/catalog/StarCatalog.cc
r1109 r1531 9 9 #include "slamac.h" 10 10 #include "File.h" 11 12 #include "MStarList.h" 11 13 12 14 ClassImp(StarCatalog); … … 319 321 } 320 322 321 void StarCatalog::DrawSCAltAz(byte *img, const int color) 323 void StarCatalog::DrawSCAltAz(byte *img, const int color) const 322 324 { 323 325 // … … 353 355 } 354 356 355 void StarCatalog::DrawSCRaDec(byte *img, const int color) 357 void StarCatalog::DrawSCRaDec(byte *img, const int color) const 356 358 { 357 359 // … … 396 398 } 397 399 400 void StarCatalog::GetImg(byte *img, byte *cimg, MStarList &list) const 401 { 402 memset(cimg, 0, 768*576); 403 404 DrawSCAltAz(cimg, 2<<4); 405 DrawSCRaDec(cimg, 2); 406 407 DrawStars(list, cimg); 408 DrawCross(img, 768/2, 576/2); 409 } 410 398 411 void StarCatalog::GetImg(byte *img, byte *cimg, const double utc, 399 412 const RaDec &radec) 400 413 { 401 // memset(img, 0, 768*576); 402 memset(cimg, 0, 768*576); 403 404 SetMjd(utc); 405 //fAlpha = sla.GetAlpha(); 406 SetRaDec(radec); 407 408 DrawSCAltAz(cimg, 2<<4); 409 DrawSCRaDec(cimg, 2); 410 411 CalcImg(img); 412 413 DrawCross(img, 768/2, 576/2); 414 MStarList list; 415 GetStars(list, utc, radec); 416 GetImg(img, cimg, list); 417 /* 418 // memset(img, 0, 768*576); 419 SetMjd(utc); 420 //fAlpha = sla.GetAlpha(); 421 SetRaDec(radec); 422 //CalcImg(cimg); 423 */ 414 424 } 415 425 … … 417 427 const AltAz &altaz) 418 428 { 419 // memset(img, 0, 768*576); 420 memset(cimg, 0, 768*576); 421 429 MStarList list; 430 GetStars(list, utc, altaz); 431 GetImg(img, cimg, list); 432 /* 433 // memset(img, 0, 768*576); 434 435 SetMjd(utc); 436 //fAlpha = sla.GetAlpha(); 437 SetAltAz(altaz); 438 439 CalcRaDecRange(); 440 441 //CalcImg(img); 442 */ 443 444 } 445 446 void StarCatalog::GetStars(MStarList &list, const double utc, const RaDec &radec) 447 { 422 448 SetMjd(utc); 423 //fAlpha = sla.GetAlpha(); 449 SetRaDec(radec); 450 451 CalcStars(list); 452 } 453 454 void StarCatalog::GetStars(MStarList &list, const double utc, const AltAz &altaz) 455 { 456 SetMjd(utc); 424 457 SetAltAz(altaz); 425 458 426 459 CalcRaDecRange(); 427 DrawSCRaDec(cimg, 2); 428 DrawSCAltAz(cimg, 2<<4); 429 CalcImg(img); 430 431 DrawCross(img, 768/2, 576/2); 460 CalcStars(list); 432 461 } 433 462 … … 453 482 } 454 483 455 Bool_t StarCatalog::DrawAltAz(const int color, byte *img, double alt, double az, int size) 484 Bool_t StarCatalog::DrawAltAz(const int color, byte *img, double alt, double az, int size) const 456 485 { 457 486 // … … 492 521 } 493 522 523 /* 494 524 Bool_t StarCatalog::Draw(const int color, byte *img, const SaoFile *sao) 495 525 { 496 //497 // ---- mean to observed ---498 //499 AltAz altaz=CalcAltAz(sao->GetRaDec()) * 360.0/D2PI;500 501 526 if (sao->MagV() > fLimitMag) 502 527 return kFALSE; 503 528 529 // 530 // ---- mean to observed --- 531 // 532 AltAz altaz=CalcAltAz(sao->GetRaDec()) * 360.0/D2PI; 533 504 534 const int mag = (10 - (sao->MagV()>1 ? (int)sao->MagV() : 1))/2; 505 535 … … 509 539 return DrawAltAz(color, img, altaz.Alt(), altaz.Az(), mag); 510 540 } 511 512 Bool_t StarCatalog::DrawRaDec(const int color, byte *img, double ra, double dec, int size) 541 */ 542 543 Bool_t StarCatalog::DrawRaDec(const int color, byte *img, double ra, double dec, int size) const 513 544 { 514 545 // … … 542 573 return DrawRaDec(color, img, radec.Ra(), radec.Dec()); 543 574 } 544 575 /* 545 576 void StarCatalog::CalcImg(byte *img) 546 577 { … … 574 605 575 606 // 576 // Try to draw star into the image (white) 577 // 578 if (!Draw(0xff, img, fSao)) 607 // Try to draw star into the image 608 // white = 0xff 609 // 610 if (!Draw(0x0f, img, fSao)) 579 611 deleted++; 580 612 … … 586 618 cout << " " << count << "-" << deleted << "=" << count-deleted << " " << flush; 587 619 } 588 620 */ 621 void StarCatalog::DrawStars(MStarList &list, byte *img) 622 { 623 MStarListIter Next(&list); 624 625 MStar *star; 626 while ((star=Next())) 627 { 628 const int mag = (10 - (star->GetMag()>1 ? (int)star->GetMag() : 1))/2; 629 630 Double_t color = 0x0f; 631 632 DrawCircle(color, img, (int)star->GetX(), (int)star->GetY(), mag); 633 } 634 } 635 636 void StarCatalog::CalcStars(MStarList &list) const 637 { 638 // 639 // --------- search for stars in catalog ---------- 640 // 641 int count = 0; 642 int deleted = 0; 643 644 int idx = 0; 645 646 while (fSrt[idx].dec<fDecMin) 647 idx++; 648 649 idx--; 650 while (++idx<fEntries && fSrt[idx].dec<fDecMax+1) 651 { 652 const int ra = fSrt[idx].ra; 653 654 if (!fRa0[ra]) 655 continue; 656 657 int nr = fSrt[idx].nr; 658 do 659 { 660 // 661 // Get entry from catalog 662 // 663 fSao->GetEntry(nr++); 664 665 if (fSao->MagV() > fLimitMag) 666 continue; 667 668 // 669 // ---- mean to observed --- 670 // 671 AltAz altaz=CalcAltAz(fSao->GetRaDec()); 672 673 // 674 // alt/az[rad] -> alt/az[pix] 675 // 676 double dx, dy; 677 slaDe2h(altaz.Az()-fAltAz.Az(), -altaz.Alt(), 678 DPI/2-fAltAz.Alt(), &dx, &dy); 679 680 // 681 // Align alt/az[pix] 682 // 683 const float xx = 768.0 - (fWidth -dx+DPI)/fPixSize; 684 const float yy = (fHeight+dy) /fPixSize; 685 686 // 687 // Range Check, add stars to the list 688 // 689 if (!(0<=xx && xx<768 && 0<=yy && yy<576)) 690 { 691 deleted++; 692 continue; 693 } 694 695 list.Add(xx, yy, fSao->MagV()); 696 count++; 697 } 698 while ((int)(360.0/D2PI*fSao->Ra())==ra); 699 } 700 701 cout << " " << count+deleted << "-" << deleted << "=" << count << " " << endl; 702 } 703 704 AltAz StarCatalog::CalcAltAzFromPix(Double_t pixx, Double_t pixy) const 705 { 706 Double_t dx = (pixx-768.0)*fPixSize + fWidth+DPI; 707 Double_t dy = pixy*fPixSize - fHeight; 708 709 double ha, dec; 710 slaDh2e(dx, dy, DPI/2-fAltAz.Alt(), &ha, &dec); 711 712 return AltAz(-dec, ha+fAltAz.Az()); 713 } -
trunk/MagicSoft/Cosy/catalog/StarCatalog.h
r1111 r1531 15 15 16 16 typedef unsigned char byte; 17 18 class MStarList; 17 19 18 20 class StarCatalog : public SlaStars … … 41 43 int fDecMax; 42 44 43 void DrawCross(byte *img, const int x, const int y);44 void DrawCircle(int color, byte *img, int xx, int yy, int size);45 static void DrawCross(byte *img, const int x, const int y); 46 static void DrawCircle(int color, byte *img, int xx, int yy, int size); 45 47 46 Bool_t DrawAltAz(const int color, byte *img, double alt, double az, int size=0) ;47 Bool_t DrawRaDec(const int color, byte *img, double ra, double dec, int size=0) ;48 Bool_t DrawAltAz(const int color, byte *img, double alt, double az, int size=0) const; 49 Bool_t DrawRaDec(const int color, byte *img, double ra, double dec, int size=0) const; 48 50 49 51 Bool_t Draw(const int color, byte *img, const AltAz &altaz); 50 52 Bool_t Draw(const int color, byte *img, const RaDec &radec); 51 Bool_t Draw(const int color, byte *img, const SaoFile *sao);52 53 53 void CalcImg(byte *); 54 //Bool_t Draw(const int color, byte *img, const SaoFile *sao); 55 //void CalcImg(byte *); 56 57 void CalcStars(MStarList &list) const; 58 59 static void DrawStars(MStarList &list, byte *img); 54 60 55 61 void SetRaDec(const RaDec &radec); 56 62 void SetAltAz(const AltAz &altaz); 57 void DrawSCAltAz(byte *img, const int color) ;58 void DrawSCRaDec(byte *img, const int color) ;63 void DrawSCAltAz(byte *img, const int color) const; 64 void DrawSCRaDec(byte *img, const int color) const; 59 65 60 66 void CalcRaDecRange(); … … 68 74 virtual ~StarCatalog(); 69 75 70 void GetImg(byte *img, byte *cimg, const double utc, 71 const RaDec &radec); 72 void GetImg(byte *img, byte *cimg, const double utc, 73 const AltAz &altaz); 76 void GetImg(byte *img, byte *cimg, MStarList &list) const; 77 void GetImg(byte *img, byte *cimg, const double utc, const RaDec &radec); 78 void GetImg(byte *img, byte *cimg, const double utc, const AltAz &altaz); 79 80 void GetStars(MStarList &list, const double utc, const RaDec &radec); 81 void GetStars(MStarList &list, const double utc, const AltAz &altaz); 74 82 75 83 const AltAz GetAltAz() const { return fAltAz*kRad2Deg; } … … 78 86 79 87 void SetPixSize(const double pixsize); 80 void SetLimitMag(const float mag) { fLimitMag = mag; }; 88 void SetLimitMag(const float mag) { fLimitMag = mag; } 89 90 AltAz CalcAltAzFromPix(Double_t pixx, Double_t pixy) const; 81 91 82 92 ClassDef(StarCatalog, 0)
Note:
See TracChangeset
for help on using the changeset viewer.