PostGIS  2.2.7dev-r@@SVN_REVISION@@
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 3677 of file lwgeom_topo.c.

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.

3678 {
3679  LWT_ISO_NODE *node;
3680  int ret;
3681 
3682  node = _lwt_GetIsoNode( topo, nid );
3683  if ( ! node ) return -1;
3684 
3685  if ( lwt_be_ExistsCoincidentNode(topo, pt) )
3686  {
3687  lwfree(node);
3688  lwerror("SQL/MM Spatial exception - coincident node");
3689  return -1;
3690  }
3691 
3692  if ( lwt_be_ExistsEdgeIntersectingPoint(topo, pt) )
3693  {
3694  lwfree(node);
3695  lwerror("SQL/MM Spatial exception - edge crosses node.");
3696  return -1;
3697  }
3698 
3699  /* TODO: check that the new point is in the same containing face !
3700  * See https://trac.osgeo.org/postgis/ticket/3232
3701  */
3702 
3703  node->node_id = nid;
3704  node->geom = pt;
3705  ret = lwt_be_updateNodesById(topo, node, 1,
3707  if ( ret == -1 ) {
3708  lwfree(node);
3709  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
3710  return -1;
3711  }
3712 
3713  lwfree(node);
3714  return 0;
3715 }
LWPOINT * geom
void lwfree(void *mem)
Definition: lwutil.c:214
int lwt_be_ExistsEdgeIntersectingPoint(LWT_TOPOLOGY *topo, LWPOINT *pt)
Definition: lwgeom_topo.c:406
const LWT_BE_IFACE * be_iface
int lwt_be_ExistsCoincidentNode(LWT_TOPOLOGY *topo, LWPOINT *pt)
Definition: lwgeom_topo.c:394
LWT_ELEMID node_id
static int lwt_be_updateNodesById(LWT_TOPOLOGY *topo, const LWT_ISO_NODE *nodes, int numnodes, int upd_fields)
Definition: lwgeom_topo.c:318
static LWT_ISO_NODE * _lwt_GetIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID nid)
Definition: lwgeom_topo.c:3652
#define LWT_COL_NODE_GEOM
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
Definition: lwgeom_topo.c:124
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74

Here is the call graph for this function: