PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwpoly_add_ring()

int lwpoly_add_ring ( LWPOLY poly,
POINTARRAY pa 
)

Add a ring to a polygon.

Add a ring, allocating extra space if necessary.

Point array will be referenced, not copied.

Definition at line 247 of file lwpoly.c.

248 {
249  if( ! poly || ! pa )
250  return LW_FAILURE;
251 
252  /* We have used up our storage, add some more. */
253  if( poly->nrings >= poly->maxrings )
254  {
255  int new_maxrings = 2 * (poly->nrings + 1);
256  poly->rings = lwrealloc(poly->rings, new_maxrings * sizeof(POINTARRAY*));
257  poly->maxrings = new_maxrings;
258  }
259 
260  /* Add the new ring entry. */
261  poly->rings[poly->nrings] = pa;
262  poly->nrings++;
263 
264  return LW_SUCCESS;
265 }
#define LW_FAILURE
Definition: liblwgeom.h:79
#define LW_SUCCESS
Definition: liblwgeom.h:80
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:237
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t maxrings
Definition: liblwgeom.h:459
uint32_t nrings
Definition: liblwgeom.h:458

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

Referenced by GeneratePolygonGeometry(), geography_centroid_from_mpoly(), lwgeom_segmentize_sphere(), lwpoly_chaikin(), lwpoly_construct_circle(), lwpoly_construct_rectangle(), lwpoly_filterm(), lwpoly_from_twkb_state(), lwpoly_from_wkb_state(), lwpoly_set_effective_area(), parse_geojson_multipolygon(), and wkt_parser_polygon_add_ring().

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