proj2.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*!
  2. \file lib/gis/proj2.c
  3. \brief GIS Library - Projection support (internal subroutines)
  4. (C) 2001-2011 by the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Original author CERL
  8. */
  9. #include <grass/gis.h>
  10. #include <grass/glocale.h>
  11. /*!
  12. \brief Get projection units code (for internal use only)
  13. \param n projection code
  14. Supported units (see gis.h):
  15. - U_UNKNOWN (XY)
  16. - U_METERS (UTM)
  17. - U_FEET (SP)
  18. - U_DEGREES (LL)
  19. \return units code (see gis.h)
  20. \return U_UNDEFINED if not defined
  21. */
  22. int G__projection_units(int n)
  23. {
  24. switch (n) {
  25. case PROJECTION_XY:
  26. return U_UNKNOWN;
  27. case PROJECTION_UTM:
  28. return U_METERS;
  29. case PROJECTION_SP:
  30. return U_FEET;
  31. case PROJECTION_LL:
  32. return U_DEGREES;
  33. default:
  34. return U_UNDEFINED;
  35. }
  36. return U_UNDEFINED;
  37. }
  38. /*!
  39. \brief Get projection name
  40. \param n projection code
  41. \return projection name
  42. \return NULL on error
  43. */
  44. const char *G__projection_name(int n)
  45. {
  46. switch (n) {
  47. case PROJECTION_XY:
  48. return "x,y";
  49. case PROJECTION_UTM:
  50. return "UTM";
  51. case PROJECTION_SP:
  52. return _("State Plane");
  53. case PROJECTION_LL:
  54. return _("Latitude-Longitude");
  55. case PROJECTION_OTHER:
  56. return _("Other Projection");
  57. default:
  58. return NULL;
  59. }
  60. }