5528 int num, numedges=0, numnodes=0;
5536 LWDEBUGF(1,
"Working tolerance:%.15g", tol);
5544 LWDEBUGG(1, tmp,
"Repeated-point removed");
5545 }}
else tmp=(
LWGEOM*)line;
5550 if ( ! noded )
return NULL;
5557 LWDEBUGF(1,
"BOX expanded by %g is %.15g %.15g, %.15g %.15g",
5562 int nearbycount = 0;
5566 if ( numedges == -1 )
5572 LWDEBUGF(1,
"Line has %d points, its bbox intersects %d edges bboxes",
5573 line->points->npoints, numedges);
5577 nearbycount += numedges;
5579 for (i=0; i<numedges; ++i)
5587 if ( dist && dist >= tol )
continue;
5588 nearby[nearbyindex++] = g;
5590 LWDEBUGF(2,
"Found %d lines closer than tolerance (%g)", nearbyindex, tol);
5598 LWDEBUGF(1,
"Line intersects %d edges", nearbyindex);
5601 NULL, nearbyindex, nearby);
5603 LWDEBUGG(1, iedges,
"Collected edges");
5604 LWDEBUGF(1,
"Snapping noded, with srid=%d "
5605 "to interesecting edges, with srid=%d",
5610 LWDEBUGF(1,
"Diffing snapped, with srid=%d "
5611 "and interesecting edges, with srid=%d",
5615 LWDEBUGF(1,
"Intersecting snapped, with srid=%d "
5616 "and interesecting edges, with srid=%d",
5621 LWDEBUGF(1,
"Linemerging set1, with srid=%d", set1->
srid);
5626 LWDEBUGF(1,
"Unioning noded, with srid=%d "
5627 "and set2, with srid=%d", noded->
srid, set2->
srid);
5642 if ( numnodes == -1 )
5648 LWDEBUGF(1,
"Line bbox intersects %d nodes bboxes", numnodes);
5649 int nearbyedgecount = nearbyindex;
5653 nearbycount = nearbyindex + numnodes;
5660 for (i=0; i<numnodes; ++i)
5666 if ( dist && dist >= tol )
continue;
5667 nearby[nearbyindex++] = g;
5672 LWDEBUGF(1,
"Number of nearby elements is %d", nearbyindex);
5680 NULL, nearbyindex, nearby);
5683 LWDEBUGG(1, elems,
"Collected nearby elements");
5688 LWDEBUGG(1, noded,
"Elements-snapped");
5696 NULL, nearbyindex-nearbyedgecount,
5697 nearby + nearbyedgecount);
5715 LWDEBUGG(1, noded,
"Unary-unioned");
5719 LWDEBUG(1,
"Freeing up nearby elements");
5721 if ( nearby )
lwfree(nearby);
5725 LWDEBUGG(1, noded,
"Finally-noded");
5731 LWDEBUG(1,
"Noded line was a collection");
5737 LWDEBUG(1,
"Noded line was a single geom");
5738 geomsbuf[0] = noded;
5743 LWDEBUGF(1,
"Line was split into %d edges", ngeoms);
5751 for ( i=0; i<ngeoms; ++i )
5757 #if POSTGIS_DEBUG_LEVEL > 0
5761 LWDEBUGF(1,
"Component %d of split line is: %s", i, wkt1);
5776 LWDEBUGF(1,
"Component %d of split line collapsed", i);
5785 LWDEBUGG(1, noded,
"Noded before free");
void gbox_expand(GBOX *g, double d)
Move the box minimums down and the maximums up by the distance provided.
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
LWGEOM * lwgeom_node(const LWGEOM *lwgeom_in)
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwgeom_intersection(const LWGEOM *geom1, const LWGEOM *geom2)
LWGEOM * lwgeom_difference(const LWGEOM *geom1, const LWGEOM *geom2)
void * lwrealloc(void *mem, size_t size)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
LWGEOM * lwgeom_unaryunion(const LWGEOM *geom1)
void lwcollection_release(LWCOLLECTION *lwcollection)
double lwgeom_mindistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing min distance calculation.
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
LWGEOM * lwgeom_linemerge(const LWGEOM *geom1)
void * lwalloc(size_t size)
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
LWGEOM * lwgeom_union(const LWGEOM *geom1, const LWGEOM *geom2)
LWGEOM * lwline_remove_repeated_points(const LWLINE *in, double tolerance)
#define LW_ON_INTERRUPT(x)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
#define LWDEBUGG(level, geom, msg)
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
static LWGEOM * _lwt_split_by_nodes(const LWGEOM *g, const LWGEOM *nodes)
static void _lwt_release_nodes(LWT_ISO_NODE *nodes, int num_nodes)
static LWT_ISO_NODE * lwt_be_getNodeWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, int *numelems, int fields, int limit)
static LWT_ELEMID _lwt_AddLineEdge(LWT_TOPOLOGY *topo, LWLINE *edge, double tol, int handleFaceSplit)
#define _LWT_MINTOLERANCE(topo, geom)
static LWGEOM * _lwt_toposnap(LWGEOM *src, LWGEOM *tgt, double tol)
static LWT_ISO_EDGE * lwt_be_getEdgeWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, int *numelems, int fields, int limit)
static void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
const LWT_BE_IFACE * be_iface