ds9context.h

Go to the documentation of this file.
00001 #ifndef DISPLAY_DS9_DS9CONTEXT_H_
00002 #define DISPLAY_DS9_DS9CONTEXT_H_
00003 #include <string>
00004 #include <vector>
00005 #include <list>
00006 #include <measures/Measures/MDirection.h>
00007 #include <display/Display/WorldCanvas.h>
00008 #include <display/QtViewer/RegionToolManager.qo.h>
00009 
00010 namespace casa {
00011         namespace viewer {
00012 
00013                 extern double degToRad(double);
00014                 extern double radToDeg(double);
00015 
00016                 double parseSEXStr(const char* d);
00017                 extern double parseHMSStr(const char* str);
00018                 extern double parseDMSStr(const char* str);
00019 
00020                 std::vector<double> coordtovec( double * );
00021                 std::vector<double> doubletovec( double x=1, double y=1, double z=1 );
00022 
00023                 typedef std::vector<double> Vertex;
00024                 typedef std::vector<double> Vector;
00025                 typedef std::string Tag;
00026 
00027                 enum CoordSystem { IMAGE, PHYSICAL, AMPLIFIER, DETECTOR, WCS,
00028                                    WCSA, WCSB, WCSC, WCSD, WCSE, WCSF, WCSG, WCSH, WCSI,
00029                                    WCSJ, WCSK, WCSL, WCSM, WCSN, WCSO, WCSP, WCSQ, WCSR,
00030                                    WCSS, WCST, WCSU, WCSV, WCSW, WCSX, WCSY, WCSZ, WCS0
00031                                  };
00032 
00033                 enum SkyFrame {FK4, FK5, ICRS, GALACTIC, ECLIPTIC, NATIVEWCS};
00034                 enum SkyFormat {DEGREES, SEXAGESIMAL, ARCMIN, ARCSEC};
00035 
00036                 inline MDirection::Types todirection( SkyFrame frame ) {
00037                         switch ( frame ) {
00038                         case FK4:
00039                                 return MDirection::B1950;
00040                         case FK5:
00041                                 return MDirection::J2000;
00042                         case GALACTIC:
00043                                 return MDirection::GALACTIC;
00044                         case ECLIPTIC:
00045                                 return MDirection::ECLIPTIC;
00046                         default:
00047                                 return MDirection::GALACTIC;
00048                         }
00049                 }
00050 
00051                 inline const char *tostr(SkyFrame sf) {
00052                         return sf == FK4 ? "FK4" :
00053                                sf == FK5 ? "FK5" :
00054                                sf == ICRS ? "ICRS" :
00055                                sf == ECLIPTIC ? "ECLIPTIC" : "NATIVEWCS";
00056                 }
00057 
00058                 inline const char * tostr(CoordSystem cs) {
00059                         return cs == IMAGE ? "IMAGE" :
00060                                cs == PHYSICAL ? "PHYSICAL" :
00061                                cs == AMPLIFIER ? "AMPLIFIER" :
00062                                cs == DETECTOR ? "DETECTOR" :
00063                                cs == WCS ? "WCS" : cs == WCSA ? "WCSA" :
00064                                cs == WCSB ? "WCSB" : cs == WCSC ? "WCSC" :
00065                                cs == WCSD ? "WCSD" : cs == WCSE ? "WCSE" :
00066                                cs == WCSF ? "WCSF" : cs == WCSG ? "WCSG" :
00067                                cs == WCSH ? "WCSH" : cs == WCSI ? "WCSI" :
00068                                cs == WCSJ ? "WCSJ" : cs == WCSK ? "WCSK" :
00069                                cs == WCSL ? "WCSL" : cs == WCSM ? "WCSM" :
00070                                cs == WCSN ? "WCSN" : cs == WCSO ? "WCSO" :
00071                                cs == WCSP ? "WCSP" : cs == WCSQ ? "WCSQ" :
00072                                cs == WCSR ? "WCSR" : cs == WCSS ? "WCSS" :
00073                                cs == WCST ? "WCST" : cs == WCSU ? "WCSU" :
00074                                cs == WCSV ? "WCSV" : cs == WCSW ? "WCSW" :
00075                                cs == WCSX ? "WCSX" : cs == WCSY ? "WCSY" :
00076                                cs == WCSZ ? "WCSZ" : "WCS0";
00077                 }
00078 
00079                 inline const char *tostr( SkyFormat f ) {
00080                         return f == DEGREES ? "DEGREES" :
00081                                f == SEXAGESIMAL ? "SEXAGESIMAL" :
00082                                f == ARCMIN ? "ARCMIN" : "ARCSEC";
00083                 }
00084 
00085                 class ds9context {
00086                 public:
00087                         ds9context( WorldCanvas *wc, RegionToolManager *mgr ) : wc_(wc), toolmgr(mgr) { }
00088 
00089                         SHARED_PTR<RegionTool> tool ( region::RegionTypes t )
00090                                 { return toolmgr->tool(t); }
00091 
00092                         double mapAngleFromRef(double /*angle*/, CoordSystem /*sys*/, SkyFrame /*sky*/) {
00093                                 return 0;
00094                         }
00095                         double mapAngleToRef(double /*angle*/, CoordSystem /*sys*/, SkyFrame /*sky*/) {
00096                                 return 0;
00097                         }
00098                         // from Base::findFits(globalTile)->mapLenToRef(...)
00099                         double mapLenToRef(double d, CoordSystem sys, SkyFormat format=DEGREES);
00100                         // from Base::findFits(globalTile)->mapLenToRef(...)
00101                         Vector mapLenToRef(const Vector &, CoordSystem sys, SkyFormat format=DEGREES);
00102                         // from Base::findFits(globalTile)->mapToRef(...)
00103                         Vector mapToRef(const Vector& v, CoordSystem sys, SkyFrame format=FK5);
00104 
00105                         void resetCompositeMarker() { }
00106 
00107                         void createContourPolygonCmd( const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00108                                                       const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00109                                                       const std::list<Tag>& /*tag*/ ) { }
00110                         void createCompassCmd( const Vector& /*center*/, double /*r*/, const char* /*north*/, const char* /*east*/,
00111                                                int /*na*/, int /*ea*/, CoordSystem /*sys*/, SkyFrame /*sky*/, const char* /*color*/, int* /*dash*/,
00112                                                int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00113                                                const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00114                         void createCompositeCmd( const Vector& /*center*/, double /*angle*/, int /*global*/, const char* /*color*/, int* /*dash*/,
00115                                                  int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00116                                                  const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00117                         void createVectCmd( const Vector& /*center*/, const Vector& /*p2*/, int /*arrow*/,const char* /*color*/, int* /*dash*/,
00118                                             int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00119                                             const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00120                         void createVectCmd( const Vector& /*center*/, double /*mag*/, double /*ang*/, int /*arrow*/, const char* /*color*/, int* /*dash*/,
00121                                             int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00122                                             const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00123 
00124                         void createProjectionCmd( const Vector& /*center*/, const Vector& /*p2*/, double /*w*/, const char* /*mvcb*/,
00125                                                   const char* /*delcb*/, const char* /*color*/, int* /*dash*/, int /*width*/,
00126                                                   const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00127                                                   const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00128                         void createRulerCmd( const Vector& /*center*/, const Vector& /*p2*/, CoordSystem /*sys*/, SkyFrame /*sky*/,
00129                                              CoordSystem /*distsys*/, SkyFormat /*distformat*/, const char* /*color*/, int* /*dash*/,
00130                                              int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00131                                              const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00132                         void createCircle3dCmd( const Vector& /*center*/, double /*radius*/, const char* /*mvcb*/,
00133                                                 const char* /*delcb*/, const char* /*color*/, int* /*dash*/, int /*width*/,
00134                                                 const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00135                                                 const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00136                         void createAnnulusCmd( const Vector& /*center*/, double /*start*/, double /*stop*/, int /*num*/,
00137                                                const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00138                                                const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00139                                                const std::list<Tag>& /*tag*/ ) { }
00140                         void createAnnulusCmd( const Vector& /*center*/, int /*num*/, double* /*radii*/, const char* /*color*/, int* /*dash*/,
00141                                                int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00142                                                const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00143                         void createCpandaCmd( const Vector& /*center*/, double /*ang1*/, double /*ang2*/, int /*an*/,
00144                                               double /*rad1*/, double /*rad2*/, int /*rn*/, const char* /*color*/, int* /*dash*/,
00145                                               int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00146                                               const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00147                         void createCpandaCmd( const Vector& /*center*/, int /*an*/, double* /*a*/, int /*rn*/, double* /*r*/,
00148                                               const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00149                                               const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00150                                               const std::list<Tag>& /*tag*/ ) { }
00151                         void createEllipseAnnulusCmd( const Vector& /*center*/, const Vector& /*inner*/,
00152                                                       const Vector& /*outer*/, int /*num*/, double /*angle*/,
00153                                                       const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00154                                                       const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00155                                                       const std::list<Tag>& /*tag*/ ) { }
00156                         void createEllipseAnnulusCmd( const Vector& /*center*/, int /*num*/, Vector* /*radii*/, double /*angle*/,
00157                                                       const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00158                                                       const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00159                                                       const std::list<Tag>& /*tag*/ ) { }
00160                         void createEpandaCmd( const Vector& /*center*/, double /*ang1*/, double /*ang2*/, int /*an*/,
00161                                               const Vector& /*rad1*/, const Vector& /*rad2*/, int /*rn*/, double /*angle*/,
00162                                               const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00163                                               const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00164                                               const std::list<Tag>& /*tag*/ ) { }
00165                         void createEpandaCmd( const Vector& /*center*/, int /*an*/, double* /*a*/, int /*rn*/, Vector* /*r*/,
00166                                               double /*angle*/, const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00167                                               const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00168                                               const std::list<Tag>& /*tag*/ ) { }
00169                         void createLineCmd( const Vector& /*center*/, const Vector& /*p2*/, int /*arrow1*/, int /*arrow2*/,
00170                                             const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00171                                             const char* /*text*/, unsigned short /*prop*/,
00172                                             const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00173                         void createBoxAnnulusCmd( const Vector& /*center*/, const Vector& /*inner*/, const Vector& /*outer*/,
00174                                                   int /*num*/, double /*angle*/, const char* /*color*/, int* /*dash*/,
00175                                                   int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00176                                                   const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00177                         void createBoxAnnulusCmd( const Vector& /*center*/, int /*num*/, Vector* /*size*/, double /*angle*/,
00178                                                   const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00179                                                   const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00180                                                   const std::list<Tag>& /*tag*/ ) { }
00181 
00182                         void createBpandaCmd( const Vector& /*center*/, double /*ang1*/, double /*ang2*/, int /*an*/,
00183                                               const Vector& /*rad1*/, const Vector& /*rad2*/, int /*rn*/, double /*angle*/,
00184                                               const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00185                                               const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00186                                               const std::list<Tag>& /*tag*/ ) { }
00187                         void createBpandaCmd( const Vector& /*center*/, int /*an*/, double* /*a*/, int /*rn*/, Vector* /*r*/,
00188                                               double /*angle*/,const char* /*color*/, int* /*dash*/, int /*width*/,
00189                                               const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00190                                               const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00191 
00192                         void createTextCmd( const Vector& /*center*/, double /*angle*/, int /*rotate*/, const char* /*color*/, int* /*dash*/,
00193                                             int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00194                                             const char* /*comment*/, const std::list<Tag>& /*tag*/ ) { }
00195 
00196 
00197                         // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
00198                         void createBoxCmd( const Vector& /*center*/, const Vector& /*size*/, double /*angle*/,
00199                                            const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00200                                            const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00201                                            const std::list<Tag>& /*tag*/ );
00202                         void createEllipseCmd( const Vector& /*center*/, const Vector& /*radius*/, double /*angle*/,
00203                                                const char* /*color*/, int* /*dash*/, int /*width*/, const char* /*font*/,
00204                                                const char* /*text*/, unsigned short /*prop*/, const char* /*comment*/,
00205                                                const std::list<Tag>& /*tag*/ );
00206                         void createCircleCmd( const Vector& /*center*/, double /*radius*/, const char* /*color*/, int* /*dash*/,
00207                                               int /*width*/, const char* /*font*/, const char* /*text*/, unsigned short /*prop*/,
00208                                               const char* /*comment*/, const std::list<Tag>& /*tag*/ );
00209                         void createPolygonCmd( const Vector& center, const Vector& bb, const char* color, int* dash,
00210                                                int width, const char* font, const char* text, unsigned short prop,
00211                                                const char* comment, const std::list<Tag>& tag );
00212                         void createPolygonCmd( const std::list<Vertex>& list, const char* color, int* dash,
00213                                                int width, const char* font, const char* text, unsigned short prop,
00214                                                const char* comment, const std::list<Tag>& tag );
00215 
00216                         void createCirclePointCmd( const Vector& center, int size, const char* color, int* dash,
00217                                                    int width, const char* font, const char* text, unsigned short prop,
00218                                                    const char* comment, const std::list<Tag>& tag );
00219                         void createBoxPointCmd( const Vector& center, int size, const char* color, int* dash,
00220                                                 int width, const char* font, const char* text, unsigned short prop,
00221                                                 const char* comment, const std::list<Tag>& tag );
00222                         void createDiamondPointCmd( const Vector& center, int size, const char* color, int* dash,
00223                                                     int width, const char* font, const char* text, unsigned short prop,
00224                                                     const char* comment, const std::list<Tag>& tag );
00225                         void createCrossPointCmd( const Vector& center, int size, const char* color, int* dash,
00226                                                   int width, const char* font, const char* text, unsigned short prop,
00227                                                   const char* comment, const std::list<Tag>& tag );
00228                         void createExPointCmd( const Vector& center, int size, const char* color, int* dash,
00229                                                int width, const char* font, const char* text, unsigned short prop,
00230                                                const char* comment, const std::list<Tag>& tag );
00231                         void createArrowPointCmd( const Vector& center, int size, const char* color, int* dash,
00232                                                   int width, const char* font, const char* text, unsigned short prop,
00233                                                   const char* comment, const std::list<Tag>& tag );
00234                         void createBoxCirclePointCmd( const Vector& center, int size, const char* color, int* dash,
00235                                                       int width, const char* font, const char* text, unsigned short prop,
00236                                                       const char* comment, const std::list<Tag>& tag );
00237                         // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
00238 
00239 
00240                         void markerDeleteLastCmd() { }
00241 
00242                 private:
00243                         WorldCanvas *wc_;
00244                         RegionToolManager *toolmgr;
00245                 };
00246         }
00247 }
00248 
00249 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1