PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwcollection_simplify()

LWCOLLECTION* lwcollection_simplify ( const LWCOLLECTION igeom,
double  dist,
int  preserve_collapsed 
)

Definition at line 526 of file lwcollection.c.

References LWCOLLECTION::flags, FLAGS_GET_M, FLAGS_GET_Z, LWCOLLECTION::geoms, lwcollection_add_lwgeom(), lwcollection_construct_empty(), lwcollection_is_empty(), lwgeom_simplify(), LWCOLLECTION::ngeoms, LWCOLLECTION::srid, and LWCOLLECTION::type.

Referenced by lwgeom_simplify().

527 {
528  int i;
529  LWCOLLECTION *out = lwcollection_construct_empty(igeom->type, igeom->srid, FLAGS_GET_Z(igeom->flags), FLAGS_GET_M(igeom->flags));
530 
531  if( lwcollection_is_empty(igeom) )
532  return out; /* should we return NULL instead ? */
533 
534  for( i = 0; i < igeom->ngeoms; i++ )
535  {
536  LWGEOM *ngeom = lwgeom_simplify(igeom->geoms[i], dist, preserve_collapsed);
537  if ( ngeom ) out = lwcollection_add_lwgeom(out, ngeom);
538  }
539 
540  return out;
541 }
uint8_t type
Definition: liblwgeom.h:503
int lwcollection_is_empty(const LWCOLLECTION *col)
Definition: lwcollection.c:501
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
uint8_t flags
Definition: liblwgeom.h:504
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:187
LWGEOM ** geoms
Definition: liblwgeom.h:509
LWGEOM * lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed)
Definition: lwgeom.c:1602
int32_t srid
Definition: liblwgeom.h:506
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:140
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
Here is the call graph for this function:
Here is the caller graph for this function: