PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcollection_segmentize2d()

LWCOLLECTION* lwcollection_segmentize2d ( LWCOLLECTION col,
double  dist 
)

Definition at line 223 of file lwcollection.c.

References LWCOLLECTION::geoms, lwalloc(), lwcollection_clone(), lwcollection_construct(), lwfree(), lwgeom_free(), lwgeom_segmentize2d(), LWCOLLECTION::ngeoms, LWCOLLECTION::srid, and LWCOLLECTION::type.

Referenced by lwgeom_segmentize2d().

224 {
225  uint32_t i;
226  LWGEOM **newgeoms;
227 
228  if ( ! col->ngeoms ) return lwcollection_clone(col);
229 
230  newgeoms = lwalloc(sizeof(LWGEOM *)*col->ngeoms);
231  for (i=0; i<col->ngeoms; i++)
232  {
233  newgeoms[i] = lwgeom_segmentize2d(col->geoms[i], dist);
234  if ( ! newgeoms[i] ) {
235  while (i--) lwgeom_free(newgeoms[i]);
236  lwfree(newgeoms);
237  return NULL;
238  }
239  }
240 
241  return lwcollection_construct(col->type, col->srid, NULL, col->ngeoms, newgeoms);
242 }
void lwfree(void *mem)
Definition: lwutil.c:214
uint8_t type
Definition: liblwgeom.h:487
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *g)
Clone LWCOLLECTION object.
Definition: lwcollection.c:110
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:30
LWGEOM ** geoms
Definition: liblwgeom.h:493
int32_t srid
Definition: liblwgeom.h:490
LWGEOM * lwgeom_segmentize2d(LWGEOM *line, double dist)
Definition: lwgeom.c:668
void * lwalloc(size_t size)
Definition: lwutil.c:199
Here is the call graph for this function:
Here is the caller graph for this function: