casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ds9context.h
Go to the documentation of this file.
1 #ifndef DISPLAY_DS9_DS9CONTEXT_H_
2 #define DISPLAY_DS9_DS9CONTEXT_H_
3 #include <string>
4 #include <vector>
5 #include <list>
9 
10 namespace casa {
11  namespace viewer {
12 
13  extern double degToRad(double);
14  extern double radToDeg(double);
15 
16  double parseSEXStr(const char* d);
17  extern double parseHMSStr(const char* str);
18  extern double parseDMSStr(const char* str);
19 
20  std::vector<double> coordtovec( double * );
21  std::vector<double> doubletovec( double x=1, double y=1, double z=1 );
22 
23  typedef std::vector<double> Vertex;
24  typedef std::vector<double> Vector;
25  typedef std::string Tag;
26 
31  };
32 
35 
37  switch ( frame ) {
38  case FK4:
40  case FK5:
42  case GALACTIC:
44  case ECLIPTIC:
46  default:
48  }
49  }
50 
51  inline const char *tostr(SkyFrame sf) {
52  return sf == FK4 ? "FK4" :
53  sf == FK5 ? "FK5" :
54  sf == ICRS ? "ICRS" :
55  sf == ECLIPTIC ? "ECLIPTIC" : "NATIVEWCS";
56  }
57 
58  inline const char * tostr(CoordSystem cs) {
59  return cs == IMAGE ? "IMAGE" :
60  cs == PHYSICAL ? "PHYSICAL" :
61  cs == AMPLIFIER ? "AMPLIFIER" :
62  cs == DETECTOR ? "DETECTOR" :
63  cs == WCS ? "WCS" : cs == WCSA ? "WCSA" :
64  cs == WCSB ? "WCSB" : cs == WCSC ? "WCSC" :
65  cs == WCSD ? "WCSD" : cs == WCSE ? "WCSE" :
66  cs == WCSF ? "WCSF" : cs == WCSG ? "WCSG" :
67  cs == WCSH ? "WCSH" : cs == WCSI ? "WCSI" :
68  cs == WCSJ ? "WCSJ" : cs == WCSK ? "WCSK" :
69  cs == WCSL ? "WCSL" : cs == WCSM ? "WCSM" :
70  cs == WCSN ? "WCSN" : cs == WCSO ? "WCSO" :
71  cs == WCSP ? "WCSP" : cs == WCSQ ? "WCSQ" :
72  cs == WCSR ? "WCSR" : cs == WCSS ? "WCSS" :
73  cs == WCST ? "WCST" : cs == WCSU ? "WCSU" :
74  cs == WCSV ? "WCSV" : cs == WCSW ? "WCSW" :
75  cs == WCSX ? "WCSX" : cs == WCSY ? "WCSY" :
76  cs == WCSZ ? "WCSZ" : "WCS0";
77  }
78 
79  inline const char *tostr( SkyFormat f ) {
80  return f == DEGREES ? "DEGREES" :
81  f == SEXAGESIMAL ? "SEXAGESIMAL" :
82  f == ARCMIN ? "ARCMIN" : "ARCSEC";
83  }
84 
85  class ds9context {
86  public:
87  ds9context( WorldCanvas *wc, RegionToolManager *mgr ) : wc_(wc), toolmgr(mgr) { }
88 
89  std::shared_ptr<RegionTool> tool ( region::RegionTypes t )
90  { return toolmgr->tool(t); }
91 
92  double mapAngleFromRef(double /*angle*/, CoordSystem /*sys*/, SkyFrame /*sky*/) {
93  return 0;
94  }
95  double mapAngleToRef(double /*angle*/, CoordSystem /*sys*/, SkyFrame /*sky*/) {
96  return 0;
97  }
98  // from Base::findFits(globalTile)->mapLenToRef(...)
99  double mapLenToRef(double d, CoordSystem sys, SkyFormat format=DEGREES);
100  // from Base::findFits(globalTile)->mapLenToRef(...)
101  Vector mapLenToRef(const Vector &, CoordSystem sys, SkyFormat format=DEGREES);
102  // from Base::findFits(globalTile)->mapToRef(...)
103  Vector mapToRef(const Vector& v, CoordSystem sys, SkyFrame format=FK5);
104 
106 
107  void createContourPolygonCmd( const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
108  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
109  const std::list<Tag>& /*tag*/ ) { }
110  void createCompassCmd( const Vector& /*center*/, double /*r*/, const char* /*north*/, const char* /*east*/,
111  int /*na*/, int /*ea*/, CoordSystem /*sys*/, SkyFrame /*sky*/, const char* /*color*/, int* /*dash*/,
112  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
113  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
114  void createCompositeCmd( const Vector& /*center*/, double /*angle*/, int /*global*/, const char* /*color*/, int* /*dash*/,
115  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
116  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
117  void createVectCmd( const Vector& /*center*/, const Vector& /*p2*/, int /*arrow*/,const char* /*color*/, int* /*dash*/,
118  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
119  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
120  void createVectCmd( const Vector& /*center*/, double /*mag*/, double /*ang*/, int /*arrow*/, const char* /*color*/, int* /*dash*/,
121  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
122  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
123 
124  void createProjectionCmd( const Vector& /*center*/, const Vector& /*p2*/, double /*w*/, const char* /*mvcb*/,
125  const char* /*delcb*/, const char* /*color*/, int* /*dash*/, int /*width*/,
126  const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
127  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
128  void createRulerCmd( const Vector& /*center*/, const Vector& /*p2*/, CoordSystem /*sys*/, SkyFrame /*sky*/,
129  CoordSystem /*distsys*/, SkyFormat /*distformat*/, const char* /*color*/, int* /*dash*/,
130  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
131  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
132  void createCircle3dCmd( const Vector& /*center*/, double /*radius*/, const char* /*mvcb*/,
133  const char* /*delcb*/, const char* /*color*/, int* /*dash*/, int /*width*/,
134  const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
135  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
136  void createAnnulusCmd( const Vector& /*center*/, double /*start*/, double /*stop*/, int /*num*/,
137  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
138  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
139  const std::list<Tag>& /*tag*/ ) { }
140  void createAnnulusCmd( const Vector& /*center*/, int /*num*/, double* /*radii*/, const char* /*color*/, int* /*dash*/,
141  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
142  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
143  void createCpandaCmd( const Vector& /*center*/, double /*ang1*/, double /*ang2*/, int /*an*/,
144  double /*rad1*/, double /*rad2*/, int /*rn*/, const char* /*color*/, int* /*dash*/,
145  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
146  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
147  void createCpandaCmd( const Vector& /*center*/, int /*an*/, double* /*a*/, int /*rn*/, double* /*r*/,
148  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
149  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
150  const std::list<Tag>& /*tag*/ ) { }
151  void createEllipseAnnulusCmd( const Vector& /*center*/, const Vector& /*inner*/,
152  const Vector& /*outer*/, int /*num*/, double /*angle*/,
153  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
154  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
155  const std::list<Tag>& /*tag*/ ) { }
156  void createEllipseAnnulusCmd( const Vector& /*center*/, int /*num*/, Vector* /*radii*/, double /*angle*/,
157  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
158  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
159  const std::list<Tag>& /*tag*/ ) { }
160  void createEpandaCmd( const Vector& /*center*/, double /*ang1*/, double /*ang2*/, int /*an*/,
161  const Vector& /*rad1*/, const Vector& /*rad2*/, int /*rn*/, double /*angle*/,
162  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
163  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
164  const std::list<Tag>& /*tag*/ ) { }
165  void createEpandaCmd( const Vector& /*center*/, int /*an*/, double* /*a*/, int /*rn*/, Vector* /*r*/,
166  double /*angle*/, const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
167  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
168  const std::list<Tag>& /*tag*/ ) { }
169  void createLineCmd( const Vector& /*center*/, const Vector& /*p2*/, int /*arrow1*/, int /*arrow2*/,
170  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
171  const char* /*text*/, unsigned short /*prop*/,
172  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
173  void createBoxAnnulusCmd( const Vector& /*center*/, const Vector& /*inner*/, const Vector& /*outer*/,
174  int /*num*/, double /*angle*/, const char* /*color*/, int* /*dash*/,
175  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
176  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
177  void createBoxAnnulusCmd( const Vector& /*center*/, int /*num*/, Vector* /*size*/, double /*angle*/,
178  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
179  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
180  const std::list<Tag>& /*tag*/ ) { }
181 
182  void createBpandaCmd( const Vector& /*center*/, double /*ang1*/, double /*ang2*/, int /*an*/,
183  const Vector& /*rad1*/, const Vector& /*rad2*/, int /*rn*/, double /*angle*/,
184  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
185  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
186  const std::list<Tag>& /*tag*/ ) { }
187  void createBpandaCmd( const Vector& /*center*/, int /*an*/, double* /*a*/, int /*rn*/, Vector* /*r*/,
188  double /*angle*/,const char* /*color*/, int* /*dash*/, int /*width*/,
189  const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
190  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
191 
192  void createTextCmd( const Vector& /*center*/, double /*angle*/, int /*rotate*/, const char* /*color*/, int* /*dash*/,
193  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
194  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
195 
196 
197  // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
198  void createBoxCmd( const Vector& /*center*/, const Vector& /*size*/, double /*angle*/,
199  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
200  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
201  const std::list<Tag>& /*tag*/ );
202  void createEllipseCmd( const Vector& /*center*/, const Vector& /*radius*/, double /*angle*/,
203  const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
204  const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
205  const std::list<Tag>& /*tag*/ );
206  void createCircleCmd( const Vector& /*center*/, double /*radius*/, const char* /*color*/, int* /*dash*/,
207  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
208  const char* /*comment*/, const std::list<Tag>& /*tag*/ );
209  void createPolygonCmd( const Vector& center, const Vector& bb, const char* color, int* dash,
210  int width, const char* font, const char* text, unsigned short prop,
211  const char* comment, const std::list<Tag>& tag );
212  void createPolygonCmd( const std::list<Vertex>& list, const char* color, int* dash,
213  int width, const char* font, const char* text, unsigned short prop,
214  const char* comment, const std::list<Tag>& tag );
215 
216  void createCirclePointCmd( const Vector& center, int size, const char* color, int* dash,
217  int width, const char* font, const char* text, unsigned short prop,
218  const char* comment, const std::list<Tag>& tag );
219  void createBoxPointCmd( const Vector& center, int size, const char* color, int* dash,
220  int width, const char* font, const char* text, unsigned short prop,
221  const char* comment, const std::list<Tag>& tag );
222  void createDiamondPointCmd( const Vector& center, int size, const char* color, int* dash,
223  int width, const char* font, const char* text, unsigned short prop,
224  const char* comment, const std::list<Tag>& tag );
225  void createCrossPointCmd( const Vector& center, int size, const char* color, int* dash,
226  int width, const char* font, const char* text, unsigned short prop,
227  const char* comment, const std::list<Tag>& tag );
228  void createExPointCmd( const Vector& center, int size, const char* color, int* dash,
229  int width, const char* font, const char* text, unsigned short prop,
230  const char* comment, const std::list<Tag>& tag );
231  void createArrowPointCmd( const Vector& center, int size, const char* color, int* dash,
232  int width, const char* font, const char* text, unsigned short prop,
233  const char* comment, const std::list<Tag>& tag );
234  void createBoxCirclePointCmd( const Vector& center, int size, const char* color, int* dash,
235  int width, const char* font, const char* text, unsigned short prop,
236  const char* comment, const std::list<Tag>& tag );
237  // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
238 
239 
241 
242  private:
245  };
246  }
247 }
248 
249 #endif
void createEpandaCmd(const Vector &, int, double *, int, Vector *, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:165
void createCircleCmd(const Vector &, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
void createAnnulusCmd(const Vector &, int, double *, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:140
void createBpandaCmd(const Vector &, int, double *, int, Vector *, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:187
double parseSEXStr(const char *d)
double mapLenToRef(double d, CoordSystem sys, SkyFormat format=DEGREES)
from Base::findFits(globalTile)-&gt;mapLenToRef(...)
void createVectCmd(const Vector &, double, double, int, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:120
std::vector< double > Vector
Definition: ds9context.h:24
void createRulerCmd(const Vector &, const Vector &, CoordSystem, SkyFrame, CoordSystem, SkyFormat, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:128
void createCirclePointCmd(const Vector &center, int size, const char *color, int *dash, int width, const char *font, const char *text, unsigned short prop, const char *comment, const std::list< Tag > &tag)
void createPolygonCmd(const Vector &center, const Vector &bb, const char *color, int *dash, int width, const char *font, const char *text, unsigned short prop, const char *comment, const std::list< Tag > &tag)
std::vector< double > Vertex
Definition: ds9context.h:23
void createAnnulusCmd(const Vector &, double, double, int, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:136
void createContourPolygonCmd(const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:107
double parseDMSStr(const char *str)
void createCrossPointCmd(const Vector &center, int size, const char *color, int *dash, int width, const char *font, const char *text, unsigned short prop, const char *comment, const std::list< Tag > &tag)
void createBoxAnnulusCmd(const Vector &, const Vector &, const Vector &, int, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:173
void createBpandaCmd(const Vector &, double, double, int, const Vector &, const Vector &, int, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:182
casacore::MDirection::Types todirection(SkyFrame frame)
Definition: ds9context.h:36
RegionToolManager * toolmgr
Definition: ds9context.h:244
void createLineCmd(const Vector &, const Vector &, int, int, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:169
std::shared_ptr< RegionTool > tool(region::RegionTypes t)
Definition: ds9context.h:89
void createEpandaCmd(const Vector &, double, double, int, const Vector &, const Vector &, int, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:160
void createEllipseCmd(const Vector &, const Vector &, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
size_t size() const
void createCpandaCmd(const Vector &, double, double, int, double, double, int, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:143
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
void createCompassCmd(const Vector &, double, const char *, const char *, int, int, CoordSystem, SkyFrame, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:110
double mapAngleFromRef(double, CoordSystem, SkyFrame)
Definition: ds9context.h:92
std::vector< double > doubletovec(double x=1, double y=1, double z=1)
std::vector< double > coordtovec(double *)
void createProjectionCmd(const Vector &, const Vector &, double, const char *, const char *, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:124
void createArrowPointCmd(const Vector &center, int size, const char *color, int *dash, int width, const char *font, const char *text, unsigned short prop, const char *comment, const std::list< Tag > &tag)
void createBoxPointCmd(const Vector &center, int size, const char *color, int *dash, int width, const char *font, const char *text, unsigned short prop, const char *comment, const std::list< Tag > &tag)
void createBoxCirclePointCmd(const Vector &center, int size, const char *color, int *dash, int width, const char *font, const char *text, unsigned short prop, const char *comment, const std::list< Tag > &tag)
ds9context(WorldCanvas *wc, RegionToolManager *mgr)
Definition: ds9context.h:87
double degToRad(double)
double mapAngleToRef(double, CoordSystem, SkyFrame)
Definition: ds9context.h:95
void createBoxAnnulusCmd(const Vector &, int, Vector *, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:177
void createVectCmd(const Vector &, const Vector &, int, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:117
void createExPointCmd(const Vector &center, int size, const char *color, int *dash, int width, const char *font, const char *text, unsigned short prop, const char *comment, const std::list< Tag > &tag)
Vector mapToRef(const Vector &v, CoordSystem sys, SkyFrame format=FK5)
from Base::findFits(globalTile)-&gt;mapToRef(...)
std::shared_ptr< RegionTool > tool(region::RegionTypes)
fetch tool for a particular region type...
void createBoxCmd(const Vector &, const Vector &, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
double radToDeg(double)
double parseHMSStr(const char *str)
void createCompositeCmd(const Vector &, double, int, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:114
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
void createCpandaCmd(const Vector &, int, double *, int, double *, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:147
void createEllipseAnnulusCmd(const Vector &, const Vector &, const Vector &, int, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:151
void createTextCmd(const Vector &, double, int, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:192
void createCircle3dCmd(const Vector &, double, const char *, const char *, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:132
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
std::string Tag
Definition: ds9context.h:25
void createDiamondPointCmd(const Vector &center, int size, const char *color, int *dash, int width, const char *font, const char *text, unsigned short prop, const char *comment, const std::list< Tag > &tag)
const char * tostr(SkyFrame sf)
Definition: ds9context.h:51
void createEllipseAnnulusCmd(const Vector &, int, Vector *, double, const char *, int *, int, const char *, const char *, unsigned short, const char *, const std::list< Tag > &)
Definition: ds9context.h:156
the RegionCreator class now has static members which allow for the retrieval of lists of RegionCreato...