PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void lwgeom_collect_endpoints ( const LWGEOM lwg,
LWMPOINT col 
)
static

Definition at line 41 of file lwgeom_geos_node.c.

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().

42 {
43  int i, n;
44  LWLINE* l;
45 
46  switch (lwg->type)
47  {
48  case MULTILINETYPE:
49  for ( i = 0,
50  n = lwgeom_ngeoms(lwg);
51  i < n; ++i )
52  {
54  lwgeom_subgeom(lwg, i),
55  col);
56  }
57  break;
58  case LINETYPE:
59  l = (LWLINE*)lwg;
60  col = lwmpoint_add_lwpoint(col,
61  lwline_get_lwpoint(l, 0));
62  col = lwmpoint_add_lwpoint(col,
64  break;
65  default:
66  lwerror("lwgeom_collect_endpoints: invalid type %s",
67  lwtype_name(lwg->type));
68  break;
69  }
70 }
#define LINETYPE
Definition: liblwgeom.h:61
LWPOINT * lwline_get_lwpoint(LWLINE *line, int where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Definition: lwline.c:294
int npoints
Definition: liblwgeom.h:327
static int lwgeom_ngeoms(const LWGEOM *n)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
static const LWGEOM * lwgeom_subgeom(const LWGEOM *g, int n)
static void lwgeom_collect_endpoints(const LWGEOM *lwg, LWMPOINT *col)
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition: lwmpoint.c:32
uint8_t type
Definition: liblwgeom.h:352
#define MULTILINETYPE
Definition: liblwgeom.h:64
POINTARRAY * points
Definition: liblwgeom.h:378

Here is the call graph for this function:

Here is the caller graph for this function: