4910 double mindist = FLT_MAX;
4937 LWDEBUGF(1,
"New point is within %.15g units of %d nodes", tol, num);
4942 for (i=0; i<num; ++i)
4944 sorted[i].
ptr = nodes+i;
4947 ((
LWT_ISO_NODE*)(sorted[i].ptr))->node_id, sorted[i].score);
4951 for (i=0; i<num; ++i)
4960 for ( i=0; i<num; ++i )
4967 if ( dist && dist >= tol )
continue;
4968 if ( !
id || dist < mindist )
4978 if ( moved ) *moved = mindist == 0 ? 0 : 1;
4999 LWDEBUGF(1,
"New point is within %.15g units of %d edges", tol, num);
5006 for (i=0; i<num; ++i)
5008 sorted[i].
ptr = edges+i;
5011 ((
LWT_ISO_EDGE*)(sorted[i].ptr))->edge_id, sorted[i].score);
5015 for (j=0, i=0; i<num; ++i)
5017 if ( sorted[i].score == sorted[0].score )
5032 for (i=0; i<num; ++i)
5045 if ( moved ) *moved =
lwgeom_same(prj,pt) ? 0 : 1;
5077 " does not contain projected point to it",
5084 LWDEBUG(1,
"But there's another to check");
5099 LWDEBUGF(1,
"Edge snapped with tolerance %g", snaptol);
5102 #if POSTGIS_DEBUG_LEVEL > 0
5107 LWDEBUGF(1,
"Edge %s snapped became %s", wkt1, wkt2);
5120 LWDEBUGF(1,
"Edge first point is %g %g, "
5121 "snapline first point is %g %g",
5122 p1.
x, p1.
y, p2.
x, p2.
y);
5123 if ( p1.
x != p2.
x || p1.
y != p2.
y )
5125 LWDEBUG(1,
"Snapping moved first point, re-adding it");
5134 #if POSTGIS_DEBUG_LEVEL > 0
5138 LWDEBUGF(1,
"Tweaked snapline became %s", wkt1);
5143 #if POSTGIS_DEBUG_LEVEL > 0
5145 LWDEBUG(1,
"Snapping did not move first point");
5155 lwerror(
"lwt_ChangeEdgeGeom failed");
5160 #if POSTGIS_DEBUG_LEVEL > 0
5166 LWDEBUGF(1,
"Edge %s contains projected point %s", wkt1, wkt2);
5179 lwerror(
"lwt_ModEdgeSplit failed");
5207 if ( moved ) *moved = 0;
5211 lwerror(
"lwt_AddIsoNode failed");
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
void lwgeom_geos_error(const char *fmt,...)
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)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
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)
LWGEOM * lwgeom_force_3dz(const LWGEOM *geom)
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
void lwline_free(LWLINE *line)
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
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 LWT_COL_EDGE_EDGE_ID
Edge fields.
#define LWT_COL_NODE_GEOM
#define LWT_COL_NODE_NODE_ID
Node fields.
#define LWT_COL_EDGE_GEOM
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
#define LWDEBUGG(level, geom, msg)
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
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 LWT_ELEMID _lwt_AddIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID face, LWPOINT *pt, int skipISOChecks, int checkFace)
static void _lwt_release_nodes(LWT_ISO_NODE *nodes, int num_nodes)
static double _lwt_minTolerance(LWGEOM *g)
static int compare_scored_pointer(const void *si1, const void *si2)
LWT_ISO_EDGE * lwt_be_getEdgeWithinDistance2D(LWT_TOPOLOGY *topo, LWPOINT *pt, double dist, int *numelems, int fields, int limit)
#define _LWT_MINTOLERANCE(topo, geom)
LWT_ISO_NODE * lwt_be_getNodeWithinDistance2D(LWT_TOPOLOGY *topo, LWPOINT *pt, double dist, int *numelems, int fields, int limit)
static LWGEOM * _lwt_toposnap(LWGEOM *src, LWGEOM *tgt, double tol)
static void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
int lwt_ChangeEdgeGeom(LWT_TOPOLOGY *topo, LWT_ELEMID edge_id, LWLINE *geom)
Changes the shape of an edge without affecting the topology structure.
Datum contains(PG_FUNCTION_ARGS)
const LWT_BE_IFACE * be_iface