PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ ptarray_copy_point()

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

Definition at line 450 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().

451 {
452  int ndims = FLAGS_NDIMS(pa->flags);
453  switch (ndims)
454  {
455  case 2:
456  {
457  POINT2D *p_from = (POINT2D*)(getPoint_internal(pa, from));
458  POINT2D *p_to = (POINT2D*)(getPoint_internal(pa, to));
459  *p_to = *p_from;
460  return;
461  }
462  case 3:
463  {
464  POINT3D *p_from = (POINT3D*)(getPoint_internal(pa, from));
465  POINT3D *p_to = (POINT3D*)(getPoint_internal(pa, to));
466  *p_to = *p_from;
467  return;
468  }
469  case 4:
470  {
471  POINT4D *p_from = (POINT4D*)(getPoint_internal(pa, from));
472  POINT4D *p_to = (POINT4D*)(getPoint_internal(pa, to));
473  *p_to = *p_from;
474  return;
475  }
476  default:
477  {
478  lwerror("%s: unsupported number of dimensions - %d", __func__, ndims);
479  return;
480  }
481  }
482  return;
483 }
uint8_t flags
Definition: liblwgeom.h:371
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1750
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:151
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: