1 | #ifndef MARS_MAstroCatalog
|
---|
2 | #define MARS_MAstroCatalog
|
---|
3 |
|
---|
4 | #ifndef ROOT_TVector3
|
---|
5 | #include <TVector3.h>
|
---|
6 | #endif
|
---|
7 | #ifndef ROOT_TExMap
|
---|
8 | #include <TExMap.h>
|
---|
9 | #endif
|
---|
10 | #ifndef ROOT_TList
|
---|
11 | #include <TList.h>
|
---|
12 | #endif
|
---|
13 |
|
---|
14 | class MTime;
|
---|
15 | class MObservatory;
|
---|
16 | class TArrayI;
|
---|
17 | class TGToolTip;
|
---|
18 |
|
---|
19 | class MVector3 : public TVector3
|
---|
20 | {
|
---|
21 | private:
|
---|
22 | enum VectorType_t
|
---|
23 | {
|
---|
24 | kIsInvalid,
|
---|
25 | kIsRaDec,
|
---|
26 | kIsZdAz,
|
---|
27 | kIsAltAz,
|
---|
28 | kIsArbitrary
|
---|
29 | };
|
---|
30 |
|
---|
31 | VectorType_t fType;
|
---|
32 |
|
---|
33 | TString fName;
|
---|
34 |
|
---|
35 |
|
---|
36 | public:
|
---|
37 | /*
|
---|
38 | MVector3(Double_t theta=0, Double_t phi=0, Double_t mag=1)
|
---|
39 | {
|
---|
40 | SetMagThetaPhi(exp(mag), theta, phi);
|
---|
41 | }*/
|
---|
42 | MVector3() { fType=kIsInvalid; }
|
---|
43 | MVector3(const TVector3 &v3) : TVector3(v3) { fType=kIsArbitrary; }
|
---|
44 | Double_t Magnitude() const { return -2.5*TMath::Log10(Mag()); }
|
---|
45 |
|
---|
46 | void SetRaDec(Double_t ra, Double_t dec, Double_t mag)
|
---|
47 | {
|
---|
48 | fType = kIsRaDec;
|
---|
49 | SetMagThetaPhi(pow(10, -mag/2.5), TMath::Pi()/2-dec, ra);
|
---|
50 | }
|
---|
51 | void SetName(const TString &str) { fName = str.Strip(TString::kBoth); }
|
---|
52 | void SetZdAz(Double_t zd, Double_t az, Double_t mag)
|
---|
53 | {
|
---|
54 | fType = kIsZdAz;
|
---|
55 | SetMagThetaPhi(pow(10, -mag/2.5), zd, az);
|
---|
56 | }
|
---|
57 | void SetAltAz(Double_t alt, Double_t az, Double_t mag)
|
---|
58 | {
|
---|
59 | fType = kIsAltAz;
|
---|
60 | SetMagThetaPhi(pow(10, -mag/2.5), TMath::Pi()/2-alt, az);
|
---|
61 | }
|
---|
62 |
|
---|
63 | const char *GetName() const { return fName; }
|
---|
64 |
|
---|
65 | MVector3 GetZdAz(const MObservatory &obs, Double_t gmst) const;
|
---|
66 | MVector3 GetZdAz(const MTime &time, MObservatory &obs) const;
|
---|
67 | MVector3 GetRaDec(const MObservatory &obs, Double_t gmst) const;
|
---|
68 | MVector3 GetRaDec(const MTime &time, MObservatory &obs) const;
|
---|
69 |
|
---|
70 | ClassDef(MVector3, 1)
|
---|
71 | };
|
---|
72 |
|
---|
73 | class MAstroCatalog : public TObject
|
---|
74 | {
|
---|
75 | private:
|
---|
76 | Double_t fLimMag; // [1] Limiting Magnitude
|
---|
77 | Double_t fRadiusFOV; // [deg] Radius of Field of View
|
---|
78 |
|
---|
79 | TGToolTip *fToolTip; //!
|
---|
80 |
|
---|
81 | void ShowToolTip(Int_t px, Int_t py, const char *txt);
|
---|
82 |
|
---|
83 | TString FindToken(TString &line, Char_t tok=',');
|
---|
84 |
|
---|
85 | Int_t atoi(const TSubString &sub);
|
---|
86 | Float_t atof(const TSubString &sub);
|
---|
87 | Int_t atoi(const TString &s);
|
---|
88 | Float_t atof(const TString &s);
|
---|
89 |
|
---|
90 | //#if ROOT_VERSION_CODE < ROOT_VERSION(4,00,03)
|
---|
91 | Bool_t fPlainScreen; //! Just a dummy!!!! ([Set,Is]Freezed)
|
---|
92 | //#endif
|
---|
93 |
|
---|
94 | protected:
|
---|
95 | enum {
|
---|
96 | kHasChanged = BIT(15),
|
---|
97 | kGuiActive = BIT(16),
|
---|
98 | kPlainScreen = BIT(17)
|
---|
99 | };
|
---|
100 |
|
---|
101 | TExMap fMapG;
|
---|
102 | TList fList; // List of stars loaded
|
---|
103 | MVector3 fRaDec; // pointing position
|
---|
104 |
|
---|
105 | MObservatory *fObservatory; // Possible obervatora location
|
---|
106 | MTime *fTime; // Possible observation time
|
---|
107 |
|
---|
108 | virtual Int_t Convert(const TRotation &rot, TVector2 &v, Int_t type=0);
|
---|
109 | virtual Bool_t DrawLine(const TVector2 &v0, Double_t dx, Double_t dy, const TRotation &rot, Int_t type);
|
---|
110 | virtual void AddPrimitives(Option_t *o);
|
---|
111 | virtual void DrawPrimitives(Option_t *o);
|
---|
112 | virtual void SetRangePad();
|
---|
113 | void Draw(const TVector2 &v0, const TRotation &rot, TArrayI &dx, TArrayI &dy, Int_t stepx, Int_t stepy, Int_t type);
|
---|
114 | void DrawNet(const TVector2 &v0, const TRotation &rot, Int_t type);
|
---|
115 | void DrawStar(Double_t x, Double_t y, const TVector3 &v, Bool_t t, const char *txt=0);
|
---|
116 | void Paint(Option_t *o="");
|
---|
117 | Int_t DistancetoPrimitive(Int_t px, Int_t py);
|
---|
118 | void Update();
|
---|
119 |
|
---|
120 | void ExecuteEventKbd(Int_t keycode, Int_t keysym);
|
---|
121 | void ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2);
|
---|
122 |
|
---|
123 | void DrawMap();
|
---|
124 | void AddMap(void *k, void *v=0) { fMapG.Add(fMapG.GetSize(), (Long_t)k, (Long_t)v); }
|
---|
125 | void DeleteMap()
|
---|
126 | {
|
---|
127 | Long_t key, val;
|
---|
128 | TExMapIter map(&fMapG);
|
---|
129 | while (map.Next(key, val))
|
---|
130 | {
|
---|
131 | delete (TObject*)(key);
|
---|
132 | if (!val)
|
---|
133 | continue;
|
---|
134 |
|
---|
135 | delete (TString*)(val);
|
---|
136 | /*
|
---|
137 | Long_t key2, val2;
|
---|
138 | TExMapIter map2(&fMapG);
|
---|
139 | while (map2.Next(key2, val2))
|
---|
140 | if (val==val2)
|
---|
141 | {
|
---|
142 | delete (TObject*)key;
|
---|
143 | fMapG.Remove(key);
|
---|
144 | }*/
|
---|
145 | }
|
---|
146 | fMapG.Delete();
|
---|
147 | }
|
---|
148 |
|
---|
149 | public:
|
---|
150 | MAstroCatalog();
|
---|
151 | ~MAstroCatalog();
|
---|
152 |
|
---|
153 | void SetTime(const MTime &time);
|
---|
154 | void SetObservatory(const MObservatory &obs);
|
---|
155 | void SetLimMag(Double_t mag) { fLimMag=mag; Update(); } // *MENU* *ARGS={mag=>fLimMag}
|
---|
156 | void SetRadiusFOV(Double_t deg)
|
---|
157 | {
|
---|
158 | //const Double_t max = TestBit(kPlainScreen) ? 90 : 55;
|
---|
159 | const Double_t max = TestBit(kPlainScreen) ? 180 : 90;
|
---|
160 | if (deg>max)
|
---|
161 | deg=max;
|
---|
162 | if (deg<=0)
|
---|
163 | deg=1;
|
---|
164 |
|
---|
165 | fRadiusFOV=deg;
|
---|
166 |
|
---|
167 | Update();
|
---|
168 | } // *MENU* *ARGS={deg=>fRadiusFOV}
|
---|
169 | void SetRaDec(Double_t ra, Double_t dec) { fRaDec.SetRaDec(ra, dec, 1); Update(); }
|
---|
170 | void SetRaDec(const TVector3 &v) { fRaDec=v; Update(); }
|
---|
171 | void SetGuiActive(Bool_t b=kTRUE) { b ? SetBit(kGuiActive) : ResetBit(kGuiActive); }
|
---|
172 |
|
---|
173 | void SetPlainScreen(Bool_t b=kTRUE) { b ? SetBit(kPlainScreen) : ResetBit(kPlainScreen); Update(); } // *TOGGLE* *GETTER=IsPlainScreen
|
---|
174 | Bool_t IsPlainScreen() const { return TestBit(kPlainScreen); }
|
---|
175 |
|
---|
176 | Double_t GetLimMag() const { return fLimMag; }
|
---|
177 | Double_t GetRadiusFOV() const { return fRadiusFOV; }
|
---|
178 |
|
---|
179 | void Delete(Option_t *o="") { fList.Delete(); DeleteMap(); }
|
---|
180 |
|
---|
181 | Int_t ReadXephem(TString catalog = "/usr/X11R6/lib/xephem/catalogs/YBS.edb");
|
---|
182 | Int_t ReadNGC2000(TString catalog = "ngc2000.dat");
|
---|
183 | Int_t ReadBSC(TString catalog = "bsc5.dat");
|
---|
184 |
|
---|
185 | void Print(Option_t *o="") const { fList.Print(); }
|
---|
186 |
|
---|
187 | TList *GetList() { return &fList; }
|
---|
188 |
|
---|
189 | void Draw(Option_t *o="");
|
---|
190 |
|
---|
191 | virtual void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected=0);
|
---|
192 |
|
---|
193 | ClassDef(MAstroCatalog, 1)
|
---|
194 | };
|
---|
195 | #endif
|
---|