Changeset 921 for trunk/MagicSoft/Cosy/gui
- Timestamp:
- 08/30/01 16:02:20 (23 years ago)
- Location:
- trunk/MagicSoft/Cosy/gui
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
r920 r921 190 190 aaz *= d2r; 191 191 192 const float dphi2 = aaz/2.; 193 const float cos2 = cos(dphi2)*cos(dphi2); 194 const float sin2 = sin(dphi2)*sin(dphi2); 195 196 float dist = acos(cos(azd)*cos2 - cos(2*pzd+azd)*sin2); 192 const double dphi2 = aaz/2.; 193 const double cos2 = cos(dphi2)*cos(dphi2); 194 const double sin2 = sin(dphi2)*sin(dphi2); 195 const double d = cos(azd)*cos2 - cos(2*pzd+azd)*sin2; 196 197 double dist = acos(d); 197 198 198 199 dist *= 3600./d2r; -
trunk/MagicSoft/Cosy/gui/MGCoordinate.cc
r918 r921 23 23 }; 24 24 25 MGCoordinate::MGCoordinate(const TGWindow* p, 25 MGCoordinate::MGCoordinate(const TGWindow* p, const Int_t type=kETypeDeg, 26 26 const Bool_t flag, const char *txt, 27 27 const Int_t deg, const UInt_t min, const UInt_t sec) 28 : TGFrame(p, 11 4, flag?76:46, kSunkenFrame|kFixedSize), fDeg(deg), fMin(min), fSec(sec)28 : TGFrame(p, 119, flag?76:46, kSunkenFrame|kFixedSize), fDeg(deg), fMin(min), fSec(sec) 29 29 { 30 30 // p = pointer to MainFrame (not owner) … … 37 37 // fTextEntryMin->SetAlignment(kTextCenterX); 38 38 // fTextEntrySec->SetAlignment(kTextCenterX); 39 fTextEntryDeg->Move( 4, 26);40 fTextEntryMin->Move(4 4, 26);41 fTextEntrySec->Move( 78, 26);39 fTextEntryDeg->Move( 7, 26); 40 fTextEntryMin->Move(47, 26); 41 fTextEntrySec->Move(81, 26); 42 42 fTextEntryDeg->MapWindow(); 43 43 fTextEntryMin->MapWindow(); … … 60 60 fLabelMin->SetTextJustify(kTextRight); 61 61 fLabelSec->SetTextJustify(kTextRight); 62 fLabelDeg->Move( 4+6, ypos);63 fLabelMin->Move( 44+6, ypos);64 fLabelSec->Move( 78+6, ypos);62 fLabelDeg->Move(13, ypos); 63 fLabelMin->Move(53, ypos); 64 fLabelSec->Move(87, ypos); 65 65 fLabelDeg->MapWindow(); 66 66 fLabelMin->MapWindow(); … … 82 82 TGLabel *label; 83 83 84 const char *deg = type==kETypeDeg ? "\xb0" : "h"; 85 const char *min = type==kETypeDeg ? "'" : "m"; 86 const char *sec = type==kETypeDeg ? "\"" : "s"; 87 84 88 if (flag) 85 89 { 86 label = new TGLabel(this, "\xb0");90 label = new TGLabel(this, deg); 87 91 label->SetTextJustify(kTextLeft); 88 label->Move(3 6, 26);92 label->Move(39, 26); 89 93 label->MapWindow(); 90 94 fList.Add(label); 91 95 92 label = new TGLabel(this, "'");96 label = new TGLabel(this, min); 93 97 label->SetTextJustify(kTextLeft); 94 label->Move(7 0, 26);98 label->Move(73, 26); 95 99 label->MapWindow(); 96 100 fList.Add(label); 97 101 98 label = new TGLabel(this, "\"");102 label = new TGLabel(this, sec); 99 103 label->SetTextJustify(kTextLeft); 100 label->Move(10 4, 26);104 label->Move(107, 26); 101 105 label->MapWindow(); 102 106 fList.Add(label); 103 107 } 104 108 105 label = new TGLabel(this, "\xb0");109 label = new TGLabel(this, deg); 106 110 label->SetTextJustify(kTextLeft); 107 label->Move(3 6, ypos);111 label->Move(39, ypos); 108 112 label->MapWindow(); 109 113 fList.Add(label); 110 114 111 label = new TGLabel(this, "'");115 label = new TGLabel(this, min); 112 116 label->SetTextJustify(kTextLeft); 113 label->Move(7 0, ypos);117 label->Move(73, ypos); 114 118 label->MapWindow(); 115 119 fList.Add(label); 116 120 117 label = new TGLabel(this, "\"");121 label = new TGLabel(this, sec); 118 122 label->SetTextJustify(kTextLeft); 119 label->Move(10 4, ypos);123 label->Move(107, ypos); 120 124 label->MapWindow(); 121 125 fList.Add(label); -
trunk/MagicSoft/Cosy/gui/MGCoordinate.h
r808 r921 14 14 #include "MGList.h" 15 15 #endif 16 17 enum { 18 kETypeDeg, 19 kETypeH 20 }; 16 21 17 22 class TGLabel; … … 41 46 42 47 public: 43 MGCoordinate(const TGWindow* p, 48 MGCoordinate(const TGWindow* p, const Int_t type=kETypeDeg, 44 49 const Bool_t flag=kTRUE, const char *txt="Coordinates:", 45 50 const Int_t deg=0, const UInt_t min=0, const UInt_t sec=0); -
trunk/MagicSoft/Cosy/gui/MGCoordinates.cc
r808 r921 12 12 13 13 MGCoordinates::MGCoordinates(const TGWindow* p, 14 const Int_t type, 14 15 const Bool_t flag, 15 const char *txt1, const char *txt2,16 16 const Int_t deg1, const UInt_t min1, const UInt_t sec1, 17 17 const Int_t deg2, const UInt_t min2, const UInt_t sec2) 18 : TGFrame(p, 2 34, 76, kFixedSize)18 : TGFrame(p, 244, 76, kFixedSize) 19 19 { 20 const Int_t t = type==kETypeZdAz ? kETypeDeg : kETypeH; 21 const char *txt1 = type==kETypeZdAz ? "Zenith Dist [\xb0]:" : "Right Ascension [h]:"; 22 const char *txt2 = type==kETypeZdAz ? "Azimuth [\xb0]:" : "Declination [\xb0]:"; 23 20 24 // p = pointer to MainFrame (not owner) 21 fX = new MGCoordinate(this, flag, txt1, deg1, min1, sec1);25 fX = new MGCoordinate(this, t, flag, txt1, deg1, min1, sec1); 22 26 fX->Move(0, 0); 23 27 24 fY = new MGCoordinate(this, flag, txt2, deg2, min2, sec2);25 fY->Move(12 0, 0);28 fY = new MGCoordinate(this, kETypeDeg, flag, txt2, deg2, min2, sec2); 29 fY->Move(125, 0); 26 30 27 31 MapWindow(); -
trunk/MagicSoft/Cosy/gui/MGCoordinates.h
r808 r921 15 15 #endif 16 16 17 enum { 18 kETypeZdAz, 19 kETypeRaDec 20 }; 21 17 22 class MGCoordinate; 18 23 … … 23 28 24 29 public: 25 MGCoordinates(const TGWindow* p, 30 MGCoordinates(const TGWindow* p, const Int_t type=kETypeZdAz, 26 31 const Bool_t flag=kTRUE, 27 const char *txt1="Coordinate1:",28 const char *txt2="Coordinate2:",29 32 const Int_t deg1=0, const UInt_t min1=0, const UInt_t sec1=0, 30 33 const Int_t deg2=0, const UInt_t min2=0, const UInt_t sec2=0); -
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; -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r920 r921 54 54 TGLabel *fOffsetAz; 55 55 56 MGCoordinates *fCoord; 56 MGCoordinates *fCZdAz; 57 MGCoordinates *fCRaDec; 58 57 59 MGSkyPosition *fSkyPosition; 58 60 MGAccuracy *fAccuracy; … … 74 76 void CreateMenu(); 75 77 void CreateLabel(TGCompositeFrame *f); 76 void Create Button(TGCompositeFrame *tf1, TGCompositeFrame *tf2);78 void CreateTabs(TGTab *fTab); 77 79 78 void Start(UInt_t id); 80 void StartPos(); 81 void StartTrack(); 79 82 80 83 void EnableLabel(TGLabel *label, Bool_t stat); -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r920 r921 259 259 Y = fy; 260 260 261 float /*int*/ xm = /*(int)floor*/(fmod(fabs(x), 60.));262 float /*int*/ ym = /*(int)floor*/(fmod(fabs(y), 60.));261 float xm = fmod(fabs(x), 60.); 262 float ym = fmod(fabs(y), 60.); 263 263 264 264 char txt[100]; -
trunk/MagicSoft/Cosy/gui/MGVelocity.cc
r918 r921 167 167 fText->Draw(); 168 168 fList->Add(fText); 169 170 fTextVel = new TText(2*70, 2*70, ""); 171 fTextVel->SetTextAlign(33); // right, top 172 fTextVel->SetTextColor(10); // white 173 fTextVel->Draw(); 174 fList->Add(fTextVel); 169 175 } 170 176 … … 198 204 sprintf(txt, "x%.0f", 1./fScale); 199 205 200 fText->SetText(fText->GetX() /*70*2*/, fText->GetY()/*70*2*/, txt);206 fText->SetText(fText->GetX(), fText->GetY(), txt); 201 207 } 202 208 … … 263 269 } 264 270 271 void MGVelocity::UpdateVelText(Float_t vx, Float_t vy) 272 { 273 static int X = ~0; 274 static int Y = ~0; 275 276 vx /= 60.; //['/min] 277 vy /= 60.; //['/min] 278 279 int fx = (int)floor(vx*10.); 280 int fy = (int)floor(vy*10.); 281 282 if (X==fx && Y==fy) 283 return; 284 285 X = fx; 286 Y = fy; 287 288 char txt[100]; 289 sprintf(txt, "Zd=%.1f'\nAz=%.1f'", 290 vx, vy); 291 292 fTextVel->SetText(fTextVel->GetX(), fTextVel->GetY(), txt); 293 } 265 294 266 295 void MGVelocity::Update(ZdAz &zdaz) … … 272 301 // static int Y = 0xaffe; 273 302 274 float x = zdaz.Az()*3600.; 275 float y = zdaz.Zd()*3600.; 276 277 int pixx = (int)(x*fScale/fPix); 278 int pixy = (int)(y*fScale/fPix); 303 float vx = zdaz.Az()*3600.; // ["/min] 304 float vy = zdaz.Zd()*3600.; // ["/min] 305 306 UpdateVelText(vx, vy); 307 308 int pixx = (int)(vx*fScale/fPix); 309 int pixy = (int)(vy*fScale/fPix); 279 310 280 311 // … … 284 315 285 316 if (pixx || pixy) 286 rc = UpdateAvg( x,y);317 rc = UpdateAvg(vx, vy); 287 318 288 319 if (rc) … … 296 327 // cout << zdaz.Az()*3600. << " " << zdaz.Zd()*3600. << endl; 297 328 298 x *= fScale;299 y *= fScale;300 301 fArrow->SetX2( x);302 fArrow->SetY2( y);303 304 fArrowX->SetX2( x);305 fArrowY->SetY2( y);329 vx *= fScale; 330 vy *= fScale; 331 332 fArrow->SetX2(vx); 333 fArrow->SetY2(vy); 334 335 fArrowX->SetX2(vx); 336 fArrowY->SetY2(vy); 306 337 307 338 fOld->Set(pixx, pixy); … … 309 340 SetModified(); 310 341 UpdateCanvas(); 311 312 } 342 } -
trunk/MagicSoft/Cosy/gui/MGVelocity.h
r913 r921 31 31 32 32 TText *fText; 33 TText *fTextVel; 33 34 34 35 XY *fOld; … … 43 44 void DrawCoordinateSystem(); 44 45 void UpdateText(); 46 void UpdateVelText(Float_t x, Float_t y); 45 47 46 48 public:
Note:
See TracChangeset
for help on using the changeset viewer.