PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwmpoint_from_lwgeom()

LWMPOINT* lwmpoint_from_lwgeom ( const LWGEOM g)

Definition at line 124 of file lwmpoint.c.

References lwgeom_has_m(), lwgeom_has_z(), lwmpoint_add_lwpoint(), lwmpoint_construct_empty(), lwpoint_make(), lwpointiterator_create(), lwpointiterator_destroy(), lwpointiterator_next(), and LWGEOM::srid.

Referenced by ST_Points(), and test_lwmpoint_from_lwgeom().

125 {
127  int has_z = lwgeom_has_z(g);
128  int has_m = lwgeom_has_m(g);
129  LWMPOINT* result = lwmpoint_construct_empty(g->srid, has_z, has_m);
130  POINT4D p;
131 
132  while(lwpointiterator_next(it, &p)) {
133  LWPOINT* lwp = lwpoint_make(g->srid, has_z, has_m, &p);
134  lwmpoint_add_lwpoint(result, lwp);
135  }
136 
138  return result;
139 }
int lwpointiterator_next(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assign the next point in the iterator to p, and advances the iterator to the next point...
Definition: lwiterator.c:212
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:849
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition: lwiterator.c:244
int32_t srid
Definition: liblwgeom.h:398
LWMPOINT * lwmpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwmpoint.c:39
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
Definition: lwiterator.c:269
LWPOINT * lwpoint_make(int srid, int hasz, int hasm, const POINT4D *p)
Definition: lwpoint.c:188
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition: lwmpoint.c:45
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:856
Here is the call graph for this function:
Here is the caller graph for this function: