Changeset 921 for trunk/MagicSoft/Cosy/gui/MGCosy.cc
- Timestamp:
- 08/30/01 16:02:20 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r920 r921 191 191 } 192 192 193 void MGCosy::CreateButton(TGCompositeFrame *tf1, TGCompositeFrame *tf2) 194 { 193 void MGCosy::CreateTabs(TGTab *fTab) 194 { 195 TGCompositeFrame *tf1 = fTab->AddTab("Position Zd/Az"); 196 TGCompositeFrame *tf2 = fTab->AddTab("Track Ra/Dec"); 197 198 fCZdAz = new MGCoordinates(tf1, kETypeZdAz); 199 fCZdAz->Move(27, 105); 200 fList->Add(fCZdAz); 201 202 fCRaDec = new MGCoordinates(tf2, kETypeRaDec); 203 fCRaDec->Move(27, 105); 204 fList->Add(fCRaDec); 205 206 195 207 const int x=15; 196 208 const int y=12; … … 235 247 // red: 164, 192, 224, 232 236 248 // 237 238 // TGTextButton *fButton1 = new TGTextButton(this, "Position Zd/Az", kPB_POSITION); 239 // TGTextButton *fButton2 = new TGTextButton(this, "Track Ra/Dec", kPB_TRACK); 240 TGTextButton *fButton4 = new TGTextButton(this, "Calc Zd/Az", kPB_CALCALTAZ); 241 TGTextButton *fButton5 = new TGTextButton(this, "Set Polaris", kPB_POLARIS); 242 // fButton1->Move(120, 40); 243 // fButton2->Move(120, 65); 244 fButton4->Resize(80, 25); 245 fButton5->Resize(80, 25); 246 247 fButton4->Move(40, 257); 248 fButton5->Move(40, 288); 249 //fButton4->SetBackgroundColor(12); 250 //fButton5->SetBackgroundColor(16); 251 // fButton1->SetToolTipText("Move Telescope to Zd/Az position."); 252 // fButton2->SetToolTipText("Track the coordinates given in Ra/Dec."); 253 fButton4->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec."); 254 fButton5->SetToolTipText("Set the actual position as the position of Polaris."); 255 // fList->Add(fButton1); 256 // fList->Add(fButton2); 257 fList->Add(fButton4); 258 fList->Add(fButton5); 259 260 TGTextButton *fStart = new TGTextButton(this, "Start", kPB_START); 261 TGTextButton *fStop = new TGTextButton(this, "Stop", kPB_STOP); 262 fStart->SetBackgroundColor(20); 263 fStop ->SetBackgroundColor(224); 264 fStart->Move(147, 275); 265 fStop ->Move(212, 275); 266 fStart->Resize(60, 25); 267 fStop ->Resize(60, 25); 268 fStart->SetToolTipText("Start a telescope movement."); 269 fStop ->SetToolTipText("Stop any movement of telescope."); 270 fList->Add(fStart); 271 fList->Add(fStop); 249 TGTextButton *but; 250 251 but= new TGTextButton(this, "Calc Zd/Az", kPB_CALCALTAZ); 252 but->Resize(80, 25); 253 but->Move(37, 257); 254 but->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec."); 255 fList->Add(but); 256 257 but = new TGTextButton(this, "Set Polaris", kPB_POLARIS); 258 but->Resize(80, 25); 259 but->Move(37, 288); 260 but->SetToolTipText("Set the actual position as the position of Polaris."); 261 fList->Add(but); 262 263 but = new TGTextButton(this, "Start", kPB_START); 264 but->SetBackgroundColor(20); 265 but->Move(147, 275); 266 but->Resize(62, 25); 267 but->SetToolTipText("Start a telescope movement."); 268 fList->Add(but); 269 270 but = new TGTextButton(this, "Stop", kPB_STOP); 271 but->SetBackgroundColor(224); 272 but->Move(212, 275); 273 but->Resize(62, 25); 274 but->SetToolTipText("Stop any movement of telescope."); 275 fList->Add(but); 276 272 277 } 273 278 … … 284 289 285 290 fTab = new TGTab(f, 300, 300); 286 TGCompositeFrame *tf1 = fTab->AddTab("Position Zd/Az");287 TGCompositeFrame *tf2 = fTab->AddTab("Track Ra/Dec");288 291 fList->Add(fTab); 289 292 290 293 fSkyPosition = new MGSkyPosition(f, 300); 291 294 fAccuracy = new MGAccuracy (f, 300); 292 fVelocity = new MGVelocity (f, "Velocity [ '/min]", 300);295 fVelocity = new MGVelocity (f, "Velocity [\"/min]", 300); 293 296 // fOffset = new MGVelocity (f, "Offset se-re [']", 300); 294 297 … … 304 307 fLog = new TGListBox(f, -1, kSunkenFrame); //kSunkenFrame|kDoubleBorder, 305 308 fLog->Resize(300, 300); 309 fLog->ChangeBackground(TGFrame::GetBlackPixel()); 306 310 fList->Add(fLog); 307 311 … … 321 325 // FIXME! 322 326 // 323 fCoord = new MGCoordinates(this, kTRUE, 324 "Coordinate 1 [\xb0]:", "Coordinate 2 [\xb0]:"); 325 fCoord->Move(40, 165); 326 fList->Add(fCoord); 327 328 CreateButton(tf1, tf2); 327 CreateTabs(fTab); 329 328 CreateLabel(frame); 330 329 … … 384 383 { 385 384 zd = (Int_t)off.Zd(); 386 sprintf(text, "% ld", zd);385 sprintf(text, "%d", zd); 387 386 fOffsetZd->SetText(new TGString(text)); 388 387 } … … 390 389 { 391 390 az = (Int_t)off.Az(); 392 sprintf(text, "% ld", az);391 sprintf(text, "%d", az); 393 392 fOffsetAz->SetText(new TGString(text)); 394 393 } … … 442 441 } 443 442 444 void MGCosy::Start(UInt_t id) 445 { 446 cout << "Start " << (id?"tracking.":"positioning.") << endl; 447 448 XY xy = fCoord->GetCoordinates(); 449 450 if (id) 451 { 452 RaDec dest(xy.X(), xy.Y()); 453 cout << dest.Ra() << kDEG << " " << dest.Dec() << kDEG << endl; 454 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest)); 455 } 456 else 457 { 458 ZdAz dest(xy.X(), xy.Y()); 459 cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl; 460 fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest)); 461 } 462 463 cout << "PostMsg (" << (id?"WM_Track":"WM_Position") << ") returned." << endl; 443 void MGCosy::StartTrack() 444 { 445 cout << "Start tracking." << endl; 446 447 XY xy = fCRaDec->GetCoordinates(); 448 RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø] 449 450 cout << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl; 451 452 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest)); 453 454 cout << "PostMsg (WM_Track) returned." << endl; 455 } 456 457 void MGCosy::StartPos() 458 { 459 cout << "Start positioning." << endl; 460 461 XY xy = fCZdAz->GetCoordinates(); 462 ZdAz dest(xy.X(), xy.Y()); 463 464 cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl; 465 466 fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest)); 467 468 cout << "PostMsg (WM_Position) returned." << endl; 464 469 } 465 470 … … 482 487 switch (mp1) 483 488 { 489 /* 484 490 case kPB_POSITION: 485 491 Start(0); … … 489 495 Start(1); 490 496 return kTRUE; 491 497 */ 492 498 case kPB_START: 493 Start(fTab->GetCurrent());499 fTab->GetCurrent() ? StartTrack() : StartPos(); 494 500 return kTRUE; 495 501 … … 505 511 sla.SetMjd2Now(); 506 512 507 XY xy = fC oord->GetCoordinates();508 RaDec rd(xy.X() , xy.Y());513 XY xy = fCRaDec->GetCoordinates(); 514 RaDec rd(xy.X()*15., xy.Y()); 509 515 510 516 cout << "Ra/Dec: " << rd.Ra() << kDEG << " " << rd.Dec() << kDEG << endl;
Note:
See TracChangeset
for help on using the changeset viewer.