source: trunk/MagicSoft/Mars/mastro/MAstroCatalog.h@ 8999

Last change on this file since 8999 was 8907, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 6.7 KB
Line 
1#ifndef MARS_MAstroCatalog
2#define MARS_MAstroCatalog
3
4#ifndef MARS_MVector3
5#include "MVector3.h"
6#endif
7#ifndef ROOT_TList
8#include <TList.h>
9#endif
10#ifndef ROOT_TAttLine
11#include <TAttLine.h>
12#endif
13#ifndef ROOT_TAttMarker
14#include <TAttMarker.h>
15#endif
16#ifndef MARS_MGMap
17#include <MGMap.h>
18#endif
19
20class MTime;
21class MObservatory;
22class TArrayI;
23class TGToolTip;
24class TGraph;
25
26class MAttLine : public TObject, public TAttLine
27{
28public:
29 MAttLine() { }
30 ClassDef(MAttLine, 1) // Helper class to have a TAttLine derving from TObject (for standalone GED editor)
31};
32
33class MAstroCatalog : public TObject, public TAttMarker
34{
35private:
36 Double_t fLimMag; // [1] Limiting Magnitude
37 Double_t fRadiusFOV; // [deg] Radius of Field of View
38
39 TGToolTip *fToolTip; //! The tooltip currently displayed
40 Double_t fAngle; //! Rotation angle of map
41
42 MAttLine fAttLineSky; // Line Style and color for sky coordinates
43 MAttLine fAttLineLocal; // Line Style and color for local coordinates
44
45 void ShowToolTip(Int_t px, Int_t py, const char *txt);
46 void SetLineAttributes(MAttLine &att);
47
48 TString FindToken(TString &line, Char_t tok=',');
49
50 Int_t atoi(const TString &s);
51 Float_t atof(const TString &s);
52
53//#if ROOT_VERSION_CODE < ROOT_VERSION(4,00,03)
54// Bool_t fPlainScreen; //! Just a dummy!!!! ([Set,Is]Freezed)
55// Bool_t fNoToolTips; //! Just a dummy!!!! ([Set,Is]Freezed)
56//#endif
57
58 virtual Int_t ConvertToPad(const TVector3 &w, TVector2 &v) const;
59 virtual void AddPrimitives(TString o);
60 virtual void SetRangePad(Option_t *o);
61
62 Int_t Convert(const TRotation &rot, TVector2 &v) const;
63 void Draw(const TVector2 &v0, const TRotation &rot, TArrayI &dx, TArrayI &dy, Int_t stepx, Int_t stepy, Int_t type);
64 void DrawPrimitives(Option_t *o);
65 Bool_t DrawLine(const TVector2 &v0, Int_t dx, Int_t dy, const TRotation &rot, Int_t type);
66 void DrawGrid(const TVector3 &v0, const TRotation &rot, Int_t type);
67 void Paint(Option_t *o="");
68 Int_t DistancetoPrimitive(Int_t px, Int_t py);
69
70protected:
71 enum {
72 kMark = BIT(14), // A mark for the sources in the list
73 kHasChanged = BIT(15), // Display has changed
74 kGuiActive = BIT(16), // GUI is interactive
75 kPlainScreen = BIT(17), // View is a plain screen view
76 kMirrorX = BIT(18), // Mirror display in X
77 kMirrorY = BIT(19), // Mirror display in Y
78 kNoToolTips = BIT(20), // suppress tooltips
79 kDrawingImage = BIT(21) // just drawing into a bitmap
80 };
81
82 MGMap fMapG; //! A map with all gui primitives and tooltips
83
84 TList fList; // List of stars loaded
85 MVector3 fRaDec; // pointing position
86
87 MObservatory *fObservatory; // Possible obervatory location
88 MTime *fTime; // Possible observation time
89
90 TRotation AlignCoordinates(const TVector3 &v) const;
91 virtual TString GetPadTitle() const;
92 TRotation GetGrid(Bool_t local);
93 void DrawStar(Double_t x, Double_t y, const TVector3 &v, Int_t col, const char *txt=0, Bool_t resize=kFALSE);
94 void Update(Bool_t upd=kFALSE);
95
96 void ExecuteEventKbd(Int_t keycode, Int_t keysym);
97 void ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2);
98 char *GetObjectInfo(Int_t px, Int_t py) const;
99
100public:
101 MAstroCatalog();
102 ~MAstroCatalog();
103
104 void ForceUpdate() { Update(kTRUE); } // Slot for marker handling
105
106 // Setter to control the sky position and behaviour
107 void SetTime(const MTime &time);
108 void SetObservatory(const MObservatory &obs);
109 void SetLimMag(Double_t mag) { fLimMag=mag; Update(); } // *MENU* *ARGS={mag=>fLimMag}
110
111 void SetRadiusFOV(Double_t pixsize, Double_t w, Double_t h);
112 void SetRadiusFOV(Double_t deg)
113 {
114 //const Double_t max = TestBit(kPlainScreen) ? 90 : 55;
115 const Double_t max = TestBit(kPlainScreen) ? 180 : 90;
116 if (deg>max)
117 deg=max;
118 if (deg<1)
119 deg=1;
120
121 fRadiusFOV=deg;
122
123 Update();
124 } // *MENU* *ARGS={deg=>fRadiusFOV}
125
126 void SetRaDec(Double_t ra, Double_t dec) { fRaDec.SetRaDec(ra, dec, 1); Update(); }
127 void SetRaDec(const TVector3 &v) { fRaDec=v; Update(); }
128 void SetGuiActive(Bool_t b=kTRUE) { b ? SetBit(kGuiActive) : ResetBit(kGuiActive); }
129
130 void SetPlainScreen(Bool_t b=kTRUE) { b ? SetBit(kPlainScreen) : ResetBit(kPlainScreen); Update(); } // *TOGGLE* *GETTER=IsPlainScreen
131 Bool_t IsPlainScreen() const { return TestBit(kPlainScreen); }
132
133 void SetNoToolTips(Bool_t b=kTRUE) { b ? SetBit(kNoToolTips) : ResetBit(kNoToolTips); } // *TOGGLE* *GETTER=HasNoToolTips
134 Bool_t HasNoToolTips() const { return TestBit(kNoToolTips); }
135
136 Double_t GetLimMag() const { return fLimMag; } // Get Limiting Magnitude
137 Double_t GetRadiusFOV() const { return fRadiusFOV; } // Get maximum radius of Field Of View
138
139 // Interface to set stars
140 Int_t ReadXephem(TString catalog = "/usr/X11R6/lib/xephem/catalogs/YBS.edb");
141 Int_t ReadNGC2000(TString catalog = "ngc2000.dat");
142 Int_t ReadBSC(TString catalog = "bsc5.dat");
143 Int_t ReadHeasarcPPM(TString catalog = "heasarc_ppm.tdat", TString fout="");
144 Int_t ReadCompressed(TString catalog);
145 Bool_t AddObject(Float_t ra, Float_t dec, Float_t mag, TString name="");
146
147 // Interface to get stars
148 TList *GetList() { return &fList; } // Return list of stars
149 UInt_t GetNumStars() const { return fList.GetEntries(); }
150 TObject *FindObject(const char *name) const { return fList.FindObject(name); }
151 TObject *FindObject(const TObject *obj) const { return fList.FindObject(obj); }
152 void MarkObject(const char *name) const { TObject *o=FindObject(name); if (o) o->SetBit(kMark); }
153
154 void GetVisibilityCurve(TGraph &g, const char *name=0) const;
155
156 // TObject
157 void Delete(Option_t *o="") { fList.Delete(); fMapG.Delete(); } // Delete list of stars
158 void Print(Option_t *o="") const { fList.Print(); } // Print all stars
159 void Draw(Option_t *o="");
160 void SetDrawOption(Option_t *option="")
161 {
162 TObject::SetDrawOption(option);
163 Update(kTRUE);
164 } //*MENU*
165
166 // Interface to Cosy
167 void PaintImg(unsigned char *buf, int w=768, int h=576, Option_t *o=0);
168
169 // Interface to line styles
170 void SetLineAttributesLocal() { SetLineAttributes(fAttLineLocal); } //*MENU*
171 void SetLineAttributesSky() { SetLineAttributes(fAttLineSky); } //*MENU*
172 void SetMarkerAttributes(); //*MENU*
173
174 TAttLine &GetAttLineSky() { return fAttLineSky; }
175 TAttLine &GetAttLineLocal() { return fAttLineLocal; }
176
177 virtual void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected=0);
178
179 ClassDef(MAstroCatalog, 2) // Display class for star catalogs
180};
181
182#endif
Note: See TracBrowser for help on using the repository browser.