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

◆ _lwt_toposnap()

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

Definition at line 483 of file lwgeom_topo.c.

484{
485 LWGEOM *tmp = src;
486 LWGEOM *tmp2;
487 int changed;
488 int iterations = 0;
489
490 int maxiterations = lwgeom_count_vertices(tgt);
491
492 /* GEOS snapping can be unstable */
493 /* See https://trac.osgeo.org/geos/ticket/760 */
494 do {
495 tmp2 = lwgeom_snap(tmp, tgt, tol);
496 ++iterations;
497 changed = ( lwgeom_count_vertices(tmp2) != lwgeom_count_vertices(tmp) );
498 LWDEBUGF(2, "After iteration %d, geometry changed ? %d (%d vs %d vertices)", iterations, changed, lwgeom_count_vertices(tmp2), lwgeom_count_vertices(tmp));
499 if ( tmp != src ) lwgeom_free(tmp);
500 tmp = tmp2;
501 } while ( changed && iterations <= maxiterations );
502
503 LWDEBUGF(1, "It took %d/%d iterations to properly snap",
504 iterations, maxiterations);
505
506 return tmp;
507}
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
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:1337
#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: