Split an edge by a node, modifying the original edge and adding a new one.
1171{
1175 const LWGEOM *oldedge_geom;
1176 const LWGEOM *newedge_geom;
1179 int ret;
1180
1181 split_col =
_lwt_EdgeSplit( topo, edge, pt, skipISOChecks, &oldedge );
1182 if ( ! split_col ) return -1;
1183 oldedge_geom = split_col->
geoms[0];
1184 newedge_geom = split_col->
geoms[1];
1185
1187 ((
LWGEOM*)newedge_geom)->srid = split_col->
srid;
1188
1189
1194 {
1198 return -1;
1199 }
1201
1204 lwerror(
"Backend coding error: "
1205 "insertNodes callback did not return node_id");
1206 return -1;
1207 }
1208
1209
1211 if ( newedge1.
edge_id == -1 ) {
1215 return -1;
1216 }
1225
1226 if ( ! newedge1.
geom ) {
1229 lwerror(
"first geometry in lwgeom_split output is not a line");
1230 return -1;
1231 }
1233 if ( ret == -1 ) {
1237 return -1;
1238 } else if ( ret == 0 ) {
1241 lwerror(
"Insertion of split edge failed (no reason)");
1242 return -1;
1243 }
1244
1245
1247
1248 if ( ! updedge.
geom ) {
1251 lwerror(
"second geometry in lwgeom_split output is not a line");
1252 return -1;
1253 }
1259 NULL, 0);
1260 if ( ret == -1 ) {
1264 return -1;
1265 } else if ( ret == 0 ) {
1269 return -1;
1270 } else if ( ret > 1 ) {
1274 return -1;
1275 }
1276
1277
1278
1287 if ( ret == -1 ) {
1291 return -1;
1292 }
1293
1302 if ( ret == -1 ) {
1306 return -1;
1307 }
1308
1309
1311 if ( ! ret ) {
1315 return -1;
1316 }
1317
1320
1321
1323}
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