1 #include "csf.h"
2 #include "csfimpl.h"
3
4 /* get minimum cell value
5 * RgetMinVal returns the value stored in
6 * the header as the minimum value.
7 * If the minMaxStatus is MM_WRONGVALUE
8 * then a missing value is returned.
9 * returns 0 if argument minVal is returned with a missing
10 * value, nonzero if not.
11 *
12 * example
13 * .so examples/csfstat.tr
14 */
15
RgetMinVal(const MAP * map,void * minVal)16 int RgetMinVal(
17 const MAP *map, /* map handle */
18 void *minVal) /* write-only. Minimum value or missing value */
19 {
20 /* use buffer that can hold largest
21 * cell representation
22 */
23 CSF_VAR_TYPE buf_1;
24 void *buf = (void *)(&buf_1);
25
26 CHECKHANDLE(map);
27 CsfGetVarType(buf, &(map->raster.minVal), RgetCellRepr(map));
28
29 map->file2app((size_t)1, buf);
30
31 if (map->minMaxStatus == MM_WRONGVALUE)
32 SetMV(map, buf);
33
34 CsfGetVarType(minVal, buf, map->appCR);
35
36 return((!IsMV(map,minVal)) &&
37 map->minMaxStatus!=MM_WRONGVALUE);
38 }
39