Adds a linestring to the topology.
The given line will snap to existing nodes or edges within given tolerance. Existing edges or faces may be split by the line.
5638 LWDEBUGF(1,
"Working tolerance:%.15g", tol);
5646 LWDEBUGG(1, tmp,
"Repeated-point removed");
5647 }}
else tmp=(
LWGEOM*)line;
5652 if ( ! noded )
return NULL;
5659 LWDEBUGF(1,
"BOX expanded by %g is %.15g %.15g, %.15g %.15g",
5670 LWDEBUGF(1,
"Line has %d points, its bbox intersects %d edges bboxes", line->points->npoints, num);
5676 for (i=0; i<num; ++i)
5683 if ( dist >= tol )
continue;
5686 LWDEBUGF(2,
"Found %d lines closer than tolerance (%g)", nn, tol);
5694 LWDEBUGF(1,
"Line intersects %d edges", nn);
5699 LWDEBUGG(1, iedges,
"Collected edges");
5700 LWDEBUGF(1,
"Snapping noded, with srid=%d " 5701 "to interesecting edges, with srid=%d",
5706 LWDEBUGF(1,
"Diffing snapped, with srid=%d " 5707 "and interesecting edges, with srid=%d",
5711 LWDEBUGF(1,
"Intersecting snapped, with srid=%d " 5712 "and interesecting edges, with srid=%d",
5717 LWDEBUGF(1,
"Linemerging set1, with srid=%d", set1->
srid);
5722 LWDEBUGF(1,
"Unioning noded, with srid=%d " 5723 "and set2, with srid=%d", noded->
srid, set2->
srid);
5746 LWDEBUGF(1,
"Line bbox intersects %d nodes bboxes", num);
5752 for (i=0; i<num; ++i)
5757 if ( dist >= tol )
continue;
5766 LWDEBUGF(1,
"Line intersects %d nodes", nn);
5772 LWDEBUGG(1, inodes,
"Collected nodes");
5779 LWDEBUGG(1, noded,
"Node-snapped");
5798 LWDEBUGG(1, noded,
"Unary-unioned");
5805 LWDEBUGG(1, noded,
"Finally-noded");
5811 LWDEBUG(1,
"Noded line was a collection");
5817 LWDEBUG(1,
"Noded line was a single geom");
5818 geomsbuf[0] = noded;
5823 LWDEBUGF(1,
"Line was split into %d edges", ngeoms);
5831 for ( i=0; i<ngeoms; ++i )
5837 #if POSTGIS_DEBUG_LEVEL > 0 5841 LWDEBUGF(1,
"Component %d of split line is: %s", i, wkt1);
5856 LWDEBUGF(1,
"Component %d of split line collapsed", i);
5865 LWDEBUGG(1, noded,
"Noded before free");
static void _lwt_release_nodes(LWT_ISO_NODE *nodes, int num_nodes)
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
void gbox_expand(GBOX *g, double d)
Move the box minimums down and the maximums up by the distance provided.
void lwgeom_free(LWGEOM *geom)
#define LWDEBUG(level, msg)
#define LW_ON_INTERRUPT(x)
#define _LWT_MINTOLERANCE(topo, geom)
static LWT_ELEMID _lwt_AddLineEdge(LWT_TOPOLOGY *topo, LWLINE *edge, double tol)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
LWGEOM * lwgeom_node(const LWGEOM *lwgeom_in)
const LWT_BE_IFACE * be_iface
LWGEOM * lwgeom_intersection(const LWGEOM *geom1, const LWGEOM *geom2)
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
LWGEOM * lwgeom_difference(const LWGEOM *geom1, const LWGEOM *geom2)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
#define LWDEBUGG(level, geom, msg)
void lwcollection_release(LWCOLLECTION *lwcollection)
LWGEOM * lwline_remove_repeated_points(const LWLINE *in, double tolerance)
LWGEOM * lwgeom_unaryunion(const LWGEOM *geom1)
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
static LWGEOM * _lwt_split_by_nodes(const LWGEOM *g, const LWGEOM *nodes)
static void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
double lwgeom_mindistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initialazing min distance calculation.
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
LWGEOM * lwgeom_union(const LWGEOM *geom1, const LWGEOM *geom2)
void * lwalloc(size_t size)
static LWGEOM * _lwt_toposnap(LWGEOM *src, LWGEOM *tgt, double tol)
#define LWDEBUGF(level, msg,...)
static LWT_ISO_EDGE * lwt_be_getEdgeWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, int *numelems, int fields, int limit)
static LWT_ISO_NODE * lwt_be_getNodeWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, int *numelems, int fields, int limit)
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
LWGEOM * lwgeom_linemerge(const LWGEOM *geom1)
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)