Changeset 1273 for trunk/MagicSoft/Cosy/gui
- Timestamp:
- 04/11/02 13:20:10 (23 years ago)
- Location:
- trunk/MagicSoft/Cosy/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r1111 r1273 169 169 fStopped = new TGLabel(f, "Stopped"); 170 170 171 fError ->SetBackgroundColor(224); // red 172 fMoving ->SetBackgroundColor(10); // blue 173 fTracking->SetBackgroundColor(47); // blue 174 fStopping->SetBackgroundColor(164); // orange 175 fStopped ->SetBackgroundColor(20); // green 171 172 ULong_t color; 173 174 gClient->GetColorByName("Red", color); 175 fError->SetBackgroundColor(color); 176 gClient->GetColorByName("LightBlue", color); 177 fMoving->SetBackgroundColor(color); 178 gClient->GetColorByName("Blue", color); 179 fTracking->SetBackgroundColor(color); 180 gClient->GetColorByName("Orange", color); 181 fStopping->SetBackgroundColor(color); 182 gClient->GetColorByName("Green", color); 183 fStopped->SetBackgroundColor(color); 176 184 177 185 fError ->Move(10, 25); … … 264 272 fList->Add(but); 265 273 274 ULong_t color; 275 266 276 but = new TGTextButton(this, "Start", kPB_START); 267 but->SetBackgroundColor(20); 277 gClient->GetColorByName("Green", color); 278 but->SetBackgroundColor(color); 268 279 but->Move(147, 275); 269 280 but->Resize(62, 25); … … 272 283 273 284 but = new TGTextButton(this, "Stop", kPB_STOP); 274 but->SetBackgroundColor(224); 285 286 gClient->GetColorByName("Red", color); 287 but->SetBackgroundColor(color); 275 288 but->Move(212, 275); 276 289 but->Resize(62, 25); … … 285 298 fList = new MGList; 286 299 300 cout << "MGCosy: Creating Menu" << endl; 287 301 CreateMenu(); 288 302 303 cout << "MGCosy: Creating TGCompositeFrame" << endl; 289 304 TGCompositeFrame *f = new TGCompositeFrame(this, 0, 0); 290 305 f->SetLayoutManager(new TGMatrixLayout(f, 3, 2, 10)); 291 306 fList->Add(f); 292 307 308 cout << "MGCosy: Creating TGTab" << endl; 293 309 fTab = new TGTab(f, 300, 300); 294 310 fList->Add(fTab); 295 311 312 cout << "MGCosy: Creating MGSkyPosition" << endl; 296 313 fSkyPosition = new MGSkyPosition(f, 300); 314 cout << "MGCosy: Creating MGAccuracy" << endl; 297 315 fAccuracy = new MGAccuracy (f, 300); 316 cout << "MGCosy: Creating MGVelocity" << endl; 298 317 fVelocity = new MGVelocity (f, "Velocity [\"/min]", 300); 299 318 // fOffset = new MGVelocity (f, "Offset se-re [']", 300); … … 304 323 // fList->Add(fOffset); 305 324 325 cout << "MGCosy: Creating TGGroupFrame" << endl; 306 326 TGGroupFrame *frame = new TGGroupFrame(f, "Status"); 307 327 frame->Resize(300, 300); 308 328 fList->Add(frame); 309 329 330 cout << "MGCosy: Creating TGListBox" << endl; 310 331 fLog = new TGListBox(f, -1, kSunkenFrame); //kSunkenFrame|kDoubleBorder, 311 332 fLog->Resize(300, 300); … … 328 349 // FIXME! 329 350 // 351 cout << "MGCosy: Creating Tabs" << endl; 330 352 CreateTabs(fTab); 353 cout << "MGCosy: Creating Label" << endl; 331 354 CreateLabel(frame); 332 355 … … 334 357 // Map the window, set up the layout, etc. 335 358 // 359 cout << "MGCosy: Setting Size" << endl; 336 360 const Int_t w = 940; 337 361 const Int_t h = 660; … … 341 365 SetIconName("Cosy"); 342 366 367 cout << "MGCosy: Map Window" << endl; 343 368 MapSubwindows(); 344 369 Resize(GetDefaultSize()); -
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 // -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
r1111 r1273 17 17 18 18 class ZdAz; 19 class RaDec; 19 20 class TText; 21 class SlaStars; 20 22 class SlaPlanets; 21 23 … … 28 30 TArc *fSun; 29 31 32 TArc *fDot[6]; 33 30 34 TLine *fLin1a; 31 35 TLine *fLin1b; … … 36 40 TText *fText; 37 41 38 SlaPlanets *fSlalib; 42 SlaStars *fSlaStar; 43 SlaPlanets *fSlaPlanet; 39 44 40 45 Int_t fX[9]; 41 46 Int_t fY[9]; 47 48 void InitArc(TArc *arc, Int_t fillstyle, Int_t fillcolor, Int_t linecolor); 42 49 43 50 void InitText(); … … 49 56 void SetLin2(Float_t x1, Float_t y1, Float_t x2, Float_t y2); 50 57 58 void SetDot(TArc *arc, RaDec &radec, Int_t off); 59 51 60 void UpdateText(Float_t zd, Float_t az); 52 61 void UpdatePlanet(Int_t planet, TArc *arc); 53 void UpdatePosition( Float_t zd, Float_t az);62 void UpdatePosition(RaDec &radec, Float_t zd, Float_t az); 54 63 55 64 public:
Note:
See TracChangeset
for help on using the changeset viewer.