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

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