PostGIS  2.1.10dev-r@@SVN_REVISION@@
POINTARRAY* ptarray_construct_empty ( char  hasz,
char  hasm,
uint32_t  maxpoints 

Create a new POINTARRAY with no points.

Allocate enough storage to hold maxpoints vertices before having to reallocate the storage area.

Definition at line 57 of file ptarray.c.

References POINTARRAY::flags, gflags(), lwalloc(), POINTARRAY::maxpoints, POINTARRAY::npoints, ptarray_point_size(), and POINTARRAY::serialized_pointlist.

Referenced by BOX2D_to_LWGEOM(), BOX3D_to_LWGEOM(), gbox_to_gml2(), gbox_to_gml3(), GenerateLineStringGeometry(), GeneratePointGeometry(), GeneratePolygonGeometry(), lwcircle_segmentize(), lwcircstring_construct_empty(), lwcircstring_get_lwpoint(), lwcircstring_segmentize(), lwcompound_segmentize(), LWGEOM2GEOS(), LWGEOM_envelope(), LWGEOM_expand(), lwline_clip_to_ordinate_range(), lwline_construct_empty(), lwline_from_lwgeom_array(), lwline_from_ptarray(), lwline_get_lwpoint(), lwpoint_make(), lwpoint_make2d(), lwpoint_make3dm(), lwpoint_make3dz(), lwpoint_make4d(), lwtriangle_construct_empty(), parse_geojson_linestring(), parse_geojson_multilinestring(), parse_geojson_multipoint(), parse_geojson_multipolygon(), parse_geojson_point(), parse_geojson_polygon(), parse_gml_coord(), parse_gml_coordinates(), parse_gml_pos(), parse_gml_poslist(), parse_kml_coordinates(), path_to_geometry(), polygon_to_geometry(), ptarray_construct(), ptarray_force_dims(), ptarray_grid(), ptarray_locate_along(), ptarray_locate_between_m(), ptarray_segmentize2d(), ptarray_segmentize_sphere(), ptarray_simplify(), ptarray_substring(), rt_raster_get_convex_hull(), RTreeCreateLeafNode(), ST_MakeEnvelope(), and wkt_parser_ptarray_new().

58 {
59  uint8_t dims = gflags(hasz, hasm, 0);
60  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
61  pa->serialized_pointlist = NULL;
63  /* Set our dimsionality info on the bitmap */
64  pa->flags = dims;
66  /* We will be allocating a bit of room */
67  pa->npoints = 0;
68  pa->maxpoints = maxpoints;
70  /* Allocate the coordinate array */
71  if ( maxpoints > 0 )
72  pa->serialized_pointlist = lwalloc(maxpoints * ptarray_point_size(pa));
73  else
74  pa->serialized_pointlist = NULL;
76  return pa;
77 }
uint8_t * serialized_pointlist
Definition: liblwgeom.h:322
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:41
int npoints
Definition: liblwgeom.h:327
uint8_t flags
Definition: liblwgeom.h:325
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:131
int maxpoints
Definition: liblwgeom.h:328
void * lwalloc(size_t size)
Definition: lwutil.c:175

Here is the call graph for this function: