source: trunk/MagicSoft/Cosy/gui/MGAccuracy.cc@ 912

Last change on this file since 912 was 912, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 3.3 KB
Line 
1//
2// This File contains the definition of the MGCoordinates-class
3//
4// Author: Thomas Bretz
5// Version: V1.0 (1-8-2000)
6
7#include "MGAccuracy.h"
8
9#include <iostream.h> // cout
10
11#include <TArc.h>
12#include <TLine.h>
13#include <TList.h>
14#include <TCanvas.h>
15
16#include "coord.h"
17
18void MGAccuracy::DrawCoordinateSystem()
19{
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);
50
51 TArc arc;
52 arc.SetFillStyle(4000); // transparent
53 arc.SetFillColor(39);
54 arc.SetLineColor(3); // green
55 arc.SetLineStyle(2); // dashed (s. TAttLine)
56 arc.DrawArc(0, 0, 20./60);
57
58 arc.SetLineColor(5); // yellow
59 arc.DrawArc(0, 0, 40./60);
60
61 arc.SetLineColor(2); // red
62 arc.DrawArc(0, 0, 1);
63}
64
65void MGAccuracy::InitPosition()
66{
67 fLin1 = new TLine(0, 0, 0, 0);
68 fLin2 = new TLine(0, 0, 0, 0);
69
70 fLin1->SetLineColor(10); // white (s. TAttFill)
71 fLin2->SetLineColor(10); // white
72 fLin1->SetLineStyle(1); // solid (s. TAttLine)
73 fLin2->SetLineStyle(1);
74
75 fLin1->Draw();
76 fLin2->Draw();
77
78 fList->Add(fLin1);
79 fList->Add(fLin2);
80}
81
82MGAccuracy::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
94 DrawCoordinateSystem();
95 InitPosition();
96
97 Resize(w, h); //GetDefaultSize()); // ???
98
99 MapSubwindows();
100}
101
102MGAccuracy::~MGAccuracy()
103{
104 delete fList;
105
106 cout << "MGAccuracy destroyed." << endl;
107}
108
109void MGAccuracy::Update(ZdAz &zdaz)
110{
111 //
112 // calculate actual time for planet positions
113 //
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)
134 return;
135
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}
Note: See TracBrowser for help on using the repository browser.