[postgis-tickets] [SCM] PostGIS branch main updated. 3.1.0rc1-350-gea18ecd
git at osgeo.org
git at osgeo.org
Thu Jul 15 06:07:58 PDT 2021
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, main has been updated
via ea18ecdda1e907490048167cb013ea82c2160f8d (commit)
from 40b8e63bdb055547d695727bc5c5df57f41c7d4d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ea18ecdda1e907490048167cb013ea82c2160f8d
Author: Sandro Santilli <strk at kbt.io>
Date: Thu Jul 15 14:53:14 2021 +0200
Prevent moving an isolated node to different face
Closes #3232 in main branch (3.2.0dev)
Includes regression test, moving existing
tests from sqlmm to ad-hoc file
diff --git a/NEWS b/NEWS
index 3d22927..53c8234 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ PostGIS 3.2.0
- #4933, topology.GetFaceByPoint will not work with topologies having invalid edge linking.
* Enhancements *
+ - #3232, Prevent moving an isolated node to different face
+ (Sandro Santilli)
- Consider collection TopoGeometries while editing topology primitives.
(Sandro Santilli)
- #3248, Prevent removing isolated edges if used in a TopoGeometry
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 51c4639..8b7e2cd 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -3611,6 +3611,7 @@ lwt_MoveIsoNode(LWT_TOPOLOGY* topo, LWT_ELEMID nid, LWPOINT *pt)
{
LWT_ISO_NODE *node;
int ret;
+ int newPointFace;
node = _lwt_GetIsoNode( topo, nid );
if ( ! node ) return -1;
@@ -3629,9 +3630,19 @@ lwt_MoveIsoNode(LWT_TOPOLOGY* topo, LWT_ELEMID nid, LWPOINT *pt)
return -1;
}
- /* TODO: check that the new point is in the same containing face !
- * See https://trac.osgeo.org/postgis/ticket/3232
- */
+ /* Check that the new point is in the same containing face !
+ * See https://trac.osgeo.org/postgis/ticket/3232 */
+ newPointFace = lwt_be_getFaceContainingPoint(topo, pt);
+ if ( newPointFace == -1 ) {
+ lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+ return -1;
+ }
+ if ( node->containing_face != newPointFace )
+ {
+ lwfree(node);
+ lwerror("Cannot move isolated node across faces");
+ return -1;
+ }
node->node_id = nid;
node->geom = pt;
diff --git a/topology/test/regress/sqlmm.sql b/topology/test/regress/sqlmm.sql
index ec2881a..c42fa37 100644
--- a/topology/test/regress/sqlmm.sql
+++ b/topology/test/regress/sqlmm.sql
@@ -96,28 +96,6 @@ SELECT '-- ST_AddIsoNode(2) ------------------------';
-- ST_AddIsoNode edge-crossing node
SELECT topology.ST_AddIsoNode('sqlmm_topology', NULL, 'POINT(5 9.5)');
-
--------------------------------------------------------------
--- ST_MoveIsoNode
--------------------------------------------------------------
-
-SELECT '-- ST_MoveIsoNode ------------------------';
-
--- Isolated node to invalid location (coincident)
-SELECT topology.ST_MoveIsoNode('sqlmm_topology', 8, 'POINT(5 10)');
--- Isolated node to invalid location (edge-crossing)
-SELECT topology.ST_MoveIsoNode('sqlmm_topology', 8, 'POINT(5 9)');
-
--- Non isolated node (is used by an edge);
-SELECT topology.ST_MoveIsoNode('sqlmm_topology', 4, 'POINT(5 4)');
-
--- Invalid point
-SELECT topology.ST_MoveIsoNode('sqlmm_topology', 2, 'MULTIPOINT(5 4)');
-
--- Valid move
-SELECT topology.ST_MoveIsoNode('sqlmm_topology', 8, 'POINT(7 11)');
-SELECT topology.ST_MoveIsoNode('sqlmm_topology', 8, 'POINT(7 10)');
-
-------------------------------------------------------------
-- ST_RemoveIsoEdge
-------------------------------------------------------------
diff --git a/topology/test/regress/sqlmm_expected b/topology/test/regress/sqlmm_expected
index 0b22ddc..e62599a 100644
--- a/topology/test/regress/sqlmm_expected
+++ b/topology/test/regress/sqlmm_expected
@@ -36,13 +36,6 @@ ERROR: SQL/MM Spatial exception - not isolated node
ERROR: SQL/MM Spatial exception - not isolated node
-- ST_AddIsoNode(2) ------------------------
ERROR: SQL/MM Spatial exception - edge crosses node.
--- ST_MoveIsoNode ------------------------
-ERROR: SQL/MM Spatial exception - coincident node
-ERROR: SQL/MM Spatial exception - edge crosses node.
-ERROR: SQL/MM Spatial exception - not isolated node
-ERROR: SQL/MM Spatial exception - invalid point
-Isolated Node 8 moved to location 7,11
-Isolated Node 8 moved to location 7,10
-- ST_RemoveIsoEdge ---------------------
#3351.1|4|
#3351.1|5|
diff --git a/topology/test/regress/st_moveisonode.sql b/topology/test/regress/st_moveisonode.sql
new file mode 100644
index 0000000..feb544f
--- /dev/null
+++ b/topology/test/regress/st_moveisonode.sql
@@ -0,0 +1,31 @@
+\set VERBOSITY terse
+set client_min_messages to ERROR;
+
+-- Import city_data
+\i ../load_topology.sql
+
+-- Isolated node to invalid location (coincident)
+SELECT 'coincident_node', topology.ST_MoveIsoNode('city_data', 4, 'POINT(25 35)');
+-- Isolated node to invalid location (edge-crossing)
+SELECT 'edge-crossing', topology.ST_MoveIsoNode('city_data', 4, 'POINT(20 40)');
+
+-- Non isolated node (is used by an edge);
+SELECT 'not-isolated', topology.ST_MoveIsoNode('city_data', 3, 'POINT(25 36)');
+
+-- Invalid point
+SELECT 'invalid-new-point', topology.ST_MoveIsoNode('city_data', 4, 'MULTIPOINT(5 4)');
+
+-- Move outside of original containing face (universal)
+SELECT 'change-face-to-universal', topology.ST_MoveIsoNode('city_data', 4, 'POINT(20 41)');
+-- Move outside of original containing face (universal)
+SELECT 'change-face-to-other', topology.ST_MoveIsoNode('city_data', 4, 'POINT(15 37)');
+
+-- Valid move
+SELECT topology.ST_MoveIsoNode('city_data', 4, 'POINT(21 37)');
+SELECT topology.ST_MoveIsoNode('city_data', 4, 'POINT(19 37)');
+
+-- TODO: test moving the node in a different face (#3232)
+
+
+-- Cleanup
+SELECT NULL FROM topology.DropTopology('city_data');
diff --git a/topology/test/regress/st_moveisonode_expected b/topology/test/regress/st_moveisonode_expected
new file mode 100644
index 0000000..f5091cd
--- /dev/null
+++ b/topology/test/regress/st_moveisonode_expected
@@ -0,0 +1,8 @@
+ERROR: SQL/MM Spatial exception - coincident node
+ERROR: SQL/MM Spatial exception - edge crosses node.
+ERROR: SQL/MM Spatial exception - not isolated node
+ERROR: SQL/MM Spatial exception - invalid point
+ERROR: Cannot move isolated node across faces
+ERROR: Cannot move isolated node across faces
+Isolated Node 4 moved to location 21,37
+Isolated Node 4 moved to location 19,37
diff --git a/topology/test/tests.mk b/topology/test/tests.mk
index f98afe4..63cfaf2 100644
--- a/topology/test/tests.mk
+++ b/topology/test/tests.mk
@@ -55,6 +55,7 @@ TESTS += \
$(topsrcdir)/topology/test/regress/st_getfacegeometry.sql \
$(topsrcdir)/topology/test/regress/st_modedgeheal.sql \
$(topsrcdir)/topology/test/regress/st_modedgesplit.sql \
+ $(topsrcdir)/topology/test/regress/st_moveisonode.sql \
$(topsrcdir)/topology/test/regress/st_newedgeheal.sql \
$(topsrcdir)/topology/test/regress/st_newedgessplit.sql \
$(topsrcdir)/topology/test/regress/st_remedgemodface.sql \
-----------------------------------------------------------------------
Summary of changes:
NEWS | 2 ++
liblwgeom/lwgeom_topo.c | 17 ++++++++++++---
topology/test/regress/sqlmm.sql | 22 -------------------
topology/test/regress/sqlmm_expected | 7 ------
topology/test/regress/st_moveisonode.sql | 31 +++++++++++++++++++++++++++
topology/test/regress/st_moveisonode_expected | 8 +++++++
topology/test/tests.mk | 1 +
7 files changed, 56 insertions(+), 32 deletions(-)
create mode 100644 topology/test/regress/st_moveisonode.sql
create mode 100644 topology/test/regress/st_moveisonode_expected
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list