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

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