Commit eaddc45822a04cfd1c111eadce8f930281e5f3d4
1 parent
eafe6202
Minor revision of projection class interfaces.
Showing
9 changed files
with
184 additions
and
102 deletions
include/GWcsMER.hpp
| ... | ... | @@ -53,13 +53,13 @@ public: |
| 53 | 53 | virtual ~GWcsMER(void); |
| 54 | 54 | |
| 55 | 55 | // Operators |
| 56 | - GWcsMER& operator= (const GWcsMER& wcs); | |
| 56 | + GWcsMER& operator=(const GWcsMER& wcs); | |
| 57 | 57 | |
| 58 | 58 | // Implemented pure virtual base class methods |
| 59 | 59 | virtual void clear(void); |
| 60 | 60 | virtual GWcsMER* clone(void) const; |
| 61 | - virtual std::string code(void) const { return "MER"; } | |
| 62 | - virtual std::string name(void) const { return "Mercator's"; } | |
| 61 | + virtual std::string code(void) const; | |
| 62 | + virtual std::string name(void) const; | |
| 63 | 63 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 64 | 64 | |
| 65 | 65 | private: |
| ... | ... | @@ -76,4 +76,32 @@ private: |
| 76 | 76 | double* x, double* y, int* stat) const; |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | + | |
| 80 | +/***********************************************************************//** | |
| 81 | + * @brief Return projection code | |
| 82 | + * | |
| 83 | + * @return Projection code. | |
| 84 | + * | |
| 85 | + * Returns the projection code "MER". | |
| 86 | + ***************************************************************************/ | |
| 87 | +inline | |
| 88 | +std::string GWcsMER::code(void) const | |
| 89 | +{ | |
| 90 | + return "MER"; | |
| 91 | +} | |
| 92 | + | |
| 93 | + | |
| 94 | +/***********************************************************************//** | |
| 95 | + * @brief Return projection name | |
| 96 | + * | |
| 97 | + * @return Projection name. | |
| 98 | + * | |
| 99 | + * Returns the projection name. | |
| 100 | + ***************************************************************************/ | |
| 101 | +inline | |
| 102 | +std::string GWcsMER::name(void) const | |
| 103 | +{ | |
| 104 | + return "Mercator's"; | |
| 105 | +} | |
| 106 | + | |
| 79 | 107 | #endif /* GWCSMER_HPP */ | ... | ... |
include/GWcsSTG.hpp
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | #define GWCSSTG_HPP |
| 29 | 29 | |
| 30 | 30 | /* __ Includes ___________________________________________________________ */ |
| 31 | +#include <string> | |
| 31 | 32 | #include "GWcs.hpp" |
| 32 | 33 | |
| 33 | 34 | |
| ... | ... | @@ -52,13 +53,13 @@ public: |
| 52 | 53 | virtual ~GWcsSTG(void); |
| 53 | 54 | |
| 54 | 55 | // Operators |
| 55 | - GWcsSTG& operator= (const GWcsSTG& wcs); | |
| 56 | + GWcsSTG& operator=(const GWcsSTG& wcs); | |
| 56 | 57 | |
| 57 | 58 | // Implemented pure virtual base class methods |
| 58 | 59 | virtual void clear(void); |
| 59 | 60 | virtual GWcsSTG* clone(void) const; |
| 60 | - virtual std::string code(void) const { return "STG"; } | |
| 61 | - virtual std::string name(void) const { return "stereographic"; } | |
| 61 | + virtual std::string code(void) const; | |
| 62 | + virtual std::string name(void) const; | |
| 62 | 63 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 63 | 64 | |
| 64 | 65 | private: |
| ... | ... | @@ -75,4 +76,32 @@ private: |
| 75 | 76 | double* x, double* y, int* stat) const; |
| 76 | 77 | }; |
| 77 | 78 | |
| 79 | + | |
| 80 | +/***********************************************************************//** | |
| 81 | + * @brief Return projection code | |
| 82 | + * | |
| 83 | + * @return Projection code. | |
| 84 | + * | |
| 85 | + * Returns the projection code "STG". | |
| 86 | + ***************************************************************************/ | |
| 87 | +inline | |
| 88 | +std::string GWcsSTG::code(void) const | |
| 89 | +{ | |
| 90 | + return "STG"; | |
| 91 | +} | |
| 92 | + | |
| 93 | + | |
| 94 | +/***********************************************************************//** | |
| 95 | + * @brief Return projection name | |
| 96 | + * | |
| 97 | + * @return Projection name. | |
| 98 | + * | |
| 99 | + * Returns the projection name. | |
| 100 | + ***************************************************************************/ | |
| 101 | +inline | |
| 102 | +std::string GWcsSTG::name(void) const | |
| 103 | +{ | |
| 104 | + return "stereographic"; | |
| 105 | +} | |
| 106 | + | |
| 78 | 107 | #endif /* GWCSSTG_HPP */ | ... | ... |
include/GWcsTAN.hpp
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | #define GWCSTAN_HPP |
| 29 | 29 | |
| 30 | 30 | /* __ Includes ___________________________________________________________ */ |
| 31 | +#include <string> | |
| 31 | 32 | #include "GWcs.hpp" |
| 32 | 33 | |
| 33 | 34 | |
| ... | ... | @@ -52,13 +53,13 @@ public: |
| 52 | 53 | virtual ~GWcsTAN(void); |
| 53 | 54 | |
| 54 | 55 | // Operators |
| 55 | - GWcsTAN& operator= (const GWcsTAN& wcs); | |
| 56 | + GWcsTAN& operator=(const GWcsTAN& wcs); | |
| 56 | 57 | |
| 57 | 58 | // Implemented pure virtual base class methods |
| 58 | 59 | virtual void clear(void); |
| 59 | 60 | virtual GWcsTAN* clone(void) const; |
| 60 | - virtual std::string code(void) const { return "TAN"; } | |
| 61 | - virtual std::string name(void) const { return "gnomonic"; } | |
| 61 | + virtual std::string code(void) const; | |
| 62 | + virtual std::string name(void) const; | |
| 62 | 63 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 63 | 64 | |
| 64 | 65 | private: |
| ... | ... | @@ -75,4 +76,32 @@ private: |
| 75 | 76 | double* x, double* y, int* stat) const; |
| 76 | 77 | }; |
| 77 | 78 | |
| 79 | + | |
| 80 | +/***********************************************************************//** | |
| 81 | + * @brief Return projection code | |
| 82 | + * | |
| 83 | + * @return Projection code. | |
| 84 | + * | |
| 85 | + * Returns the projection code "TAN". | |
| 86 | + ***************************************************************************/ | |
| 87 | +inline | |
| 88 | +std::string GWcsTAN::code(void) const | |
| 89 | +{ | |
| 90 | + return "TAN"; | |
| 91 | +} | |
| 92 | + | |
| 93 | + | |
| 94 | +/***********************************************************************//** | |
| 95 | + * @brief Return projection name | |
| 96 | + * | |
| 97 | + * @return Projection name. | |
| 98 | + * | |
| 99 | + * Returns the projection name. | |
| 100 | + ***************************************************************************/ | |
| 101 | +inline | |
| 102 | +std::string GWcsTAN::name(void) const | |
| 103 | +{ | |
| 104 | + return "gnomonic"; | |
| 105 | +} | |
| 106 | + | |
| 78 | 107 | #endif /* GWCSTAN_HPP */ | ... | ... |
src/sky/GWcsAIT.cpp
| ... | ... | @@ -34,7 +34,6 @@ |
| 34 | 34 | #include "GWcsRegistry.hpp" |
| 35 | 35 | |
| 36 | 36 | /* __ Method name definitions ____________________________________________ */ |
| 37 | -#define G_PRJ_SET "GWcsAIT::prj_set()" | |
| 38 | 37 | #define G_PRJ_X2S "GWcsAIT::prj_x2s(int, int, int, int, double*, double*,"\ |
| 39 | 38 | " double*, double*, int*)" |
| 40 | 39 | #define G_PRJ_S2X "GWcsAIT::prj_s2x(int, int, int, int, double*, double*,"\ |
| ... | ... | @@ -325,7 +324,7 @@ void GWcsAIT::prj_set(void) const |
| 325 | 324 | |
| 326 | 325 | |
| 327 | 326 | /***********************************************************************//** |
| 328 | - * @brief Cartesian-to-spherical deprojection | |
| 327 | + * @brief Pixel-to-spherical deprojection | |
| 329 | 328 | * |
| 330 | 329 | * @param[in] nx X vector length. |
| 331 | 330 | * @param[in] ny Y vector length (0=no replication). |
| ... | ... | @@ -343,13 +342,13 @@ void GWcsAIT::prj_set(void) const |
| 343 | 342 | * One or more of the (x,y) coordinates were invalid, as indicated |
| 344 | 343 | * by the stat vector. |
| 345 | 344 | * |
| 346 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | |
| 345 | + * Deproject pixel (x,y) coordinates in the plane of projection to native | |
| 347 | 346 | * spherical coordinates (phi,theta). |
| 348 | 347 | * |
| 349 | 348 | * This method has been adapted from the wcslib function prj.c::aitx2s(). |
| 350 | 349 | * The interface follows very closely that of wcslib. In contrast to the |
| 351 | 350 | * wcslib routine, however, the method assumes that the projection has been |
| 352 | - * setup previsouly (as this will be done by the constructor). | |
| 351 | + * setup previously (as this will be done by the constructor). | |
| 353 | 352 | ***************************************************************************/ |
| 354 | 353 | void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, |
| 355 | 354 | const double* x, const double* y, |
| ... | ... | @@ -458,7 +457,7 @@ void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, |
| 458 | 457 | |
| 459 | 458 | |
| 460 | 459 | /***********************************************************************//** |
| 461 | - * @brief Generic spherical-to-Cartesian projection | |
| 460 | + * @brief Generic spherical-to-pixel projection | |
| 462 | 461 | * |
| 463 | 462 | * @param[in] nphi Longitude vector length. |
| 464 | 463 | * @param[in] ntheta Latitude vector length (0=no replication). |
| ... | ... | @@ -476,13 +475,13 @@ void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, |
| 476 | 475 | * One or more of the (phi,theta) coordinates were invalid, as |
| 477 | 476 | * indicated by the stat vector. |
| 478 | 477 | * |
| 479 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | |
| 478 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) | |
| 480 | 479 | * coordinates in the plane of projection. |
| 481 | 480 | * |
| 482 | 481 | * This method has been adapted from the wcslib function prj.c::aits2x(). |
| 483 | 482 | * The interface follows very closely that of wcslib. In contrast to the |
| 484 | 483 | * wcslib routine, however, the method assumes that the projection has been |
| 485 | - * setup previsouly (as this will be done by the constructor). | |
| 484 | + * setup previously (as this will be done by the constructor). | |
| 486 | 485 | ***************************************************************************/ |
| 487 | 486 | void GWcsAIT::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 488 | 487 | const double* phi, const double* theta, | ... | ... |
src/sky/GWcsAZP.cpp
| ... | ... | @@ -352,7 +352,7 @@ void GWcsAZP::prj_set(void) const |
| 352 | 352 | |
| 353 | 353 | |
| 354 | 354 | /***********************************************************************//** |
| 355 | - * @brief Cartesian-to-spherical deprojection | |
| 355 | + * @brief Pixel-to-spherical deprojection | |
| 356 | 356 | * |
| 357 | 357 | * @param[in] nx X vector length. |
| 358 | 358 | * @param[in] ny Y vector length (0=no replication). |
| ... | ... | @@ -370,13 +370,13 @@ void GWcsAZP::prj_set(void) const |
| 370 | 370 | * One or more of the (x,y) coordinates were invalid, as indicated |
| 371 | 371 | * by the stat vector. |
| 372 | 372 | * |
| 373 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | |
| 373 | + * Deproject pixel (x,y) coordinates in the plane of projection to native | |
| 374 | 374 | * spherical coordinates (phi,theta). |
| 375 | 375 | * |
| 376 | 376 | * This method has been adapted from the wcslib function prj.c::azpx2s(). |
| 377 | 377 | * The interface follows very closely that of wcslib. In contrast to the |
| 378 | 378 | * wcslib routine, however, the method assumes that the projection has been |
| 379 | - * setup previsouly (as this will be done by the constructor). | |
| 379 | + * setup previously (as this will be done by the constructor). | |
| 380 | 380 | ***************************************************************************/ |
| 381 | 381 | void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, |
| 382 | 382 | const double* x, const double* y, |
| ... | ... | @@ -477,7 +477,7 @@ void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, |
| 477 | 477 | |
| 478 | 478 | |
| 479 | 479 | /***********************************************************************//** |
| 480 | - * @brief Generic spherical-to-Cartesian projection | |
| 480 | + * @brief Generic spherical-to-pixel projection | |
| 481 | 481 | * |
| 482 | 482 | * @param[in] nphi Longitude vector length. |
| 483 | 483 | * @param[in] ntheta Latitude vector length (0=no replication). |
| ... | ... | @@ -495,13 +495,13 @@ void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, |
| 495 | 495 | * One or more of the (phi,theta) coordinates were invalid, as |
| 496 | 496 | * indicated by the stat vector. |
| 497 | 497 | * |
| 498 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | |
| 498 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) | |
| 499 | 499 | * coordinates in the plane of projection. |
| 500 | 500 | * |
| 501 | 501 | * This method has been adapted from the wcslib function prj.c::azps2x(). |
| 502 | 502 | * The interface follows very closely that of wcslib. In contrast to the |
| 503 | 503 | * wcslib routine, however, the method assumes that the projection has been |
| 504 | - * setup previsouly (as this will be done by the constructor). | |
| 504 | + * setup previously (as this will be done by the constructor). | |
| 505 | 505 | ***************************************************************************/ |
| 506 | 506 | void GWcsAZP::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 507 | 507 | const double* phi, const double* theta, | ... | ... |
src/sky/GWcsCAR.cpp
| ... | ... | @@ -336,7 +336,7 @@ void GWcsCAR::prj_set(void) const |
| 336 | 336 | * This method has been adapted from the wcslib function prj.c::carx2s(). |
| 337 | 337 | * The interface follows very closely that of wcslib. In contrast to the |
| 338 | 338 | * wcslib routine, however, the method assumes that the projection has been |
| 339 | - * setup previsouly (as this will be done by the constructor). | |
| 339 | + * setup previously (as this will be done by the constructor). | |
| 340 | 340 | ***************************************************************************/ |
| 341 | 341 | void GWcsCAR::prj_x2s(int nx, int ny, int sxy, int spt, |
| 342 | 342 | const double* x, const double* y, |
| ... | ... | @@ -410,7 +410,7 @@ void GWcsCAR::prj_x2s(int nx, int ny, int sxy, int spt, |
| 410 | 410 | * This method has been adapted from the wcslib function prj.c::cars2x(). |
| 411 | 411 | * The interface follows very closely that of wcslib. In contrast to the |
| 412 | 412 | * wcslib routine, however, the method assumes that the projection has been |
| 413 | - * setup previsouly (as this will be done by the constructor). | |
| 413 | + * setup previously (as this will be done by the constructor). | |
| 414 | 414 | ***************************************************************************/ |
| 415 | 415 | void GWcsCAR::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 416 | 416 | const double* phi, const double* theta, | ... | ... |
src/sky/GWcsMER.cpp
| ... | ... | @@ -70,7 +70,7 @@ GWcsMER::GWcsMER(void) : GWcs() |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /***********************************************************************//** |
| 73 | - * @brief Constructor | |
| 73 | + * @brief Projection constructor | |
| 74 | 74 | * |
| 75 | 75 | * @param[in] coords Coordinate system. |
| 76 | 76 | * @param[in] crval1 X value of reference pixel. |
| ... | ... | @@ -136,8 +136,9 @@ GWcsMER::~GWcsMER(void) |
| 136 | 136 | * @brief Assignment operator |
| 137 | 137 | * |
| 138 | 138 | * @param[in] wcs World Coordinate System. |
| 139 | + * @return World Coordinate System. | |
| 139 | 140 | ***************************************************************************/ |
| 140 | -GWcsMER& GWcsMER::operator= (const GWcsMER& wcs) | |
| 141 | +GWcsMER& GWcsMER::operator=(const GWcsMER& wcs) | |
| 141 | 142 | { |
| 142 | 143 | // Execute only if object is not identical |
| 143 | 144 | if (this != &wcs) { |
| ... | ... | @@ -168,7 +169,7 @@ GWcsMER& GWcsMER::operator= (const GWcsMER& wcs) |
| 168 | 169 | ==========================================================================*/ |
| 169 | 170 | |
| 170 | 171 | /***********************************************************************//** |
| 171 | - * @brief Clear instance | |
| 172 | + * @brief Clear Mercator's projection | |
| 172 | 173 | * |
| 173 | 174 | * This method properly resets the object to an initial state. |
| 174 | 175 | ***************************************************************************/ |
| ... | ... | @@ -190,7 +191,9 @@ void GWcsMER::clear(void) |
| 190 | 191 | |
| 191 | 192 | |
| 192 | 193 | /***********************************************************************//** |
| 193 | - * @brief Clone instance | |
| 194 | + * @brief Clone Mercator's projection | |
| 195 | + * | |
| 196 | + * @return Pointer to deep copy of Mercator's projection. | |
| 194 | 197 | ***************************************************************************/ |
| 195 | 198 | GWcsMER* GWcsMER::clone(void) const |
| 196 | 199 | { |
| ... | ... | @@ -202,7 +205,7 @@ GWcsMER* GWcsMER::clone(void) const |
| 202 | 205 | * @brief Print WCS information |
| 203 | 206 | * |
| 204 | 207 | * @param[in] chatter Chattiness (defaults to NORMAL). |
| 205 | - * @return String containing WCS information. | |
| 208 | + * @return String containing Mercator's projection information. | |
| 206 | 209 | ***************************************************************************/ |
| 207 | 210 | std::string GWcsMER::print(const GChatter& chatter) const |
| 208 | 211 | { |
| ... | ... | @@ -295,7 +298,8 @@ void GWcsMER::prj_set(void) const |
| 295 | 298 | m_r0 = gammalib::rad2deg; |
| 296 | 299 | m_w.push_back(1.0); |
| 297 | 300 | m_w.push_back(1.0); |
| 298 | - } else { | |
| 301 | + } | |
| 302 | + else { | |
| 299 | 303 | m_w.push_back(m_r0 * gammalib::deg2rad); |
| 300 | 304 | m_w.push_back(1.0/m_w[0]); |
| 301 | 305 | } |
| ... | ... | @@ -312,7 +316,7 @@ void GWcsMER::prj_set(void) const |
| 312 | 316 | |
| 313 | 317 | |
| 314 | 318 | /***********************************************************************//** |
| 315 | - * @brief Cartesian-to-spherical deprojection | |
| 319 | + * @brief Pixel-to-spherical deprojection | |
| 316 | 320 | * |
| 317 | 321 | * @param[in] nx X vector length. |
| 318 | 322 | * @param[in] ny Y vector length (0=no replication). |
| ... | ... | @@ -326,13 +330,13 @@ void GWcsMER::prj_set(void) const |
| 326 | 330 | * coordinates [deg]. |
| 327 | 331 | * @param[out] stat Status return value for each vector element (always 0) |
| 328 | 332 | * |
| 329 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | |
| 333 | + * Deproject pixel (x,y) coordinates in the plane of projection to native | |
| 330 | 334 | * spherical coordinates (phi,theta). |
| 331 | 335 | * |
| 332 | 336 | * This method has been adapted from the wcslib function prj.c::merx2s(). |
| 333 | 337 | * The interface follows very closely that of wcslib. In contrast to the |
| 334 | 338 | * wcslib routine, however, the method assumes that the projection has been |
| 335 | - * setup previsouly (as this will be done by the constructor). | |
| 339 | + * setup previously (as this will be done by the constructor). | |
| 336 | 340 | ***************************************************************************/ |
| 337 | 341 | void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, |
| 338 | 342 | const double* x, const double* y, |
| ... | ... | @@ -386,7 +390,7 @@ void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, |
| 386 | 390 | |
| 387 | 391 | |
| 388 | 392 | /***********************************************************************//** |
| 389 | - * @brief Generic spherical-to-Cartesian projection | |
| 393 | + * @brief Generic spherical-to-pixel projection | |
| 390 | 394 | * |
| 391 | 395 | * @param[in] nphi Longitude vector length. |
| 392 | 396 | * @param[in] ntheta Latitude vector length (0=no replication). |
| ... | ... | @@ -400,15 +404,14 @@ void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, |
| 400 | 404 | * @param[out] y Vector of projected y coordinates. |
| 401 | 405 | * @param[out] stat Status return value for each vector element (always 0) |
| 402 | 406 | * |
| 403 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | |
| 407 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) | |
| 404 | 408 | * coordinates in the plane of projection. |
| 405 | 409 | * |
| 406 | 410 | * This method has been adapted from the wcslib function prj.c::mers2x(). |
| 407 | 411 | * The interface follows very closely that of wcslib. In contrast to the |
| 408 | 412 | * wcslib routine, however, the method assumes that the projection has been |
| 409 | - * setup previsouly (as this will be done by the constructor). | |
| 413 | + * setup previously (as this will be done by the constructor). | |
| 410 | 414 | ***************************************************************************/ |
| 411 | -#define G_PRJ_X2S | |
| 412 | 415 | void GWcsMER::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 413 | 416 | const double* phi, const double* theta, |
| 414 | 417 | double* x, double* y, int* stat) const |
| ... | ... | @@ -472,10 +475,3 @@ void GWcsMER::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 472 | 475 | // Return |
| 473 | 476 | return; |
| 474 | 477 | } |
| 475 | - | |
| 476 | - | |
| 477 | -/*========================================================================== | |
| 478 | - = = | |
| 479 | - = Friends = | |
| 480 | - = = | |
| 481 | - ==========================================================================*/ | ... | ... |
src/sky/GWcsSTG.cpp
| ... | ... | @@ -34,8 +34,8 @@ |
| 34 | 34 | #include "GWcsRegistry.hpp" |
| 35 | 35 | |
| 36 | 36 | /* __ Method name definitions ____________________________________________ */ |
| 37 | -#define G_PRJ_S2X "GWcsSTG::prj_s2x(int,int,int,int,double*,double*,double*,"\ | |
| 38 | - "double*,int*)" | |
| 37 | +#define G_PRJ_S2X "GWcsSTG::prj_s2x(int, int, int, int, double*, double*,"\ | |
| 38 | + " double*, double*, int*)" | |
| 39 | 39 | |
| 40 | 40 | /* __ Macros _____________________________________________________________ */ |
| 41 | 41 | |
| ... | ... | @@ -72,7 +72,7 @@ GWcsSTG::GWcsSTG(void) : GWcs() |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | /***********************************************************************//** |
| 75 | - * @brief Constructor | |
| 75 | + * @brief Projection constructor | |
| 76 | 76 | * |
| 77 | 77 | * @param[in] coords Coordinate system. |
| 78 | 78 | * @param[in] crval1 X value of reference pixel. |
| ... | ... | @@ -138,8 +138,9 @@ GWcsSTG::~GWcsSTG(void) |
| 138 | 138 | * @brief Assignment operator |
| 139 | 139 | * |
| 140 | 140 | * @param[in] wcs World Coordinate System. |
| 141 | + * @return World Coordinate System. | |
| 141 | 142 | ***************************************************************************/ |
| 142 | -GWcsSTG& GWcsSTG::operator= (const GWcsSTG& wcs) | |
| 143 | +GWcsSTG& GWcsSTG::operator=(const GWcsSTG& wcs) | |
| 143 | 144 | { |
| 144 | 145 | // Execute only if object is not identical |
| 145 | 146 | if (this != &wcs) { |
| ... | ... | @@ -170,7 +171,7 @@ GWcsSTG& GWcsSTG::operator= (const GWcsSTG& wcs) |
| 170 | 171 | ==========================================================================*/ |
| 171 | 172 | |
| 172 | 173 | /***********************************************************************//** |
| 173 | - * @brief Clear instance | |
| 174 | + * @brief Clear projection | |
| 174 | 175 | * |
| 175 | 176 | * This method properly resets the object to an initial state. |
| 176 | 177 | ***************************************************************************/ |
| ... | ... | @@ -192,7 +193,9 @@ void GWcsSTG::clear(void) |
| 192 | 193 | |
| 193 | 194 | |
| 194 | 195 | /***********************************************************************//** |
| 195 | - * @brief Clone instance | |
| 196 | + * @brief Clone projection | |
| 197 | + * | |
| 198 | + * @return Pointer to deep copy of projection. | |
| 196 | 199 | ***************************************************************************/ |
| 197 | 200 | GWcsSTG* GWcsSTG::clone(void) const |
| 198 | 201 | { |
| ... | ... | @@ -201,10 +204,10 @@ GWcsSTG* GWcsSTG::clone(void) const |
| 201 | 204 | |
| 202 | 205 | |
| 203 | 206 | /***********************************************************************//** |
| 204 | - * @brief Print WCS information | |
| 207 | + * @brief Print projection information | |
| 205 | 208 | * |
| 206 | 209 | * @param[in] chatter Chattiness (defaults to NORMAL). |
| 207 | - * @return String containing WCS information. | |
| 210 | + * @return String containing projection information. | |
| 208 | 211 | ***************************************************************************/ |
| 209 | 212 | std::string GWcsSTG::print(const GChatter& chatter) const |
| 210 | 213 | { |
| ... | ... | @@ -274,7 +277,7 @@ void GWcsSTG::free_members(void) |
| 274 | 277 | * @brief Setup of projection |
| 275 | 278 | * |
| 276 | 279 | * This method sets up the projection information. The method has been |
| 277 | - * adapted from the wcslib function prj.c::carset. | |
| 280 | + * adapted from the wcslib function prj.c::stgset. | |
| 278 | 281 | * |
| 279 | 282 | * Given and/or returned: |
| 280 | 283 | * m_r0 Reset to 180/pi if 0. |
| ... | ... | @@ -311,7 +314,7 @@ void GWcsSTG::prj_set(void) const |
| 311 | 314 | |
| 312 | 315 | |
| 313 | 316 | /***********************************************************************//** |
| 314 | - * @brief Cartesian-to-spherical deprojection | |
| 317 | + * @brief Pixel-to-spherical deprojection | |
| 315 | 318 | * |
| 316 | 319 | * @param[in] nx X vector length. |
| 317 | 320 | * @param[in] ny Y vector length (0=no replication). |
| ... | ... | @@ -325,21 +328,22 @@ void GWcsSTG::prj_set(void) const |
| 325 | 328 | * coordinates [deg]. |
| 326 | 329 | * @param[out] stat Status return value for each vector element (always 0) |
| 327 | 330 | * |
| 328 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | |
| 331 | + * Deproject pixel (x,y) coordinates in the plane of projection to native | |
| 329 | 332 | * spherical coordinates (phi,theta). |
| 330 | 333 | * |
| 331 | - * This method has been adapted from the wcslib function prj.c::carx2s(). | |
| 334 | + * This method has been adapted from the wcslib function prj.c::stgx2s(). | |
| 332 | 335 | * The interface follows very closely that of wcslib. In contrast to the |
| 333 | 336 | * wcslib routine, however, the method assumes that the projection has been |
| 334 | - * setup previsouly (as this will be done by the constructor). | |
| 337 | + * setup previously (as this will be done by the constructor). | |
| 335 | 338 | ***************************************************************************/ |
| 336 | 339 | void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, |
| 337 | 340 | const double* x, const double* y, |
| 338 | 341 | double* phi, double* theta, int* stat) const |
| 339 | 342 | { |
| 340 | 343 | // Initialize projection if required |
| 341 | - if (!m_prjset) | |
| 344 | + if (!m_prjset) { | |
| 342 | 345 | prj_set(); |
| 346 | + } | |
| 343 | 347 | |
| 344 | 348 | // Set value replication length mx,my |
| 345 | 349 | int mx; |
| ... | ... | @@ -394,7 +398,7 @@ void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, |
| 394 | 398 | |
| 395 | 399 | |
| 396 | 400 | /***********************************************************************//** |
| 397 | - * @brief Generic spherical-to-Cartesian projection | |
| 401 | + * @brief Generic spherical-to-pixel projection | |
| 398 | 402 | * |
| 399 | 403 | * @param[in] nphi Longitude vector length. |
| 400 | 404 | * @param[in] ntheta Latitude vector length (0=no replication). |
| ... | ... | @@ -408,21 +412,22 @@ void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, |
| 408 | 412 | * @param[out] y Vector of projected y coordinates. |
| 409 | 413 | * @param[out] stat Status return value for each vector element (always 0) |
| 410 | 414 | * |
| 411 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | |
| 415 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) | |
| 412 | 416 | * coordinates in the plane of projection. |
| 413 | 417 | * |
| 414 | - * This method has been adapted from the wcslib function prj.c::cars2x(). | |
| 418 | + * This method has been adapted from the wcslib function prj.c::stgs2x(). | |
| 415 | 419 | * The interface follows very closely that of wcslib. In contrast to the |
| 416 | 420 | * wcslib routine, however, the method assumes that the projection has been |
| 417 | - * setup previsouly (as this will be done by the constructor). | |
| 421 | + * setup previously (as this will be done by the constructor). | |
| 418 | 422 | ***************************************************************************/ |
| 419 | 423 | void GWcsSTG::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 420 | 424 | const double* phi, const double* theta, |
| 421 | 425 | double* x, double* y, int* stat) const |
| 422 | 426 | { |
| 423 | 427 | // Initialize projection if required |
| 424 | - if (!m_prjset) | |
| 428 | + if (!m_prjset) { | |
| 425 | 429 | prj_set(); |
| 430 | + } | |
| 426 | 431 | |
| 427 | 432 | // Set value replication length mphi,mtheta |
| 428 | 433 | int mphi; |
| ... | ... | @@ -501,10 +506,3 @@ void GWcsSTG::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 501 | 506 | // Return |
| 502 | 507 | return; |
| 503 | 508 | } |
| 504 | - | |
| 505 | - | |
| 506 | -/*========================================================================== | |
| 507 | - = = | |
| 508 | - = Friends = | |
| 509 | - = = | |
| 510 | - ==========================================================================*/ | ... | ... |
src/sky/GWcsTAN.cpp
| ... | ... | @@ -34,8 +34,8 @@ |
| 34 | 34 | #include "GWcsRegistry.hpp" |
| 35 | 35 | |
| 36 | 36 | /* __ Method name definitions ____________________________________________ */ |
| 37 | -#define G_PRJ_S2X "GWcsTAN::prj_s2x(int,int,int,int,double*,double*,double*,"\ | |
| 38 | - "double*,int*)" | |
| 37 | +#define G_PRJ_S2X "GWcsTAN::prj_s2x(int, int, int, int, double*, double*,"\ | |
| 38 | + " double*, double*, int*)" | |
| 39 | 39 | |
| 40 | 40 | /* __ Macros _____________________________________________________________ */ |
| 41 | 41 | |
| ... | ... | @@ -72,7 +72,7 @@ GWcsTAN::GWcsTAN(void) : GWcs() |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | /***********************************************************************//** |
| 75 | - * @brief Constructor | |
| 75 | + * @brief Projection constructor | |
| 76 | 76 | * |
| 77 | 77 | * @param[in] coords Coordinate system. |
| 78 | 78 | * @param[in] crval1 X value of reference pixel. |
| ... | ... | @@ -138,8 +138,9 @@ GWcsTAN::~GWcsTAN(void) |
| 138 | 138 | * @brief Assignment operator |
| 139 | 139 | * |
| 140 | 140 | * @param[in] wcs World Coordinate System. |
| 141 | + * @return World Coordinate System. | |
| 141 | 142 | ***************************************************************************/ |
| 142 | -GWcsTAN& GWcsTAN::operator= (const GWcsTAN& wcs) | |
| 143 | +GWcsTAN& GWcsTAN::operator=(const GWcsTAN& wcs) | |
| 143 | 144 | { |
| 144 | 145 | // Execute only if object is not identical |
| 145 | 146 | if (this != &wcs) { |
| ... | ... | @@ -170,9 +171,9 @@ GWcsTAN& GWcsTAN::operator= (const GWcsTAN& wcs) |
| 170 | 171 | ==========================================================================*/ |
| 171 | 172 | |
| 172 | 173 | /***********************************************************************//** |
| 173 | - * @brief Clear instance | |
| 174 | + * @brief Clear gnomonic projection | |
| 174 | 175 | * |
| 175 | - * This method properly resets the object to an initial state. | |
| 176 | + * Resets the gnomonic projection to an clean initial state. | |
| 176 | 177 | ***************************************************************************/ |
| 177 | 178 | void GWcsTAN::clear(void) |
| 178 | 179 | { |
| ... | ... | @@ -192,7 +193,9 @@ void GWcsTAN::clear(void) |
| 192 | 193 | |
| 193 | 194 | |
| 194 | 195 | /***********************************************************************//** |
| 195 | - * @brief Clone instance | |
| 196 | + * @brief Clone gnomonic projection | |
| 197 | + * | |
| 198 | + * @return Pointer to deep copy of gnomonic projection. | |
| 196 | 199 | ***************************************************************************/ |
| 197 | 200 | GWcsTAN* GWcsTAN::clone(void) const |
| 198 | 201 | { |
| ... | ... | @@ -201,10 +204,10 @@ GWcsTAN* GWcsTAN::clone(void) const |
| 201 | 204 | |
| 202 | 205 | |
| 203 | 206 | /***********************************************************************//** |
| 204 | - * @brief Print WCS information | |
| 207 | + * @brief Print gnomonic projection information | |
| 205 | 208 | * |
| 206 | 209 | * @param[in] chatter Chattiness (defaults to NORMAL). |
| 207 | - * @return String containing WCS information. | |
| 210 | + * @return String containing gnomonic projection information. | |
| 208 | 211 | ***************************************************************************/ |
| 209 | 212 | std::string GWcsTAN::print(const GChatter& chatter) const |
| 210 | 213 | { |
| ... | ... | @@ -274,7 +277,7 @@ void GWcsTAN::free_members(void) |
| 274 | 277 | * @brief Setup of projection |
| 275 | 278 | * |
| 276 | 279 | * This method sets up the projection information. The method has been |
| 277 | - * adapted from the wcslib function prj.c::carset. | |
| 280 | + * adapted from the wcslib function prj.c::tanset. | |
| 278 | 281 | * |
| 279 | 282 | * Given and/or returned: |
| 280 | 283 | * m_r0 Reset to 180/pi if 0. |
| ... | ... | @@ -291,8 +294,9 @@ void GWcsTAN::prj_set(void) const |
| 291 | 294 | m_w.clear(); |
| 292 | 295 | |
| 293 | 296 | // Precompute |
| 294 | - if (m_r0 == 0.0) | |
| 297 | + if (m_r0 == 0.0) { | |
| 295 | 298 | m_r0 = gammalib::rad2deg; |
| 299 | + } | |
| 296 | 300 | |
| 297 | 301 | // Compute fiducial offset |
| 298 | 302 | prj_off(0.0, 90.0); |
| ... | ... | @@ -306,7 +310,7 @@ void GWcsTAN::prj_set(void) const |
| 306 | 310 | |
| 307 | 311 | |
| 308 | 312 | /***********************************************************************//** |
| 309 | - * @brief Cartesian-to-spherical deprojection | |
| 313 | + * @brief Pixel-to-spherical deprojection | |
| 310 | 314 | * |
| 311 | 315 | * @param[in] nx X vector length. |
| 312 | 316 | * @param[in] ny Y vector length (0=no replication). |
| ... | ... | @@ -320,21 +324,22 @@ void GWcsTAN::prj_set(void) const |
| 320 | 324 | * coordinates [deg]. |
| 321 | 325 | * @param[out] stat Status return value for each vector element (always 0) |
| 322 | 326 | * |
| 323 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | |
| 327 | + * Deproject pixel (x,y) coordinates in the plane of projection to native | |
| 324 | 328 | * spherical coordinates (phi,theta). |
| 325 | 329 | * |
| 326 | - * This method has been adapted from the wcslib function prj.c::carx2s(). | |
| 330 | + * This method has been adapted from the wcslib function prj.c::tanx2s(). | |
| 327 | 331 | * The interface follows very closely that of wcslib. In contrast to the |
| 328 | 332 | * wcslib routine, however, the method assumes that the projection has been |
| 329 | - * setup previsouly (as this will be done by the constructor). | |
| 333 | + * setup previously (as this will be done by the constructor). | |
| 330 | 334 | ***************************************************************************/ |
| 331 | 335 | void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, |
| 332 | 336 | const double* x, const double* y, |
| 333 | 337 | double* phi, double* theta, int* stat) const |
| 334 | 338 | { |
| 335 | 339 | // Initialize projection if required |
| 336 | - if (!m_prjset) | |
| 340 | + if (!m_prjset) { | |
| 337 | 341 | prj_set(); |
| 342 | + } | |
| 338 | 343 | |
| 339 | 344 | // Set value replication length mx,my |
| 340 | 345 | int mx; |
| ... | ... | @@ -356,8 +361,9 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, |
| 356 | 361 | for (int ix = 0; ix < nx; ++ix, rowoff += spt, xp += sxy) { |
| 357 | 362 | double xj = *xp + m_x0; |
| 358 | 363 | double* phip = phi + rowoff; |
| 359 | - for (int iy = 0; iy < my; ++iy, phip += rowlen) | |
| 364 | + for (int iy = 0; iy < my; ++iy, phip += rowlen) { | |
| 360 | 365 | *phip = xj; |
| 366 | + } | |
| 361 | 367 | } |
| 362 | 368 | |
| 363 | 369 | // Do y dependence |
| ... | ... | @@ -371,10 +377,12 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, |
| 371 | 377 | for (int ix = 0; ix < mx; ++ix, phip += spt, thetap += spt) { |
| 372 | 378 | double xj = *phip; |
| 373 | 379 | double r = std::sqrt(xj*xj + yj2); |
| 374 | - if (r == 0.0) | |
| 380 | + if (r == 0.0) { | |
| 375 | 381 | *phip = 0.0; |
| 376 | - else | |
| 382 | + } | |
| 383 | + else { | |
| 377 | 384 | *phip = gammalib::atan2d(xj, -yj); |
| 385 | + } | |
| 378 | 386 | *thetap = gammalib::atan2d(m_r0, r); |
| 379 | 387 | *(statp++) = 0; |
| 380 | 388 | } |
| ... | ... | @@ -386,7 +394,7 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, |
| 386 | 394 | |
| 387 | 395 | |
| 388 | 396 | /***********************************************************************//** |
| 389 | - * @brief Generic spherical-to-Cartesian projection | |
| 397 | + * @brief Generic spherical-to-pixel projection | |
| 390 | 398 | * |
| 391 | 399 | * @param[in] nphi Longitude vector length. |
| 392 | 400 | * @param[in] ntheta Latitude vector length (0=no replication). |
| ... | ... | @@ -400,21 +408,22 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, |
| 400 | 408 | * @param[out] y Vector of projected y coordinates. |
| 401 | 409 | * @param[out] stat Status return value for each vector element (always 0) |
| 402 | 410 | * |
| 403 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | |
| 411 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) | |
| 404 | 412 | * coordinates in the plane of projection. |
| 405 | 413 | * |
| 406 | - * This method has been adapted from the wcslib function prj.c::cars2x(). | |
| 414 | + * This method has been adapted from the wcslib function prj.c::tans2x(). | |
| 407 | 415 | * The interface follows very closely that of wcslib. In contrast to the |
| 408 | 416 | * wcslib routine, however, the method assumes that the projection has been |
| 409 | - * setup previsouly (as this will be done by the constructor). | |
| 417 | + * setup previously (as this will be done by the constructor). | |
| 410 | 418 | ***************************************************************************/ |
| 411 | 419 | void GWcsTAN::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 412 | 420 | const double* phi, const double* theta, |
| 413 | 421 | double* x, double* y, int* stat) const |
| 414 | 422 | { |
| 415 | 423 | // Initialize projection if required |
| 416 | - if (!m_prjset) | |
| 424 | + if (!m_prjset) { | |
| 417 | 425 | prj_set(); |
| 426 | + } | |
| 418 | 427 | |
| 419 | 428 | // Set value replication length mphi,mtheta |
| 420 | 429 | int mphi; |
| ... | ... | @@ -492,16 +501,10 @@ void GWcsTAN::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 492 | 501 | } |
| 493 | 502 | |
| 494 | 503 | // Handle status code |
| 495 | - if (status == 4) | |
| 504 | + if (status == 4) { | |
| 496 | 505 | throw GException::wcs_invalid_phi_theta(G_PRJ_S2X, n_invalid); |
| 506 | + } | |
| 497 | 507 | |
| 498 | 508 | // Return |
| 499 | 509 | return; |
| 500 | 510 | } |
| 501 | - | |
| 502 | - | |
| 503 | -/*========================================================================== | |
| 504 | - = = | |
| 505 | - = Friends = | |
| 506 | - = = | |
| 507 | - ==========================================================================*/ | ... | ... |