enforce.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /****************************************************************************
  2. *
  3. * MODULE: r.carve
  4. *
  5. * AUTHOR(S): Original author Bill Brown, UIUC GIS Laboratory
  6. * Brad Douglas <rez touchofmadness com>
  7. *
  8. * PURPOSE: Takes vector stream data, converts it to 3D raster and
  9. * subtracts a specified depth
  10. *
  11. * COPYRIGHT: (C) 2006 by the GRASS Development Team
  12. *
  13. * This program is free software under the GNU General Public
  14. * License (>=v2). Read the file COPYING that comes with GRASS
  15. * for details.
  16. *
  17. ****************************************************************************/
  18. #ifndef __ENFORCE_H__
  19. #define __ENFORCE_H__
  20. #include <stdio.h>
  21. #include <grass/gis.h>
  22. #include <grass/raster.h>
  23. #include <grass/bitmap.h>
  24. #include <grass/vector.h>
  25. #define APP_VERSION 1.0
  26. #define MAX_PTS 10000
  27. /* 2x2 determinat */
  28. #define DET2_2(a,b,c,d) ((a*d) - (b*c))
  29. #define LINTERP(a,b,r) ((a)+(r) * ((b)-(a)))
  30. #define SQR(x) (x * x)
  31. typedef double Point2[2];
  32. typedef struct
  33. {
  34. Point2 pnts[MAX_PTS];
  35. int npts;
  36. double sum_x, sum_y, sum_xy, sum_x_sq, slope, yinter;
  37. } PointGrp;
  38. struct parms
  39. {
  40. struct Option *inrast, *invect, *outrast, *outvect;
  41. RASTER_MAP_TYPE raster_type;
  42. double swidth, sdepth;
  43. int wrap, noflat;
  44. };
  45. /* enforce_ds.c */
  46. extern int enforce_downstream(int /*infd */ , int /*outfd */ ,
  47. struct Map_info * /*Map */ ,
  48. struct Map_info * /*outMap */ ,
  49. struct parms * /* parm */ );
  50. /* lobf.c */
  51. extern Point2 *pg_getpoints(PointGrp *);
  52. extern Point2 *pg_getpoints_reversed(PointGrp *);
  53. extern double pg_y_from_x(PointGrp *, const double);
  54. extern void pg_init(PointGrp *);
  55. extern void pg_addpt(PointGrp *, Point2);
  56. /* raster.c */
  57. void *read_raster(void *, const int, const RASTER_MAP_TYPE);
  58. void *write_raster(void *, const int, const RASTER_MAP_TYPE);
  59. /* support.c */
  60. extern void update_rast_history(struct parms *);
  61. /* vect.c */
  62. extern int open_new_vect(struct Map_info *, char *);
  63. extern int close_vect(struct Map_info *, const int);
  64. #endif /* __ENFORCE_H__ */