PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ ptarray_construct_empty()

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 59 of file ptarray.c.

60 {
61  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
62  pa->serialized_pointlist = NULL;
63 
64  /* Set our dimensionality info on the bitmap */
65  pa->flags = lwflags(hasz, hasm, 0);
66 
67  /* We will be allocating a bit of room */
68  pa->npoints = 0;
69  pa->maxpoints = maxpoints;
70 
71  /* Allocate the coordinate array */
72  if ( maxpoints > 0 )
73  pa->serialized_pointlist = lwalloc(maxpoints * ptarray_point_size(pa));
74  else
75  pa->serialized_pointlist = NULL;
76 
77  return pa;
78 }
void * lwalloc(size_t size)
Definition: lwutil.c:227
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition: lwutil.c:471
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition: lwinline.h:48
lwflags_t flags
Definition: liblwgeom.h:417
uint32_t maxpoints
Definition: liblwgeom.h:414
uint32_t npoints
Definition: liblwgeom.h:413
uint8_t * serialized_pointlist
Definition: liblwgeom.h:420

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

Referenced by BOX2D_to_LWGEOM(), BOX3D_to_LWGEOM(), encode_mpoint(), gbox_to_gml2(), gbox_to_gml3(), GenerateLineStringGeometry(), GeneratePointGeometry(), GeneratePolygonGeometry(), geography_centroid_from_mpoly(), lwarc_linearize(), lwcircstring_construct_empty(), lwcircstring_get_lwpoint(), lwcircstring_linearize(), lwcompound_linearize(), LWGEOM_envelope(), lwgeom_from_encoded_polyline(), lwline_clip_to_ordinate_range(), lwline_construct_empty(), lwline_from_lwgeom_array(), lwline_from_ptarray(), lwline_get_lwpoint(), lwline_interpolate_points(), lwline_split_by_point_to(), lwpoint_make(), lwpoint_make2d(), lwpoint_make3dm(), lwpoint_make3dz(), lwpoint_make4d(), lwpoly_construct_circle(), lwpoly_construct_rectangle(), lwtriangle_clip_to_ordinate_range(), lwtriangle_construct_empty(), parse_geojson_linestring(), parse_geojson_multilinestring(), parse_geojson_multipoint(), parse_geojson_point(), parse_geojson_poly_rings(), parse_gml_coord(), parse_gml_coordinates(), parse_gml_pos(), parse_gml_poslist(), parse_kml_coordinates(), path_to_geometry(), polygon_to_geometry(), ptarray_chaikin(), ptarray_clamp_to_ordinate_range(), ptarray_construct(), ptarray_force_dims(), ptarray_from_twkb_state(), ptarray_locate_along(), ptarray_locate_between_m(), ptarray_segmentize2d(), ptarray_segmentize_sphere(), ptarray_set_effective_area(), ptarray_substring(), rt_raster_get_convex_hull(), rt_raster_get_envelope_geom(), RTreeCreateLeafNode(), ST_BoundingDiagonal(), test_trim_bits(), and wkt_parser_ptarray_new().

Here is the call graph for this function: