PostGIS  2.3.7dev-r@@SVN_REVISION@@
int lwpoly_add_ring ( LWPOLY poly,
POINTARRAY pa 
)

Add a ring, allocating extra space if necessary.

The polygon takes ownership of the passed point array.

Add a ring, allocating extra space if necessary.

Point array will be referenced, not copied.

Definition at line 225 of file lwpoly.c.

References LW_FAILURE, LW_SUCCESS, lwrealloc(), LWPOLY::maxrings, LWPOLY::nrings, and LWPOLY::rings.

Referenced by GeneratePolygonGeometry(), lwgeom_segmentize_sphere(), lwpoly_construct_circle(), lwpoly_construct_rectangle(), lwpoly_from_twkb_state(), lwpoly_from_wkb_state(), lwpoly_grid(), lwpoly_set_effective_area(), lwpoly_simplify(), parse_geojson_multipolygon(), and wkt_parser_polygon_add_ring().

226 {
227  if( ! poly || ! pa )
228  return LW_FAILURE;
229 
230  /* We have used up our storage, add some more. */
231  if( poly->nrings >= poly->maxrings )
232  {
233  int new_maxrings = 2 * (poly->nrings + 1);
234  poly->rings = lwrealloc(poly->rings, new_maxrings * sizeof(POINTARRAY*));
235  poly->maxrings = new_maxrings;
236  }
237 
238  /* Add the new ring entry. */
239  poly->rings[poly->nrings] = pa;
240  poly->nrings++;
241 
242  return LW_SUCCESS;
243 }
#define LW_SUCCESS
Definition: liblwgeom.h:79
#define LW_FAILURE
Definition: liblwgeom.h:78
POINTARRAY ** rings
Definition: liblwgeom.h:456
int nrings
Definition: liblwgeom.h:454
int maxrings
Definition: liblwgeom.h:455
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:235

Here is the call graph for this function:

Here is the caller graph for this function: