6527 for (i=0; i<num; ++i)
6534 if ( dist >= tol )
continue;
6536 sorted[j++].
score = dist;
6547 for (j=0, i=0; i<num; ++i)
6549 if ( sorted[i].score == sorted[0].score )
6565 if ( moved ) *moved =
lwgeom_same(prj, lwpoint) ? 0 : 1;
6588 LWDEBUGG(1, prj,
"Projected point");
6592 for (i=0; i<num; ++i)
6608 lwerror(
"Something went wrong with _lwt_SnapEdgeToExistingNode");
6625 " does not contain projected point to it",
6633 LWDEBUG(1,
"But there's another to check");
6642 LWDEBUGF(1,
"Edge snapped with tolerance %g", tol);
6645 #if POSTGIS_DEBUG_LEVEL > 0
6650 LWDEBUGF(1,
"Edge %s snapped became %s", wkt1, wkt2);
6663 LWDEBUGF(1,
"Edge first point is %g %g, "
6664 "snapline first point is %g %g",
6665 p1.
x, p1.
y, p2.
x, p2.
y);
6666 if ( p1.
x != p2.
x || p1.
y != p2.
y )
6668 LWDEBUG(1,
"Snapping moved first point, re-adding it");
6676 #if POSTGIS_DEBUG_LEVEL > 0
6680 LWDEBUGF(1,
"Tweaked snapline became %s", wkt1);
6685 #if POSTGIS_DEBUG_LEVEL > 0
6687 LWDEBUG(1,
"Snapping did not move first point");
6696 lwerror(
"lwt_ChangeEdgeGeom failed");
6701 #if POSTGIS_DEBUG_LEVEL > 0
6707 LWDEBUGF(1,
"Edge %s contains projected point %s", wkt1, wkt2);
6719 lwerror(
"lwt_ModEdgeSplit failed");
6740 if ( edges2 )
lwfree(edges2);
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
LWGEOM * lwgeom_closest_point(const LWGEOM *lw1, const LWGEOM *lw2)
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwgeom_force_3dz(const LWGEOM *geom, double zval)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
int ptarray_insert_point(POINTARRAY *pa, const POINT4D *p, uint32_t where)
Insert a point into an existing POINTARRAY.
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
double lwgeom_mindistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing min distance calculation.
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
void * lwalloc(size_t size)
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
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.
Datum contains(PG_FUNCTION_ARGS)
#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.
#define LWDEBUGG(level, geom, msg)
static int _lwt_SnapEdgeToExistingNode(LWT_TOPOLOGY *topo, LWT_ISO_NODE *node, LWT_ISO_EDGE *edge, double tol)
LWT_ELEMID lwt_ModEdgeSplit(LWT_TOPOLOGY *topo, LWT_ELEMID edge, LWPOINT *pt, int skipISOChecks)
Split an edge by a node, modifying the original edge and adding a new one.
static int compare_scored_pointer(const void *si1, const void *si2)
static LWGEOM * _lwt_toposnap(LWGEOM *src, LWGEOM *tgt, double tol)
int lwt_ChangeEdgeGeom(LWT_TOPOLOGY *topo, LWT_ELEMID edge_id, LWLINE *geom)
Changes the shape of an edge without affecting the topology structure.
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 LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
LWT_ELEMID containing_face