PostGIS  2.5.7dev-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 70 of file ptarray.c.

71 {
72  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
73  pa->serialized_pointlist = NULL;
74 
75  /* Set our dimensionality info on the bitmap */
76  pa->flags = gflags(hasz, hasm, 0);
77 
78  /* We will be allocating a bit of room */
79  pa->npoints = 0;
80  pa->maxpoints = maxpoints;
81 
82  /* Allocate the coordinate array */
83  if ( maxpoints > 0 )
84  pa->serialized_pointlist = lwalloc(maxpoints * ptarray_point_size(pa));
85  else
86  pa->serialized_pointlist = NULL;
87 
88  return pa;
89 }
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
void * lwalloc(size_t size)
Definition: lwutil.c:229
size_t ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
uint32_t maxpoints
Definition: liblwgeom.h:375
uint32_t npoints
Definition: liblwgeom.h:374
uint8_t * serialized_pointlist
Definition: liblwgeom.h:369
uint8_t flags
Definition: liblwgeom.h:372

References POINTARRAY::flags, gflags(), lwalloc(), 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_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_chaikin(), 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: