PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ lwt_MoveIsoNode()

int lwt_MoveIsoNode ( LWT_TOPOLOGY topo,
LWT_ELEMID  node,
LWPOINT pt 
)

Move an isolated node.

For ST_MoveIsoNode

Parameters
topothe topology to operate on
nodethe identifier of the nod to be moved
ptthe new node position
Returns
0 on success, -1 on error (liblwgeom error handler will be invoked with error message)

Definition at line 3627 of file lwgeom_topo.c.

3628 {
3629  LWT_ISO_NODE *node;
3630  int ret;
3631 
3632  node = _lwt_GetIsoNode( topo, nid );
3633  if ( ! node ) return -1;
3634 
3635  if ( lwt_be_ExistsCoincidentNode(topo, pt) )
3636  {
3637  lwfree(node);
3638  lwerror("SQL/MM Spatial exception - coincident node");
3639  return -1;
3640  }
3641 
3642  if ( lwt_be_ExistsEdgeIntersectingPoint(topo, pt) )
3643  {
3644  lwfree(node);
3645  lwerror("SQL/MM Spatial exception - edge crosses node.");
3646  return -1;
3647  }
3648 
3649  /* TODO: check that the new point is in the same containing face !
3650  * See https://trac.osgeo.org/postgis/ticket/3232
3651  */
3652 
3653  node->node_id = nid;
3654  node->geom = pt;
3655  ret = lwt_be_updateNodesById(topo, node, 1,
3657  if ( ret == -1 ) {
3658  lwfree(node);
3659  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
3660  return -1;
3661  }
3662 
3663  lwfree(node);
3664  return 0;
3665 }
void lwfree(void *mem)
Definition: lwutil.c:242
#define LWT_COL_NODE_GEOM
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
int lwt_be_ExistsEdgeIntersectingPoint(LWT_TOPOLOGY *topo, LWPOINT *pt)
Definition: lwgeom_topo.c:395
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
Definition: lwgeom_topo.c:119
static LWT_ISO_NODE * _lwt_GetIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID nid)
Definition: lwgeom_topo.c:3601
static int lwt_be_updateNodesById(LWT_TOPOLOGY *topo, const LWT_ISO_NODE *nodes, int numnodes, int upd_fields)
Definition: lwgeom_topo.c:307
int lwt_be_ExistsCoincidentNode(LWT_TOPOLOGY *topo, LWPOINT *pt)
Definition: lwgeom_topo.c:382
LWT_ELEMID node_id
LWPOINT * geom
const LWT_BE_IFACE * be_iface

References _lwt_GetIsoNode(), LWT_TOPOLOGY_T::be_iface, LWT_ISO_NODE::geom, lwerror(), lwfree(), lwt_be_ExistsCoincidentNode(), lwt_be_ExistsEdgeIntersectingPoint(), lwt_be_lastErrorMessage(), lwt_be_updateNodesById(), LWT_COL_NODE_GEOM, and LWT_ISO_NODE::node_id.

Here is the call graph for this function: