xres.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include <grass/gis.h>
  2. #include <grass/raster.h>
  3. #include "globals.h"
  4. #include "globals2.h"
  5. #include "expression.h"
  6. #include "func_proto.h"
  7. /****************************************************************
  8. ewres() east-west resolution
  9. nsres() north-south resolution
  10. tbres() top-bottom resolution
  11. ****************************************************************/
  12. int f_ewres(int argc, const int *argt, void **args)
  13. {
  14. DCELL *res = args[0];
  15. int i;
  16. if (argc > 0)
  17. return E_ARG_HI;
  18. if (argt[0] != DCELL_TYPE)
  19. return E_RES_TYPE;
  20. for (i = 0; i < columns; i++)
  21. res[i] = current_region2.ew_res;
  22. return 0;
  23. }
  24. int f_nsres(int argc, const int *argt, void **args)
  25. {
  26. DCELL *res = args[0];
  27. int i;
  28. if (argc > 0)
  29. return E_ARG_HI;
  30. if (argt[0] != DCELL_TYPE)
  31. return E_RES_TYPE;
  32. for (i = 0; i < columns; i++)
  33. res[i] = current_region2.ns_res;
  34. return 0;
  35. }
  36. int f_tbres(int argc, const int *argt, void **args)
  37. {
  38. DCELL *res = args[0];
  39. int i;
  40. if (argc > 0)
  41. return E_ARG_HI;
  42. if (argt[0] != DCELL_TYPE)
  43. return E_RES_TYPE;
  44. for (i = 0; i < columns; i++)
  45. SET_NULL_D(&res[i]);
  46. return 0;
  47. }