Changeset 3710 for trunk/MagicSoft/Mars/mastro
- Timestamp:
- 04/13/04 10:27:53 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mastro
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mastro/MAstroCamera.cc
r3704 r3710 26 26 // 27 27 // MAstroCamera 28 // ============ 28 29 // 29 30 // A tools displaying stars from a catalog in the camera display. 30 // 31 // PRELIMINARY!! 32 // 33 // 34 // Usage: 35 // ------ 31 36 // For a usage example see macros/starfield.C 32 37 // 33 // PRELIMINARY!! 34 // 38 // To be able to reflect the star-light you need the geometry of the 39 // mirror and the distance of the plain screen. 40 // 41 // You can get the mirror geometry from a MC file and the distance of 42 // the screen from MGeomCam. 43 // 44 // 45 // Algorithm: 46 // ---------- 35 47 // The caluclation of the position of the reflection in the camera is 36 48 // done by: … … 44 56 // individual mirror 45 57 // 46 // GUI: You can use the the cursor keys to change the pointing position 47 // and plus/minus to change the time by a quarter of an hour. 58 // 59 // GUI: 60 // ---- 61 // * You can use the the cursor keys to change the pointing position 62 // and plus/minus to change the time by a quarter of an hour. 63 // 64 // ToDo: 65 // ----- 66 // * possibility to overwrite distance from mirror to screen 67 // * read the mirror geometry directly from the MC input file 48 68 // 49 69 ///////////////////////////////////////////////////////////////////////////// 50 70 #include "MAstroCamera.h" 51 71 52 #include <KeySymbols.h> 53 54 #include <TH2.h> 55 #include <TMarker.h> 56 #include <TVirtualPad.h> 72 #include <KeySymbols.h> // kKey_* 73 74 #include <TH2.h> // TH2D 75 #include <TMarker.h> // TMarker 76 #include <TVirtualPad.h> // gPad 57 77 58 78 #include "MLog.h" … … 64 84 #include "MTime.h" 65 85 #include "MAstroSky2Local.h" 66 #include "../mhist/MHCamera.h"67 86 #include "MObservatory.h" 87 88 #include "../mhist/MHCamera.h" // FIXME: This dependancy is very bad! 89 // HOW TO GET RID OF IT? Move MHCamera to mgeom? 68 90 69 91 ClassImp(MAstroCamera); -
trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc
r3707 r3710 25 25 ////////////////////////////////////////////////////////////////////////////// 26 26 // 27 // MAstroCatalog 28 // 29 // THIS IMPLEMENTATION IS PRELIMINARY AND WILL BE MERGED WITH 30 // SOME PARTS OF THE DRIVE SOFTWARE SOON! 31 // 32 // To display a starfield you must have a supported catalog, then do: 27 // MAstroCatalog 28 // ============= 29 // 30 // THIS IMPLEMENTATION IS PRELIMINARY AND WILL BE MERGED WITH 31 // SOME PARTS OF THE DRIVE SOFTWARE SOON! 32 // 33 // 34 // Usage: 35 // ------ 36 // 37 // To display a starfield you must have a supported catalog, then do: 33 38 // 34 39 // MTime time; … … 63 68 // information is displayed. 64 69 // 70 // 71 // Coordinate Transformation: 72 // ------------------------- 65 73 // The conversion from sky coordinates to local coordinates is done using 66 74 // MAstroSky2Local which does a simple rotation of the coordinate system. … … 68 76 // astrometrical corrections (nutation, precission, abberation, ...) 69 77 // 78 // 70 79 // GUI: 80 // ---- 71 81 // * If the gui is interactive you can use the cursor keys to change 72 82 // the position you are looking at and with plus/minus you 73 83 // can (un)zoom the FOV (Field Of View) 74 //75 84 // * The displayed values mean the following: 76 85 // + alpha: Right Ascension … … 81 90 // coordinate system 82 91 // + time of display 83 //84 92 // * Move the mouse on top of the grid points or the stars to get 85 93 // more setailed information. 94 // * Enable the event-info in a canvas to see the current 95 // ObjectInfo=tooltip-text 96 // * call SetNoToolTips to supress the tooltips 97 // * the blue lines are the local coordinat system 98 // * the red lines are sky coordinate system 99 // 86 100 // 87 101 // ToDo: 102 // ----- 88 103 // - replace MVetcor3 by a more convinient class. Maybe use TExMap, too. 104 // - change tooltips to multi-line tools tips as soon as root 105 // supports them 106 // - a derived class is missing which supports all astrometrical 107 // correction (base on slalib and useable in Cosy) 89 108 // 90 109 ////////////////////////////////////////////////////////////////////////////// 91 110 #include "MAstroCatalog.h" 92 111 93 #include <errno.h> 94 #include <fstream> 95 #include <stdlib.h> 96 #include <limits.h> // INT_MAX (Suse 7.3/gcc 2.95) 97 98 #include <KeySymbols.h> 99 100 #include <TPad.h> // TPad::GetMaxPickDistance 101 #include <TLine.h> 102 #include <TMarker.h> 103 #include <TCanvas.h> 104 #include <TArrayI.h> 105 #include <TGToolTip.h> 106 #include <TRotation.h> 107 #include <TPaveText.h> 112 #include <errno.h> // strerror 113 #include <fstream> // ifstream 114 #include <stdlib.h> // ati, atof 115 #include <limits.h> // INT_MAX (Suse 7.3/gcc 2.95) 116 117 #include <KeySymbols.h> // kKey_* 118 119 #include <TLine.h> // TLine 120 #include <TMarker.h> // TMarker 121 #include <TCanvas.h> // TCanvas 122 #include <TArrayI.h> // TArrayI 123 #include <TGToolTip.h> // TGToolTip 124 #include <TPaveText.h> // TPaveText 108 125 109 126 #include "MLog.h" … … 997 1014 // -------------------------------------------------------------------------- 998 1015 // 1016 // Search for an object at px, py in fMapG. Return the pointer to it 1017 // if found. Set str accordingly if a tooltip string is found. 1018 // 1019 TObject *MAstroCatalog::PickObject(Int_t px, Int_t py, TString &str) const 1020 { 1021 Long_t key, val; 1022 TExMapIter map(&fMapG); 1023 while (map.Next(key, val)) 1024 { 1025 if (!val) 1026 continue; 1027 1028 TObject *o=(TObject*)key; 1029 if (o->DistancetoPrimitive(px, py)>TPad::GetMaxPickDistance()) 1030 continue; 1031 1032 str = *(TString*)val; 1033 return o; 1034 } 1035 return NULL; 1036 } 1037 1038 // -------------------------------------------------------------------------- 1039 // 999 1040 // This function was connected to all created canvases. It is used 1000 1041 // to redirect GetObjectInfo into our own status bar. 1001 1042 // 1002 // The 'connection' is done in AddTab 1043 // The 'connection' is done in Draw. It seems that 'connected' 1044 // functions must be public. 1003 1045 // 1004 1046 void MAstroCatalog::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected) … … 1012 1054 // Try to find a corresponding object with kCannotPick set and 1013 1055 // an available TString (for a tool tip) 1014 TString *str=0;1056 TString str; 1015 1057 if (!selected || selected==this) 1016 { 1017 Long_t key, val; 1018 TExMapIter map(&fMapG); 1019 while (map.Next(key, val)) 1020 { 1021 if (!val) 1022 continue; 1023 1024 TObject *o=(TObject*)key; 1025 if (o->DistancetoPrimitive(px, py)>TPad::GetMaxPickDistance()) 1026 continue; 1027 1028 selected = o; 1029 str = (TString*)val; 1030 break; 1031 } 1032 } 1058 selected = PickObject(px, py, str); 1033 1059 1034 1060 if (!selected) … … 1039 1065 { 1040 1066 case kMouseMotion: 1041 if (!fToolTip->IsMapped() && str)1042 ShowToolTip(px, py, *str);1067 if (!fToolTip->IsMapped() && !str.IsNull()) 1068 ShowToolTip(px, py, str); 1043 1069 break; 1044 1070 … … 1136 1162 1137 1163 // -------------------------------------------------------------------------- 1164 // 1165 // Displays a tooltip 1166 // 1138 1167 void MAstroCatalog::ShowToolTip(Int_t px, Int_t py, const char *txt) 1139 1168 { 1169 if (TestBit(kNoToolTips)) 1170 return; 1171 1140 1172 Int_t x=0; 1141 1173 Int_t y=0; … … 1151 1183 fToolTip->Show(x+4, y+4); 1152 1184 } 1185 1186 // ------------------------------------------------------------------------ 1187 // 1188 // Returns string containing info about the object at position (px,py). 1189 // Returned string will be re-used (lock in MT environment). 1190 // 1191 char *MAstroCatalog::GetObjectInfo(Int_t px, Int_t py) const 1192 { 1193 1194 TString str; 1195 PickObject(px, py, str); 1196 1197 static char txt[129]; 1198 txt[128]=0; 1199 1200 return strncpy(txt, str.Data(), 128); 1201 } 1202 1153 1203 1154 1204 /* -
trunk/MagicSoft/Mars/mastro/MAstroCatalog.h
r3704 r3710 127 127 kPlainScreen = BIT(17), // View is a plain screen view 128 128 kMirrorX = BIT(18), // Mirror display in X 129 kMirrorY = BIT(19) // Mirror display in Y 129 kMirrorY = BIT(19), // Mirror display in Y 130 kNoToolTips = BIT(20) // suppress tooltips 130 131 }; 131 132 … … 141 142 void Update(Bool_t upd=kFALSE); 142 143 143 void ExecuteEventKbd(Int_t keycode, Int_t keysym); 144 void ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2); 144 void ExecuteEventKbd(Int_t keycode, Int_t keysym); 145 void ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2); 146 TObject *PickObject(Int_t px, Int_t py, TString &str) const; 147 char *GetObjectInfo(Int_t px, Int_t py) const; 145 148 146 149 void AddMap(TObject *k, void *v=0) … … 176 179 Bool_t IsPlainScreen() const { return TestBit(kPlainScreen); } 177 180 181 void SetNoToolTips(Bool_t b=kTRUE) { b ? SetBit(kNoToolTips) : ResetBit(kNoToolTips); } // *TOGGLE* *GETTER=HasNoToolTips 182 Bool_t HasNoToolTips() const { return TestBit(kNoToolTips); } 183 178 184 Double_t GetLimMag() const { return fLimMag; } // Get Limiting Magnitude 179 185 Double_t GetRadiusFOV() const { return fRadiusFOV; } // Get maximum radius of Field Of View
Note:
See TracChangeset
for help on using the changeset viewer.