Ignore:
Timestamp:
04/11/02 13:20:10 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r1111 r1273  
    1616
    1717#include "coord.h"
     18#include "SlaStars.h"
    1819#include "SlaPlanets.h"
    1920
    2021ClassImp(MGSkyPosition);
     22
     23void MGSkyPosition::InitArc(TArc *arc, Int_t fillstyle, Int_t fillcolor, Int_t linecolor)
     24{
     25    arc->SetFillStyle(fillstyle);      // (s. TAttFill)
     26    arc->SetFillColor(fillcolor);      // (s. TAttFill)
     27    arc->SetLineColor(linecolor);
     28    arc->Draw();
     29}
    2130
    2231void MGSkyPosition::InitPlanets()
     
    3443    //   Neptun     7.8
    3544    //
    36     fSlalib = new SlaPlanets;
     45    fSlaPlanet = new SlaPlanets;
     46    fSlaStar   = new SlaStars;
    3747
    3848    //
     
    4151    //   1, 12, 13, 14, 15, 16, 17, 18, 19, 10
    4252    //
    43     fMars = new TArc(0, 0, 1);
    44     fMars->SetFillStyle(1001);     // solid      (s. TAttFill)
    45     fMars->SetFillColor(13);       // light grey (s. TAttFill)
    46     fMars->SetLineColor(12);
    47     fMars->Draw();
    48 
    49     fVenus = new TArc(0, 0, 2);
    50     fVenus->SetFillStyle(1001);    // solid      (s. TAttFill)
    51     fVenus->SetFillColor(15);      // light grey (s. TAttFill)
    52     fVenus->SetLineColor(14);
    53     fVenus->Draw();
    54 
     53    fMars    = new TArc(0, 0, 1);
     54    fVenus   = new TArc(0, 0, 2);
    5555    fJupiter = new TArc(0, 0, 2);
    56     fJupiter->SetFillStyle(1001);  // solid      (s. TAttFill)
    57     fJupiter->SetFillColor(17);    // light grey (s. TAttFill)
    58     fJupiter->SetLineColor(16);
    59     fJupiter->Draw();
    60 
    61     fMoon = new TArc(0, 0, 3, 290, 70);
    62     fMoon->SetFillStyle(1001);     // solid      (s. TAttFill)
    63     fMoon->SetFillColor(19);       // light grey (s. TAttFill)
    64     fMoon->SetLineColor(15);
    65     fMoon->Draw();
     56    fMoon    = new TArc(0, 0, 3, 290, 70);
     57    fSun     = new TArc(0, 0, 2);
     58
     59    InitArc(fMars,    1001, 13, 12);
     60    InitArc(fVenus,   1001, 15, 14);
     61    InitArc(fJupiter, 1001, 17, 16);
     62    InitArc(fMoon,    1001, 19, 15);
     63    InitArc(fSun,     1001, 10, 19);
    6664
    6765    for (int i=0; i<4; i++)
     
    7472        fList->Add(fSunL[i]);
    7573    }
    76 
    77     fSun = new TArc(0, 0, 2);
    78     fSun->SetFillStyle(1001);     // solid      (s. TAttFill)
    79     fSun->SetFillColor(10);       // white      (s. TAttFill)
    80     fSun->SetLineColor(19);
    81     fSun->Draw();
    8274
    8375    fList->Add(fMars);
     
    168160    fList->Add(fLin1b);
    169161    fList->Add(fLin2);
     162
     163    for (int i=0; i<6; i++)
     164    {
     165        fDot[i] = new TArc(0, 0, 1);
     166        InitArc(fDot[i], 1001, 10, 19);
     167        fList->Add(fDot[i]);
     168    }
    170169}
    171170
     
    173172    : MGEmbeddedCanvas("SkyPosition", p, w, 110)
    174173{
     174    cout << "MGSkyPosition: Initilizing." << endl;
    175175    DrawCoordinateSystem();
    176176    InitPlanets();
     
    178178    InitText();
    179179    InitCanvas();
     180    cout << "MGSkyPosition: Initilizing done." << endl;
    180181}
    181182
    182183MGSkyPosition::~MGSkyPosition()
    183184{
    184     delete fSlalib;
     185    delete fSlaPlanet;
     186    delete fSlaStar;
    185187
    186188    cout << "MGSkyPosition destroyed." << endl;
     
    203205}
    204206
    205 void MGSkyPosition::UpdatePosition(Float_t zd, Float_t az)
    206 {
     207void MGSkyPosition::SetDot(TArc *arc, RaDec &radec, Int_t off)
     208{
     209    RaDec rd(radec.Ra()+off*360/24*kDeg2Rad, radec.Dec());
     210    ZdAz zdaz = fSlaStar->CalcZdAz(rd);
     211
     212    const float s = sin(zdaz.Az());
     213    const float c = cos(zdaz.Az());
     214
     215    const float x = s*zdaz.Zd()*kRad2Deg;             // [deg]
     216    const float y = c*zdaz.Zd()*kRad2Deg;             // [deg]
     217
     218    arc->SetX1(x);
     219    arc->SetY1(y);
     220
     221    SetModified();
     222}
     223
     224void MGSkyPosition::UpdatePosition(RaDec &radec, Float_t zd, Float_t az)
     225{
     226    //
     227    // zd [deg]
     228    // az [deg]
     229    //
    207230    static int X =~0;
    208231    static int Y =~0;
     
    210233    static int Ry=~0;
    211234
    212     const float rad = az*kDeg2Rad;
     235    const float rad = az*kDeg2Rad;    // [rad]
    213236
    214237    const float s = sin(rad);
    215238    const float c = cos(rad);
    216239
    217     const float x = s*zd;
    218     const float y = c*zd;
     240    const float x = s*zd;             // [deg]
     241    const float y = c*zd;             // [deg]
    219242
    220243    const int pixx = (int)(x/fPix);
     
    238261    SetLin1(s*95., c*95.);
    239262    SetLin2(x+dy, y-dx, x-dy, y+dx);
     263
     264    if (zd<80)
     265    {
     266        for(int i=0; i<3; i++)
     267            SetDot(fDot[i], radec, i-3);
     268        for(int i=3; i<6; i++)
     269            SetDot(fDot[i], radec, i-2);
     270    }
    240271
    241272    SetModified();
     
    279310    // calculate actual time for planet positions
    280311    //
    281     fSlalib->SetMjd2Now();
     312    fSlaPlanet->SetMjd2Now();
     313    fSlaStar->SetMjd2Now();
    282314
    283315    UpdatePlanet(kESun,     fSun);
     
    287319    UpdatePlanet(kEMars,    fMars);
    288320
    289     UpdatePosition(pos.Zd(), pos.Az());
     321    RaDec radec = fSlaStar->CalcRaDec(pos*kDeg2Rad);
     322
     323    UpdatePosition(radec, pos.Zd(), pos.Az());
    290324    UpdateText(pos.Zd(), pos.Az());
    291325
     
    298332    // calculate actual position of planet
    299333    //
    300     fSlalib->UpdatePlanetPos((ePlanets_t)planet);
    301 
    302     ZdAz zdaz = fSlalib->GetPlanetPos((ePlanets_t)planet);
     334    fSlaPlanet->UpdatePlanetPos((ePlanets_t)planet);
     335
     336    ZdAz zdaz = fSlaPlanet->GetPlanetPos((ePlanets_t)planet);
    303337
    304338    //
Note: See TracChangeset for help on using the changeset viewer.