print_hdr.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /****************************************************************************
  2. *
  3. * MODULE: r.coin
  4. *
  5. * AUTHOR(S): Michael O'Shea - CERL
  6. * Michael Shapiro - CERL
  7. *
  8. * PURPOSE: Calculates the coincidence of two raster map layers.
  9. *
  10. * COPYRIGHT: (C) 2006 by the GRASS Development Team
  11. *
  12. * This program is free software under the GNU General Public
  13. * License (>=v2). Read the file COPYING that comes with GRASS
  14. * for details.
  15. *
  16. ***************************************************************************/
  17. #include <grass/raster.h>
  18. #include "coin.h"
  19. int print_coin_hdr(int Conformat)
  20. {
  21. char unit_type[20];
  22. const char *mapset, *location;
  23. char north[30], south[30], east[30], west[30];
  24. mapset = G_mapset();
  25. location = G_location();
  26. switch (Conformat) {
  27. case 'a':
  28. sprintf(unit_type, "acres");
  29. break;
  30. case 'h':
  31. sprintf(unit_type, "hectares");
  32. break;
  33. case 'k':
  34. sprintf(unit_type, "square kilometers");
  35. break;
  36. case 'm':
  37. sprintf(unit_type, "square miles");
  38. break;
  39. case 'p':
  40. sprintf(unit_type, "percent cover");
  41. break;
  42. case 'x':
  43. sprintf(unit_type, "percent of cols");
  44. break;
  45. case 'y':
  46. sprintf(unit_type, "percent of rows");
  47. break;
  48. default:
  49. sprintf(unit_type, "cells");
  50. break;
  51. }
  52. G_format_northing(window.north, north, window.proj);
  53. G_format_northing(window.south, south, window.proj);
  54. G_format_easting(window.east, east, window.proj);
  55. G_format_easting(window.west, west, window.proj);
  56. fprintf(dumpfile, "\n");
  57. fprintf(dumpfile, "+%78.78s+\n", midline);
  58. fprintf(dumpfile, "|%24.24sCOINCIDENCE TABULATION REPORT%25.25s|\n",
  59. fill, fill);
  60. fprintf(dumpfile, "|%78.78s|\n", midline);
  61. fprintf(dumpfile, "| Location: %-16.14sMapset: %-17.15sDate: %-20.20s|\n",
  62. location, mapset, G_date());
  63. fprintf(dumpfile, "|%78.78s|\n", fill);
  64. fprintf(dumpfile, "| Layer 1: %-15.15s-- %-50.49s|\n", map1name, title1);
  65. fprintf(dumpfile, "| Layer 2: %-15.15s-- %-50.49s|\n", map2name, title2);
  66. fprintf(dumpfile, "| Mask: %-68.68s|\n", Rast_mask_info());
  67. fprintf(dumpfile, "|%78.78s|\n", fill);
  68. fprintf(dumpfile, "| Units: %-68.68s|\n", unit_type);
  69. fprintf(dumpfile, "|%78.78s|\n", midline);
  70. fprintf(dumpfile, "| Window:%22.22sNorth: %-10s%31.31s|\n",
  71. fill, north, fill);
  72. fprintf(dumpfile, "|%14.14sWest: %-9s%19.19sEast: %-9s%15.15s|\n",
  73. fill, west, fill, east, fill);
  74. fprintf(dumpfile, "|%30.30sSouth: %-10s%31.31s|\n", fill, south, fill);
  75. fprintf(dumpfile, "+%78.78s+\n\n", midline);
  76. return 0;
  77. }