Changeset 913 for trunk/MagicSoft/Cosy
- Timestamp:
- 08/23/01 14:40:17 (23 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r912 r913 1 1 -*-*- END -*-*- 2 2001/08/23 - Thomas Bretz: 3 4 * gui/MGEmbeddedCanvas.[h,cc]: 5 - added 6 7 * gui/MGVelocity.[h,cc]: 8 - added 9 10 * MCosy.[h,cc]: 11 - added GetRePosPdo 12 - changed fOffset to an offset between the se and re system 13 - changed old fOffset to fTrackingError which gives you a good 14 estimate what the tracking error really is 15 - changed the weighting of fOffset from 0.1 to 0.3 16 - reordered some statements for a better overview 17 - changed update of GUI from thread to a timer (s.HandleTimer) 18 19 * Makefile: 20 - added libpthread.a 21 - reordered libraries 22 23 * gui/MGAccuracy.[h,cc]: 24 - changed the layout 25 - make use of TGaxis 26 - added the numbers as text into canvas 27 - added a title 28 - derived from MEmbeddedCanvas 29 30 * gui/MGCosy.[h,cc]: 31 - changed layout 32 - added canvas for velocity 33 - added canvas for offset 34 35 * gui/MGSkyPosition.[h,cc]: 36 - added position as text 37 - added axis labels 38 - derived from MEmbeddedCanvas 39 - reorganized parts of the existing code 40 41 2 42 3 43 2001/08/17 - Thomas Bretz: -
trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
r912 r913 11 11 #include <TArc.h> 12 12 #include <TLine.h> 13 #include <TText.h> 14 #include <TWbox.h> 13 15 #include <TList.h> 16 #include <TGaxis.h> 14 17 #include <TCanvas.h> 15 18 … … 18 21 void MGAccuracy::DrawCoordinateSystem() 19 22 { 20 TLine line; 21 22 line.SetLineColor(13); 23 line.SetLineStyle(3); // dotted (s. TAttLine) 24 line.DrawLine(-.5, -1.05, -.5, 1.05); 25 line.DrawLine( -1.05, -.5, 1.05, -.5); 26 line.DrawLine( .5, -1.05, .5, 1.05); 27 line.DrawLine( -1.05, .5, 1.05, .5); 28 29 line.DrawLine(-.25, -1.05, -.25, 1.05); 30 line.DrawLine( -1.05, -.25, 1.05, -.25); 31 line.DrawLine( .25, -1.05, .25, 1.05); 32 line.DrawLine( -1.05, .25, 1.05, .25); 33 34 line.DrawLine(-.75, -1.05, -.75, 1.05); 35 line.DrawLine( -1.05, -.75, 1.05, -.75); 36 line.DrawLine( .75, -1.05, .75, 1.05); 37 line.DrawLine( -1.05, .75, 1.05, .75); 38 39 line.SetLineColor(12); 40 line.SetLineStyle(2); // dashed (s. TAttLine) 41 line.DrawLine(-1, -1.05, -1, 1.05); 42 line.DrawLine(-1.05, -1, 1.05, -1); 43 line.DrawLine( 1, -1.05, 1, 1.05); 44 line.DrawLine(-1.05, 1, 1.05, 1); 45 46 line.SetLineColor(1); // black 47 line.SetLineStyle(1); // solid (s. TAttLine) 48 line.DrawLine(-1.05, 0, 1.05, 0); 49 line.DrawLine( 0, -1.05, 0, 1.05); 23 TWbox box; 24 box.DrawWbox(-145*2, 145*2, -15*2, 120*2, 18, 2, 1); 25 26 TText text; 27 text.SetTextAlign(22); // centered, centered (s.TAttText) 28 text.DrawText(-80*2, 132.5*2, "Tracking Error [']"); 29 50 30 51 31 TArc arc; … … 54 34 arc.SetLineColor(3); // green 55 35 arc.SetLineStyle(2); // dashed (s. TAttLine) 56 arc.DrawArc(0, 0, 20./60);36 arc.DrawArc(0, 0, 79.1/2.); // 0.5se 57 37 58 38 arc.SetLineColor(5); // yellow 59 arc.DrawArc(0, 0, 40./60);39 arc.DrawArc(0, 0, 79.1); // 1.0se 60 40 61 41 arc.SetLineColor(2); // red 62 arc.DrawArc(0, 0, 1); 63 } 64 65 void MGAccuracy::InitPosition() 42 arc.DrawArc(0, 0, 79.1*2.); // 2.0se 43 44 45 text.SetTextAlign(11); // left, bottom (s.TAttText) 46 text.SetTextColor(3); 47 text.DrawText(220, -220, "0.5se"); 48 49 text.SetTextColor(5); 50 text.DrawText(220, -250, "1.0se"); 51 52 text.SetTextColor(2); 53 text.DrawText(220, -280, "2.0se"); 54 55 56 TLine line; 57 line.DrawLine(-65*4, 0, 65*4, 0); 58 line.DrawLine( 0, -65*4, 0, 65*4); 59 60 TGaxis *axe; 61 axe = new TGaxis(-60*4, 0, 60*4, 0, -4, 4, 30204, "+-N"); 62 axe->SetTitle("Az"); // \xb0 63 axe->SetBit(kCanDelete); 64 axe->Draw(); 65 66 axe = new TGaxis( 0, -60*4, 0, 60*4, -4, 4, 304, "+-N"); 67 axe->SetTitle("Zd"); // \xb0 68 axe->SetBit(kCanDelete); 69 axe->Draw(); 70 71 // 72 // FIXME? Use TAxis? 73 // 74 /* 75 TLine line; 76 line.SetLineColor(13); 77 line.SetLineStyle(3); // dotted (s. TAttLine) 78 line.DrawLine(-30, -65, -30, 65); 79 line.DrawLine(-65, -30, 65, -30); 80 line.DrawLine( 30, -65, 30, 65); 81 line.DrawLine(-65, 30, 65, 30); 82 83 line.DrawLine(-15, -65, -15, 65); 84 line.DrawLine(-65, -15, 65, -15); 85 line.DrawLine( 15, -65, 15, 65); 86 line.DrawLine(-65, 15, 65, 15); 87 88 line.DrawLine(-45, -65, -45, 65); 89 line.DrawLine(-65, -45, 65, -45); 90 line.DrawLine( 45, -65, 45, 65); 91 line.DrawLine(-65, 45, 65, 45); 92 93 line.SetLineColor(12); 94 line.SetLineStyle(2); // dashed (s. TAttLine) 95 line.DrawLine(-60, -65, -60, 65); 96 line.DrawLine(-65, -60, 65, -60); 97 line.DrawLine( 60, -65, 60, 65); 98 line.DrawLine(-65, 60, 65, 60); 99 100 line.SetLineColor(1); // black 101 line.SetLineStyle(1); // solid (s. TAttLine) 102 line.DrawLine(-65, 0, 65, 0); 103 line.DrawLine( 0, -65, 0, 65); 104 105 line.DrawLine(-1, 60, 1, 60); 106 line.DrawLine(-1, -60, 1, -60); 107 line.DrawLine(-1, 30, 1, 30); 108 line.DrawLine(-1, -30, 1, -30); 109 110 line.DrawLine( 60, -1, 60, 1); 111 line.DrawLine(-60, -1, -60, 1); 112 line.DrawLine( 30, -1, 30, 1); 113 line.DrawLine(-30, -1, -30, 1); 114 115 TText text; 116 text.SetTextAlign(22); // centered, centered (s.TAttText) 117 text.DrawText(60, 5, "dAz[\xb0]"); 118 text.DrawText(0, 70, "dZd[\xb0]"); 119 120 text.SetTextAlign(23); // centered, centered (s.TAttText) 121 text.DrawText(-60, -2, "-1'"); 122 text.DrawText( 60, -2, "1'"); 123 text.DrawText(-30, -2, "-30\""); 124 text.DrawText( 30, -2, "30\""); 125 126 text.SetTextAlign(32); // centered, centered (s.TAttText) 127 text.DrawText(-2, -60, "-1'"); 128 text.DrawText(-2, 60, "1'"); 129 text.DrawText(-2, -30, "-30\""); 130 text.DrawText(-2, 30, "30\""); 131 */ 132 } 133 134 void MGAccuracy::InitText() 135 { 136 fTxt = new TText(280, 280, "0' / 0'"); 137 fTxt->SetTextAlign(33); // right, top 138 fTxt->SetTextColor(10); 139 fTxt->Draw(); 140 141 fList->Add(fTxt); 142 } 143 144 void MGAccuracy::InitCross() 66 145 { 67 146 fLin1 = new TLine(0, 0, 0, 0); … … 73 152 fLin2->SetLineStyle(1); 74 153 154 fLin1->SetLineWidth(2); 155 fLin2->SetLineWidth(2); 156 75 157 fLin1->Draw(); 76 158 fLin2->Draw(); … … 80 162 } 81 163 82 MGAccuracy::MGAccuracy(const TGWindow* p, const Int_t w, const Int_t h) 83 : TRootEmbeddedCanvas("Accuracy", p, w-1, h-1, kRaisedFrame),//, 0) //234, 76, kFixedSize) 84 fModified(kFALSE) 85 { 86 fCanvas = GetCanvas(); 87 88 fCanvas->SetFillColor(39); // s. TAttFill 89 fCanvas->Range(-1.1, -1.1, 1.1, 1.1); 90 91 fList = new TList; 92 fList->SetOwner(); 93 164 MGAccuracy::MGAccuracy(const TGWindow* p, const UInt_t w) 165 : MGEmbeddedCanvas("Accuracy", p, w, 75*4) 166 { 94 167 DrawCoordinateSystem(); 95 InitPosition(); 96 97 Resize(w, h); //GetDefaultSize()); // ???98 99 MapSubwindows();168 169 InitText(); 170 InitCross(); 171 172 InitCanvas(); 100 173 } 101 174 102 175 MGAccuracy::~MGAccuracy() 103 176 { 104 delete fList;105 106 177 cout << "MGAccuracy destroyed." << endl; 107 178 } 108 179 180 void MGAccuracy::UpdateText(Float_t x, Float_t y) 181 { 182 /* 183 int xs = (int)floor(fmod(fabs(x), 60.)); 184 int ys = (int)floor(fmod(fabs(y), 60.)); 185 x /= 60.; 186 y /= 60.; 187 int xm = (int)floor(fmod(fabs(x), 60.)); 188 int ym = (int)floor(fmod(fabs(y), 60.)); 189 190 char tx[100]; 191 char ty[100]; 192 193 xm ? sprintf(tx, "%d'%02d\"", xm, xs) : sprintf(tx, "%d\"", xs); 194 ym ? sprintf(ty, "%d'%02d\"", ym, ys) : sprintf(ty, "%d\"", ys); 195 196 char txt[200]; 197 sprintf(txt, "%s / %s", tx, ty); 198 */ 199 200 // FIXME: We are on a sphere 201 202 float r = sqrt(x*x+y*y); 203 204 int rs = (int)floor(fmod(r, 60.)); 205 r /= 60.; 206 int rm = (int)floor(fmod(r, 60.)); 207 208 char txt[100]; 209 rm ? sprintf(txt, "%d'%02d\"", rm, rs) : sprintf(txt, "%d\"", rs); 210 211 fTxt->SetText(fTxt->GetX(), fTxt->GetY(), txt); 212 } 213 214 void MGAccuracy::UpdateCross(Float_t x, Float_t y) 215 { 216 fLin1->SetX1(x-5.); 217 fLin1->SetX2(x+5.); 218 219 fLin2->SetX1(x-5.); 220 fLin2->SetX2(x+5.); 221 222 fLin1->SetY1(y-5.); 223 fLin1->SetY2(y+5.); 224 225 fLin2->SetY1(y+5.); 226 fLin2->SetY2(y-5.); 227 } 228 109 229 void MGAccuracy::Update(ZdAz &zdaz) 110 230 { … … 112 232 // calculate actual time for planet positions 113 233 // 114 115 fLin1->SetX1(zdaz.Zd()*60.-0.02); 116 fLin1->SetX2(zdaz.Zd()*60.+0.02); 117 118 fLin2->SetX1(zdaz.Zd()*60.-0.02); 119 fLin2->SetX2(zdaz.Zd()*60.+0.02); 120 121 fLin1->SetY1(zdaz.Az()*60.-0.02); 122 fLin1->SetY2(zdaz.Az()*60.+0.02); 123 124 fLin2->SetY1(zdaz.Az()*60.+0.02); 125 fLin2->SetY2(zdaz.Az()*60.-0.02); 126 127 fCanvas->Modified(); 128 fCanvas->Update(); 129 130 /* 131 DrawPosition(pos.Zd(), pos.Az()); 132 133 if (!fModified) 234 static int X = ~0; 235 static int Y = ~0; 236 237 float x = zdaz.Az()*3600.; // ["] 238 float y = zdaz.Zd()*3600.; // ["] 239 240 int pixx = (int)(x/fPix); // [pix] 241 int pixy = (int)(y/fPix); // [pix] 242 243 if (X==pixx && Y==pixy) 134 244 return; 135 245 136 // FIXME: Sometimes (if the canvas couldn't be created correctly: 137 // X11 Pixmap error) Update hangs the Gui system. 138 139 fModified = kFALSE; 140 */ 141 } 246 X = pixx; 247 Y = pixy; 248 249 UpdateCross(x, y); 250 UpdateText(x, y); 251 252 SetModified(); 253 UpdateCanvas(); 254 } -
trunk/MagicSoft/Cosy/gui/MGAccuracy.h
r912 r913 8 8 // Version: V1.0 (1-8-2000) 9 9 10 11 #ifndef ROOT_TRootEmbeddedCanvas 12 #include <TRootEmbeddedCanvas.h> 10 #ifndef MGEMBEDDEDCANVAS_H 11 #include "MGEmbeddedCanvas.h" 13 12 #endif 14 13 15 14 class TList; 16 15 class TLine; 16 class TText; 17 17 class TCanvas; 18 18 … … 20 20 class SlaPlanets; 21 21 22 class MGAccuracy : public TRootEmbeddedCanvas22 class MGAccuracy : public MGEmbeddedCanvas 23 23 { 24 TCanvas *fCanvas; 24 TLine *fLin1; 25 TLine *fLin2; 25 26 26 TLine *fLin1; 27 TLine *fLin2; 28 /* 29 TLine *fLin2; 30 */ 31 TList *fList; 32 33 Bool_t fModified; 34 35 void InitPosition(); 36 37 // void SetLin1(int x, int y); 38 // void SetLin2(int x1, int y1, int x2, int y2); 27 TText *fTxt; 39 28 40 29 void DrawCoordinateSystem(); 41 30 31 void InitText(); 32 void InitCross(); 33 34 void UpdateText(Float_t x, Float_t y); 35 void UpdateCross(Float_t x, Float_t y); 36 42 37 public: 43 MGAccuracy(const TGWindow* p, const Int_t w, const Int_t h);38 MGAccuracy(const TGWindow* p, const UInt_t w); 44 39 ~MGAccuracy(); 45 40 -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r912 r913 9 9 #include <TSystem.h> // gSystem 10 10 #include <TGLabel.h> // TGLabel 11 #include <TG Splitter.h> // TGHorizontal3DLine11 #include <TG3DLine.h> // TGHorizontal3DLine (TGSplitter) 12 12 #include <TApplication.h> // gApplication 13 13 … … 19 19 #include "MGCoordinates.h" 20 20 #include "MGSkyPosition.h" 21 #include "MGVelocity.h" 21 22 22 23 #include "SlaStars.h" … … 156 157 fList->Add(fCoord); 157 158 158 fAccuracy = new MGAccuracy(this, 200, 200); 159 fAccuracy->Move(320, 260); 160 fList->Add(fAccuracy); 161 162 fSkyPosition = new MGSkyPosition(this, 200, 200); 159 fSkyPosition = new MGSkyPosition(this, 300); 163 160 fSkyPosition->Move(320, 40); 164 161 fList->Add(fSkyPosition); 165 162 163 fAccuracy = new MGAccuracy(this, 300); 164 fAccuracy->Move(320, 360); 165 fList->Add(fAccuracy); 166 167 fVelocity = new MGVelocity(this, "Velocity ['/min]", 300); 168 fVelocity->Move(10, 360); 169 fList->Add(fVelocity); 170 171 fOffset = new MGVelocity(this, "Offset se-re [']", 300); 172 fOffset->Move(630, 360); 173 fList->Add(fOffset); 174 166 175 // 167 176 // Map the window, set up the layout, etc. 168 177 // 169 SetWMSizeHints(550, 500, 550, 500, 10, 10); // set the smallest and biggest size of the Main frame 178 const Int_t w = 650+310; 179 const Int_t h = 690; 180 SetWMSizeHints(w, h, w, h, 10, 10); // set the smallest and biggest size of the Main frame 170 181 171 182 MapSubwindows(); … … 178 189 } 179 190 180 181 182 191 // ====================================================================== 183 192 … … 196 205 } 197 206 // ====================================================================== 198 void MGCosy::Update(ZdAz pos, ZdAz acc )207 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off) 199 208 { 200 209 fSkyPosition->Update(pos); 201 210 fAccuracy->Update(acc); 211 fVelocity->Update(vel); 212 fOffset->Update(off); 202 213 } 203 214 // ====================================================================== -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r912 r913 30 30 class MGSkyPosition; 31 31 class MGAccuracy; 32 class MGVelocity; 32 33 33 34 class MGCosy : public TGMainFrame … … 50 51 MGSkyPosition *fSkyPosition; 51 52 MGAccuracy *fAccuracy; 53 MGVelocity *fVelocity; 54 MGVelocity *fOffset; 52 55 53 56 MsgQueue *fQueue; … … 67 70 TGLabel **GetLabel3() { return fLabel3; } 68 71 69 void Update(ZdAz pos, ZdAz acc );72 void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off); 70 73 71 74 Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2); -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r912 r913 11 11 #include <TArc.h> 12 12 #include <TLine.h> 13 #include <TText.h> 13 14 #include <TList.h> 14 15 #include <TCanvas.h> … … 94 95 } 95 96 97 void MGSkyPosition::InitText() 98 { 99 fText = new TText(105, 105, ""); 100 fText->SetFillStyle(4000); // transparent 101 fText->SetTextAlign(33); // right, top 102 fText->SetTextColor(10); // white 103 fText->Draw(); 104 105 fList->Add(fText); 106 } 107 96 108 void MGSkyPosition::DrawCoordinateSystem() 97 109 { … … 105 117 arc.DrawArc(0, 0, 22.5); 106 118 119 // 120 // FIXME? Use TAxis? 121 // 107 122 TLine line; 108 123 line.SetLineColor(1); // black … … 110 125 line.DrawLine(-95, 0, 95, 0); 111 126 line.DrawLine( 0, -95, 0, 95); 127 128 TText text; 129 text.SetTextAlign(22); // centered, centered (s.TAttText) 130 text.SetTextColor(13); // dark gray 131 text.DrawText(0.71*22.5, 0.71*22.5, "22.5\xb0"); 132 text.DrawText(0.71*45.0, 0.71*45.0, "45\xb0"); 133 text.DrawText(0.71*67.5, 0.71*67.5, "67.5\xb0"); 134 text.DrawText(0.71*90.0, 0.71*90.0, "90\xb0"); 135 136 text.SetTextAlign(22); // centered, centered (s.TAttText) 137 text.SetTextColor(1); // black 138 139 text.DrawText(0, 102, "N (0\xb0)"); 140 text.DrawText(0, -102, "S (180\xb0)"); 141 142 text.SetTextAngle(270); 143 text.DrawText( 102, 0, "E (90\xb0)"); 144 145 text.SetTextAngle(90); 146 text.DrawText(-102, 0, "W (270\xb0)"); 112 147 } 113 148 … … 133 168 } 134 169 135 MGSkyPosition::MGSkyPosition(const TGWindow* p, const Int_t w, const Int_t h) 136 : TRootEmbeddedCanvas("SkyPosition", p, w-1, h-1, kRaisedFrame),//, 0) //234, 76, kFixedSize) 137 fModified(kFALSE) 138 { 139 fCanvas = GetCanvas(); 140 141 fCanvas->SetFillColor(39); // s. TAttFill 142 fCanvas->Range(-100, -100, 100, 100); 143 144 fList = new TList; 145 fList->SetOwner(); 146 170 MGSkyPosition::MGSkyPosition(const TGWindow* p, const UInt_t w) 171 : MGEmbeddedCanvas("SkyPosition", p, w, 110) 172 { 147 173 DrawCoordinateSystem(); 174 InitPlanets(); 148 175 InitPosition(); 149 InitPlanets(); 150 151 Resize(w, h); //GetDefaultSize()); // ??? 152 MapSubwindows(); 176 InitText(); 177 InitCanvas(); 153 178 } 154 179 155 180 MGSkyPosition::~MGSkyPosition() 156 181 { 157 delete fList;158 182 delete fSlalib; 159 183 … … 161 185 } 162 186 163 void MGSkyPosition::SetLin1( int x, int y)187 void MGSkyPosition::SetLin1(Float_t x, Float_t y) 164 188 { 165 189 fLin1a->SetX2(x); … … 169 193 } 170 194 171 void MGSkyPosition::SetLin2( int x1, int y1, int x2, int y2)195 void MGSkyPosition::SetLin2(Float_t x1, Float_t y1, Float_t x2, Float_t y2) 172 196 { 173 197 fLin2->SetX1(x1); … … 177 201 } 178 202 179 void MGSkyPosition:: DrawPosition(Float_t zd, Float_t az)203 void MGSkyPosition::UpdatePosition(Float_t zd, Float_t az) 180 204 { 181 205 static int X=~0; … … 187 211 const float c = cos(rad); 188 212 189 const int x = (int)(s*zd); 190 const int y = (int)(c*zd); 191 192 if (X==x && Y==y) 213 const float x = s*zd; 214 const float y = c*zd; 215 216 const int pixx = (int)(x/fPix); 217 const int pixy = (int)(y/fPix); 218 219 if (X==pixx && Y==pixy) 193 220 return; 194 221 195 X = x;196 Y = y;197 198 const int dx = (int)(s*4);199 const int dy = (int)(c*4);200 201 SetLin1(s*95 , c*95);222 X = pixx; 223 Y = pixy; 224 225 const float dx = s*4.; 226 const float dy = c*4.; 227 228 SetLin1(s*95., c*95.); 202 229 SetLin2(x+dy, y-dx, x-dy, y+dx); 203 230 204 fModified = kTRUE; 205 } 231 SetModified(); 232 } 233 234 void MGSkyPosition::UpdateText(Float_t x, Float_t y) 235 { 236 static int X = ~0; 237 static int Y = ~0; 238 239 int xd = (int)floor(x); 240 int yd = (int)floor(y); 241 x *= 60.; 242 y *= 60.; 243 244 int fx = (int)floor(x*10.); 245 int fy = (int)floor(y*10.); 246 247 if (X==fx && Y==fy) 248 return; 249 250 X = fx; 251 Y = fy; 252 253 float/*int*/ xm = /*(int)floor*/(fmod(fabs(x), 60.)); 254 float/*int*/ ym = /*(int)floor*/(fmod(fabs(y), 60.)); 255 256 char txt[100]; 257 sprintf(txt, "Zd=%d\xb0%02.1f'\nAz=%d\xb0%02.1f'", 258 xd, xm, yd, ym); 259 260 fText->SetText(fText->GetX(), fText->GetY(), txt); 261 262 SetModified(); 263 } 264 206 265 207 266 void MGSkyPosition::Update(ZdAz &pos) … … 212 271 fSlalib->SetMjd2Now(); 213 272 214 DrawPlanet(kESun, fSun); 215 DrawPlanet(kEMoon, fMoon); 216 DrawPlanet(kEJupiter, fJupiter); 217 DrawPlanet(kEVenus, fVenus); 218 DrawPlanet(kEMars, fMars); 219 220 DrawPosition(pos.Zd(), pos.Az()); 221 222 if (!fModified) 223 return; 224 225 // FIXME: Sometimes (if the canvas couldn't be created correctly: 226 // X11 Pixmap error) Update hangs the Gui system. 227 228 fCanvas->Modified(); 229 fCanvas->Update(); 230 231 fModified = kFALSE; 232 } 233 234 void MGSkyPosition::DrawPlanet(Int_t planet, TArc *arc) 273 UpdatePlanet(kESun, fSun); 274 UpdatePlanet(kEMoon, fMoon); 275 UpdatePlanet(kEJupiter, fJupiter); 276 UpdatePlanet(kEVenus, fVenus); 277 UpdatePlanet(kEMars, fMars); 278 279 UpdatePosition(pos.Zd(), pos.Az()); 280 UpdateText(pos.Zd(), pos.Az()); 281 282 UpdateCanvas(); 283 } 284 285 void MGSkyPosition::UpdatePlanet(Int_t planet, TArc *arc) 235 286 { 236 287 // … … 249 300 const float deg = 360.0/D2PI*zdaz.Zd(); 250 301 251 const int x = (int)(s*deg); 252 const int y = (int)(c*deg); 253 254 if (fX[planet]==x && fY[planet]==y) 302 const float x = s*deg; 303 const float y = c*deg; 304 305 const int pixx = (int)(x/fPix); 306 const int pixy = (int)(y/fPix); 307 308 if (fX[planet]==pixx && fY[planet]==pixy) 255 309 return; 256 310 257 fX[planet] = x;258 fY[planet] = y;311 fX[planet] = pixx; 312 fY[planet] = pixy; 259 313 260 314 // … … 264 318 arc->SetY1(y); 265 319 266 fModified = kTRUE;320 SetModified(); 267 321 268 322 if (planet!=kESun) … … 272 326 cout << " Zd=" << deg << " Az=" << 360./D2PI*zdaz.Az() << endl; 273 327 274 fSunL[0]->SetX1(x- 4); fSunL[0]->SetX2(x+4);275 fSunL[1]->SetX1(x- 3); fSunL[1]->SetX2(x+3);276 fSunL[2]->SetX1(x- 3); fSunL[2]->SetX2(x+3);277 fSunL[3]->SetX1(x ); fSunL[3]->SetX2(x);278 279 fSunL[0]->SetY1(y ); fSunL[0]->SetY2(y);280 fSunL[1]->SetY1(y- 3); fSunL[1]->SetY2(y+3);281 fSunL[2]->SetY1(y+ 3); fSunL[2]->SetY2(y-3);282 fSunL[3]->SetY1(y- 4); fSunL[3]->SetY2(y+4);283 } 328 fSunL[0]->SetX1(x-3.5); fSunL[0]->SetX2(x+3.5); 329 fSunL[1]->SetX1(x-2.5); fSunL[1]->SetX2(x+2.5); 330 fSunL[2]->SetX1(x-2.5); fSunL[2]->SetX2(x+2.5); 331 fSunL[3]->SetX1(x); fSunL[3]->SetX2(x); 332 333 fSunL[0]->SetY1(y); fSunL[0]->SetY2(y); 334 fSunL[1]->SetY1(y-2.5); fSunL[1]->SetY2(y+2.5); 335 fSunL[2]->SetY1(y+2.5); fSunL[2]->SetY2(y-2.5); 336 fSunL[3]->SetY1(y-3.5); fSunL[3]->SetY2(y+3.5); 337 } -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
r912 r913 9 9 10 10 11 #ifndef ROOT_TRootEmbeddedCanvas12 #include <TRootEmbeddedCanvas.h>11 #ifndef MGEMBEDDEDCANVAS_H 12 #include "MGEmbeddedCanvas.h" 13 13 #endif 14 14 15 15 class TArc; 16 class TList;17 16 class TLine; 18 class TCanvas;19 17 20 18 class ZdAz; 19 class TText; 21 20 class SlaPlanets; 22 21 23 class MGSkyPosition : public TRootEmbeddedCanvas22 class MGSkyPosition : public MGEmbeddedCanvas 24 23 { 25 TCanvas *fCanvas;26 27 24 TArc *fMoon; 28 25 TArc *fJupiter; … … 37 34 TLine *fSunL[4]; 38 35 36 TText *fText; 37 39 38 SlaPlanets *fSlalib; 40 41 TList *fList;42 39 43 40 Int_t fX[9]; 44 41 Int_t fY[9]; 45 42 46 Bool_t fModified; 47 43 void InitText(); 48 44 void InitPlanets(); 49 45 void InitPosition(); 50 51 void SetLin1(int x, int y);52 void SetLin2(int x1, int y1, int x2, int y2);53 54 void DrawPlanet(Int_t planet, TArc *arc);55 void DrawPosition(Float_t zd, Float_t az);56 46 void DrawCoordinateSystem(); 57 47 58 Bool_t CheckRange(Int_t x, Int_t y) const 59 { 60 return x>-95 && x<95 && y>-95 && y<95; 61 } 48 void SetLin1(Float_t x, Float_t y); 49 void SetLin2(Float_t x1, Float_t y1, Float_t x2, Float_t y2); 50 51 void UpdateText(Float_t zd, Float_t az); 52 void UpdatePlanet(Int_t planet, TArc *arc); 53 void UpdatePosition(Float_t zd, Float_t az); 62 54 63 55 public: 64 MGSkyPosition(const TGWindow* p, const Int_t w, const Int_t h);56 MGSkyPosition(const TGWindow* p, const UInt_t w); 65 57 ~MGSkyPosition(); 66 58 -
trunk/MagicSoft/Cosy/gui/Makefile
r912 r913 35 35 MGCosy.cc \ 36 36 MGImage.cc \ 37 MGEmbeddedCanvas.cc \ 37 38 MGAccuracy.cc \ 39 MGVelocity.cc \ 38 40 MGSkyPosition.cc 39 41
Note:
See TracChangeset
for help on using the changeset viewer.