Changeset 1273 for trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
- Timestamp:
- 04/11/02 13:20:10 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r1111 r1273 16 16 17 17 #include "coord.h" 18 #include "SlaStars.h" 18 19 #include "SlaPlanets.h" 19 20 20 21 ClassImp(MGSkyPosition); 22 23 void 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 } 21 30 22 31 void MGSkyPosition::InitPlanets() … … 34 43 // Neptun 7.8 35 44 // 36 fSlalib = new SlaPlanets; 45 fSlaPlanet = new SlaPlanets; 46 fSlaStar = new SlaStars; 37 47 38 48 // … … 41 51 // 1, 12, 13, 14, 15, 16, 17, 18, 19, 10 42 52 // 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); 55 55 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); 66 64 67 65 for (int i=0; i<4; i++) … … 74 72 fList->Add(fSunL[i]); 75 73 } 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();82 74 83 75 fList->Add(fMars); … … 168 160 fList->Add(fLin1b); 169 161 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 } 170 169 } 171 170 … … 173 172 : MGEmbeddedCanvas("SkyPosition", p, w, 110) 174 173 { 174 cout << "MGSkyPosition: Initilizing." << endl; 175 175 DrawCoordinateSystem(); 176 176 InitPlanets(); … … 178 178 InitText(); 179 179 InitCanvas(); 180 cout << "MGSkyPosition: Initilizing done." << endl; 180 181 } 181 182 182 183 MGSkyPosition::~MGSkyPosition() 183 184 { 184 delete fSlalib; 185 delete fSlaPlanet; 186 delete fSlaStar; 185 187 186 188 cout << "MGSkyPosition destroyed." << endl; … … 203 205 } 204 206 205 void MGSkyPosition::UpdatePosition(Float_t zd, Float_t az) 206 { 207 void 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 224 void MGSkyPosition::UpdatePosition(RaDec &radec, Float_t zd, Float_t az) 225 { 226 // 227 // zd [deg] 228 // az [deg] 229 // 207 230 static int X =~0; 208 231 static int Y =~0; … … 210 233 static int Ry=~0; 211 234 212 const float rad = az*kDeg2Rad; 235 const float rad = az*kDeg2Rad; // [rad] 213 236 214 237 const float s = sin(rad); 215 238 const float c = cos(rad); 216 239 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] 219 242 220 243 const int pixx = (int)(x/fPix); … … 238 261 SetLin1(s*95., c*95.); 239 262 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 } 240 271 241 272 SetModified(); … … 279 310 // calculate actual time for planet positions 280 311 // 281 fSlalib->SetMjd2Now(); 312 fSlaPlanet->SetMjd2Now(); 313 fSlaStar->SetMjd2Now(); 282 314 283 315 UpdatePlanet(kESun, fSun); … … 287 319 UpdatePlanet(kEMars, fMars); 288 320 289 UpdatePosition(pos.Zd(), pos.Az()); 321 RaDec radec = fSlaStar->CalcRaDec(pos*kDeg2Rad); 322 323 UpdatePosition(radec, pos.Zd(), pos.Az()); 290 324 UpdateText(pos.Zd(), pos.Az()); 291 325 … … 298 332 // calculate actual position of planet 299 333 // 300 fSla lib->UpdatePlanetPos((ePlanets_t)planet);301 302 ZdAz zdaz = fSla lib->GetPlanetPos((ePlanets_t)planet);334 fSlaPlanet->UpdatePlanetPos((ePlanets_t)planet); 335 336 ZdAz zdaz = fSlaPlanet->GetPlanetPos((ePlanets_t)planet); 303 337 304 338 //
Note:
See TracChangeset
for help on using the changeset viewer.