37 lwerror(
"%s only supports compound curves", __func__);
54 for (uint32_t i = 0; i < compound->
ngeoms; i++)
56 uint32_t i_end = i == 0 ? compound->
ngeoms - 1 : i - 1;
87 for (uint32_t i = 1; i < compound->
ngeoms; i++)
124 for (i = 0; i < comp->
ngeoms; i++)
138 LWDEBUG(4,
"Got an empty component for a compound curve!");
155 LWDEBUG(4,
"Components don't join up end-to-end!");
156 LWDEBUGF(4,
"first pt (%g %g %g %g) last pt (%g %g %g %g)", first.
x, first.
y, first.
z, first.
m, last.
x, last.
y, last.
z, last.
m);
183 lwerror(
"lwgeom_contains_point failed");
194 int winding_number = 0;
197 for ( i = 0; i < comp->
ngeoms; i++ )
235 wn += winding_number;
260 uint32_t npoints = 0;
265 if ( where >= npoints )
267 lwerror(
"%s: index %d is not in range of number of vertices (%d) in input", __func__, where, npoints);
271 for ( i = 0; i < lwcmp->
ngeoms; i++ )
275 if ( where >=
count && where <
count + npoints_part )
281 count += npoints_part;
char result[OUT_DOUBLE_BUFFER_SIZE]
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWGEOM * lwcompound_as_lwgeom(const LWCOMPOUND *obj)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
#define FLAGS_GET_Z(flags)
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
double lwgeom_length_2d(const LWGEOM *geom)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
#define FLAGS_GET_M(flags)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
LWCIRCSTRING * lwgeom_as_lwcircstring(const LWGEOM *lwgeom)
#define LW_TRUE
Return types for functions with status returns.
LWPOINT * lwline_get_lwpoint(const LWLINE *line, uint32_t where)
Returns freshly allocated LWPOINT that corresponds to the index where.
int ptarray_contains_point_partial(const POINTARRAY *pa, const POINT2D *pt, int check_closed, int *winding_number)
#define LW_INSIDE
Constants for point-in-polygon return values.
int ptarrayarc_contains_point(const POINTARRAY *pa, const POINT2D *pt)
For POINTARRAYs representing CIRCULARSTRINGS.
int p3d_same(const POINT3D *p1, const POINT3D *p2)
int ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt)
Return LW_INSIDE if the point is inside the POINTARRAY, LW_OUTSIDE if it is outside,...
int ptarrayarc_contains_point_partial(const POINTARRAY *pa, const POINT2D *pt, int check_closed, int *winding_number)
int p2d_same(const POINT2D *p1, const POINT2D *p2)
uint32_t lwcompound_num_curves(const LWCOMPOUND *compound)
double lwcompound_length_2d(const LWCOMPOUND *comp)
int lwcompound_contains_point(const LWCOMPOUND *comp, const POINT2D *pt)
LWPOINT * lwcompound_get_lwpoint(const LWCOMPOUND *lwcmp, uint32_t where)
const LWGEOM * lwcollection_getsubcurve(const LWCOMPOUND *compound, uint32_t curvenum)
int lwcompound_is_closed(const LWCOMPOUND *compound)
LWCOMPOUND * lwcompound_construct_from_lwline(const LWLINE *lwline)
Construct an equivalent compound curve from a linestring.
LWPOINT * lwcompound_get_startpoint(const LWCOMPOUND *lwcmp)
double lwcompound_length(const LWCOMPOUND *comp)
int lwcompound_is_valid(const LWCOMPOUND *compound)
int lwgeom_contains_point(const LWGEOM *geom, const POINT2D *pt)
LWCOMPOUND * lwcompound_construct_empty(int32_t srid, char hasz, char hasm)
int lwcompound_add_lwgeom(LWCOMPOUND *comp, LWGEOM *geom)
Add a component, allocating extra space if necessary.
LWPOINT * lwcompound_get_endpoint(const LWCOMPOUND *lwcmp)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static const POINT3D * getPoint3d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT3D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)