GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gsdiff.c
Go to the documentation of this file.
1 
30 #include <grass/gstypes.h>
31 #include "gsget.h"
32 
33 static geosurf *Refsurf = NULL;
34 static typbuff *Refbuff = NULL;
35 static float Refscale = 1.0;
36 
42 void gsdiff_set_SDscale(float scale)
43 {
44  Refscale = scale;
45 
46  return;
47 }
48 
54 float gsdiff_get_SDscale(void)
55 {
56  return (Refscale);
57 }
58 
64 void gsdiff_set_SDref(geosurf * gsref)
65 {
66  Refsurf = gsref;
67  Refbuff = gs_get_att_typbuff(gsref, ATT_TOPO, 0);
68 
69  return;
70 }
71 
77 geosurf *gsdiff_get_SDref(void)
78 {
79  if (Refsurf && Refbuff) {
80  return (Refsurf);
81  }
82 
83  return (NULL);
84 }
85 
94 float gsdiff_do_SD(float val, int offset)
95 {
96  float ref;
97 
98  if (Refbuff) {
99  GET_MAPATT(Refbuff, offset, ref);
100  return (ref + (val - ref) * Refscale);
101  }
102 
103  return (val);
104 }
void gsdiff_set_SDscale(float scale)
Set scale.
Definition: gsdiff.c:42
float gsdiff_get_SDscale(void)
Get scale.
Definition: gsdiff.c:54
geosurf * gsdiff_get_SDref(void)
ADD.
Definition: gsdiff.c:77
typbuff * gs_get_att_typbuff(geosurf *gs, int desc, int to_write)
Get attribute data buffer.
Definition: gs.c:681
void gsdiff_set_SDref(geosurf *gsref)
ADD.
Definition: gsdiff.c:64
return NULL
Definition: dbfopen.c:1394
float gsdiff_do_SD(float val, int offset)
ADD.
Definition: gsdiff.c:94
#define GET_MAPATT(buff, offset, att)
Definition: gsget.h:27