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

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