PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcollection_simplify()

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

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

507 {
508  int i;
509  LWCOLLECTION *out = lwcollection_construct_empty(igeom->type, igeom->srid, FLAGS_GET_Z(igeom->flags), FLAGS_GET_M(igeom->flags));
510 
511  if( lwcollection_is_empty(igeom) )
512  return out; /* should we return NULL instead ? */
513 
514  for( i = 0; i < igeom->ngeoms; i++ )
515  {
516  LWGEOM *ngeom = lwgeom_simplify(igeom->geoms[i], dist, preserve_collapsed);
517  if ( ngeom ) out = lwcollection_add_lwgeom(out, ngeom);
518  }
519 
520  return out;
521 }
uint8_t type
Definition: liblwgeom.h:487
int lwcollection_is_empty(const LWCOLLECTION *col)
Definition: lwcollection.c:481
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:81
uint8_t flags
Definition: liblwgeom.h:488
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:174
LWGEOM ** geoms
Definition: liblwgeom.h:493
LWGEOM * lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed)
Definition: lwgeom.c:1558
int32_t srid
Definition: liblwgeom.h:490
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:124
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
Here is the call graph for this function:
Here is the caller graph for this function: