PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ ptarray_copy_point()

void ptarray_copy_point ( POINTARRAY pa,
uint32_t  from,
uint32_t  to 
)

Definition at line 460 of file lwgeom_api.c.

References POINTARRAY::flags, FLAGS_NDIMS, getPoint_internal(), and lwerror().

Referenced by lwgeom_remove_repeated_points_in_place(), lwgeom_simplify_in_place(), ptarray_remove_repeated_points_in_place(), and ptarray_simplify_in_place().

461 {
462  int ndims = FLAGS_NDIMS(pa->flags);
463  switch (ndims)
464  {
465  case 2:
466  {
467  POINT2D *p_from = (POINT2D*)(getPoint_internal(pa, from));
468  POINT2D *p_to = (POINT2D*)(getPoint_internal(pa, to));
469  *p_to = *p_from;
470  return;
471  }
472  case 3:
473  {
474  POINT3D *p_from = (POINT3D*)(getPoint_internal(pa, from));
475  POINT3D *p_to = (POINT3D*)(getPoint_internal(pa, to));
476  *p_to = *p_from;
477  return;
478  }
479  case 4:
480  {
481  POINT4D *p_from = (POINT4D*)(getPoint_internal(pa, from));
482  POINT4D *p_to = (POINT4D*)(getPoint_internal(pa, to));
483  *p_to = *p_from;
484  return;
485  }
486  default:
487  {
488  lwerror("%s: unsupported number of dimensions - %d", __func__, ndims);
489  return;
490  }
491  }
492  return;
493 }
uint8_t flags
Definition: liblwgeom.h:372
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1750
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
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: