PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 154 of file lwpoly.c.

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

Referenced by GeneratePolygonGeometry(), lwgeom_segmentize_sphere(), lwpoly_from_wkb_state(), lwpoly_simplify(), parse_geojson_multipolygon(), and wkt_parser_polygon_add_ring().

155 {
156  if( ! poly || ! pa )
157  return LW_FAILURE;
158 
159  /* We have used up our storage, add some more. */
160  if( poly->nrings >= poly->maxrings )
161  {
162  int new_maxrings = 2 * (poly->nrings + 1);
163  poly->rings = lwrealloc(poly->rings, new_maxrings * sizeof(POINTARRAY*));
164  poly->maxrings = new_maxrings;
165  }
166 
167  /* Add the new ring entry. */
168  poly->rings[poly->nrings] = pa;
169  poly->nrings++;
170 
171  return LW_SUCCESS;
172 }
#define LW_SUCCESS
Definition: liblwgeom.h:55
#define LW_FAILURE
Definition: liblwgeom.h:54
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
int maxrings
Definition: liblwgeom.h:412
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:183

Here is the call graph for this function:

Here is the caller graph for this function: