Ignore:
Timestamp:
03/02/03 17:08:13 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r1793 r1804  
    262262    float y = c*zdaz.Zd()*kRad2Deg;             // [deg]
    263263
    264     if (x>95 || x<-95 || y>95 || y<-95)
    265     {
    266         if (arc->GetX1()==10 && arc->GetY1()==100)
    267             return;
    268 
    269         x=-100;
    270         y= 100;
    271     }
    272 
    273     const int pixx = (int)(x/fPix);
    274     const int pixy = (int)(y/fPix);
    275 
    276     const int oldx = (int)(arc->GetX1()/fPix);
    277     const int oldy = (int)(arc->GetY1()/fPix);
    278 
    279     if (pixx==oldx && pixy==oldy)
    280         return;
    281 
    282     arc->SetX1(x);
    283     arc->SetY1(y);
    284 
    285     SetModified(); //***MEMORY LEAK!!!***
     264    SetDotRange(arc, x, y);
    286265}
    287266
     
    393372}
    394373
     374bool MGSkyPosition::SetDotRange(TArc *arc, float &x, float &y)
     375{
     376    if (!(x>-95 && x<95 && y>-95 && y<95))
     377    {
     378        if (arc->GetX1()==-100 && arc->GetY1()==100)
     379            return false;
     380
     381        x=-100;
     382        y= 100;
     383    }
     384
     385    const int pixx = (int)(x/fPix);
     386    const int pixy = (int)(y/fPix);
     387
     388    const int oldx = (int)(arc->GetX1()/fPix);
     389    const int oldy = (int)(arc->GetY1()/fPix);
     390
     391    if (pixx==oldx && pixy==oldy)
     392        return false;
     393
     394    arc->SetX1(x);
     395    arc->SetY1(y);
     396
     397    SetModified();
     398
     399    return true;
     400}
     401
    395402void MGSkyPosition::UpdatePlanet(Int_t planet, TArc *arc)
    396403{
     
    400407    fSlaPlanet->UpdatePlanetPos((ePlanets_t)planet);
    401408
    402     ZdAz zdaz = fSlaPlanet->GetPlanetPos((ePlanets_t)planet);
     409    const ZdAz zdaz = fSlaPlanet->GetPlanetPos((ePlanets_t)planet);
    403410
    404411    //
     
    413420    float y = c*deg;
    414421
    415     if (x>95 || x<-95 || y>95 || y<-95)
    416     {
    417         if (arc->GetX1()==10 && arc->GetY1()==100)
    418             return;
    419 
    420         x=-100;
    421         y= 100;
    422     }
    423 
    424     const int pixx = (int)(x/fPix);
    425     const int pixy = (int)(y/fPix);
    426 
    427     const int oldx = (int)(arc->GetX1()/fPix);
    428     const int oldy = (int)(arc->GetY1()/fPix);
    429 
    430     if (oldx==pixx && oldy==pixy)
     422    if (!SetDotRange(arc, x, y))
    431423        return;
    432 
    433     //
    434     // Set new position
    435     //
    436     arc->SetX1(x);
    437     arc->SetY1(y);
    438 
    439     SetModified();
    440424
    441425    if (planet==kESaturn)
Note: See TracChangeset for help on using the changeset viewer.