Split an edge by a node, modifying the original edge and adding a new one.
1054{
1058 const LWGEOM *oldedge_geom;
1059 const LWGEOM *newedge_geom;
1062 int ret;
1063
1064 split_col =
_lwt_EdgeSplit( topo, edge, pt, skipISOChecks, &oldedge );
1065 if ( ! split_col ) return -1;
1066 oldedge_geom = split_col->
geoms[0];
1067 newedge_geom = split_col->
geoms[1];
1068
1070 ((
LWGEOM*)newedge_geom)->srid = split_col->
srid;
1071
1072
1077 {
1081 return -1;
1082 }
1084
1087 lwerror(
"Backend coding error: "
1088 "insertNodes callback did not return node_id");
1089 return -1;
1090 }
1091
1092
1094 if ( newedge1.
edge_id == -1 ) {
1098 return -1;
1099 }
1108
1109 if ( ! newedge1.
geom ) {
1112 lwerror(
"first geometry in lwgeom_split output is not a line");
1113 return -1;
1114 }
1116 if ( ret == -1 ) {
1120 return -1;
1121 } else if ( ret == 0 ) {
1124 lwerror(
"Insertion of split edge failed (no reason)");
1125 return -1;
1126 }
1127
1128
1130
1131 if ( ! updedge.
geom ) {
1134 lwerror(
"second geometry in lwgeom_split output is not a line");
1135 return -1;
1136 }
1142 NULL, 0);
1143 if ( ret == -1 ) {
1147 return -1;
1148 } else if ( ret == 0 ) {
1152 return -1;
1153 } else if ( ret > 1 ) {
1157 return -1;
1158 }
1159
1160
1161
1170 if ( ret == -1 ) {
1174 return -1;
1175 }
1176
1185 if ( ret == -1 ) {
1189 return -1;
1190 }
1191
1192
1194 if ( ! ret ) {
1198 return -1;
1199 }
1200
1203
1204
1206}
void lwcollection_free(LWCOLLECTION *col)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
#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
#define PGTOPO_BE_ERROR()
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
LWT_ELEMID lwt_be_getNextEdgeId(LWT_TOPOLOGY *topo)
int lwt_be_updateTopoGeomEdgeSplit(LWT_TOPOLOGY *topo, LWT_ELEMID split_edge, LWT_ELEMID new_edge1, LWT_ELEMID new_edge2)
int lwt_be_insertNodes(LWT_TOPOLOGY *topo, LWT_ISO_NODE *node, uint64_t numelems)
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)
void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
int lwt_be_insertEdges(LWT_TOPOLOGY *topo, LWT_ISO_EDGE *edge, uint64_t numelems)
static LWCOLLECTION * _lwt_EdgeSplit(LWT_TOPOLOGY *topo, LWT_ELEMID edge, LWPOINT *pt, int skipISOChecks, LWT_ISO_EDGE **oldedge)
LWT_ELEMID containing_face