PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwline_get_lwpoint()

LWPOINT * lwline_get_lwpoint ( const LWLINE line,
uint32_t  where 
)
extern

Returns freshly allocated LWPOINT that corresponds to the index where.

Returns NULL if the geometry is empty or the index invalid.

Definition at line 309 of file lwline.c.

310{
311 POINT4D pt;
312 LWPOINT *lwpoint;
313 POINTARRAY *pa;
314
315 if ( lwline_is_empty(line) || where >= line->points->npoints )
316 return NULL;
317
319 pt = getPoint4d(line->points, where);
321 lwpoint = lwpoint_construct(line->srid, NULL, pa);
322 return lwpoint;
323}
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
Definition lwgeom_api.c:108
LWPOINT * lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point)
Definition lwpoint.c:129
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition ptarray.c:59
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:179
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:180
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition ptarray.c:147
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:107
int lwline_is_empty(const LWLINE *line)
lwflags_t flags
Definition liblwgeom.h:471
POINTARRAY * points
Definition liblwgeom.h:469
int32_t srid
Definition liblwgeom.h:470
uint32_t npoints
Definition liblwgeom.h:413

References LWLINE::flags, FLAGS_GET_M, FLAGS_GET_Z, getPoint4d(), LW_TRUE, lwline_is_empty(), lwpoint_construct(), POINTARRAY::npoints, LWLINE::points, ptarray_append_point(), ptarray_construct_empty(), and LWLINE::srid.

Referenced by _lwt_AddLine(), _lwt_AddLineEdge(), gserialized_distance_nd(), lwcompound_get_endpoint(), lwcompound_get_lwpoint(), lwgeom_collect_endpoints(), LWGEOM_dumppoints(), LWGEOM_endpoint_linestring(), LWGEOM_pointn_linestring(), LWGEOM_startpoint_linestring(), and lwline_covers_lwline().

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