PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpoint_force_dims()

LWPOINT* lwpoint_force_dims ( const LWPOINT lwpoint,
int  hasz,
int  hasm 
)

Definition at line 271 of file lwpoint.c.

References lwpoint_construct(), lwpoint_construct_empty(), lwpoint_is_empty(), LWPOINT::point, ptarray_force_dims(), LWPOINT::srid, and LWPOINT::type.

Referenced by lwgeom_force_dims().

272 {
273  POINTARRAY *pdims = NULL;
274  LWPOINT *pointout;
275 
276  /* Return 2D empty */
277  if( lwpoint_is_empty(point) )
278  {
279  pointout = lwpoint_construct_empty(point->srid, hasz, hasm);
280  }
281  else
282  {
283  /* Always we duplicate the ptarray and return */
284  pdims = ptarray_force_dims(point->point, hasz, hasm);
285  pointout = lwpoint_construct(point->srid, NULL, pdims);
286  }
287  pointout->type = point->type;
288  return pointout;
289 }
uint8_t type
Definition: liblwgeom.h:407
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoint.c:151
int lwpoint_is_empty(const LWPOINT *point)
Definition: lwpoint.c:291
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
POINTARRAY * ptarray_force_dims(const POINTARRAY *pa, int hasz, int hasm)
Definition: ptarray.c:1038
Here is the call graph for this function:
Here is the caller graph for this function: