Changeset 2278 for trunk/MagicSoft/Cosy/gui/MGCosy.cc
- Timestamp:
- 07/15/03 15:05:21 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r2069 r2278 55 55 kPB_DECp, 56 56 kPB_DECm, 57 kPB_ZDp, 58 kPB_ZDm, 59 kPB_AZp, 60 kPB_AZm, 57 61 kPB_LoadBending, 58 62 kPB_ResetBending, 59 63 kPB_CALIBSE, 60 64 kCB_PredefPos, 65 kCB_StarList, 61 66 62 67 // kLog … … 85 90 TGPopupMenu *logmenu = new TGPopupMenu(gClient->GetRoot()); 86 91 logmenu->AddEntry("&Copy Selected", kLogCopy); 87 logmenu->AddEntry(" Clear all", kLogClear);92 logmenu->AddEntry("&Select All", kLogSelect); 88 93 logmenu->AddSeparator(); 89 logmenu->AddEntry(" Select All", kLogSelect);94 logmenu->AddEntry("Clear &all", kLogClear); 90 95 /* 91 96 logmenu->AddSeparator(); … … 93 98 */ 94 99 logmenu->AddSeparator(); 95 logmenu->AddEntry("Sa ve",kLogSave);96 logmenu->AddEntry("Save a ppend",kLogAppend);100 logmenu->AddEntry("Sa&ve", kLogSave); 101 logmenu->AddEntry("Save a&ppend", kLogAppend); 97 102 logmenu->Associate(this); 98 103 … … 160 165 fList->Add(fLabel2); 161 166 fList->Add(fLabel3); 162 167 /* 163 168 l = new TGLabel(f, "Offset-Zd:"); 164 169 l->Move(x-60, y+102); … … 177 182 fList->Add(fOffsetZd); 178 183 fList->Add(fOffsetAz); 179 184 */ 180 185 l = new TGLabel(f, "Ra (estimated):"); 181 l->Move(x-60, y+142 );186 l->Move(x-60, y+142-20); 182 187 fList->Add(l); 183 188 184 189 l = new TGLabel(f, "Ra (nominal):"); 185 l->Move(x-60, y+159 );190 l->Move(x-60, y+159-20); 186 191 fList->Add(l); 187 192 188 193 l = new TGLabel(f, "Dec (estimated):"); 189 l->Move(x-60, y+182 );194 l->Move(x-60, y+182-20); 190 195 fList->Add(l); 191 196 192 197 l = new TGLabel(f, "Dec (nominal):"); 193 l->Move(x-60, y+199 );198 l->Move(x-60, y+199-20); 194 199 fList->Add(l); 195 200 … … 214 219 fZdSoll->SetTextJustify(kTextRight); 215 220 fAzSoll->SetTextJustify(kTextRight); 216 fRaEst->Move(x+30, y+142 );217 fRaSoll->Move(x+30, y+159 );218 fDecEst->Move(x+30, y+182 );219 fDecSoll->Move(x+30, y+199 );221 fRaEst->Move(x+30, y+142-20); 222 fRaSoll->Move(x+30, y+159-20); 223 fDecEst->Move(x+30, y+182-20); 224 fDecSoll->Move(x+30, y+199-20); 220 225 fZdSoll->Move(x+30, y+222); 221 226 fAzSoll->Move(x+30, y+239); … … 311 316 if (!fin) 312 317 { 313 cout << "ERROR: Predifined posi ionin 'prepos.txt' not found." << endl;318 cout << "ERROR: Predifined positions in 'prepos.txt' not found." << endl; 314 319 return; 315 320 } … … 329 334 } 330 335 331 void MGCosy::CreateTabs(TGTab *fTab) 336 void MGCosy::CreateStarList(TGCompositeFrame *tf1) 337 { 338 /* 339 TGComboBox *box = new TGComboBox(tf1, kCB_StarList); 340 box->Resize(120, 20); 341 box->Associate(this); 342 343 TGLayoutHints *lay = new TGLayoutHints(kLHintsLeft|kLHintsTop, 344 27, 0, 200, 0); 345 tf1->AddFrame(box, lay); 346 347 fList->Add(box); 348 fList->Add(lay); 349 350 ifstream fin("stars.txt"); 351 if (!fin) 352 { 353 cout << "ERROR: Star List 'stars.txt' not found." << endl; 354 return; 355 } 356 357 int i=0; 358 while (1) 359 { 360 TString str; 361 Int_t h, m, s, d, am, as; 362 fin >> h >> m >> s >> d >> am >> as; 363 if (!fin) 364 break; 365 366 box->AddEntry(str, i++); 367 368 fStarList.Add(zd, az); 369 } 370 */ 371 } 372 373 void MGCosy::CreateTabs() 332 374 { 333 375 TGCompositeFrame *tf1 = fTab->AddTab("Position"); 334 376 TGCompositeFrame *tf2 = fTab->AddTab("Track"); 377 TGCompositeFrame *tf4 = fTab->AddTab("Calib"); 335 378 #ifdef EXPERT 336 TGCompositeFrame *tf4 = fTab->AddTab("Calib");337 379 TGCompositeFrame *tf5 = fTab->AddTab("Test SE"); 338 380 TGCompositeFrame *tf6 = fTab->AddTab("Gear"); … … 345 387 346 388 CreatePredefinedPos(tf1); 389 CreateStarList(tf4); 347 390 348 391 fCRaDec = new MGCoordinates(tf2, kETypeRaDec); … … 350 393 fList->Add(fCRaDec); 351 394 352 #ifdef EXPERT353 395 fCCalib = new MGCoordinates(tf4, kETypeRaDec); 354 396 fCCalib->Move(27, 105); 355 397 fList->Add(fCCalib); 356 #endif357 398 358 399 const int x=15; … … 386 427 fList->Add(l3); 387 428 388 #ifdef EXPERT389 429 l1 = new TGLabel(tf4, "Start the calibration using the Start button."); 390 430 l2 = new TGLabel(tf4, "Write a coordinate pair to a TPoint file using"); … … 401 441 fList->Add(l4); 402 442 443 #ifdef EXPERT 403 444 l1 = new TGLabel(tf5, "START starts histograming the differences of"); 404 445 l2 = new TGLabel(tf5, "the two shaftencoders at the elevation axis."); … … 495 536 fList->Add(but); 496 537 */ 538 #ifdef EXPERT 497 539 but = new TGTextButton(tf4, "Load", kPB_LoadBending); 498 but->Resize( 80, 25);499 but->Move( 25, 190);540 but->Resize(50, 25); 541 but->Move(151, 185); 500 542 but->SetToolTipText("Load bending corrections from file 'bending.txt'"); 501 543 but->Associate(this); … … 503 545 504 546 but = new TGTextButton(tf4, "Reset", kPB_ResetBending); 505 but->Resize( 80, 25);506 but->Move(2 5, 220);547 but->Resize(50, 25); 548 but->Move(206, 185); 507 549 but->SetToolTipText("Reset bending correction (coefficients=0)"); 508 550 but->Associate(this); 509 551 fList->Add(but); 552 #endif EXPERT 510 553 511 554 but = new TGTextButton(tf4, "TPoint", kPB_TPOINT); 512 but->Resize( 80, 25);513 but->Move( 25, 250);555 but->Resize(50, 25); 556 but->Move(176/*231*/, 213); 514 557 but->SetToolTipText("Trigger writing a tpoint coordinate pair."); 558 but->Associate(this); 559 fList->Add(but); 560 561 but= new TGTextButton(tf4, "Zd -", kPB_ZDm); 562 but->Resize(50, 25); 563 but->Move(25, 210); 564 but->SetToolTipText("Zenith Distance -= 1SE"); 565 but->Associate(this); 566 fList->Add(but); 567 but= new TGTextButton(tf4, "Zd +", kPB_ZDp); 568 but->Resize(50, 25); 569 but->Move(90, 210); 570 but->SetToolTipText("Zenith Distance += 1SE"); 571 but->Associate(this); 572 fList->Add(but); 573 but= new TGTextButton(tf4, "Az +", kPB_AZp); 574 but->Resize(50, 25); 575 but->Move(55, 185); 576 but->SetToolTipText("Azimuth += 1SE"); 577 but->Associate(this); 578 fList->Add(but); 579 but= new TGTextButton(tf4, "Az -", kPB_AZm); 580 but->Resize(50, 25); 581 but->Move(55, 235); 582 but->SetToolTipText("Azimuth -= 1SE"); 515 583 but->Associate(this); 516 584 fList->Add(but); … … 728 796 AddFrame(f2, hints2); 729 797 730 //731 // FIXME!732 //733 798 #ifdef DEBUG 734 799 cout << "MGCosy: Creating Tabs" << endl; 735 800 #endif 736 CreateTabs( fTab);801 CreateTabs(); 737 802 #ifdef DEBUG 738 803 cout << "MGCosy: Creating Label" << endl; … … 871 936 } 872 937 } 873 938 /* 874 939 void MGCosy::UpdateOffset(ZdAz &off) 875 940 { … … 892 957 } 893 958 } 894 959 */ 895 960 void MGCosy::UpdateZdAz(ZdAz &soll) 896 961 { … … 954 1019 } 955 1020 956 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off,RaDec radec,1021 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, /*ZdAz off,*/ RaDec radec, 957 1022 ZdAz soll, UInt_t stat, UInt_t stat2) 958 1023 { … … 962 1027 double mjd = UpdateTime(); 963 1028 fSkyPosition->Update(pos, mjd); 964 fAccuracy->Update(pos, acc); 965 fVelocity->Update(vel); 966 UpdateOffset(off); 1029 //UpdateOffset(off); 967 1030 UpdateRaDec(pos, mjd, radec); 968 1031 UpdateZdAz(soll); … … 991 1054 SetLabelColor(fAvailSe3, stat2&0x20); 992 1055 993 stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow(); 994 stat&kTracking ? fVelocity->MapWindow() : fVelocity->UnmapWindow(); 1056 if (stat&kTracking) 1057 { 1058 fAccuracy->Update(pos, acc); 1059 fVelocity->Update(vel); 1060 fAccuracy->MapWindow(); 1061 fVelocity->MapWindow(); 1062 } 1063 else 1064 { 1065 fAccuracy->UnmapWindow(); 1066 fVelocity->UnmapWindow(); 1067 } 995 1068 // stat&kTracking ? fOffset->MapWindow() : fOffset->UnmapWindow(); 996 1069 … … 1022 1095 } 1023 1096 1024 void MGCosy::StartTrack( )1097 void MGCosy::StartTrack(bool track) 1025 1098 { 1026 1099 cout << "Start tracking." << endl; 1027 1100 1028 XY xy = fCRaDec->GetCoordinates(); 1029 RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø] 1030 1031 cout << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl; 1101 XY xy0 = fCRaDec->GetCoordinates(); 1102 XY xy1 = track ? xy0 : fCCalib->GetCoordinates(); 1103 1104 RaDec dest0(xy0.X()*15., xy0.Y()); // xy.X() [h]->[ø] 1105 RaDec dest1(xy1.X()*15., xy1.Y()); // xy.X() [h]->[ø] 1106 1107 cout << "TrackPos: " << dest0.Ra() << "h " << dest0.Dec() << "\xb0" << endl; 1108 cout << "CalibPos: " << dest1.Ra() << "h " << dest1.Dec() << "\xb0" << endl; 1109 1110 RaDec dest[2] = { dest0, dest1 }; 1032 1111 1033 1112 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest)); … … 1036 1115 } 1037 1116 1038 void MGCosy::StartTrackPos( )1117 void MGCosy::StartTrackPos(Long_t mp1) 1039 1118 { 1040 1119 cout << "Start tracking Zd/Az pos." << endl; … … 1043 1122 1044 1123 ZdAz za(xy.X(), xy.Y()); 1124 1125 switch (mp1) 1126 { 1127 case kPB_ZDm: 1128 za.Zd(za.Zd()-360/16384.); 1129 break; 1130 case kPB_ZDp: 1131 za.Zd(za.Zd()+360/16384.); 1132 break; 1133 case kPB_AZm: 1134 za.Az(za.Az()-360/16384.); 1135 break; 1136 case kPB_AZp: 1137 za.Az(za.Az()+360/16384.); 1138 break; 1139 } 1045 1140 1046 1141 cout << za.Zd() << "\xb0 " << za.Az() << "\xb0" << endl; … … 1203 1298 return kTRUE; 1204 1299 case 1: 1205 StartTrack( );1300 StartTrack(true); 1206 1301 return kTRUE; 1207 1302 case 2: 1208 1303 fCRaDec->SetCoordinates(fCCalib->GetCoordinates()); 1304 StartTrack(false); 1209 1305 return kTRUE; 1210 1306 case 3: … … 1261 1357 break; 1262 1358 } 1263 RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø]1264 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));1265 //fQueue->Proc(WM_NEWTRACK, &dest);1266 1359 fCRaDec->SetCoordinates(xy); 1267 1268 cout << "New Ra/Dec: " << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl; 1360 StartTrack(false); 1361 /* 1362 RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø] 1363 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest)); 1364 //fQueue->Proc(WM_NEWTRACK, &dest); 1365 */ 1366 //cout << "New Ra/Dec: " << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl; 1269 1367 } 1368 return kTRUE; 1369 1370 case kPB_ZDp: 1371 case kPB_ZDm: 1372 case kPB_AZp: 1373 case kPB_AZm: 1374 StartTrackPos(mp1); 1270 1375 return kTRUE; 1271 1376
Note:
See TracChangeset
for help on using the changeset viewer.