Changeset 1701 for trunk/MagicSoft/Cosy/gui/MGCosy.cc
- Timestamp:
- 01/10/03 15:38:47 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r1699 r1701 43 43 kPB_TRACK, 44 44 kPB_STOP, 45 kPB_HOME, 45 46 kPB_CALCALTAZ, 46 47 kPB_TPOINT, … … 98 99 99 100 l = new TGLabel(f, "Mjd:"); 100 l->Move(x-60, y+ 20);101 l->Move(x-60, y+17); 101 102 fList->Add(l); 102 103 … … 104 105 fMjd = new TGLabel(f, "00000.000000"); 105 106 fUtc->Move(x-25, y); 106 fMjd->Move(x-25, y+ 20);107 fMjd->Move(x-25, y+17); 107 108 fList->Add(fUtc); 108 109 fList->Add(fMjd); 109 110 110 111 l = new TGLabel(f, "SE-Az:"); 111 l->Move(x-60, y+ 60);112 l->Move(x-60, y+40); 112 113 fList->Add(l); 113 114 114 115 l = new TGLabel(f, "SE-Zd1:"); 115 l->Move(x-60, y+ 80);116 l->Move(x-60, y+57); 116 117 fList->Add(l); 117 118 118 119 l = new TGLabel(f, "SE-Zd2:"); 119 l->Move(x-60, y+ 100);120 l->Move(x-60, y+74); 120 121 fList->Add(l); 121 122 … … 127 128 fLabel1[1]->SetTextJustify(kTextRight); 128 129 fLabel1[2]->SetTextJustify(kTextRight); 129 fLabel1[0]->Move(x, y+ 60);130 fLabel1[1]->Move(x+43, y+ 60);131 fLabel1[2]->Move(x+70, y+ 60);130 fLabel1[0]->Move(x, y+40); 131 fLabel1[1]->Move(x+43, y+40); 132 fLabel1[2]->Move(x+70, y+40); 132 133 fList->Add(fLabel1[0]); 133 134 fList->Add(fLabel1[1]); … … 144 145 fLabel2[1]->SetTextJustify(kTextRight); 145 146 fLabel2[2]->SetTextJustify(kTextRight); 146 fLabel2[0]->Move(x, y+ 80);147 fLabel2[1]->Move(x+43, y+ 80);148 fLabel2[2]->Move(x+70, y+ 80);147 fLabel2[0]->Move(x, y+57); 148 fLabel2[1]->Move(x+43, y+57); 149 fLabel2[2]->Move(x+70, y+57); 149 150 fList->Add(fLabel2[0]); 150 151 fList->Add(fLabel2[1]); … … 161 162 fLabel3[1]->SetTextJustify(kTextRight); 162 163 fLabel3[2]->SetTextJustify(kTextRight); 163 fLabel3[0]->Move(x, y+ 100);164 fLabel3[1]->Move(x+43, y+ 100);165 fLabel3[2]->Move(x+70, y+ 100);164 fLabel3[0]->Move(x, y+74); 165 fLabel3[1]->Move(x+43, y+74); 166 fLabel3[2]->Move(x+70, y+74); 166 167 fList->Add(fLabel3[0]); 167 168 fList->Add(fLabel3[1]); … … 172 173 173 174 l = new TGLabel(f, "Offset-Zd:"); 174 l->Move(x-60, y+1 40);175 l->Move(x-60, y+102); 175 176 fList->Add(l); 176 177 177 178 l = new TGLabel(f, "Offset-Az:"); 178 l->Move(x-60, y+1 60);179 l->Move(x-60, y+119); 179 180 fList->Add(l); 180 181 … … 183 184 fOffsetZd->SetTextJustify(kTextRight); 184 185 fOffsetAz->SetTextJustify(kTextRight); 185 fOffsetZd->Move(x, y+1 40);186 fOffsetAz->Move(x, y+1 60);186 fOffsetZd->Move(x, y+102); 187 fOffsetAz->Move(x, y+119); 187 188 fList->Add(fOffsetZd); 188 189 fList->Add(fOffsetAz); 190 191 l = new TGLabel(f, "Ra (estimated):"); 192 l->Move(x-60, y+142); 193 fList->Add(l); 194 195 l = new TGLabel(f, "Ra (soll):"); 196 l->Move(x-60, y+159); 197 fList->Add(l); 198 199 l = new TGLabel(f, "Dec (estimated):"); 200 l->Move(x-60, y+182); 201 fList->Add(l); 202 203 l = new TGLabel(f, "Dec (soll):"); 204 l->Move(x-60, y+199); 205 fList->Add(l); 206 207 l = new TGLabel(f, "Zd (soll):"); 208 l->Move(x-60, y+222); 209 fList->Add(l); 210 211 l = new TGLabel(f, "Az (soll):"); 212 l->Move(x-60, y+239); 213 fList->Add(l); 214 215 fRaEst = new TGLabel(f, "+000h 00.0m"); 216 fDecEst = new TGLabel(f, "+000h 00.0m"); 217 fRaSoll = new TGLabel(f, "+000h 00.0m"); 218 fDecSoll = new TGLabel(f, "+000h 00.0m"); 219 fZdSoll = new TGLabel(f, "+000h 00.0m"); 220 fAzSoll = new TGLabel(f, "+000h 00.0m"); 221 fRaEst->SetTextJustify(kTextRight); 222 fDecEst->SetTextJustify(kTextRight); 223 fRaSoll->SetTextJustify(kTextRight); 224 fDecSoll->SetTextJustify(kTextRight); 225 fZdSoll->SetTextJustify(kTextRight); 226 fAzSoll->SetTextJustify(kTextRight); 227 fRaEst->Move(x+30, y+142); 228 fRaSoll->Move(x+30, y+159); 229 fDecEst->Move(x+30, y+182); 230 fDecSoll->Move(x+30, y+199); 231 fZdSoll->Move(x+30, y+222); 232 fAzSoll->Move(x+30, y+239); 233 fList->Add(fRaEst); 234 fList->Add(fDecEst); 235 fList->Add(fRaSoll); 236 fList->Add(fDecSoll); 237 fList->Add(fZdSoll); 238 fList->Add(fAzSoll); 189 239 190 240 … … 329 379 fList->Add(but); 330 380 381 but = new TGTextButton(tf1, "Home", kPB_HOME); 382 but->Resize(80, 25); 383 but->Move(160, 197); 384 but->SetToolTipText("Initiate Home Drive."); 385 but->Associate(this); 386 fList->Add(but); 387 331 388 but= new TGTextButton(tf2, "Calc Zd/Az", kPB_CALCALTAZ); 332 389 but->Resize(80, 25); … … 637 694 } 638 695 696 void MGCosy::UpdateRaDec(ZdAz &pos, double mjd, RaDec &radec) 697 { 698 static Int_t rai=~0; 699 static Int_t deci=~0; 700 static Int_t ras=~0; 701 static Int_t decs=~0; 702 703 static SlaStars sla; 704 sla.SetMjd(mjd); 705 706 RaDec rd = sla.CalcRaDec(pos*2*TMath::Pi()/360); 707 708 char text[64]; 709 710 rd.Ra(rd.Ra() * 24/2/TMath::Pi()); 711 rd.Dec(rd.Dec()*360/2/TMath::Pi()); 712 713 radec.Ra(radec.Ra() * 24/2/TMath::Pi()); 714 radec.Dec(radec.Dec()*360/2/TMath::Pi()); 715 716 RaDec test = rd*600; 717 718 if (rai!=(int)test.Ra()) 719 { 720 rai = (int)test.Ra(); 721 sprintf(text, "%c%dh %.1fm", rd.Ra()<0?'-':'+', abs((int)rd.Ra()), 0.1*(abs((int)test.Ra())%600)); 722 fRaEst->SetText(new TGString(text)); 723 } 724 if (deci!=(int)test.Dec()) 725 { 726 deci = (int)test.Dec(); 727 sprintf(text, "%c%dd %.1fm", rd.Dec()<0?'-':'+' , abs((int)rd.Dec()), 0.1*(abs((int)test.Dec())%600)); 728 fDecEst->SetText(new TGString(text)); 729 } 730 731 if (radec.Dec()>90|| radec.Dec()<-90) 732 { 733 radec.Ra(radec.Ra()+12); 734 radec.Dec(180-radec.Dec()); 735 } 736 radec.Ra(fmod((radec.Ra()+48), 24)); 737 738 test = radec*600; 739 740 if (ras!=(int)test.Ra()) 741 { 742 ras = (int)test.Ra(); 743 sprintf(text, "%c%dh %.1fm", radec.Ra()<0?'-':'+', abs((int)radec.Ra()), 0.1*(abs((int)test.Ra())%600)); 744 fRaSoll->SetText(new TGString(text)); 745 } 746 if (decs!=(int)test.Dec()) 747 { 748 decs = (int)test.Dec(); 749 sprintf(text, "%c%dd %.1fm", radec.Dec()<0?'-':'+' , abs((int)radec.Dec()), 0.1*(abs((int)test.Dec())%600)); 750 fDecSoll->SetText(new TGString(text)); 751 } 752 } 753 639 754 void MGCosy::UpdateOffset(ZdAz &off) 640 755 { … … 647 762 { 648 763 zd = (Int_t)off.Zd(); 649 sprintf(text, "%d ", zd);764 sprintf(text, "%dre", zd); 650 765 fOffsetZd->SetText(new TGString(text)); 651 766 } … … 653 768 { 654 769 az = (Int_t)off.Az(); 655 sprintf(text, "%d ", az);770 sprintf(text, "%dre", az); 656 771 fOffsetAz->SetText(new TGString(text)); 657 772 } 658 773 } 659 774 775 void MGCosy::UpdateZdAz(ZdAz &soll) 776 { 777 soll *= 360/2/TMath::Pi(); 778 779 static Int_t zd=~0; 780 static Int_t az=~0; 781 782 char text[21]; 783 784 ZdAz test = soll*600; 785 786 if (zd!=(int)test.Zd()) 787 { 788 zd = (int)test.Zd(); 789 sprintf(text, "%c%dh %.1fm", soll.Zd()<0?'-':'+', abs((int)soll.Zd()), 0.1*(abs((int)test.Zd())%600)); 790 fZdSoll->SetText(new TGString(text)); 791 } 792 if (az!=(int)test.Az()) 793 { 794 az = (int)test.Az(); 795 sprintf(text, "%c%dd %.1fm", soll.Az()<0?'-':'+' , abs((int)soll.Az()), 0.1*(abs((int)test.Az())%600)); 796 fAzSoll->SetText(new TGString(text)); 797 } 798 } 799 660 800 double MGCosy::UpdateTime() 661 801 { … … 682 822 } 683 823 684 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat) 824 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec, 825 ZdAz soll, UInt_t stat) 685 826 { 686 827 double mjd = UpdateTime(); … … 689 830 fVelocity->Update(vel); 690 831 UpdateOffset(off); 832 UpdateRaDec(pos, mjd, radec); 833 UpdateZdAz(soll); 691 834 692 835 #define kError 0x01 … … 701 844 EnableLabel(fStopping, stat&kStopping); 702 845 EnableLabel(fStopped, stat&kStopped); 846 EnableLabel(fRaSoll, stat&kTracking); 847 EnableLabel(fDecSoll, stat&kTracking); 848 EnableLabel(fZdSoll, stat&kMoving); 849 EnableLabel(fAzSoll, stat&kMoving); 703 850 704 851 stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow(); … … 706 853 // stat&kTracking ? fOffset->MapWindow() : fOffset->UnmapWindow(); 707 854 708 if ( !fLog->TestBit(kHasChanged))709 return;710 711 fLog->MapSubwindows();712 fLog->Layout();713 fLog->ResetBit(kHasChanged);855 if (fLog->TestBit(kHasChanged)) 856 { 857 fLog->MapSubwindows(); 858 fLog->Layout(); 859 fLog->ResetBit(kHasChanged); 860 } 714 861 } 715 862 // ====================================================================== … … 919 1066 StopDemo(); 920 1067 fQueue->PostMsg(WM_STOP, 0, 0); 921 922 1068 cout << "PostMsg (WM_Stop) returned." << endl; 923 1069 return kTRUE; … … 972 1118 fQueue->Proc(WM_RESETBENDING, NULL); 973 1119 return kTRUE; 1120 case kPB_HOME: 1121 fQueue->PostMsg(WM_HOME, 0, 0); 1122 return kTRUE; 974 1123 975 1124 default:
Note:
See TracChangeset
for help on using the changeset viewer.