PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwmpoint_from_lwgeom()

LWMPOINT* lwmpoint_from_lwgeom ( const LWGEOM g)

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

128 {
130  int has_z = lwgeom_has_z(g);
131  int has_m = lwgeom_has_m(g);
132  LWMPOINT* result = lwmpoint_construct_empty(g->srid, has_z, has_m);
133  POINT4D p;
134 
135  while(lwpointiterator_next(it, &p)) {
136  LWPOINT* lwp = lwpoint_make(g->srid, has_z, has_m, &p);
137  lwmpoint_add_lwpoint(result, lwp);
138  }
139 
141  return result;
142 }
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:885
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition: lwiterator.c:244
int32_t srid
Definition: liblwgeom.h:399
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:206
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:892
Here is the call graph for this function:
Here is the caller graph for this function: