PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_collect_endpoints()

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

Definition at line 54 of file lwgeom_geos_node.c.

55 {
56  int i, n;
57  LWLINE* l;
58 
59  switch (lwg->type)
60  {
61  case MULTILINETYPE:
62  for ( i = 0,
63  n = lwgeom_ngeoms(lwg);
64  i < n; ++i )
65  {
67  lwgeom_subgeom(lwg, i),
68  col);
69  }
70  break;
71  case LINETYPE:
72  l = (LWLINE*)lwg;
73  col = lwmpoint_add_lwpoint(col,
74  lwline_get_lwpoint(l, 0));
75  col = lwmpoint_add_lwpoint(col,
77  break;
78  default:
79  lwerror("lwgeom_collect_endpoints: invalid type %s",
80  lwtype_name(lwg->type));
81  break;
82  }
83 }
#define MULTILINETYPE
Definition: liblwgeom.h:106
#define LINETYPE
Definition: liblwgeom.h:103
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition: lwmpoint.c:45
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
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 void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
uint8_t type
Definition: liblwgeom.h:462
POINTARRAY * points
Definition: liblwgeom.h:483
uint32_t npoints
Definition: liblwgeom.h:427

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

Referenced by lwgeom_extract_endpoints().

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