PostGIS 3.6.2dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ _lwt_toposnap()

static LWGEOM * _lwt_toposnap ( LWGEOM src,
LWGEOM tgt,
double  tol 
)
static

Definition at line 423 of file lwgeom_topo.c.

424{
425 LWGEOM *tmp = src;
426 LWGEOM *tmp2;
427 int changed;
428 int iterations = 0;
429
430 int maxiterations = lwgeom_count_vertices(tgt);
431
432 /* GEOS snapping can be unstable */
433 /* See https://trac.osgeo.org/geos/ticket/760 */
434 do {
435 tmp2 = lwgeom_snap(tmp, tgt, tol);
436 ++iterations;
437 changed = ( lwgeom_count_vertices(tmp2) != lwgeom_count_vertices(tmp) );
438 LWDEBUGF(2, "After iteration %d, geometry changed ? %d (%d vs %d vertices)", iterations, changed, lwgeom_count_vertices(tmp2), lwgeom_count_vertices(tmp));
439 if ( tmp != src ) lwgeom_free(tmp);
440 tmp = tmp2;
441 } while ( changed && iterations <= maxiterations );
442
443 LWDEBUGF(1, "It took %d/%d iterations to properly snap",
444 iterations, maxiterations);
445
446 return tmp;
447}
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1218
LWGEOM * lwgeom_snap(const LWGEOM *geom1, const LWGEOM *geom2, double tolerance)
Snap vertices and segments of a geometry to another using a given tolerance.
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
Definition lwgeom.c:1309
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106

References LWDEBUGF, lwgeom_count_vertices(), lwgeom_free(), and lwgeom_snap().

Referenced by _lwt_AddLine(), and _lwt_SplitAllEdgesToNewNode().

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