proj2.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*!
  2. \file gis/proj2.c
  3. \brief GIS Library - Projection support
  4. (C) 2001-2009 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 units code
  13. \param n project code
  14. \retun units code
  15. */
  16. int G__projection_units(int n)
  17. {
  18. switch (n) {
  19. case PROJECTION_XY:
  20. return 0;
  21. case PROJECTION_UTM:
  22. return METERS;
  23. case PROJECTION_SP:
  24. return FEET;
  25. case PROJECTION_LL:
  26. return DEGREES;
  27. default:
  28. return -1;
  29. }
  30. }
  31. /*!
  32. \brief Get units name
  33. \param unit units code
  34. \param plural plural form
  35. \return units name
  36. */
  37. const char *G__unit_name(int unit, int plural)
  38. {
  39. switch (unit) {
  40. case 0:
  41. return plural ? "units" : "unit";
  42. case METERS:
  43. return plural ? "meters" : "meter";
  44. case FEET:
  45. return plural ? "feet" : "foot";
  46. case DEGREES:
  47. return plural ? "degrees" : "degree";
  48. default:
  49. return NULL;
  50. }
  51. }
  52. /*!
  53. \brief Get projection name
  54. \param n projection code
  55. \return projection name
  56. */
  57. const char *G__projection_name(int n)
  58. {
  59. switch (n) {
  60. case PROJECTION_XY:
  61. return "x,y";
  62. case PROJECTION_UTM:
  63. return "UTM";
  64. case PROJECTION_SP:
  65. return "State Plane";
  66. case PROJECTION_LL:
  67. return _("Latitude-Longitude");
  68. case PROJECTION_OTHER:
  69. return _("Other Projection");
  70. default:
  71. return NULL;
  72. }
  73. }