PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwgeom_subdivide_prec()

LWCOLLECTION* lwgeom_subdivide_prec ( const LWGEOM geom,
uint32_t  maxvertices,
double  gridSize 
)

Definition at line 2465 of file lwgeom.c.

2466 {
2467  static uint32_t startdepth = 0;
2468  static uint32_t minmaxvertices = 5;
2469  LWCOLLECTION *col;
2470 
2472 
2473  if ( lwgeom_is_empty(geom) )
2474  return col;
2475 
2476  if ( maxvertices < minmaxvertices )
2477  {
2478  lwcollection_free(col);
2479  lwerror("%s: cannot subdivide to fewer than %d vertices per output", __func__, minmaxvertices);
2480  }
2481 
2482  lwgeom_subdivide_recursive(geom, lwgeom_dimension(geom), maxvertices, startdepth, col, gridSize);
2483  lwgeom_set_srid((LWGEOM*)col, geom->srid);
2484  return col;
2485 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:108
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:357
void lwgeom_set_srid(LWGEOM *geom, int32_t srid)
Set the SRID on an LWGEOM For collections, only the parent gets an SRID, all the children get SRID_UN...
Definition: lwgeom.c:1547
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:934
int lwgeom_dimension(const LWGEOM *geom)
For an LWGEOM, returns 0 for points, 1 for lines, 2 for polygons, 3 for volume, and the max dimension...
Definition: lwgeom.c:1298
static void lwgeom_subdivide_recursive(const LWGEOM *geom, uint8_t dimension, uint32_t maxvertices, uint32_t depth, LWCOLLECTION *col, double gridSize)
Definition: lwgeom.c:2284
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:941
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:203
int32_t srid
Definition: liblwgeom.h:460

References COLLECTIONTYPE, lwcollection_construct_empty(), lwcollection_free(), lwerror(), lwgeom_dimension(), lwgeom_has_m(), lwgeom_has_z(), lwgeom_is_empty(), lwgeom_set_srid(), lwgeom_subdivide_recursive(), and LWGEOM::srid.

Referenced by lwgeom_subdivide(), and ST_Subdivide().

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