Add an isolated edge connecting two existing isolated nodes.
803{
804 uint64_t num_nodes;
805 uint64_t i;
811 int skipISOChecks = 0;
813
814
815
816
817 if (startNode == endNode)
818 {
819 lwerror(
"Closed edges would not be isolated, try lwt_AddEdgeNewFaces");
820 return -1;
821 }
822
823 if ( ! skipISOChecks )
824 {
825
827 {
828 lwerror(
"SQL/MM Spatial exception - curve not simple");
829 return -1;
830 }
831 }
832
833
834
835
836
837
838
839
840
841 num_nodes = 2;
842 node_ids[0] = startNode;
843 node_ids[1] = endNode;
846 if (num_nodes == UINT64_MAX)
847 {
849 return -1;
850 }
851 else if ( num_nodes < 2 )
852 {
854 lwerror(
"SQL/MM Spatial exception - non-existent node");
855 return -1;
856 }
857 for ( i=0; i<num_nodes; ++i )
858 {
861 {
863 lwerror(
"SQL/MM Spatial exception - not isolated node");
864 return -1;
865 }
868 {
870 lwerror(
"SQL/MM Spatial exception - nodes in different faces");
871 return -1;
872 }
873
874 if ( ! skipISOChecks )
875 {
877 {
878
882 {
884 lwerror(
"SQL/MM Spatial exception - "
885 "start node not geometry start point.");
886 return -1;
887 }
888 }
889 else
890 {
891
895 {
897 lwerror(
"SQL/MM Spatial exception - "
898 "end node not geometry end point.");
899 return -1;
900 }
901 }
902 }
903 }
904
906
907 if ( ! skipISOChecks )
908 {
910 {
911
912 return -1;
913 }
914 }
915
916
917
918
919
923 return -1;
924 }
925
926
927 if ( containing_face == -1 ) containing_face = 0;
928
935
937 if ( ret == -1 ) {
939 return -1;
940 } else if ( ret == 0 ) {
941 lwerror(
"Insertion of split edge failed (no reason)");
942 return -1;
943 }
944
945
946
947
948
949
950
951 updated_nodes[0].
node_id = startNode;
953 updated_nodes[1].
node_id = endNode;
957 if ( ret == -1 ) {
959 return -1;
960 }
961
963}
int lwgeom_is_simple(const LWGEOM *lwgeom)
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
#define P2D_SAME_STRICT(a, b)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWT_COL_NODE_CONTAINING_FACE
#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)
static int lwt_be_updateNodesById(LWT_TOPOLOGY *topo, const LWT_ISO_NODE *nodes, int numnodes, int upd_fields)
static int _lwt_CheckEdgeCrossing(LWT_TOPOLOGY *topo, LWT_ELEMID start_node, LWT_ELEMID end_node, const LWLINE *geom, LWT_ELEMID myself)
static void _lwt_release_nodes(LWT_ISO_NODE *nodes, int num_nodes)
int lwt_be_insertEdges(LWT_TOPOLOGY *topo, LWT_ISO_EDGE *edge, uint64_t numelems)
LWT_ISO_NODE * lwt_be_getNodeById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
LWT_ELEMID containing_face