| 1 | #include "MGCosy.h"
|
|---|
| 2 |
|
|---|
| 3 | #include <iostream.h>
|
|---|
| 4 |
|
|---|
| 5 | #include "msgqueue.h"
|
|---|
| 6 | #include "coord.h"
|
|---|
| 7 |
|
|---|
| 8 | #include <TROOT.h>
|
|---|
| 9 |
|
|---|
| 10 | #include <TGTab.h> // TGTab
|
|---|
| 11 | #include <TGMenu.h> // TGPopupMenu
|
|---|
| 12 | #include <TGButton.h> // TGButton
|
|---|
| 13 | #include <TSystem.h> // gSystem
|
|---|
| 14 | #include <TGLabel.h> // TGLabel
|
|---|
| 15 | #include <TGListBox.h> // TGListBox
|
|---|
| 16 | #include <TGComboBox.h> // TGComboBox
|
|---|
| 17 | #include <TG3DLine.h> // TGHorizontal3DLine (TGSplitter)
|
|---|
| 18 | #include <TGTextEntry.h> // TGTextEntry
|
|---|
| 19 | #include <TGFrame.h> // TGGroupFrame
|
|---|
| 20 | #include <TApplication.h> // gApplication
|
|---|
| 21 |
|
|---|
| 22 | //#include "timer.h" // Timer
|
|---|
| 23 |
|
|---|
| 24 | #include "MCosy.h"
|
|---|
| 25 | #include "MGList.h"
|
|---|
| 26 | #include "MGAccuracy.h"
|
|---|
| 27 | #include "MGCoordinates.h"
|
|---|
| 28 | #include "MGSkyPosition.h"
|
|---|
| 29 | #include "MGVelocity.h"
|
|---|
| 30 |
|
|---|
| 31 | #include "SlaStars.h"
|
|---|
| 32 |
|
|---|
| 33 | #undef DEBUG
|
|---|
| 34 |
|
|---|
| 35 | ClassImp(MGCosy);
|
|---|
| 36 |
|
|---|
| 37 | #define IDM_EXIT 1
|
|---|
| 38 | #define IDM_TEXT 2
|
|---|
| 39 | #define IDM_ASPECT 3
|
|---|
| 40 |
|
|---|
| 41 | enum
|
|---|
| 42 | {
|
|---|
| 43 | kPB_POSITION,
|
|---|
| 44 | kPB_TRACK,
|
|---|
| 45 | kPB_STOP,
|
|---|
| 46 | kPB_HOME,
|
|---|
| 47 | kPB_CALCALTAZ,
|
|---|
| 48 | kPB_TPOINT,
|
|---|
| 49 | kPB_START,
|
|---|
| 50 | kPB_DISPLAY1,
|
|---|
| 51 | kPB_DISPLAY2,
|
|---|
| 52 | kPB_RAp,
|
|---|
| 53 | kPB_RAm,
|
|---|
| 54 | kPB_DECp,
|
|---|
| 55 | kPB_DECm,
|
|---|
| 56 | kPB_LoadBending,
|
|---|
| 57 | kPB_ResetBending,
|
|---|
| 58 | kPB_CALIBSE,
|
|---|
| 59 | kCB_PredefPos
|
|---|
| 60 |
|
|---|
| 61 | };
|
|---|
| 62 |
|
|---|
| 63 | void MGCosy::CreateMenu()
|
|---|
| 64 | {
|
|---|
| 65 | fLayMenuBar = new TGLayoutHints (kLHintsNormal | kLHintsExpandX);
|
|---|
| 66 | fLayMenuItem = new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0);
|
|---|
| 67 |
|
|---|
| 68 | //
|
|---|
| 69 | // crate the menu bar
|
|---|
| 70 | //
|
|---|
| 71 | TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot());
|
|---|
| 72 | fFileMenu->AddEntry("Set Aspect", IDM_ASPECT);
|
|---|
| 73 | fFileMenu->AddEntry("Exit", IDM_EXIT);
|
|---|
| 74 | fFileMenu->Associate(this);
|
|---|
| 75 | fList->Add(fFileMenu);
|
|---|
| 76 |
|
|---|
| 77 | //
|
|---|
| 78 | // the button messages are handled by main frame (this)
|
|---|
| 79 | //
|
|---|
| 80 | TGMenuBar *fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
|
|---|
| 81 | fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem);
|
|---|
| 82 | AddFrame(fMenuBar, fLayMenuBar);
|
|---|
| 83 | fList->Add(fMenuBar);
|
|---|
| 84 |
|
|---|
| 85 | //
|
|---|
| 86 | // Seperator beyond menubar
|
|---|
| 87 | //
|
|---|
| 88 |
|
|---|
| 89 | TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
|
|---|
| 90 | AddFrame(fLineSep, fLayMenuBar);
|
|---|
| 91 | fList->Add(fLineSep);
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | void MGCosy::CreateLabel(TGCompositeFrame *f)
|
|---|
| 95 | {
|
|---|
| 96 | const int x = 180;
|
|---|
| 97 | const int y = 25;
|
|---|
| 98 |
|
|---|
| 99 | TGLabel *l;
|
|---|
| 100 |
|
|---|
| 101 | l = new TGLabel(f, "UTC:");
|
|---|
| 102 | l->Move(x-60, y);
|
|---|
| 103 | fList->Add(l);
|
|---|
| 104 |
|
|---|
| 105 | l = new TGLabel(f, "Mjd:");
|
|---|
| 106 | l->Move(x-60, y+17);
|
|---|
| 107 | fList->Add(l);
|
|---|
| 108 |
|
|---|
| 109 | fUtc = new TGLabel(f, "0000/00/00 00:00:00.0");
|
|---|
| 110 | fMjd = new TGLabel(f, "00000.000000");
|
|---|
| 111 | fUtc->Move(x-25, y);
|
|---|
| 112 | fMjd->Move(x-25, y+17);
|
|---|
| 113 | fList->Add(fUtc);
|
|---|
| 114 | fList->Add(fMjd);
|
|---|
| 115 |
|
|---|
| 116 | l = new TGLabel(f, "SE-Az:");
|
|---|
| 117 | l->Move(x-60, y+40);
|
|---|
| 118 | fList->Add(l);
|
|---|
| 119 |
|
|---|
| 120 | l = new TGLabel(f, "SE-Zd1:");
|
|---|
| 121 | l->Move(x-60, y+57);
|
|---|
| 122 | fList->Add(l);
|
|---|
| 123 |
|
|---|
| 124 | l = new TGLabel(f, "SE-Zd2:");
|
|---|
| 125 | l->Move(x-60, y+74);
|
|---|
| 126 | fList->Add(l);
|
|---|
| 127 |
|
|---|
| 128 | fLabel1 = new TGLabel*[3];
|
|---|
| 129 | fLabel1[0] = new TGLabel(f, "00000"); // Max: 16384
|
|---|
| 130 | fLabel1[1] = new TGLabel(f, "000"); // Max: 256
|
|---|
| 131 | fLabel1[2] = new TGLabel(f, "000"); // Max: 256
|
|---|
| 132 | fLabel1[0]->SetTextJustify(kTextRight);
|
|---|
| 133 | fLabel1[1]->SetTextJustify(kTextRight);
|
|---|
| 134 | fLabel1[2]->SetTextJustify(kTextRight);
|
|---|
| 135 | fLabel1[0]->Move(x, y+40);
|
|---|
| 136 | fLabel1[1]->Move(x+43, y+40);
|
|---|
| 137 | fLabel1[2]->Move(x+70, y+40);
|
|---|
| 138 | fList->Add(fLabel1[0]);
|
|---|
| 139 | fList->Add(fLabel1[1]);
|
|---|
| 140 | fList->Add(fLabel1[2]);
|
|---|
| 141 | //f->AddFrame(fLabel1[0]);
|
|---|
| 142 | //f->AddFrame(fLabel1[1]);
|
|---|
| 143 | //f->AddFrame(fLabel1[2]);
|
|---|
| 144 |
|
|---|
| 145 | fLabel2 = new TGLabel*[3];
|
|---|
| 146 | fLabel2[0] = new TGLabel(f, "00000");
|
|---|
| 147 | fLabel2[1] = new TGLabel(f, "000");
|
|---|
| 148 | fLabel2[2] = new TGLabel(f, "000");
|
|---|
| 149 | fLabel2[0]->SetTextJustify(kTextRight);
|
|---|
| 150 | fLabel2[1]->SetTextJustify(kTextRight);
|
|---|
| 151 | fLabel2[2]->SetTextJustify(kTextRight);
|
|---|
| 152 | fLabel2[0]->Move(x, y+57);
|
|---|
| 153 | fLabel2[1]->Move(x+43, y+57);
|
|---|
| 154 | fLabel2[2]->Move(x+70, y+57);
|
|---|
| 155 | fList->Add(fLabel2[0]);
|
|---|
| 156 | fList->Add(fLabel2[1]);
|
|---|
| 157 | fList->Add(fLabel2[2]);
|
|---|
| 158 | //f->AddFrame(fLabel2[0]);
|
|---|
| 159 | //f->AddFrame(fLabel2[1]);
|
|---|
| 160 | //f->AddFrame(fLabel2[2]);
|
|---|
| 161 |
|
|---|
| 162 | fLabel3 = new TGLabel*[3];
|
|---|
| 163 | fLabel3[0] = new TGLabel(f, "00000");
|
|---|
| 164 | fLabel3[1] = new TGLabel(f, "000");
|
|---|
| 165 | fLabel3[2] = new TGLabel(f, "000");
|
|---|
| 166 | fLabel3[0]->SetTextJustify(kTextRight);
|
|---|
| 167 | fLabel3[1]->SetTextJustify(kTextRight);
|
|---|
| 168 | fLabel3[2]->SetTextJustify(kTextRight);
|
|---|
| 169 | fLabel3[0]->Move(x, y+74);
|
|---|
| 170 | fLabel3[1]->Move(x+43, y+74);
|
|---|
| 171 | fLabel3[2]->Move(x+70, y+74);
|
|---|
| 172 | fList->Add(fLabel3[0]);
|
|---|
| 173 | fList->Add(fLabel3[1]);
|
|---|
| 174 | fList->Add(fLabel3[2]);
|
|---|
| 175 | //f->AddFrame(fLabel3[0]);
|
|---|
| 176 | //f->AddFrame(fLabel3[1]);
|
|---|
| 177 | //f->AddFrame(fLabel3[2]);
|
|---|
| 178 |
|
|---|
| 179 | l = new TGLabel(f, "Offset-Zd:");
|
|---|
| 180 | l->Move(x-60, y+102);
|
|---|
| 181 | fList->Add(l);
|
|---|
| 182 |
|
|---|
| 183 | l = new TGLabel(f, "Offset-Az:");
|
|---|
| 184 | l->Move(x-60, y+119);
|
|---|
| 185 | fList->Add(l);
|
|---|
| 186 |
|
|---|
| 187 | fOffsetZd = new TGLabel(f, "000000000");
|
|---|
| 188 | fOffsetAz = new TGLabel(f, "000000000");
|
|---|
| 189 | fOffsetZd->SetTextJustify(kTextRight);
|
|---|
| 190 | fOffsetAz->SetTextJustify(kTextRight);
|
|---|
| 191 | fOffsetZd->Move(x+15, y+102);
|
|---|
| 192 | fOffsetAz->Move(x+15, y+119);
|
|---|
| 193 | fList->Add(fOffsetZd);
|
|---|
| 194 | fList->Add(fOffsetAz);
|
|---|
| 195 |
|
|---|
| 196 | l = new TGLabel(f, "Ra (estimated):");
|
|---|
| 197 | l->Move(x-60, y+142);
|
|---|
| 198 | fList->Add(l);
|
|---|
| 199 |
|
|---|
| 200 | l = new TGLabel(f, "Ra (nominal):");
|
|---|
| 201 | l->Move(x-60, y+159);
|
|---|
| 202 | fList->Add(l);
|
|---|
| 203 |
|
|---|
| 204 | l = new TGLabel(f, "Dec (estimated):");
|
|---|
| 205 | l->Move(x-60, y+182);
|
|---|
| 206 | fList->Add(l);
|
|---|
| 207 |
|
|---|
| 208 | l = new TGLabel(f, "Dec (nominal):");
|
|---|
| 209 | l->Move(x-60, y+199);
|
|---|
| 210 | fList->Add(l);
|
|---|
| 211 |
|
|---|
| 212 | l = new TGLabel(f, "Zd (nominal):");
|
|---|
| 213 | l->Move(x-60, y+222);
|
|---|
| 214 | fList->Add(l);
|
|---|
| 215 |
|
|---|
| 216 | l = new TGLabel(f, "Az (nominal):");
|
|---|
| 217 | l->Move(x-60, y+239);
|
|---|
| 218 | fList->Add(l);
|
|---|
| 219 |
|
|---|
| 220 | fRaEst = new TGLabel(f, "+000h 00.0m");
|
|---|
| 221 | fDecEst = new TGLabel(f, "+000h 00.0m");
|
|---|
| 222 | fRaSoll = new TGLabel(f, "+000h 00.0m");
|
|---|
| 223 | fDecSoll = new TGLabel(f, "+000h 00.0m");
|
|---|
| 224 | fZdSoll = new TGLabel(f, "+000h 00.0m");
|
|---|
| 225 | fAzSoll = new TGLabel(f, "+000h 00.0m");
|
|---|
| 226 | fRaEst->SetTextJustify(kTextRight);
|
|---|
| 227 | fDecEst->SetTextJustify(kTextRight);
|
|---|
| 228 | fRaSoll->SetTextJustify(kTextRight);
|
|---|
| 229 | fDecSoll->SetTextJustify(kTextRight);
|
|---|
| 230 | fZdSoll->SetTextJustify(kTextRight);
|
|---|
| 231 | fAzSoll->SetTextJustify(kTextRight);
|
|---|
| 232 | fRaEst->Move(x+30, y+142);
|
|---|
| 233 | fRaSoll->Move(x+30, y+159);
|
|---|
| 234 | fDecEst->Move(x+30, y+182);
|
|---|
| 235 | fDecSoll->Move(x+30, y+199);
|
|---|
| 236 | fZdSoll->Move(x+30, y+222);
|
|---|
| 237 | fAzSoll->Move(x+30, y+239);
|
|---|
| 238 | fList->Add(fRaEst);
|
|---|
| 239 | fList->Add(fDecEst);
|
|---|
| 240 | fList->Add(fRaSoll);
|
|---|
| 241 | fList->Add(fDecSoll);
|
|---|
| 242 | fList->Add(fZdSoll);
|
|---|
| 243 | fList->Add(fAzSoll);
|
|---|
| 244 |
|
|---|
| 245 | fError = new TGLabel(f, "Error");
|
|---|
| 246 | fMoving = new TGLabel(f, "Moving");
|
|---|
| 247 | fTracking = new TGLabel(f, "Tracking");
|
|---|
| 248 | fStopping = new TGLabel(f, "Stopping");
|
|---|
| 249 | fStopped = new TGLabel(f, "Stopped");
|
|---|
| 250 | fAvailMac1 = new TGLabel(f, "- MAC1 -");
|
|---|
| 251 | fAvailMac2 = new TGLabel(f, "- MAC2 -");
|
|---|
| 252 | fAvailMac3 = new TGLabel(f, "- MAC3 -");
|
|---|
| 253 | fAvailSe1 = new TGLabel(f, "-SE/Zd1-");
|
|---|
| 254 | fAvailSe2 = new TGLabel(f, "-SE/Zd2-");
|
|---|
| 255 | fAvailSe3 = new TGLabel(f, "- SE/Az -");
|
|---|
| 256 |
|
|---|
| 257 | ULong_t color;
|
|---|
| 258 |
|
|---|
| 259 | gClient->GetColorByName("Red", color);
|
|---|
| 260 | fError->SetBackgroundColor(color);
|
|---|
| 261 | fAvailMac1->SetBackgroundColor(color);
|
|---|
| 262 | fAvailMac2->SetBackgroundColor(color);
|
|---|
| 263 | fAvailMac3->SetBackgroundColor(color);
|
|---|
| 264 | fAvailSe1->SetBackgroundColor(color);
|
|---|
| 265 | fAvailSe2->SetBackgroundColor(color);
|
|---|
| 266 | fAvailSe3->SetBackgroundColor(color);
|
|---|
| 267 | gClient->GetColorByName("LightBlue", color);
|
|---|
| 268 | fMoving->SetBackgroundColor(color);
|
|---|
| 269 | gClient->GetColorByName("Blue", color);
|
|---|
| 270 | fTracking->SetBackgroundColor(color);
|
|---|
| 271 | gClient->GetColorByName("Orange", color);
|
|---|
| 272 | fStopping->SetBackgroundColor(color);
|
|---|
| 273 | gClient->GetColorByName("Green", color);
|
|---|
| 274 | fStopped->SetBackgroundColor(color);
|
|---|
| 275 |
|
|---|
| 276 | fError ->Move(10, 25);
|
|---|
| 277 | fMoving ->Move(10, 25+20);
|
|---|
| 278 | fTracking->Move(10, 25+40);
|
|---|
| 279 | fStopping->Move(10, 25+60);
|
|---|
| 280 | fStopped ->Move(10, 25+80);
|
|---|
| 281 | fAvailMac1->Move(10, 25+120);
|
|---|
| 282 | fAvailMac2->Move(10, 25+140);
|
|---|
| 283 | fAvailMac3->Move(10, 25+160);
|
|---|
| 284 | fAvailSe1->Move(10, 25+180);
|
|---|
| 285 | fAvailSe2->Move(10, 25+200);
|
|---|
| 286 | fAvailSe3->Move(10, 25+220);
|
|---|
| 287 |
|
|---|
| 288 | fError ->Resize(60, 20);
|
|---|
| 289 | fMoving ->Resize(60, 20);
|
|---|
| 290 | fTracking->Resize(60, 20);
|
|---|
| 291 | fStopping->Resize(60, 20);
|
|---|
| 292 | fStopped ->Resize(60, 20);
|
|---|
| 293 | fAvailMac1->Resize(60, 20);
|
|---|
| 294 | fAvailMac2->Resize(60, 20);
|
|---|
| 295 | fAvailMac3->Resize(60, 20);
|
|---|
| 296 | fAvailSe1->Resize(60, 20);
|
|---|
| 297 | fAvailSe2->Resize(60, 20);
|
|---|
| 298 | fAvailSe3->Resize(60, 20);
|
|---|
| 299 |
|
|---|
| 300 | fList->Add(fError);
|
|---|
| 301 | fList->Add(fMoving);
|
|---|
| 302 | fList->Add(fTracking);
|
|---|
| 303 | fList->Add(fStopping);
|
|---|
| 304 | fList->Add(fStopped);
|
|---|
| 305 | fList->Add(fAvailMac1);
|
|---|
| 306 | fList->Add(fAvailMac2);
|
|---|
| 307 | fList->Add(fAvailMac3);
|
|---|
| 308 | fList->Add(fAvailSe1);
|
|---|
| 309 | fList->Add(fAvailSe2);
|
|---|
| 310 | fList->Add(fAvailSe3);
|
|---|
| 311 | }
|
|---|
| 312 |
|
|---|
| 313 | void MGCosy::CreatePredefinedPos(TGCompositeFrame *tf1)
|
|---|
| 314 | {
|
|---|
| 315 | TGComboBox *box = new TGComboBox(tf1, kCB_PredefPos);
|
|---|
| 316 | box->Resize(120, 20);
|
|---|
| 317 | box->Associate(this);
|
|---|
| 318 |
|
|---|
| 319 | TGLayoutHints *lay = new TGLayoutHints(kLHintsLeft|kLHintsTop,
|
|---|
| 320 | 27, 0, 200, 0);
|
|---|
| 321 | tf1->AddFrame(box, lay);
|
|---|
| 322 |
|
|---|
| 323 | fList->Add(box);
|
|---|
| 324 | fList->Add(lay);
|
|---|
| 325 |
|
|---|
| 326 | ifstream fin("prepos.txt");
|
|---|
| 327 | if (!fin)
|
|---|
| 328 | {
|
|---|
| 329 | cout << "ERROR: Predifined posiion in 'prepos.txt' not found." << endl;
|
|---|
| 330 | return;
|
|---|
| 331 | }
|
|---|
| 332 |
|
|---|
| 333 | int i=0;
|
|---|
| 334 | while (!fin.eof())
|
|---|
| 335 | {
|
|---|
| 336 | TString str;
|
|---|
| 337 | Double_t zd, az;
|
|---|
| 338 | fin >> str >> zd >> az;
|
|---|
| 339 | box->AddEntry(str, i++);
|
|---|
| 340 |
|
|---|
| 341 | fStarList.Add(zd, az);
|
|---|
| 342 | }
|
|---|
| 343 | }
|
|---|
| 344 |
|
|---|
| 345 | void MGCosy::CreateTabs(TGTab *fTab)
|
|---|
| 346 | {
|
|---|
| 347 | TGCompositeFrame *tf1 = fTab->AddTab("Position");
|
|---|
| 348 | TGCompositeFrame *tf2 = fTab->AddTab("Track");
|
|---|
| 349 | TGCompositeFrame *tf4 = fTab->AddTab("Calib");
|
|---|
| 350 | TGCompositeFrame *tf5 = fTab->AddTab("Test SE");
|
|---|
| 351 | TGCompositeFrame *tf6 = fTab->AddTab("Gear");
|
|---|
| 352 | /*TGCompositeFrame *tf3 =*/ fTab->AddTab("Demo");
|
|---|
| 353 |
|
|---|
| 354 | fCZdAz = new MGCoordinates(tf1, kETypeZdAz);
|
|---|
| 355 | fCZdAz->Move(27, 105);
|
|---|
| 356 | fList->Add(fCZdAz);
|
|---|
| 357 |
|
|---|
| 358 | CreatePredefinedPos(tf1);
|
|---|
| 359 |
|
|---|
| 360 | fCRaDec = new MGCoordinates(tf2, kETypeRaDec);
|
|---|
| 361 | fCRaDec->Move(27, 105);
|
|---|
| 362 | fList->Add(fCRaDec);
|
|---|
| 363 |
|
|---|
| 364 | fCCalib = new MGCoordinates(tf4, kETypeRaDec);
|
|---|
| 365 | fCCalib->Move(27, 105);
|
|---|
| 366 | fList->Add(fCCalib);
|
|---|
| 367 |
|
|---|
| 368 | const int x=15;
|
|---|
| 369 | const int y=12;
|
|---|
| 370 | const int h=16;
|
|---|
| 371 |
|
|---|
| 372 | TGLabel *l1 = new TGLabel(tf1, "Move the telescope to a position given in");
|
|---|
| 373 | TGLabel *l2 = new TGLabel(tf1, "local coordinates. The given coordinates");
|
|---|
| 374 | TGLabel *l3 = new TGLabel(tf1, "are pointing coordinates, which means that the");
|
|---|
| 375 | TGLabel *l4 = new TGLabel(tf1, "coordinates are corrected for the bending of");
|
|---|
| 376 | TGLabel *l5 = new TGLabel(tf1, "the telescope.");
|
|---|
| 377 | l1->Move(x, y);
|
|---|
| 378 | l2->Move(x, y+h);
|
|---|
| 379 | l3->Move(x, y+2*h);
|
|---|
| 380 | l4->Move(x, y+3*h);
|
|---|
| 381 | l5->Move(x, y+4*h);
|
|---|
| 382 | fList->Add(l1);
|
|---|
| 383 | fList->Add(l2);
|
|---|
| 384 | fList->Add(l3);
|
|---|
| 385 | fList->Add(l4);
|
|---|
| 386 | fList->Add(l5);
|
|---|
| 387 |
|
|---|
| 388 | l1 = new TGLabel(tf2, "Track a position given in sky coordinates.");
|
|---|
| 389 | l2 = new TGLabel(tf2, "Right Ascension and declination must be given");
|
|---|
| 390 | l3 = new TGLabel(tf2, "in the FK5, J2000 coordinate system.");
|
|---|
| 391 | l1->Move(x, y);
|
|---|
| 392 | l2->Move(x, y+h);
|
|---|
| 393 | l3->Move(x, y+2*h);
|
|---|
| 394 | fList->Add(l1);
|
|---|
| 395 | fList->Add(l2);
|
|---|
| 396 | fList->Add(l3);
|
|---|
| 397 |
|
|---|
| 398 | l1 = new TGLabel(tf4, "Start the calibration using the Start button.");
|
|---|
| 399 | l2 = new TGLabel(tf4, "Write a coordinate pair to a TPoint file using");
|
|---|
| 400 | l3 = new TGLabel(tf4, "the TPoint button. To set the Shaftencoder offset");
|
|---|
| 401 | l4 = new TGLabel(tf4, "use the Calib SE button.");
|
|---|
| 402 | l1->Move(x, y);
|
|---|
| 403 | l2->Move(x, y+h);
|
|---|
| 404 | l3->Move(x, y+2*h);
|
|---|
| 405 | l4->Move(x, y+3*h);
|
|---|
| 406 | fList->Add(l1);
|
|---|
| 407 | fList->Add(l2);
|
|---|
| 408 | fList->Add(l3);
|
|---|
| 409 | fList->Add(l4);
|
|---|
| 410 |
|
|---|
| 411 | l1 = new TGLabel(tf5, "START starts histograming the differences of");
|
|---|
| 412 | l2 = new TGLabel(tf5, "the two shaftencoders at the elevation axis.");
|
|---|
| 413 | l3 = new TGLabel(tf5, "Use STOP to stop histograming and display the");
|
|---|
| 414 | l4 = new TGLabel(tf5, "results on the screen.");
|
|---|
| 415 | l1->Move(x, y);
|
|---|
| 416 | l2->Move(x, y+h);
|
|---|
| 417 | l3->Move(x, y+2*h);
|
|---|
| 418 | l4->Move(x, y+3*h);
|
|---|
| 419 | fList->Add(l1);
|
|---|
| 420 | fList->Add(l2);
|
|---|
| 421 | fList->Add(l3);
|
|---|
| 422 | fList->Add(l4);
|
|---|
| 423 |
|
|---|
| 424 | l1 = new TGLabel(tf6, "FIXME Text missing / Only one axis?");
|
|---|
| 425 | l1->Move(x, y);
|
|---|
| 426 | fList->Add(l1);
|
|---|
| 427 |
|
|---|
| 428 | //
|
|---|
| 429 | // light green: 3 light red: 2 blue?: 2
|
|---|
| 430 | // dark green: 8 dark red: 50 dark blue?: 1
|
|---|
| 431 |
|
|---|
| 432 | //
|
|---|
| 433 | // blue: 0-7, 9, 10,11, 14, 15, 18, 19, 22, 23, 27, 31, 33-39, 41-43
|
|---|
| 434 | // 46, 47
|
|---|
| 435 | // green: 8, 12,13, 16, 17, 20, 21, 24, 25, 26, 28, 29, 30, 40, 44
|
|---|
| 436 | // 45, 48
|
|---|
| 437 | // gray: 31, 113-
|
|---|
| 438 | // red: 164, 192, 224, 232
|
|---|
| 439 | //
|
|---|
| 440 | TGTextButton *but;
|
|---|
| 441 |
|
|---|
| 442 | but= new TGTextButton(tf2, "Ra -", kPB_RAm);
|
|---|
| 443 | but->Resize(50, 25);
|
|---|
| 444 | but->Move(25, 210);
|
|---|
| 445 | but->SetToolTipText("Right ascension -= 1'");
|
|---|
| 446 | but->Associate(this);
|
|---|
| 447 | fList->Add(but);
|
|---|
| 448 | but= new TGTextButton(tf2, "RA +", kPB_RAp);
|
|---|
| 449 | but->Resize(50, 25);
|
|---|
| 450 | but->Move(90, 210);
|
|---|
| 451 | but->SetToolTipText("Right ascension += 1'");
|
|---|
| 452 | but->Associate(this);
|
|---|
| 453 | fList->Add(but);
|
|---|
| 454 | but= new TGTextButton(tf2, "DEC +", kPB_DECp);
|
|---|
| 455 | but->Resize(50, 25);
|
|---|
| 456 | but->Move(55, 185);
|
|---|
| 457 | but->SetToolTipText("Declination += 1'");
|
|---|
| 458 | but->Associate(this);
|
|---|
| 459 | fList->Add(but);
|
|---|
| 460 | but= new TGTextButton(tf2, "DEC -", kPB_DECm);
|
|---|
| 461 | but->Resize(50, 25);
|
|---|
| 462 | but->Move(55, 235);
|
|---|
| 463 | but->SetToolTipText("Declination -= 1'");
|
|---|
| 464 | but->Associate(this);
|
|---|
| 465 | fList->Add(but);
|
|---|
| 466 |
|
|---|
| 467 | but = new TGTextButton(tf1, "Home", kPB_HOME);
|
|---|
| 468 | but->Resize(80, 25);
|
|---|
| 469 | but->Move(160, 197);
|
|---|
| 470 | but->SetToolTipText("Initiate Home Drive.");
|
|---|
| 471 | but->Associate(this);
|
|---|
| 472 | fList->Add(but);
|
|---|
| 473 |
|
|---|
| 474 | but = new TGTextButton(tf5, "Display", kPB_DISPLAY1);
|
|---|
| 475 | but->Resize(80, 25);
|
|---|
| 476 | but->Move(160, 197);
|
|---|
| 477 | but->SetToolTipText("Display Histogram.");
|
|---|
| 478 | but->Associate(this);
|
|---|
| 479 | fList->Add(but);
|
|---|
| 480 |
|
|---|
| 481 | but = new TGTextButton(tf6, "Display", kPB_DISPLAY2);
|
|---|
| 482 | but->Resize(80, 25);
|
|---|
| 483 | but->Move(160, 197);
|
|---|
| 484 | but->SetToolTipText("Display Histogram.");
|
|---|
| 485 | but->Associate(this);
|
|---|
| 486 | fList->Add(but);
|
|---|
| 487 |
|
|---|
| 488 | but= new TGTextButton(tf2, "Calc Zd/Az", kPB_CALCALTAZ);
|
|---|
| 489 | but->Resize(80, 25);
|
|---|
| 490 | but->Move(165, 197);
|
|---|
| 491 | but->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec.");
|
|---|
| 492 | but->Associate(this);
|
|---|
| 493 | fList->Add(but);
|
|---|
| 494 |
|
|---|
| 495 | but = new TGTextButton(tf4, "TPoint", kPB_TPOINT);
|
|---|
| 496 | but->Resize(80, 25);
|
|---|
| 497 | but->Move(25, 190);
|
|---|
| 498 | but->SetToolTipText("Trigger writing a tpoint coordinate pair.");
|
|---|
| 499 | but->Associate(this);
|
|---|
| 500 | fList->Add(but);
|
|---|
| 501 |
|
|---|
| 502 | but = new TGTextButton(tf4, "Calib SE", kPB_CALIBSE);
|
|---|
| 503 | but->Resize(80, 25);
|
|---|
| 504 | but->Move(160, 197);
|
|---|
| 505 | but->SetToolTipText("Set SE to given coordinates.");
|
|---|
| 506 | but->Associate(this);
|
|---|
| 507 | fList->Add(but);
|
|---|
| 508 |
|
|---|
| 509 | but = new TGTextButton(tf4, "Load", kPB_LoadBending);
|
|---|
| 510 | but->Resize(80, 25);
|
|---|
| 511 | but->Move(25, 220);
|
|---|
| 512 | but->SetToolTipText("Load bending corrections from file 'bending.txt'");
|
|---|
| 513 | but->Associate(this);
|
|---|
| 514 | fList->Add(but);
|
|---|
| 515 |
|
|---|
| 516 | but = new TGTextButton(tf4, "Reset", kPB_ResetBending);
|
|---|
| 517 | but->Resize(80, 25);
|
|---|
| 518 | but->Move(25, 250);
|
|---|
| 519 | but->SetToolTipText("Reset bending correction (coefficients=0)");
|
|---|
| 520 | but->Associate(this);
|
|---|
| 521 | fList->Add(but);
|
|---|
| 522 |
|
|---|
| 523 | ULong_t color;
|
|---|
| 524 |
|
|---|
| 525 | but = new TGTextButton(this, "Start", kPB_START);
|
|---|
| 526 | gClient->GetColorByName("Green", color);
|
|---|
| 527 | but->SetBackgroundColor(color);
|
|---|
| 528 | but->Move(147, 295);
|
|---|
| 529 | but->Resize(62, 25);
|
|---|
| 530 | but->SetToolTipText("Start a telescope movement.");
|
|---|
| 531 | fList->Add(but);
|
|---|
| 532 |
|
|---|
| 533 | but = new TGTextButton(this, "Stop", kPB_STOP);
|
|---|
| 534 |
|
|---|
| 535 | gClient->GetColorByName("Red", color);
|
|---|
| 536 | but->SetBackgroundColor(color);
|
|---|
| 537 | but->Move(212, 295);
|
|---|
| 538 | but->Resize(62, 25);
|
|---|
| 539 | but->SetToolTipText("Stop any movement of telescope.");
|
|---|
| 540 | fList->Add(but);
|
|---|
| 541 |
|
|---|
| 542 | /*
|
|---|
| 543 | const Double_t ca = 0; // Left-Right Collimation Error
|
|---|
| 544 | const Double_t an = 0; // Azimuth Axis Misalignment (N-S)
|
|---|
| 545 | const Double_t aw = 0; // Azimuth Axis Misalignment (E-W)
|
|---|
| 546 | const Double_t npae = 0; // Az-El Nonperpendicularity
|
|---|
| 547 | const Double_t nrx = 0; // Nasmyth rotator displacement, horizontan
|
|---|
| 548 | const Double_t nry = 0; // Nasmyth rotator displacement, vertical
|
|---|
| 549 | const Double_t crx = 0; // Alt/Az Coude Displacement (N-S)
|
|---|
| 550 | const Double_t cry = 0; // Alt/Az Coude Displacement (E-W)
|
|---|
| 551 | l1 = new TGLabel(tf5, "CA");
|
|---|
| 552 | l1->SetTextJustify(kTextLeft);
|
|---|
| 553 | l1->Move(x, y+2*h*1.5);
|
|---|
| 554 | l1->MapWindow();
|
|---|
| 555 | fList->Add(l1);
|
|---|
| 556 | l1 = new TGLabel(tf5, "AN");
|
|---|
| 557 | l1->SetTextJustify(kTextLeft);
|
|---|
| 558 | l1->Move(x, y+3*h*1.5);
|
|---|
| 559 | l1->MapWindow();
|
|---|
| 560 | fList->Add(l1);
|
|---|
| 561 | l1 = new TGLabel(tf5, "AW");
|
|---|
| 562 | l1->SetTextJustify(kTextLeft);
|
|---|
| 563 | l1->Move(x, y+4*h*1.5);
|
|---|
| 564 | l1->MapWindow();
|
|---|
| 565 | fList->Add(l1);
|
|---|
| 566 | l1 = new TGLabel(tf5, "NPAE");
|
|---|
| 567 | l1->SetTextJustify(kTextLeft);
|
|---|
| 568 | l1->Move(x, y+5*h*1.5);
|
|---|
| 569 | l1->MapWindow();
|
|---|
| 570 | fList->Add(l1);
|
|---|
| 571 | l1 = new TGLabel(tf5, "NRX");
|
|---|
| 572 | l1->SetTextJustify(kTextLeft);
|
|---|
| 573 | l1->Move(x, y+6*h*1.5);
|
|---|
| 574 | l1->MapWindow();
|
|---|
| 575 | fList->Add(l1);
|
|---|
| 576 | l1 = new TGLabel(tf5, "NRY");
|
|---|
| 577 | l1->SetTextJustify(kTextLeft);
|
|---|
| 578 | l1->Move(x, y+7*h*1.5);
|
|---|
| 579 | l1->MapWindow();
|
|---|
| 580 | fList->Add(l1);
|
|---|
| 581 | l1 = new TGLabel(tf5, "CRX");
|
|---|
| 582 | l1->SetTextJustify(kTextLeft);
|
|---|
| 583 | l1->Move(x, y+8*h*1.5);
|
|---|
| 584 | l1->MapWindow();
|
|---|
| 585 | fList->Add(l1);
|
|---|
| 586 | l1 = new TGLabel(tf5, "CRY");
|
|---|
| 587 | l1->SetTextJustify(kTextLeft);
|
|---|
| 588 | l1->Move(x, y+9*h*1.5);
|
|---|
| 589 | l1->MapWindow();
|
|---|
| 590 | fList->Add(l1);
|
|---|
| 591 | const Double_t ie = 0; // Index Error in Elevation
|
|---|
| 592 | const Double_t ia = 0; // Index Error in Azimuth
|
|---|
| 593 | const Double_t eces = 0; // Elevation Centering Error (sin)
|
|---|
| 594 | const Double_t ecec = 0; // Elevation Centering Error (cos)
|
|---|
| 595 | const Double_t aces = 0; // Azimuth Centering Error (sin)
|
|---|
| 596 | const Double_t acec = 0; // Azimuth Centering Error (cos)
|
|---|
| 597 | l1 = new TGLabel(tf5, "IE");
|
|---|
| 598 | l1->SetTextJustify(kTextLeft);
|
|---|
| 599 | l1->Move(x+150, y+3*h*1.5);
|
|---|
| 600 | l1->MapWindow();
|
|---|
| 601 | fList->Add(l1);
|
|---|
| 602 | l1 = new TGLabel(tf5, "IA");
|
|---|
| 603 | l1->SetTextJustify(kTextLeft);
|
|---|
| 604 | l1->Move(x+150, y+4*h*1.5);
|
|---|
| 605 | l1->MapWindow();
|
|---|
| 606 | fList->Add(l1);
|
|---|
| 607 | l1 = new TGLabel(tf5, "ECES");
|
|---|
| 608 | l1->SetTextJustify(kTextLeft);
|
|---|
| 609 | l1->Move(x+150, y+5*h*1.5);
|
|---|
| 610 | l1->MapWindow();
|
|---|
| 611 | fList->Add(l1);
|
|---|
| 612 | l1 = new TGLabel(tf5, "ECEC");
|
|---|
| 613 | l1->SetTextJustify(kTextLeft);
|
|---|
| 614 | l1->Move(x+150, y+6*h*1.5);
|
|---|
| 615 | l1->MapWindow();
|
|---|
| 616 | fList->Add(l1);
|
|---|
| 617 | l1 = new TGLabel(tf5, "ACES");
|
|---|
| 618 | l1->SetTextJustify(kTextLeft);
|
|---|
| 619 | l1->Move(x+150, y+4*h*1.5);
|
|---|
| 620 | l1->MapWindow();
|
|---|
| 621 | fList->Add(l1);
|
|---|
| 622 | l1 = new TGLabel(tf5, "IA");
|
|---|
| 623 | l1->SetTextJustify(kTextLeft);
|
|---|
| 624 | l1->Move(x+150, y+4*h*1.5);
|
|---|
| 625 | l1->MapWindow();
|
|---|
| 626 | fList->Add(l1);
|
|---|
| 627 |
|
|---|
| 628 |
|
|---|
| 629 | TGTextEntry *entry = new TGTextEntry(tf5, "****", kEF_BendIE);
|
|---|
| 630 | entry->Associate(this);
|
|---|
| 631 | entry->Move(x+50, y+2*h*1.5);
|
|---|
| 632 | entry->MapWindow();
|
|---|
| 633 | fList->Add(entry);
|
|---|
| 634 |
|
|---|
| 635 | entry = new TGTextEntry(tf5, "*****", kEF_BendIA);
|
|---|
| 636 | entry->Associate(this);
|
|---|
| 637 | entry->Move(x+50, y+3*h*1.5);
|
|---|
| 638 | entry->MapWindow();
|
|---|
| 639 | fList->Add(entry);
|
|---|
| 640 | */
|
|---|
| 641 | }
|
|---|
| 642 |
|
|---|
| 643 | MGCosy::MGCosy(MObservatory::LocationName_t key, MsgQueue *q, const TGWindow *p, UInt_t w, UInt_t h)
|
|---|
| 644 | : TGMainFrame(p, w, h), fObservatory(key), fQueue(q)
|
|---|
| 645 | {
|
|---|
| 646 | fList = new MGList;
|
|---|
| 647 |
|
|---|
| 648 | #ifdef DEBUG
|
|---|
| 649 | cout << "MGCosy: Creating Menu" << endl;
|
|---|
| 650 | #endif
|
|---|
| 651 | CreateMenu();
|
|---|
| 652 |
|
|---|
| 653 | #ifdef DEBUG
|
|---|
| 654 | cout << "MGCosy: Creating TGCompositeFrame" << endl;
|
|---|
| 655 | #endif
|
|---|
| 656 | TGHorizontalFrame *f1 = new TGHorizontalFrame(this, 0, 0);
|
|---|
| 657 | TGHorizontalFrame *f2 = new TGHorizontalFrame(this, 0, 0);
|
|---|
| 658 | fList->Add(f1);
|
|---|
| 659 | fList->Add(f2);
|
|---|
| 660 |
|
|---|
| 661 | #ifdef DEBUG
|
|---|
| 662 | cout << "MGCosy: Creating TGTab" << endl;
|
|---|
| 663 | #endif
|
|---|
| 664 | fTab = new TGTab(f1, 300, 300);
|
|---|
| 665 | fList->Add(fTab);
|
|---|
| 666 |
|
|---|
| 667 | #ifdef DEBUG
|
|---|
| 668 | cout << "MGCosy: Creating MGSkyPosition" << endl;
|
|---|
| 669 | #endif
|
|---|
| 670 | fSkyPosition = new MGSkyPosition(fObservatory, f1, 300);
|
|---|
| 671 | #ifdef DEBUG
|
|---|
| 672 | cout << "MGCosy: Creating MGAccuracy" << endl;
|
|---|
| 673 | #endif
|
|---|
| 674 | fAccuracy = new MGAccuracy (f1, 300);
|
|---|
| 675 | #ifdef DEBUG
|
|---|
| 676 | cout << "MGCosy: Creating MGVelocity" << endl;
|
|---|
| 677 | #endif
|
|---|
| 678 | fVelocity = new MGVelocity (f2, "Velocity [\"/min]", 300);
|
|---|
| 679 | // fOffset = new MGVelocity (f, "Offset se-re [']", 300);
|
|---|
| 680 |
|
|---|
| 681 | fList->Add(fSkyPosition);
|
|---|
| 682 | fList->Add(fAccuracy);
|
|---|
| 683 | fList->Add(fVelocity);
|
|---|
| 684 | // fList->Add(fOffset);
|
|---|
| 685 |
|
|---|
| 686 | #ifdef DEBUG
|
|---|
| 687 | cout << "MGCosy: Creating TGGroupFrame" << endl;
|
|---|
| 688 | #endif
|
|---|
| 689 | TGGroupFrame *frame = new TGGroupFrame(f2, "Status");
|
|---|
| 690 | frame->Resize(300, 300);
|
|---|
| 691 | fList->Add(frame);
|
|---|
| 692 |
|
|---|
| 693 | #ifdef DEBUG
|
|---|
| 694 | cout << "MGCosy: Creating TGListBox" << endl;
|
|---|
| 695 | #endif
|
|---|
| 696 | fLog = new TGListBox(f2, -1, kSunkenFrame); //kSunkenFrame|kDoubleBorder,
|
|---|
| 697 | fLog->Resize(300, 300);
|
|---|
| 698 | fLog->ChangeBackground(TGFrame::GetBlackPixel());
|
|---|
| 699 | fList->Add(fLog);
|
|---|
| 700 |
|
|---|
| 701 | TGLayoutHints *hints1 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX|kLHintsExpandY, 6, 6, 6, 3);
|
|---|
| 702 | TGLayoutHints *hints2 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX|kLHintsExpandY, 6, 6, 3, 6);
|
|---|
| 703 | TGLayoutHints *hints1a = new TGLayoutHints(kLHintsLeft | kLHintsTop |kLHintsExpandX|kLHintsExpandY);
|
|---|
| 704 | TGLayoutHints *hints2a = new TGLayoutHints(kLHintsCenterY | kLHintsTop |kLHintsExpandX|kLHintsExpandY, 6, 6);
|
|---|
| 705 | TGLayoutHints *hints3a = new TGLayoutHints(kLHintsRight | kLHintsTop |kLHintsExpandX|kLHintsExpandY);
|
|---|
| 706 | TGLayoutHints *hints1b = new TGLayoutHints(kLHintsLeft | kLHintsBottom|kLHintsExpandX|kLHintsExpandY);
|
|---|
| 707 | TGLayoutHints *hints2b = new TGLayoutHints(kLHintsCenterY | kLHintsBottom|kLHintsExpandX|kLHintsExpandY, 6, 6);
|
|---|
| 708 | TGLayoutHints *hints3b = new TGLayoutHints(kLHintsRight | kLHintsBottom|kLHintsExpandX|kLHintsExpandY);
|
|---|
| 709 |
|
|---|
| 710 | fList->Add(hints1);
|
|---|
| 711 | fList->Add(hints2);
|
|---|
| 712 | fList->Add(hints1a);
|
|---|
| 713 | fList->Add(hints2a);
|
|---|
| 714 | fList->Add(hints3a);
|
|---|
| 715 | fList->Add(hints1b);
|
|---|
| 716 | fList->Add(hints2b);
|
|---|
| 717 | fList->Add(hints3b);
|
|---|
| 718 |
|
|---|
| 719 | // Layout upper frame
|
|---|
| 720 | f1->AddFrame(fTab, hints1a);
|
|---|
| 721 | f1->AddFrame(fSkyPosition, hints2a);
|
|---|
| 722 | f1->AddFrame(fAccuracy, hints3a);
|
|---|
| 723 |
|
|---|
| 724 | // Layout upper frame
|
|---|
| 725 | f2->AddFrame(frame, hints1b);
|
|---|
| 726 | f2->AddFrame(fVelocity, hints2b);
|
|---|
| 727 | f2->AddFrame(fLog, hints3b);
|
|---|
| 728 |
|
|---|
| 729 | // Layout window
|
|---|
| 730 | AddFrame(f1, hints1);
|
|---|
| 731 | AddFrame(f2, hints2);
|
|---|
| 732 |
|
|---|
| 733 | //
|
|---|
| 734 | // FIXME!
|
|---|
| 735 | //
|
|---|
| 736 | #ifdef DEBUG
|
|---|
| 737 | cout << "MGCosy: Creating Tabs" << endl;
|
|---|
| 738 | #endif
|
|---|
| 739 | CreateTabs(fTab);
|
|---|
| 740 | #ifdef DEBUG
|
|---|
| 741 | cout << "MGCosy: Creating Label" << endl;
|
|---|
| 742 | #endif
|
|---|
| 743 | CreateLabel(frame);
|
|---|
| 744 |
|
|---|
| 745 | //
|
|---|
| 746 | // Map the window, set up the layout, etc.
|
|---|
| 747 | //
|
|---|
| 748 | #ifdef DEBUG
|
|---|
| 749 | cout << "MGCosy: Setting Size" << endl;
|
|---|
| 750 | #endif
|
|---|
| 751 | const Int_t w = 940;
|
|---|
| 752 | const Int_t h = 660;
|
|---|
| 753 | SetWMSizeHints(w, h, 1280, 900, 10, 10); // set the smallest and biggest size of the Main frame
|
|---|
| 754 |
|
|---|
| 755 | SetWindowName("Cosy Main Window");
|
|---|
| 756 | SetIconName("Cosy");
|
|---|
| 757 |
|
|---|
| 758 | #ifdef DEBUG
|
|---|
| 759 | cout << "MGCosy: Map Window" << endl;
|
|---|
| 760 | #endif
|
|---|
| 761 | MapSubwindows();
|
|---|
| 762 | Resize(w, h); //GetDefaultSize());
|
|---|
| 763 | MapWindow();
|
|---|
| 764 | }
|
|---|
| 765 |
|
|---|
| 766 | // ======================================================================
|
|---|
| 767 |
|
|---|
| 768 | MGCosy::~MGCosy()
|
|---|
| 769 | {
|
|---|
| 770 | cout << "MGCosy::~MGCosy called." << endl;
|
|---|
| 771 |
|
|---|
| 772 | delete fLayMenuBar;
|
|---|
| 773 | delete fLayMenuItem;
|
|---|
| 774 |
|
|---|
| 775 | cout << "Deleting MGCosy::fList" << endl;
|
|---|
| 776 |
|
|---|
| 777 | delete fList;
|
|---|
| 778 |
|
|---|
| 779 | cout << "MGCosy::~MGCosy done." << endl;
|
|---|
| 780 | }
|
|---|
| 781 |
|
|---|
| 782 | void MGCosy::SetLabelColor(TGLabel *label, Bool_t col)
|
|---|
| 783 | {
|
|---|
| 784 | ULong_t red, green;
|
|---|
| 785 |
|
|---|
| 786 | gClient->GetColorByName("Red", red);
|
|---|
| 787 | gClient->GetColorByName("Green", green);
|
|---|
| 788 |
|
|---|
| 789 | if (col && label->TestBit(BIT(14)))
|
|---|
| 790 | return;
|
|---|
| 791 |
|
|---|
| 792 | if (!col && !label->TestBit(BIT(14)))
|
|---|
| 793 | return;
|
|---|
| 794 |
|
|---|
| 795 | col ? label->SetBit(BIT(14)) : label->ResetBit(BIT(14));
|
|---|
| 796 |
|
|---|
| 797 | label->UnmapWindow();
|
|---|
| 798 | label->SetBackgroundColor(col ? green : red);
|
|---|
| 799 | label->MapWindow();
|
|---|
| 800 | }
|
|---|
| 801 |
|
|---|
| 802 | // ======================================================================
|
|---|
| 803 | void MGCosy::EnableLabel(TGLabel *label, Bool_t stat)
|
|---|
| 804 | {
|
|---|
| 805 | stat ? label->MapWindow() : label->UnmapWindow();
|
|---|
| 806 |
|
|---|
| 807 | /*
|
|---|
| 808 | TGGC *fRedTextGC(TGButton::GetDefaultGC())
|
|---|
| 809 | // Set foreground color in graphics context for drawing of
|
|---|
| 810 | // TGlabel and TGButtons with text in red.
|
|---|
| 811 | ULong_t red;
|
|---|
| 812 | gClient->GetColorByName("red", red);
|
|---|
| 813 | fRedTextGC.SetForeground(red);
|
|---|
| 814 | */
|
|---|
| 815 | }
|
|---|
| 816 |
|
|---|
| 817 | void MGCosy::UpdateRaDec(ZdAz &pos, double mjd, RaDec &radec)
|
|---|
| 818 | {
|
|---|
| 819 | static Int_t rai=~0;
|
|---|
| 820 | static Int_t deci=~0;
|
|---|
| 821 | static Int_t ras=~0;
|
|---|
| 822 | static Int_t decs=~0;
|
|---|
| 823 |
|
|---|
| 824 | static SlaStars sla(fObservatory);
|
|---|
| 825 | sla.SetMjd(mjd);
|
|---|
| 826 |
|
|---|
| 827 | RaDec rd = sla.CalcRaDec(pos*2*TMath::Pi()/360);
|
|---|
| 828 |
|
|---|
| 829 | char text[64];
|
|---|
| 830 |
|
|---|
| 831 | rd.Ra(rd.Ra() * 24/2/TMath::Pi());
|
|---|
| 832 | rd.Dec(rd.Dec()*360/2/TMath::Pi());
|
|---|
| 833 |
|
|---|
| 834 | radec.Ra(radec.Ra() * 24/2/TMath::Pi());
|
|---|
| 835 | radec.Dec(radec.Dec()*360/2/TMath::Pi());
|
|---|
| 836 |
|
|---|
| 837 | RaDec test = rd*600;
|
|---|
| 838 |
|
|---|
| 839 | if (rai!=(int)test.Ra())
|
|---|
| 840 | {
|
|---|
| 841 | rai = (int)test.Ra();
|
|---|
| 842 | sprintf(text, "%c%dh %.1fm", rd.Ra()<0?'-':'+', abs((int)rd.Ra()), 0.1*(abs((int)test.Ra())%600));
|
|---|
| 843 | fRaEst->SetText(new TGString(text));
|
|---|
| 844 | }
|
|---|
| 845 | if (deci!=(int)test.Dec())
|
|---|
| 846 | {
|
|---|
| 847 | deci = (int)test.Dec();
|
|---|
| 848 | sprintf(text, "%c%dd %.1fm", rd.Dec()<0?'-':'+' , abs((int)rd.Dec()), 0.1*(abs((int)test.Dec())%600));
|
|---|
| 849 | fDecEst->SetText(new TGString(text));
|
|---|
| 850 | }
|
|---|
| 851 |
|
|---|
| 852 | if (radec.Dec()>90|| radec.Dec()<-90)
|
|---|
| 853 | {
|
|---|
| 854 | radec.Ra(radec.Ra()+12);
|
|---|
| 855 | radec.Dec(180-radec.Dec());
|
|---|
| 856 | }
|
|---|
| 857 | radec.Ra(fmod((radec.Ra()+48), 24));
|
|---|
| 858 |
|
|---|
| 859 | test = radec*600;
|
|---|
| 860 |
|
|---|
| 861 | if (ras!=(int)test.Ra())
|
|---|
| 862 | {
|
|---|
| 863 | ras = (int)test.Ra();
|
|---|
| 864 | sprintf(text, "%c%dh %.1fm", radec.Ra()<0?'-':'+', abs((int)radec.Ra()), 0.1*(abs((int)test.Ra())%600));
|
|---|
| 865 | fRaSoll->SetText(new TGString(text));
|
|---|
| 866 | }
|
|---|
| 867 | if (decs!=(int)test.Dec())
|
|---|
| 868 | {
|
|---|
| 869 | decs = (int)test.Dec();
|
|---|
| 870 | sprintf(text, "%c%dd %.1fm", radec.Dec()<0?'-':'+' , abs((int)radec.Dec()), 0.1*(abs((int)test.Dec())%600));
|
|---|
| 871 | fDecSoll->SetText(new TGString(text));
|
|---|
| 872 | }
|
|---|
| 873 | }
|
|---|
| 874 |
|
|---|
| 875 | void MGCosy::UpdateOffset(ZdAz &off)
|
|---|
| 876 | {
|
|---|
| 877 | static Int_t zd=~0;
|
|---|
| 878 | static Int_t az=~0;
|
|---|
| 879 |
|
|---|
| 880 | char text[21];
|
|---|
| 881 |
|
|---|
| 882 | if (zd!=(Int_t)off.Zd())
|
|---|
| 883 | {
|
|---|
| 884 | zd = (Int_t)off.Zd();
|
|---|
| 885 | sprintf(text, "%dre", zd);
|
|---|
| 886 | fOffsetZd->SetText(new TGString(text));
|
|---|
| 887 | }
|
|---|
| 888 | if (az!=(Int_t)off.Az())
|
|---|
| 889 | {
|
|---|
| 890 | az = (Int_t)off.Az();
|
|---|
| 891 | sprintf(text, "%dre", az);
|
|---|
| 892 | fOffsetAz->SetText(new TGString(text));
|
|---|
| 893 | }
|
|---|
| 894 | }
|
|---|
| 895 |
|
|---|
| 896 | void MGCosy::UpdateZdAz(ZdAz &soll)
|
|---|
| 897 | {
|
|---|
| 898 | soll *= 360/2/TMath::Pi();
|
|---|
| 899 |
|
|---|
| 900 | static Int_t zd=~0;
|
|---|
| 901 | static Int_t az=~0;
|
|---|
| 902 |
|
|---|
| 903 | char text[21];
|
|---|
| 904 |
|
|---|
| 905 | ZdAz test = soll*600;
|
|---|
| 906 |
|
|---|
| 907 | if (zd!=(int)test.Zd())
|
|---|
| 908 | {
|
|---|
| 909 | zd = (int)test.Zd();
|
|---|
| 910 | sprintf(text, "%c%dd %.1fm", soll.Zd()<0?'-':'+', abs((int)soll.Zd()), 0.1*(abs((int)test.Zd())%600));
|
|---|
| 911 | fZdSoll->SetText(new TGString(text));
|
|---|
| 912 | }
|
|---|
| 913 | if (az!=(int)test.Az())
|
|---|
| 914 | {
|
|---|
| 915 | az = (int)test.Az();
|
|---|
| 916 | sprintf(text, "%c%dd %.1fm", soll.Az()<0?'-':'+' , abs((int)soll.Az()), 0.1*(abs((int)test.Az())%600));
|
|---|
| 917 | fAzSoll->SetText(new TGString(text));
|
|---|
| 918 | }
|
|---|
| 919 | }
|
|---|
| 920 |
|
|---|
| 921 | double MGCosy::UpdateTime()
|
|---|
| 922 | {
|
|---|
| 923 | Timer time;
|
|---|
| 924 | time.Now();
|
|---|
| 925 |
|
|---|
| 926 | static char oldtxt[256];
|
|---|
| 927 |
|
|---|
| 928 | char text[256];
|
|---|
| 929 |
|
|---|
| 930 | strcpy(text, time.GetTimeStr());
|
|---|
| 931 |
|
|---|
| 932 | char *dot = strrchr(text, '.');
|
|---|
| 933 |
|
|---|
| 934 | if (dot)
|
|---|
| 935 | dot[2] = 0;
|
|---|
| 936 |
|
|---|
| 937 | if (strcmp(oldtxt, text))
|
|---|
| 938 | {
|
|---|
| 939 | fUtc->SetText(new TGString(text));
|
|---|
| 940 | strcpy(oldtxt, text);
|
|---|
| 941 | }
|
|---|
| 942 |
|
|---|
| 943 | static long oldmjd;
|
|---|
| 944 | double mjd = time.GetMjd();
|
|---|
| 945 |
|
|---|
| 946 | if (oldmjd != 1000000*mjd)
|
|---|
| 947 | {
|
|---|
| 948 | sprintf(text, "%12.6f", mjd);
|
|---|
| 949 | fMjd->SetText(new TGString(text));
|
|---|
| 950 |
|
|---|
| 951 | oldmjd = (long)(1000000*mjd);
|
|---|
| 952 | }
|
|---|
| 953 |
|
|---|
| 954 | return mjd;
|
|---|
| 955 | }
|
|---|
| 956 |
|
|---|
| 957 | void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec,
|
|---|
| 958 | ZdAz soll, UInt_t stat, UInt_t stat2)
|
|---|
| 959 | {
|
|---|
| 960 | double mjd = UpdateTime();
|
|---|
| 961 | fSkyPosition->Update(pos, mjd);
|
|---|
| 962 | fAccuracy->Update(pos, acc);
|
|---|
| 963 | fVelocity->Update(vel);
|
|---|
| 964 | UpdateOffset(off);
|
|---|
| 965 | UpdateRaDec(pos, mjd, radec);
|
|---|
| 966 | UpdateZdAz(soll);
|
|---|
| 967 |
|
|---|
| 968 | #define kError 0x01
|
|---|
| 969 | #define kMoving 0x02
|
|---|
| 970 | #define kTracking 0x04
|
|---|
| 971 | #define kStopping 0x08
|
|---|
| 972 | #define kStopped 0x10
|
|---|
| 973 |
|
|---|
| 974 | EnableLabel(fError, stat&kError);
|
|---|
| 975 | EnableLabel(fMoving, stat&kMoving);
|
|---|
| 976 | EnableLabel(fTracking, stat&kTracking);
|
|---|
| 977 | EnableLabel(fStopping, stat&kStopping);
|
|---|
| 978 | EnableLabel(fStopped, stat&kStopped);
|
|---|
| 979 | EnableLabel(fRaSoll, stat&kTracking);
|
|---|
| 980 | EnableLabel(fDecSoll, stat&kTracking);
|
|---|
| 981 | EnableLabel(fZdSoll, stat&kMoving);
|
|---|
| 982 | EnableLabel(fAzSoll, stat&kMoving);
|
|---|
| 983 |
|
|---|
| 984 | SetLabelColor(fAvailMac1, stat2&0x01);
|
|---|
| 985 | SetLabelColor(fAvailMac2, stat2&0x02);
|
|---|
| 986 | SetLabelColor(fAvailMac3, stat2&0x04);
|
|---|
| 987 | SetLabelColor(fAvailSe1, stat2&0x08);
|
|---|
| 988 | SetLabelColor(fAvailSe2, stat2&0x10);
|
|---|
| 989 | SetLabelColor(fAvailSe3, stat2&0x20);
|
|---|
| 990 |
|
|---|
| 991 | stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow();
|
|---|
| 992 | stat&kTracking ? fVelocity->MapWindow() : fVelocity->UnmapWindow();
|
|---|
| 993 | // stat&kTracking ? fOffset->MapWindow() : fOffset->UnmapWindow();
|
|---|
| 994 |
|
|---|
| 995 | if (fLog->TestBit(kHasChanged))
|
|---|
| 996 | {
|
|---|
| 997 | fLog->MapSubwindows();
|
|---|
| 998 | fLog->Layout();
|
|---|
| 999 | fLog->ResetBit(kHasChanged);
|
|---|
| 1000 | }
|
|---|
| 1001 | }
|
|---|
| 1002 | // ======================================================================
|
|---|
| 1003 |
|
|---|
| 1004 | void MGCosy::CloseWindow()
|
|---|
| 1005 | {
|
|---|
| 1006 | // Got close message for this MainFrame. Calls parent CloseWindow()
|
|---|
| 1007 | // (which destroys the window) and terminate the application.
|
|---|
| 1008 | // The close message is generated by the window manager when its close
|
|---|
| 1009 | // window menu item is selected.
|
|---|
| 1010 |
|
|---|
| 1011 | // gSystem->ExitLoop();
|
|---|
| 1012 | // gSystem->DispatchOneEvent(kTRUE);
|
|---|
| 1013 |
|
|---|
| 1014 | // TGMainFrame::CloseWindow();
|
|---|
| 1015 | cout << "Closing window - waiting until all nodes are stopped." << endl;
|
|---|
| 1016 | fQueue->PostMsg(WM_QUIT, 0, 0);
|
|---|
| 1017 | cout << "Closing window - done." << endl;
|
|---|
| 1018 | // gApplication->Terminate(0);
|
|---|
| 1019 | }
|
|---|
| 1020 |
|
|---|
| 1021 | void MGCosy::StartTrack()
|
|---|
| 1022 | {
|
|---|
| 1023 | cout << "Start tracking." << endl;
|
|---|
| 1024 |
|
|---|
| 1025 | XY xy = fCRaDec->GetCoordinates();
|
|---|
| 1026 | RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø]
|
|---|
| 1027 |
|
|---|
| 1028 | cout << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
|
|---|
| 1029 |
|
|---|
| 1030 | fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
|
|---|
| 1031 |
|
|---|
| 1032 | cout << "PostMsg (WM_Track) returned." << endl;
|
|---|
| 1033 | }
|
|---|
| 1034 |
|
|---|
| 1035 | void MGCosy::StartPos()
|
|---|
| 1036 | {
|
|---|
| 1037 | cout << "Start positioning." << endl;
|
|---|
| 1038 |
|
|---|
| 1039 | XY xy = fCZdAz->GetCoordinates();
|
|---|
| 1040 | ZdAz dest(xy.X(), xy.Y());
|
|---|
| 1041 |
|
|---|
| 1042 | cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl;
|
|---|
| 1043 |
|
|---|
| 1044 | fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest));
|
|---|
| 1045 |
|
|---|
| 1046 | cout << "PostMsg (WM_Position) returned." << endl;
|
|---|
| 1047 | }
|
|---|
| 1048 |
|
|---|
| 1049 | //
|
|---|
| 1050 | // ************************** For demo purpose **********************
|
|---|
| 1051 | //
|
|---|
| 1052 | #include <TRandom.h>
|
|---|
| 1053 | class MDemo : public MThread
|
|---|
| 1054 | {
|
|---|
| 1055 | private:
|
|---|
| 1056 | MsgQueue *fQueue;
|
|---|
| 1057 | TRandom fRand;
|
|---|
| 1058 |
|
|---|
| 1059 | public:
|
|---|
| 1060 | MDemo() : MThread(false) {}
|
|---|
| 1061 |
|
|---|
| 1062 | void SetQueue(MsgQueue *q) { fQueue = q; }
|
|---|
| 1063 |
|
|---|
| 1064 | virtual void *Thread()
|
|---|
| 1065 | {
|
|---|
| 1066 | while (1)
|
|---|
| 1067 | {
|
|---|
| 1068 | Timer tm;
|
|---|
| 1069 | tm.Now();
|
|---|
| 1070 | /*
|
|---|
| 1071 | Float_t h = 2.+tm.H()+(10.7+tm.M())/60.;
|
|---|
| 1072 | RaDec dest(h*15, 129.7);
|
|---|
| 1073 |
|
|---|
| 1074 | cout << dest.Ra()/15 << "h " << dest.Dec() << "°" << endl;
|
|---|
| 1075 |
|
|---|
| 1076 | fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
|
|---|
| 1077 |
|
|---|
| 1078 | int i = 0;
|
|---|
| 1079 | while (!HasStopFlag() && i++<60) // 2.5min
|
|---|
| 1080 | usleep(1000000);
|
|---|
| 1081 | if (HasStopFlag())
|
|---|
| 1082 | break;
|
|---|
| 1083 | */
|
|---|
| 1084 |
|
|---|
| 1085 | //fQueue->PostMsg(WM_STOP, 0, 0);
|
|---|
| 1086 |
|
|---|
| 1087 | ZdAz dest1((float)fRand.Integer(120)-60., 0);//fRand.Integer(25)+90);
|
|---|
| 1088 |
|
|---|
| 1089 | cout << "Demo: Zd=" << dest1.Zd() << "° Az=" << dest1.Az() << "°" << endl;
|
|---|
| 1090 |
|
|---|
| 1091 | fQueue->PostMsg(WM_POSITION, &dest1, sizeof(dest1));
|
|---|
| 1092 |
|
|---|
| 1093 | int i = 0;
|
|---|
| 1094 | while (!HasStopFlag() && i++<5/*5*/) // 30s
|
|---|
| 1095 | usleep(1000000);
|
|---|
| 1096 | if (HasStopFlag())
|
|---|
| 1097 | break;
|
|---|
| 1098 |
|
|---|
| 1099 | //ZdAz dest2(5, 30);
|
|---|
| 1100 | //fQueue->PostMsg(WM_POSITION, &dest2, sizeof(dest2));
|
|---|
| 1101 | /*
|
|---|
| 1102 | i = 0;
|
|---|
| 1103 | while (!HasStopFlag() && i++<30) // 30s
|
|---|
| 1104 | usleep(1000000);
|
|---|
| 1105 | */
|
|---|
| 1106 | //if (HasStopFlag())
|
|---|
| 1107 | // break;
|
|---|
| 1108 | }
|
|---|
| 1109 | cout << "Demo Thread: done." << endl;
|
|---|
| 1110 | return NULL;
|
|---|
| 1111 | }
|
|---|
| 1112 | };
|
|---|
| 1113 |
|
|---|
| 1114 | MDemo demo;
|
|---|
| 1115 |
|
|---|
| 1116 | void MGCosy::StartDemo()
|
|---|
| 1117 | {
|
|---|
| 1118 | cout << "Start Demo." << endl;
|
|---|
| 1119 |
|
|---|
| 1120 | demo.SetQueue(fQueue);
|
|---|
| 1121 | demo.Start();
|
|---|
| 1122 |
|
|---|
| 1123 | cout << "PostMsg (WM_Demo) returned." << endl;
|
|---|
| 1124 | }
|
|---|
| 1125 |
|
|---|
| 1126 | void StopDemo()
|
|---|
| 1127 | {
|
|---|
| 1128 | cout << "Stopping demo." << endl;
|
|---|
| 1129 | demo.Stop();
|
|---|
| 1130 | }
|
|---|
| 1131 |
|
|---|
| 1132 | void MGCosy::StartCalib()
|
|---|
| 1133 | {
|
|---|
| 1134 | cout << "Start Calibration." << endl;
|
|---|
| 1135 |
|
|---|
| 1136 | XY xy = fCCalib->GetCoordinates();
|
|---|
| 1137 | RaDec pos(xy.X()*360/24, xy.Y());
|
|---|
| 1138 |
|
|---|
| 1139 | fQueue->PostMsg(WM_CALIB, &pos, sizeof(pos));
|
|---|
| 1140 |
|
|---|
| 1141 | cout << "PostMsg (WM_Calib) returned." << endl;
|
|---|
| 1142 | }
|
|---|
| 1143 |
|
|---|
| 1144 | void MGCosy::StartTPoint()
|
|---|
| 1145 | {
|
|---|
| 1146 | cout << "Start writing tpoint pair." << endl;
|
|---|
| 1147 |
|
|---|
| 1148 | XY xy = fCCalib->GetCoordinates();
|
|---|
| 1149 | RaDec pos(xy.X()*360/24, xy.Y());
|
|---|
| 1150 |
|
|---|
| 1151 | //fQueue->PostMsg(WM_TPOINT, &pos, sizeof(pos));
|
|---|
| 1152 | fQueue->Proc(WM_TPOINT, &pos);
|
|---|
| 1153 |
|
|---|
| 1154 | cout << "PostMsg (WM_TPoint) returned." << endl;
|
|---|
| 1155 | }
|
|---|
| 1156 | //
|
|---|
| 1157 | // ******************************************************************
|
|---|
| 1158 | //
|
|---|
| 1159 |
|
|---|
| 1160 | Bool_t MGCosy::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
|
|---|
| 1161 | {
|
|---|
| 1162 | //
|
|---|
| 1163 | // This processing is serialized!
|
|---|
| 1164 | //
|
|---|
| 1165 | switch (GET_MSG(msg))
|
|---|
| 1166 | {
|
|---|
| 1167 | case kC_COMMAND:
|
|---|
| 1168 | switch (GET_SUBMSG(msg))
|
|---|
| 1169 | {
|
|---|
| 1170 | case kCM_COMBOBOX:
|
|---|
| 1171 | if (mp1==kCB_PredefPos)
|
|---|
| 1172 | {
|
|---|
| 1173 | MStar *pos = fStarList[mp2];
|
|---|
| 1174 | if (!pos)
|
|---|
| 1175 | return kTRUE;
|
|---|
| 1176 | fCZdAz->SetCoordinates(ZdAz(pos->GetX(), pos->GetY()));
|
|---|
| 1177 | }
|
|---|
| 1178 | return kTRUE;
|
|---|
| 1179 |
|
|---|
| 1180 | case kCM_TAB:
|
|---|
| 1181 | //cout << "Tab: " << mp1 << endl;
|
|---|
| 1182 | return kTRUE;
|
|---|
| 1183 |
|
|---|
| 1184 | case kCM_BUTTON:
|
|---|
| 1185 |
|
|---|
| 1186 | switch (mp1)
|
|---|
| 1187 | {
|
|---|
| 1188 | /*
|
|---|
| 1189 | case kPB_POSITION:
|
|---|
| 1190 | Start(0);
|
|---|
| 1191 | return kTRUE;
|
|---|
| 1192 |
|
|---|
| 1193 | case kPB_TRACK:
|
|---|
| 1194 | Start(1);
|
|---|
| 1195 | return kTRUE;
|
|---|
| 1196 | */
|
|---|
| 1197 | case kPB_START:
|
|---|
| 1198 | switch (fTab->GetCurrent())
|
|---|
| 1199 | {
|
|---|
| 1200 | case 0:
|
|---|
| 1201 | StartPos();
|
|---|
| 1202 | return kTRUE;
|
|---|
| 1203 | case 1:
|
|---|
| 1204 | StartTrack();
|
|---|
| 1205 | return kTRUE;
|
|---|
| 1206 | case 2:
|
|---|
| 1207 | fCRaDec->SetCoordinates(fCCalib->GetCoordinates());
|
|---|
| 1208 | return kTRUE;
|
|---|
| 1209 | case 3:
|
|---|
| 1210 | fQueue->Proc(WM_TESTSE, (void*)1);
|
|---|
| 1211 | return kTRUE;
|
|---|
| 1212 | case 4:
|
|---|
| 1213 | fQueue->Proc(WM_GEAR, (void*)1);
|
|---|
| 1214 | return kTRUE;
|
|---|
| 1215 | case 5:
|
|---|
| 1216 | StartDemo();
|
|---|
| 1217 | return kTRUE;
|
|---|
| 1218 | }
|
|---|
| 1219 | return kTRUE;
|
|---|
| 1220 |
|
|---|
| 1221 | case kPB_STOP:
|
|---|
| 1222 | cout << "Sending stop movement msg." << endl;
|
|---|
| 1223 | StopDemo();
|
|---|
| 1224 | fQueue->PostMsg(WM_STOP, 0, 0);
|
|---|
| 1225 | if (fTab->GetCurrent()==3)
|
|---|
| 1226 | fQueue->Proc(WM_TESTSE, NULL);
|
|---|
| 1227 | if (fTab->GetCurrent()==4)
|
|---|
| 1228 | fQueue->Proc(WM_GEAR, NULL);
|
|---|
| 1229 | cout << "PostMsg (WM_Stop) returned." << endl;
|
|---|
| 1230 | return kTRUE;
|
|---|
| 1231 |
|
|---|
| 1232 | case kPB_CALCALTAZ:
|
|---|
| 1233 | {
|
|---|
| 1234 | XY xy = fCRaDec->GetCoordinates();
|
|---|
| 1235 | fQueue->Proc(WM_CALCALTAZ, &xy);
|
|---|
| 1236 | }
|
|---|
| 1237 | return kTRUE;
|
|---|
| 1238 |
|
|---|
| 1239 | case kPB_RAp:
|
|---|
| 1240 | case kPB_RAm:
|
|---|
| 1241 | case kPB_DECp:
|
|---|
| 1242 | case kPB_DECm:
|
|---|
| 1243 | {
|
|---|
| 1244 | XY xy = fCRaDec->GetCoordinates();
|
|---|
| 1245 | switch (mp1)
|
|---|
| 1246 | {
|
|---|
| 1247 | case kPB_RAp:
|
|---|
| 1248 | xy.X(xy.X()+1./60);
|
|---|
| 1249 | break;
|
|---|
| 1250 | case kPB_RAm:
|
|---|
| 1251 | xy.X(xy.X()-1./60);
|
|---|
| 1252 | break;
|
|---|
| 1253 | case kPB_DECp:
|
|---|
| 1254 | xy.Y(xy.Y()+1./60);
|
|---|
| 1255 | break;
|
|---|
| 1256 | case kPB_DECm:
|
|---|
| 1257 | xy.Y(xy.Y()-1./60);
|
|---|
| 1258 | break;
|
|---|
| 1259 | }
|
|---|
| 1260 | RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø]
|
|---|
| 1261 | fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
|
|---|
| 1262 | //fQueue->Proc(WM_NEWTRACK, &dest);
|
|---|
| 1263 | fCRaDec->SetCoordinates(xy);
|
|---|
| 1264 |
|
|---|
| 1265 | cout << "New Ra/Dec: " << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
|
|---|
| 1266 | }
|
|---|
| 1267 | return kTRUE;
|
|---|
| 1268 |
|
|---|
| 1269 | case kPB_TPOINT:
|
|---|
| 1270 | StartTPoint();
|
|---|
| 1271 | return kTRUE;
|
|---|
| 1272 | case kPB_CALIBSE:
|
|---|
| 1273 | StartCalib();
|
|---|
| 1274 | return kTRUE;
|
|---|
| 1275 | case kPB_LoadBending:
|
|---|
| 1276 | fQueue->Proc(WM_LOADBENDING, NULL);
|
|---|
| 1277 | return kTRUE;
|
|---|
| 1278 | case kPB_ResetBending:
|
|---|
| 1279 | fQueue->Proc(WM_RESETBENDING, NULL);
|
|---|
| 1280 | return kTRUE;
|
|---|
| 1281 | case kPB_HOME:
|
|---|
| 1282 | fQueue->PostMsg(WM_HOME, 0, 0);
|
|---|
| 1283 | return kTRUE;
|
|---|
| 1284 | case kPB_DISPLAY1:
|
|---|
| 1285 | case kPB_DISPLAY2:
|
|---|
| 1286 | fQueue->PostMsg(WM_DISPLAY, 0, 0);
|
|---|
| 1287 | return kTRUE;
|
|---|
| 1288 |
|
|---|
| 1289 | default:
|
|---|
| 1290 | return kTRUE;
|
|---|
| 1291 | }
|
|---|
| 1292 | return kTRUE;
|
|---|
| 1293 |
|
|---|
| 1294 | case kCM_MENU:
|
|---|
| 1295 |
|
|---|
| 1296 | switch (mp1)
|
|---|
| 1297 | {
|
|---|
| 1298 | case IDM_EXIT:
|
|---|
| 1299 | cout << "IDM_EXIT: Posting WM_QUIT." << endl;
|
|---|
| 1300 | fQueue->PostMsg(WM_QUIT, 0, 0);
|
|---|
| 1301 | cout << "IDM_EXIT: WM_QUIT done." << endl;
|
|---|
| 1302 | //cout << "Idm_Exit." << endl;
|
|---|
| 1303 | //CloseWindow();
|
|---|
| 1304 | return kTRUE;
|
|---|
| 1305 | case IDM_ASPECT:
|
|---|
| 1306 | Int_t w = GetWidth();
|
|---|
| 1307 | Int_t h = GetHeight();
|
|---|
| 1308 | if (w>940*h/660)
|
|---|
| 1309 | w = 940*h/660;
|
|---|
| 1310 | else
|
|---|
| 1311 | h = 660*w/940;
|
|---|
| 1312 | Resize(w, h);
|
|---|
| 1313 | return kTRUE;
|
|---|
| 1314 | }
|
|---|
| 1315 | return kTRUE;
|
|---|
| 1316 | }
|
|---|
| 1317 | }
|
|---|
| 1318 |
|
|---|
| 1319 | //
|
|---|
| 1320 | // Start a thread to process the message.
|
|---|
| 1321 | //
|
|---|
| 1322 | // fQueue->PostMsg(msg, mp1, mp2);
|
|---|
| 1323 | return kTRUE;
|
|---|
| 1324 |
|
|---|
| 1325 | }
|
|---|