Ignore:
Timestamp:
07/17/03 00:25:48 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/gui/MGCosy.cc

    r2278 r2280  
    11#include "MGCosy.h"
    22
     3#include <iomanip.h>
    34#include <iostream.h>
    45
    56#include "msgqueue.h"
    67#include "coord.h"
     8#include "slalib.h"
    79
    810#include <TROOT.h>
     
    6466    kCB_PredefPos,
    6567    kCB_StarList,
     68    kPB_SavePreDef,
     69    kPB_SaveStar,
    6670
    6771    // kLog
     
    323327    while (1)
    324328    {
     329        Double_t zd, az;
     330        fin >> zd >> az;
     331
    325332        TString str;
    326         Double_t zd, az;
    327         fin >> str >> zd >> az;
     333        str.ReadLine(fin);
    328334        if (!fin)
    329335            break;
     336
    330337        box->AddEntry(str, i++);
    331 
    332         fStarList.Add(zd, az);
     338        fPreDefList.Add(zd, az);
    333339    }
    334340}
     
    336342void MGCosy::CreateStarList(TGCompositeFrame *tf1)
    337343{
    338     /*
    339344    TGComboBox *box = new TGComboBox(tf1, kCB_StarList);
    340     box->Resize(120, 20);
     345    box->Resize(170, 20);
    341346    box->Associate(this);
    342347
    343348    TGLayoutHints *lay = new TGLayoutHints(kLHintsLeft|kLHintsTop,
    344                                            27, 0, 200, 0);
     349                                           27, 0, 70, 0);
    345350    tf1->AddFrame(box, lay);
    346351
     
    358363    while (1)
    359364    {
    360         TString str;
    361365        Int_t h, m, s, d, am, as;
    362366        fin >> h >> m >> s >> d >> am >> as;
     367
     368        TString str;
     369        str.ReadLine(fin);
    363370        if (!fin)
    364371            break;
     
    366373        box->AddEntry(str, i++);
    367374
    368         fStarList.Add(zd, az);
    369         }
    370         */
     375        fStarList.Add(Slalib::Hms2Hor(h, m, s), Slalib::Dms2Deg(d, am, as));
     376    }
    371377}
    372378
     
    513519    fList->Add(but);
    514520
     521    but = new TGTextButton(tf4, "TPoint", kPB_TPOINT);
     522    but->Resize(50, 25);
     523    but->Move(176/*231*/, 213);
     524    but->SetToolTipText("Trigger writing a tpoint coordinate pair.");
     525    but->Associate(this);
     526    fList->Add(but);
     527
    515528#ifdef EXPERT
     529    but= new TGTextButton(tf1, "New Position",  kPB_SavePreDef);
     530    but->Resize(80, 25);
     531    but->Move(165, 197);
     532    but->SetToolTipText("Save new predefined position.");
     533    but->Associate(this);
     534    fList->Add(but);
     535
     536    but= new TGTextButton(tf4, "New", kPB_SaveStar);
     537    but->Resize(60, 23);
     538    but->Move(211, 69);
     539    but->SetToolTipText("Save new Source position.");
     540    but->Associate(this);
     541    fList->Add(but);
     542
    516543    but = new TGTextButton(tf5, "Display", kPB_DISPLAY1);
    517544    but->Resize(80, 25);
     
    528555    fList->Add(but);
    529556
    530     /*
    531     but = new TGTextButton(tf4, "Calib SE", kPB_CALIBSE);
    532     but->Resize(80, 25);
    533     but->Move(160, 197);
    534     but->SetToolTipText("Set SE to given coordinates.");
    535     but->Associate(this);
    536     fList->Add(but);
    537     */
    538 #ifdef EXPERT
    539557    but = new TGTextButton(tf4, "Load", kPB_LoadBending);
    540558    but->Resize(50, 25);
     
    548566    but->Move(206, 185);
    549567    but->SetToolTipText("Reset bending correction (coefficients=0)");
    550     but->Associate(this);
    551     fList->Add(but);
    552 #endif EXPERT
    553 
    554     but = new TGTextButton(tf4, "TPoint", kPB_TPOINT);
    555     but->Resize(50, 25);
    556     but->Move(176/*231*/, 213);
    557     but->SetToolTipText("Trigger writing a tpoint coordinate pair.");
    558568    but->Associate(this);
    559569    fList->Add(but);
     
    893903    char text[64];
    894904
    895     rd.Ra(rd.Ra()  * 24/2/TMath::Pi());
    896     rd.Dec(rd.Dec()*360/2/TMath::Pi());
    897 
    898     radec.Ra(radec.Ra()  * 24/2/TMath::Pi());
    899     radec.Dec(radec.Dec()*360/2/TMath::Pi());
     905    UShort_t h, d;
     906    Double_t hm, dm;
     907    Char_t   sh, sd;
     908
     909    // Calculate Display values
     910    Slalib::Rad2Hm(rd.Ra(),  sh, h, hm);
     911    Slalib::Rad2Dm(rd.Dec(), sd, d, dm);
     912
     913    rd.Ra(rd.Ra()  * 12/TMath::Pi());
     914    rd.Dec(rd.Dec()*180/TMath::Pi());
    900915
    901916    RaDec test = rd*600;
    902 
    903917    if (rai!=(int)test.Ra())
    904918    {
    905919        rai = (int)test.Ra();
    906         sprintf(text, "%c%dh %.1fm", rd.Ra()<0?'-':'+', abs((int)rd.Ra()), 0.1*(abs((int)test.Ra())%600));
     920        //sprintf(text, "%c%dh %.1fm", rd.Ra()<0?'-':'+', abs((int)rd.Ra()), 0.1*(abs((int)test.Ra())%600));
     921        sprintf(text, "%c%dh %.1fm", sh, h, hm);
    907922        fRaEst->SetText(new TGString(text));
    908923    }
     
    910925    {
    911926        deci = (int)test.Dec();
    912         sprintf(text, "%c%dd %.1fm", rd.Dec()<0?'-':'+' , abs((int)rd.Dec()), 0.1*(abs((int)test.Dec())%600));
     927        //sprintf(text, "%c%dd %.1fm", rd.Dec()<0?'-':'+' , abs((int)rd.Dec()), 0.1*(abs((int)test.Dec())%600));
     928        sprintf(text, "%c%dh %.1fm", sd, d, dm);
    913929        fDecEst->SetText(new TGString(text));
    914930    }
    915931
     932    // Align RaDec
     933    radec.Ra(radec.Ra()  * 12/TMath::Pi());
     934    radec.Dec(radec.Dec()*180/TMath::Pi());
    916935    if (radec.Dec()>90|| radec.Dec()<-90)
    917936    {
     
    921940    radec.Ra(fmod((radec.Ra()+48), 24));
    922941
     942    // Calculate display values
     943    Slalib::Hor2Hm(radec.Ra(),  sh, h, hm);
     944    Slalib::Deg2Dm(radec.Dec(), sd, d, dm);
     945
    923946    test = radec*600;
    924 
    925947    if (ras!=(int)test.Ra())
    926948    {
    927949        ras = (int)test.Ra();
    928         sprintf(text, "%c%dh %.1fm", radec.Ra()<0?'-':'+', abs((int)radec.Ra()), 0.1*(abs((int)test.Ra())%600));
     950        //sprintf(text, "%c%dh %.1fm", radec.Ra()<0?'-':'+', abs((int)radec.Ra()), 0.1*(abs((int)test.Ra())%600));
     951        sprintf(text, "%c%dh %.1fm", sh, h, hm);
    929952        fRaSoll->SetText(new TGString(text));
    930953    }
     
    932955    {
    933956        decs = (int)test.Dec();
    934         sprintf(text, "%c%dd %.1fm", radec.Dec()<0?'-':'+' , abs((int)radec.Dec()), 0.1*(abs((int)test.Dec())%600));
     957        //sprintf(text, "%c%dd %.1fm", radec.Dec()<0?'-':'+' , abs((int)radec.Dec()), 0.1*(abs((int)test.Dec())%600));
     958        sprintf(text, "%c%dh %.1fm", sd, d, dm);
    935959        fDecSoll->SetText(new TGString(text));
    936960    }
     
    12651289        {
    12661290        case kCM_COMBOBOX:
    1267             if (mp1==kCB_PredefPos)
     1291            switch (mp1)
    12681292            {
    1269                 MStar *pos = fStarList[mp2];
    1270                 if (!pos)
     1293            case kCB_PredefPos:
     1294                {
     1295                    MStar *pos = fPreDefList[mp2];
     1296                    if (pos)
     1297                        fCZdAz->SetCoordinates(ZdAz(pos->GetX(), pos->GetY()));
    12711298                    return kTRUE;
    1272                 fCZdAz->SetCoordinates(ZdAz(pos->GetX(), pos->GetY()));
     1299                }
     1300            case kCB_StarList:
     1301                {
     1302                    MStar *pos = fStarList[mp2];
     1303                    if (pos)
     1304                        fCCalib->SetCoordinates(RaDec(pos->GetX(), pos->GetY()));
     1305                    return kTRUE;
     1306                }
    12731307            }
    12741308            return kTRUE;
     
    13331367                    XY xy = fCRaDec->GetCoordinates();
    13341368                    fQueue->Proc(WM_CALCALTAZ, &xy);
     1369                }
     1370                return kTRUE;
     1371
     1372            case kPB_SavePreDef:
     1373                {
     1374                    ofstream fout("prepos.txt", ios::app);
     1375                    XY za = fCZdAz->GetCoordinates();
     1376                    fout << setprecision(7) << za.X() << " \t" << za.Y();
     1377                    fout << " New Position" << endl;
     1378                }
     1379                return kTRUE;
     1380            case kPB_SaveStar:
     1381                {
     1382                    ofstream fout("stars.txt", ios::app);
     1383                    XY za = fCCalib->GetCoordinates();
     1384
     1385                    UShort_t d, m, s;
     1386                    Char_t sgn;
     1387                    Slalib::Deg2Dms(za.X(), sgn, d, m, s);
     1388                    if (sgn=='-') fout << sgn;
     1389                    fout << d << " " << m << " " << s << " \t";
     1390                    Slalib::Deg2Dms(za.Y(), sgn, d, m, s);
     1391                    if (sgn=='-') fout << sgn;
     1392                    fout << d << " " << m << " " << s << " \t";
     1393                    fout << " New Star/Source" << endl;
    13351394                }
    13361395                return kTRUE;
  • trunk/MagicSoft/Cosy/gui/MGCosy.h

    r2278 r2280  
    6565    TGLabel       *fMjd;
    6666
     67    MStarList     fPreDefList;
    6768    MStarList     fStarList;
    6869
  • trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc

    r2278 r2280  
    318318    SetLin2(x+dy, y-dx, x-dy, y+dx);
    319319
    320     //if (zd<80)
    321     //{
    322         for(int i=0; i<3; i++)
    323             SetDot(fDot[i], radec, i-3);
    324         for(int i=3; i<6; i++)
    325             SetDot(fDot[i], radec, i-2);
    326     //}
     320    for(int i=0; i<3; i++)
     321        SetDot(fDot[i], radec, i-3);
     322    for(int i=3; i<6; i++)
     323        SetDot(fDot[i], radec, i-2);
    327324
    328325    SetModified();
     
    334331    static int Y = ~0;
    335332
    336     int xd = (int)/*floor*/(x);
    337     int yd = (int)/*floor*/(y);
    338     x *= 60.;
    339     y *= 60.;
    340 
    341     int fx = (int)/*floor*/(x*10.);
    342     int fy = (int)/*floor*/(y*10.);
     333    UShort_t xd, yd;
     334    Char_t   sx, sy;
     335    Double_t xm, ym;
     336    Slalib::Deg2Dm(x, sx, xd, xm);
     337    Slalib::Deg2Dm(y, sy, yd, ym);
     338
     339    const int fx = (int)(x*600);
     340    const int fy = (int)(y*600);
    343341
    344342    if (X==fx && Y==fy)
     
    348346    Y = fy;
    349347
    350     float xm = fmod(fabs(x), 60.);
    351     float ym = fmod(fabs(y), 60.);
    352 
    353348    char txt[100];
    354     sprintf(txt, "Zd=%s%d\xb0%02.1f'", x<0?"-":"", abs(xd), xm);
     349    sprintf(txt, "Zd=%s%d\xb0%02.1f'", sx=='-'?"-":"", xd, xm);
    355350    fText1->SetText(fText1->GetX(), fText1->GetY(), txt);
    356351
    357     sprintf(txt, "Az=%s%d\xb0%02.1f'", y<0?"-":"", abs(yd), ym);
     352    sprintf(txt, "Az=%s%d\xb0%02.1f'", sy=='-'?"-":"", yd, ym);
    358353    fText2->SetText(fText2->GetX(), fText2->GetY(), txt);
    359354
Note: See TracChangeset for help on using the changeset viewer.