610 uint64_t i, num_nodes, num_edges;
614 GEOSGeometry *edgegg;
629 LWDEBUGF(1,
"lwt_be_getNodeWithinBox2D returned %llu nodes", num_nodes);
630 if (num_nodes == UINT64_MAX)
635 for ( i=0; i<num_nodes; ++i )
639 if ( node->
node_id == start_node )
continue;
640 if ( node->
node_id == end_node )
continue;
647 GEOSGeom_destroy(edgegg);
649 lwerror(
"SQL/MM Spatial exception - geometry crosses a node");
658 LWDEBUGF(1,
"lwt_be_getEdgeWithinBox2D returned %llu edges", num_edges);
659 if (num_edges == UINT64_MAX)
661 GEOSGeom_destroy(edgegg);
665 for ( i=0; i<num_edges; ++i )
673 if ( edge_id == myself )
continue;
675 if ( ! edge->
geom ) {
683 GEOSGeom_destroy(edgegg);
693 relate = GEOSRelateBoundaryNodeRule(eegg, edgegg, 2);
694 GEOSGeom_destroy(eegg);
696 GEOSGeom_destroy(edgegg);
704 match = GEOSRelatePatternMatch(relate,
"FF*F*****");
710 GEOSGeom_destroy(edgegg);
717 match = GEOSRelatePatternMatch(relate,
"1FFF*FFF2");
720 GEOSGeom_destroy(edgegg);
731 match = GEOSRelatePatternMatch(relate,
"1********");
734 GEOSGeom_destroy(edgegg);
739 lwerror(
"Spatial exception - geometry intersects edge %"
745 match = GEOSRelatePatternMatch(relate,
"T********");
748 GEOSGeom_destroy(edgegg);
753 lwerror(
"SQL/MM Spatial exception - geometry crosses edge %"
759 match = GEOSRelatePatternMatch(relate,
"*T*******");
762 GEOSGeom_destroy(edgegg);
767 lwerror(
"Spatial exception - geometry boundary touches interior of edge %"
773 match = GEOSRelatePatternMatch(relate,
"***T*****");
776 GEOSGeom_destroy(edgegg);
781 lwerror(
"Spatial exception - boundary of edge %" LWTFMT_ELEMID" touches interior of geometry", edge_id);
790 LWDEBUGF(1,
"No edge crossing detected among the %llu candidate edges", num_edges);
794 GEOSGeom_destroy(edgegg);
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
void lwgeom_geos_error(const char *fmt,...)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
int ptarray_contains_point_partial(const POINTARRAY *pa, const POINT2D *pt, int check_closed, int *winding_number)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define PGTOPO_BE_ERROR()
Datum contains(PG_FUNCTION_ARGS)
#define LWDEBUGF(level, msg,...)
void lwnotice(const char *fmt,...) __attribute__((format(printf
Write a notice out to the notice handler.
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static void _lwt_release_nodes(LWT_ISO_NODE *nodes, int num_nodes)
LWT_ISO_EDGE * lwt_be_getEdgeWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, uint64_t limit)
void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
static LWT_ISO_NODE * lwt_be_getNodeWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, uint64_t limit)
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.