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

◆ lwgeom_collect_endpoints()

static void lwgeom_collect_endpoints ( const LWGEOM lwg,
LWMPOINT col 
)
static

Definition at line 50 of file lwgeom_geos_node.c.

51{
52 int i, n;
53 LWLINE* l;
54
55 switch (lwg->type)
56 {
57 case MULTILINETYPE:
58 for ( i = 0,
59 n = lwgeom_ngeoms(lwg);
60 i < n; ++i )
61 {
63 lwgeom_subgeom(lwg, i),
64 col);
65 }
66 break;
67 case LINETYPE:
68 l = (LWLINE*)lwg;
69 col = lwmpoint_add_lwpoint(col,
70 lwline_get_lwpoint(l, 0));
71 col = lwmpoint_add_lwpoint(col,
73 break;
74 default:
75 lwerror("lwgeom_collect_endpoints: invalid type %s",
76 lwtype_name(lwg->type));
77 break;
78 }
79}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
LWPOINT * lwline_get_lwpoint(const LWLINE *line, uint32_t where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Definition lwline.c:309
#define MULTILINETYPE
Definition liblwgeom.h:120
#define LINETYPE
Definition liblwgeom.h:117
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition lwmpoint.c:45
static const LWGEOM * lwgeom_subgeom(const LWGEOM *g, int n)
static int lwgeom_ngeoms(const LWGEOM *n)
static void lwgeom_collect_endpoints(const LWGEOM *lwg, LWMPOINT *col)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
uint8_t type
Definition liblwgeom.h:448
POINTARRAY * points
Definition liblwgeom.h:469
uint32_t npoints
Definition liblwgeom.h:413

References LINETYPE, lwerror(), lwgeom_collect_endpoints(), lwgeom_ngeoms(), lwgeom_subgeom(), lwline_get_lwpoint(), lwmpoint_add_lwpoint(), lwtype_name(), MULTILINETYPE, POINTARRAY::npoints, LWLINE::points, and LWGEOM::type.

Referenced by lwgeom_collect_endpoints(), and lwgeom_extract_endpoints().

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