Add an isolated edge connecting two existing isolated nodes.
769{
770 uint64_t num_nodes;
771 uint64_t i;
777 int skipISOChecks = 0;
779
780
781
782
783 if (startNode == endNode)
784 {
785 lwerror(
"Closed edges would not be isolated, try lwt_AddEdgeNewFaces");
786 return -1;
787 }
788
789 if ( ! skipISOChecks )
790 {
791
793 {
794 lwerror(
"SQL/MM Spatial exception - curve not simple");
795 return -1;
796 }
797 }
798
799
800
801
802
803
804
805
806
807 num_nodes = 2;
808 node_ids[0] = startNode;
809 node_ids[1] = endNode;
812 if (num_nodes == UINT64_MAX)
813 {
815 return -1;
816 }
817 else if ( num_nodes < 2 )
818 {
820 lwerror(
"SQL/MM Spatial exception - non-existent node");
821 return -1;
822 }
823 for ( i=0; i<num_nodes; ++i )
824 {
827 {
829 lwerror(
"SQL/MM Spatial exception - not isolated node");
830 return -1;
831 }
834 {
836 lwerror(
"SQL/MM Spatial exception - nodes in different faces");
837 return -1;
838 }
839
840 if ( ! skipISOChecks )
841 {
843 {
844
848 {
850 lwerror(
"SQL/MM Spatial exception - "
851 "start node not geometry start point.");
852 return -1;
853 }
854 }
855 else
856 {
857
861 {
863 lwerror(
"SQL/MM Spatial exception - "
864 "end node not geometry end point.");
865 return -1;
866 }
867 }
868 }
869 }
870
872
873 if ( ! skipISOChecks )
874 {
876 {
877
878 return -1;
879 }
880 }
881
882
883
884
885
889 return -1;
890 }
891
892
893 if ( containing_face == -1 ) containing_face = 0;
894
901
903 if ( ret == -1 ) {
905 return -1;
906 } else if ( ret == 0 ) {
907 lwerror(
"Insertion of split edge failed (no reason)");
908 return -1;
909 }
910
911
912
913
914
915
916
917 updated_nodes[0].
node_id = startNode;
919 updated_nodes[1].
node_id = endNode;
923 if ( ret == -1 ) {
925 return -1;
926 }
927
929}
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)
int p2d_same(const POINT2D *p1, const POINT2D *p2)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWT_COL_NODE_CONTAINING_FACE
void lwerror(const char *fmt,...)
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)
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
LWT_ISO_NODE * lwt_be_getNodeById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
LWT_ELEMID containing_face
const LWT_BE_IFACE * be_iface