PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwmpoint_from_lwgeom()

LWMPOINT* lwmpoint_from_lwgeom ( const LWGEOM g)

Definition at line 93 of file lwmpoint.c.

94 {
96  int has_z = lwgeom_has_z(g);
97  int has_m = lwgeom_has_m(g);
98  LWMPOINT* result = lwmpoint_construct_empty(g->srid, has_z, has_m);
99  POINT4D p;
100 
101  while(lwpointiterator_next(it, &p)) {
102  LWPOINT* lwp = lwpoint_make(g->srid, has_z, has_m, &p);
103  lwmpoint_add_lwpoint(result, lwp);
104  }
105 
107  return result;
108 }
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition: lwiterator.c:244
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
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
Definition: lwiterator.c:269
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:930
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:937
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
LWMPOINT * lwmpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwmpoint.c:39
int32_t srid
Definition: liblwgeom.h:402

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().

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