PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ ptarray_force_dims()

POINTARRAY* ptarray_force_dims ( const POINTARRAY pa,
int  hasz,
int  hasm,
double  zval,
double  mval 
)

Definition at line 1043 of file ptarray.c.

1044 {
1045  /* TODO handle zero-length point arrays */
1046  uint32_t i;
1047  int in_hasz = FLAGS_GET_Z(pa->flags);
1048  int in_hasm = FLAGS_GET_M(pa->flags);
1049  POINT4D pt;
1050  POINTARRAY *pa_out = ptarray_construct_empty(hasz, hasm, pa->npoints);
1051 
1052  for( i = 0; i < pa->npoints; i++ )
1053  {
1054  getPoint4d_p(pa, i, &pt);
1055  if( hasz && ! in_hasz )
1056  pt.z = zval;
1057  if( hasm && ! in_hasm )
1058  pt.m = mval;
1059  ptarray_append_point(pa_out, &pt, LW_TRUE);
1060  }
1061 
1062  return pa_out;
1063 }
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:180
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:181
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:126
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:108
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:59
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int repeated_points)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition: ptarray.c:147
double m
Definition: liblwgeom.h:429
double z
Definition: liblwgeom.h:429
lwflags_t flags
Definition: liblwgeom.h:446
uint32_t npoints
Definition: liblwgeom.h:442

References POINTARRAY::flags, FLAGS_GET_M, FLAGS_GET_Z, getPoint4d_p(), LW_TRUE, POINT4D::m, POINTARRAY::npoints, ptarray_append_point(), ptarray_construct_empty(), and POINT4D::z.

Referenced by lwline_force_dims(), lwpoint_force_dims(), and lwpoly_force_dims().

Here is the call graph for this function:
Here is the caller graph for this function: