PostGIS  2.2.8dev-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 270 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().

271 {
272  if ( ! p )
273  {
274  lwerror("Null input geometry.");
275  return;
276  }
277 
278  if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
279  {
280  lwerror("Cannot set %c ordinate.", ordinate);
281  return;
282  }
283 
284  LWDEBUGF(4, " setting ordinate %c to %g", ordinate, value);
285 
286  switch ( ordinate )
287  {
288  case 'X':
289  p->x = value;
290  return;
291  case 'Y':
292  p->y = value;
293  return;
294  case 'Z':
295  p->z = value;
296  return;
297  case 'M':
298  p->m = value;
299  return;
300  }
301 }
double x
Definition: liblwgeom.h:336
double m
Definition: liblwgeom.h:336
double z
Definition: liblwgeom.h:336
int value
Definition: genraster.py:61
double y
Definition: liblwgeom.h:336
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
Here is the call graph for this function:
Here is the caller graph for this function: