PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwpoint_force_dims()

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

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

254 {
255  POINTARRAY *pdims = NULL;
256  LWPOINT *pointout;
257 
258  /* Return 2D empty */
259  if( lwpoint_is_empty(point) )
260  {
261  pointout = lwpoint_construct_empty(point->srid, hasz, hasm);
262  }
263  else
264  {
265  /* Always we duplicate the ptarray and return */
266  pdims = ptarray_force_dims(point->point, hasz, hasm);
267  pointout = lwpoint_construct(point->srid, NULL, pdims);
268  }
269  pointout->type = point->type;
270  return pointout;
271 }
uint8_t type
Definition: liblwgeom.h:406
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoint.c:133
POINTARRAY * point
Definition: liblwgeom.h:410
int lwpoint_is_empty(const LWPOINT *point)
Definition: lwpoint.c:273
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:111
POINTARRAY * ptarray_force_dims(const POINTARRAY *pa, int hasz, int hasm)
Definition: ptarray.c:1042
int32_t srid
Definition: liblwgeom.h:409
Here is the call graph for this function:
Here is the caller graph for this function: