[SCM] PostGIS branch master updated. 3.4.0rc1-934-g53b48e51d
git at osgeo.org
git at osgeo.org
Sat Feb 17 00:54:39 PST 2024
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, master has been updated
via 53b48e51df0991680fefd7af44a8faf33668306b (commit)
from d47bde26b885728ff281abe51c00701a4114d2c4 (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 53b48e51df0991680fefd7af44a8faf33668306b
Author: Sandro Santilli <strk at kbt.io>
Date: Sat Feb 17 09:35:32 2024 +0100
Avoid changing signature of TopoGeo_addLinestring
Use an internal _TopoGeo_addLinestringNoFace function instead from
the ST_CreateTopoGeo function.
Closes #5670
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index cbf461f00..4e3d8b83a 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -5191,6 +5191,80 @@ Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS)
SRF_RETURN_NEXT(funcctx, result);
}
+/* _TopoGeo_AddLinestringNoFace(atopology, point, tolerance) */
+Datum TopoGeo_AddLinestringNoFace(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(TopoGeo_AddLinestringNoFace);
+Datum TopoGeo_AddLinestringNoFace(PG_FUNCTION_ARGS)
+{
+ text* toponame_text;
+ char* toponame;
+ double tol;
+ int nelems;
+ GSERIALIZED *geom;
+ LWGEOM *lwgeom;
+ LWLINE *ln;
+ LWT_TOPOLOGY *topo;
+
+ toponame_text = PG_GETARG_TEXT_P(0);
+ toponame = text_to_cstring(toponame_text);
+ PG_FREE_IF_COPY(toponame_text, 0);
+
+ geom = PG_GETARG_GSERIALIZED_P(1);
+ lwgeom = lwgeom_from_gserialized(geom);
+ /* TODO: allow multilines too */
+ ln = lwgeom_as_lwline(lwgeom);
+ if ( ! ln )
+ {
+ {
+ char buf[32];
+ _lwtype_upper_name(lwgeom_get_type(lwgeom), buf, 32);
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ lwpgerror("Invalid geometry type (%s) passed to "
+ "TopoGeo_AddLinestringNoFace, expected LINESTRING", buf);
+ PG_RETURN_NULL();
+ }
+ }
+
+ tol = PG_GETARG_FLOAT8(2);
+ if ( tol < 0 )
+ {
+ PG_FREE_IF_COPY(geom, 1);
+ lwpgerror("Tolerance must be >=0");
+ PG_RETURN_NULL();
+ }
+
+ if ( SPI_OK_CONNECT != SPI_connect() )
+ {
+ lwpgerror("Could not connect to SPI");
+ PG_RETURN_NULL();
+ }
+
+ topo = lwt_LoadTopology(be_iface, toponame);
+ pfree(toponame);
+ if ( ! topo )
+ {
+ /* should never reach this point, as lwerror would raise an exception */
+ SPI_finish();
+ PG_RETURN_NULL();
+ }
+
+ POSTGIS_DEBUG(1, "Calling lwt_AddLineNoFace");
+ /* return discarded as we assume lwerror would raise an exception earlier
+ * in case of error
+ */
+ lwt_AddLineNoFace(topo, ln, tol, &nelems);
+ POSTGIS_DEBUG(1, "lwt_AddLineNoFace returned");
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ lwt_FreeTopology(topo);
+ POSTGIS_DEBUG(1, "TopoGeo_AddLinestringNoFace calling SPI_finish");
+
+ SPI_finish();
+
+ PG_RETURN_VOID();
+}
+
/* TopoGeo_AddPolygon(atopology, poly, tolerance) */
Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(TopoGeo_AddPolygon);
diff --git a/topology/sql/populate.sql.in b/topology/sql/populate.sql.in
index 6788633c6..e7cd3531f 100644
--- a/topology/sql/populate.sql.in
+++ b/topology/sql/populate.sql.in
@@ -698,16 +698,12 @@ CREATE OR REPLACE FUNCTION topology.TopoGeo_AddPoint(atopology varchar, apoint g
--} TopoGeo_AddPoint
--{
--- TopoGeo_addLinestring(toponame, linegeom, tolerance=0, skipFaceSplitDetection=false)
+-- TopoGeo_addLinestring(toponame, linegeom, tolerance)
--
--- Add a LineString into a topology
---
--- Availability: 2.0.0
--- Changed: 3.5.0 - add skipFaceSplitDetection optional parameter
--- Replaces TopoGeo_addLinestring(varchar, geometry, float8) deprecated in 3.5.0
+-- Add a LineString into a topology
--
-- }{
-CREATE OR REPLACE FUNCTION topology.TopoGeo_addLinestring(atopology varchar, aline geometry, tolerance float8 DEFAULT 0, skipFaceSplitDetection bool DEFAULT false)
+CREATE OR REPLACE FUNCTION topology.TopoGeo_addLinestring(atopology varchar, aline geometry, tolerance float8 DEFAULT 0)
RETURNS SETOF int AS
'MODULE_PATHNAME', 'TopoGeo_AddLinestring'
LANGUAGE 'c' VOLATILE;
@@ -741,6 +737,12 @@ $$
LANGUAGE 'plpgsql';
--} TopoGeo_AddGeometry
+
+CREATE OR REPLACE FUNCTION topology._TopoGeo_addLinestringNoFace(atopology varchar, aline geometry, tolerance float8 DEFAULT 0)
+ RETURNS void AS
+ 'MODULE_PATHNAME', 'TopoGeo_AddLinestringNoFace'
+ LANGUAGE 'c' VOLATILE STRICT;
+
CREATE OR REPLACE FUNCTION topology._RegisterMissingFaces(atopology varchar)
RETURNS void AS
'MODULE_PATHNAME', 'RegisterMissingFaces'
diff --git a/topology/sql/sqlmm.sql.in b/topology/sql/sqlmm.sql.in
index 6b95da8da..17f28275a 100644
--- a/topology/sql/sqlmm.sql.in
+++ b/topology/sql/sqlmm.sql.in
@@ -539,10 +539,7 @@ BEGIN
--
FOR rec IN
WITH linework AS ( SELECT geom FROM ST_Dump(nodededges) )
- SELECT topology.TopoGeo_addLinestring(
- atopology, geom, 0,
- skipFaceSplitDetection => true
- )
+ SELECT topology._TopoGeo_addLinestringNoFace(atopology, geom)
FROM linework
ORDER BY geom
LOOP
-----------------------------------------------------------------------
Summary of changes:
topology/postgis_topology.c | 74 ++++++++++++++++++++++++++++++++++++++++++++
topology/sql/populate.sql.in | 16 +++++-----
topology/sql/sqlmm.sql.in | 5 +--
3 files changed, 84 insertions(+), 11 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list