GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
gsget.c
Go to the documentation of this file.
1
/*!
2
\file lib/ogsf/gsget.c
3
4
\brief OGSF library - get map attribute (lower level functions)
5
6
GRASS OpenGL gsurf OGSF Library
7
8
(C) 1999-2008 by the GRASS Development Team
9
10
This program is free software under the
11
GNU General Public License (>=v2).
12
Read the file COPYING that comes with GRASS
13
for details.
14
15
\author Bill Brown USACERL (January 1993)
16
\author Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)
17
*/
18
19
#include <
grass/ogsf.h
>
20
21
/*!
22
\brief Get map attributes
23
24
\param buff
25
\param offset
26
\param[out] att
27
28
\return 0 on failure
29
\return 1 on success
30
*/
31
int
get_mapatt
(
typbuff
* buff,
int
offset,
float
*att)
32
{
33
if
(buff->
nm
) {
34
if
(
BM_get
35
(buff->
nm
, (offset % buff->
nm
->
cols
),
36
(offset / buff->
nm
->
cols
))) {
37
return
(0);
38
}
39
}
40
41
*att = (buff->
ib
? (float)buff->
ib
[offset] :
42
buff->
sb
? (
float
)buff->
sb
[offset] :
43
buff->
cb
? (float)buff->
cb
[offset] :
44
buff->
fb
? (
float
)buff->
fb
[offset] : buff->
k
);
45
46
if
(buff->
tfunc
) {
47
*att = (buff->
tfunc
) (*att, offset);
48
}
49
50
return
(1);
51
}
typbuff::sb
short * sb
Definition:
ogsf.h:208
typbuff::k
float k
Definition:
ogsf.h:213
typbuff::ib
int * ib
Definition:
ogsf.h:207
get_mapatt
int get_mapatt(typbuff *buff, int offset, float *att)
Get map attributes.
Definition:
gsget.c:31
BM_get
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
Definition:
bitmap.c:223
ogsf.h
typbuff::tfunc
float(* tfunc)(float, int)
Definition:
ogsf.h:212
BM::cols
int cols
Definition:
bitmap.h:20
typbuff
Definition:
ogsf.h:204
typbuff::nm
struct BM * nm
Definition:
ogsf.h:211
typbuff::fb
float * fb
Definition:
ogsf.h:206
typbuff::cb
unsigned char * cb
Definition:
ogsf.h:209
lib
ogsf
gsget.c
Generated on Tue Feb 14 2023 05:56:00 for GRASS GIS 8 Programmer's Manual by
1.8.13