PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpoint_set_ordinate()

void lwpoint_set_ordinate ( POINT4D p,
char  ordinate,
double  value 
)

Given a point, ordinate number and value, set that ordinate on the point.

Definition at line 283 of file lwlinearreferencing.c.

References LWDEBUGF, lwerror(), POINT4D::m, genraster::value, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by point_interpolate(), and test_lwpoint_set_ordinate().

284 {
285  if ( ! p )
286  {
287  lwerror("Null input geometry.");
288  return;
289  }
290 
291  if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
292  {
293  lwerror("Cannot set %c ordinate.", ordinate);
294  return;
295  }
296 
297  LWDEBUGF(4, " setting ordinate %c to %g", ordinate, value);
298 
299  switch ( ordinate )
300  {
301  case 'X':
302  p->x = value;
303  return;
304  case 'Y':
305  p->y = value;
306  return;
307  case 'Z':
308  p->z = value;
309  return;
310  case 'M':
311  p->m = value;
312  return;
313  }
314 }
double x
Definition: liblwgeom.h:352
double m
Definition: liblwgeom.h:352
double z
Definition: liblwgeom.h:352
int value
Definition: genraster.py:61
double y
Definition: liblwgeom.h:352
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
Here is the call graph for this function:
Here is the caller graph for this function: