4210 uint64_t num_node_edges;
4217 int e2sign, e2freenode;
4221 size_t bufleft = 256;
4229 " with itself, try with another", eid1);
4236 if ((nedges == UINT64_MAX) || (edges == NULL))
4241 for ( i=0; i<nedges; ++i )
4243 if ( edges[i].edge_id == eid1 ) {
4246 lwerror(
"Corrupted topology: multiple edges have id %"
4252 else if ( edges[i].edge_id == eid2 ) {
4255 lwerror(
"Corrupted topology: multiple edges have id %"
4266 "SQL/MM Spatial exception - non-existent edge %" LWTFMT_ELEMID,
4274 "SQL/MM Spatial exception - non-existent edge %" LWTFMT_ELEMID,
4308 if ( commonnode != -1 )
4313 if (num_node_edges == UINT64_MAX)
4319 for (i=0; i<num_node_edges; ++i)
4322 if ( node_edges[i].edge_id == eid1 )
continue;
4323 if ( node_edges[i].edge_id == eid2 )
continue;
4326 if ( bufleft > 0 ) {
4328 ( ptr==buf ?
"" :
"," ), node_edges[i].edge_id);
4329 if (
r >= (
int) bufleft )
4347 if ( commonnode == -1 )
4360 if ( commonnode != -1 )
4365 if (num_node_edges == UINT64_MAX)
4371 for (i=0; i<num_node_edges; ++i)
4374 if ( node_edges[i].edge_id == eid1 )
continue;
4375 if ( node_edges[i].edge_id == eid2 )
continue;
4378 if ( bufleft > 0 ) {
4380 ( ptr==buf ?
"" :
"," ), node_edges[i].edge_id);
4381 if (
r >= (
int) bufleft )
4396 if ( num_node_edges )
lwfree(node_edges);
4400 if ( commonnode == -1 )
4405 lwerror(
"SQL/MM Spatial exception - other edges connected (%s)",
4410 lwerror(
"SQL/MM Spatial exception - non-connected edges");
4487 lwerror(
"Coding error: caseno=%d should never happen", caseno);
4508 else if (result != 1)
4512 lwerror(
"Unexpected error: %d edges updated when expecting 1", i);
4530 else if (result == 0)
4534 lwerror(
"Insertion of split edge failed (no reason)");
4638 eid1, eid2, newedge.
edge_id) )
4644 return modEdge ? commonnode : newedge.
edge_id;
int ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, double gap_tolerance)
Append a POINTARRAY, pa2 to the end of an existing POINTARRAY, pa1.
POINTARRAY * ptarray_clone_deep(const POINTARRAY *ptarray)
Deep clone a pointarray (also clones serialized pointlist)
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
void ptarray_free(POINTARRAY *pa)
void lwline_free(LWLINE *line)
void ptarray_reverse_in_place(POINTARRAY *pa)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWT_COL_EDGE_START_NODE
#define LWT_COL_EDGE_NEXT_RIGHT
#define LWT_COL_EDGE_EDGE_ID
Edge fields.
#define LWT_COL_EDGE_END_NODE
#define LWT_COL_EDGE_NEXT_LEFT
#define LWT_COL_EDGE_GEOM
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
static int lwt_be_deleteNodesById(const LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t numelems)
LWT_ISO_EDGE * lwt_be_getEdgeById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
static int lwt_be_updateTopoGeomEdgeHeal(LWT_TOPOLOGY *topo, LWT_ELEMID edge1, LWT_ELEMID edge2, LWT_ELEMID newedge)
static LWT_ISO_EDGE * lwt_be_getEdgeByNode(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
static int lwt_be_checkTopoGeomRemNode(LWT_TOPOLOGY *topo, LWT_ELEMID node_id, LWT_ELEMID eid1, LWT_ELEMID eid2)
int lwt_be_updateEdges(LWT_TOPOLOGY *topo, const LWT_ISO_EDGE *sel_edge, int sel_fields, const LWT_ISO_EDGE *upd_edge, int upd_fields, const LWT_ISO_EDGE *exc_edge, int exc_fields)
int lwt_be_deleteEdges(LWT_TOPOLOGY *topo, const LWT_ISO_EDGE *sel_edge, int sel_fields)
int lwt_be_insertEdges(LWT_TOPOLOGY *topo, LWT_ISO_EDGE *edge, uint64_t numelems)
static void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
static int lwt_be_updateEdgesById(LWT_TOPOLOGY *topo, const LWT_ISO_EDGE *edges, int numedges, int upd_fields)
const LWT_BE_IFACE * be_iface