[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha3-20-g0a083db

git at osgeo.org git at osgeo.org
Thu Dec 3 12:18:03 PST 2020


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  0a083db6c7399a94051cb8dbe156d79c52e50536 (commit)
      from  99128ad0195da994e0cc82648008103adab75f61 (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 0a083db6c7399a94051cb8dbe156d79c52e50536
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Dec 3 11:02:14 2020 -0800

    Polish handling of curvilinear geometry types being
    sent to GEOS. GEOS only takes linear types, so all
    curvilinear types need to be (a) stroked and (b)
    re-typed to a linear type. The lwgeom_has_arc() function
    is to exact for that work: it will correctly note
    that curve types with no curve components have no arc.
    So a new broader test for any type that *might* have
    an arc is added, to handle the GEOS transformation
    situation.
    Closes #4796

diff --git a/liblwgeom/liblwgeom.h.in b/liblwgeom/liblwgeom.h.in
index a5ea431..805ea7c 100644
--- a/liblwgeom/liblwgeom.h.in
+++ b/liblwgeom/liblwgeom.h.in
@@ -2278,8 +2278,24 @@ extern void lwgeom_trim_bits_in_place(LWGEOM *geom, int32_t prec_x, int32_t prec
  * SQLMM internal functions
  ******************************************************************************/
 
+/**
+* Geometry includes at least one actual circular arc
+*/
 int lwgeom_has_arc(const LWGEOM *geom);
+/**
+* Geometry type is one of the potentially "arc containing"
+* types (circstring, multicurve, etc) but does not necessarily
+* contain an actual arc.
+*/
+int lwgeom_type_arc(const LWGEOM *geom);
+/**
+* Convert type with arcs into equivalent linearized type
+*/
 LWGEOM *lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad);
+/**
+* Convert linearized type into arc type, de-linearizing the
+* strokes where possible.
+*/
 LWGEOM *lwgeom_unstroke(const LWGEOM *geom);
 
 /**
diff --git a/liblwgeom/lwgeom_geos.c b/liblwgeom/lwgeom_geos.c
index c2a41ee..e1e8e6a 100644
--- a/liblwgeom/lwgeom_geos.c
+++ b/liblwgeom/lwgeom_geos.c
@@ -407,7 +407,7 @@ LWGEOM2GEOS(const LWGEOM* lwgeom, uint8_t autofix)
 
 	LWDEBUGF(4, "LWGEOM2GEOS got a %s", lwtype_name(lwgeom->type));
 
-	if (lwgeom_has_arc(lwgeom))
+	if (lwgeom_type_arc(lwgeom))
 	{
 		LWGEOM* lwgeom_stroked = lwgeom_stroke(lwgeom, 32);
 		GEOSGeometry* g = LWGEOM2GEOS(lwgeom_stroked, autofix);
diff --git a/liblwgeom/lwstroke.c b/liblwgeom/lwstroke.c
index 7377ad4..ff025ff 100644
--- a/liblwgeom/lwstroke.c
+++ b/liblwgeom/lwstroke.c
@@ -72,8 +72,6 @@ lwgeom_has_arc(const LWGEOM *geom)
 	case TINTYPE:
 		return LW_FALSE;
 	case CIRCSTRINGTYPE:
-	case CURVEPOLYTYPE:
-	case COMPOUNDTYPE:
 		return LW_TRUE;
 	/* It's a collection that MAY contain an arc */
 	default:
@@ -87,7 +85,21 @@ lwgeom_has_arc(const LWGEOM *geom)
 	}
 }
 
-
+int
+lwgeom_type_arc(const LWGEOM *geom)
+{
+	switch (geom->type)
+	{
+	case COMPOUNDTYPE:
+	case CIRCSTRINGTYPE:
+	case CURVEPOLYTYPE:
+	case MULTISURFACETYPE:
+	case MULTICURVETYPE:
+		return LW_TRUE;
+	default:
+		return LW_FALSE;
+	}
+}
 
 /*******************************************************************************
  * Begin curve segmentize functions
diff --git a/regress/core/sql-mm-general.sql b/regress/core/sql-mm-general.sql
index eee49d3..1f898ea 100644
--- a/regress/core/sql-mm-general.sql
+++ b/regress/core/sql-mm-general.sql
@@ -1,20 +1,22 @@
-SELECT ST_HasArc(ST_GeomFromText('POINT(0 0)'));
-SELECT ST_HasArc(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)'));
-SELECT ST_HasArc(ST_GeomFromEWKT('CIRCULARSTRING(
+SELECT 'arc1', ST_HasArc(ST_GeomFromText('POINT(0 0)'));
+SELECT 'arc2', ST_HasArc(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)'));
+SELECT 'arc2a', ST_HasArc(ST_GeomFromText('COMPOUNDCURVE((0 0, 1 1, 1 0))'));
+SELECT 'arc2b', ST_HasArc(ST_GeomFromText('COMPOUNDCURVE((0 0, 1 1, 1 0), CIRCULARSTRING(1 0, 1 1, 1 0))'));
+SELECT 'arc3', ST_HasArc(ST_GeomFromEWKT('CIRCULARSTRING(
                 0 0 0 0,
                 0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2)'));
-SELECT ST_HasArc(ST_GeomFromEWKT('COMPOUNDCURVE(CIRCULARSTRING(
+SELECT 'arc4', ST_HasArc(ST_GeomFromEWKT('COMPOUNDCURVE(CIRCULARSTRING(
                 0 0 0 0,
                 0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
                 2 0 0 0,
                 0 0 0 0))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('POLYGON(
+SELECT 'arc5', ST_HasArc(ST_GeomFromEWKT('POLYGON(
                 (-10 -10, 10 -10, 10 10, -10 10, -10 -10),
                 (5 0, 0 5, -5 0, 0 -5, 5 0))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('CURVEPOLYGON(CIRCULARSTRING(
+SELECT 'arc6', ST_HasArc(ST_GeomFromEWKT('CURVEPOLYGON(CIRCULARSTRING(
                 -2 0 0 0,
                 -1 -1 1 2,
                 0 0 2 4,
@@ -27,16 +29,16 @@ SELECT ST_HasArc(ST_GeomFromEWKT('CURVEPOLYGON(CIRCULARSTRING(
                 1 0 3 6,
                 0 1 3 4,
                 -1 0 1 2))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('MULTIPOINT((0 0), (3 2))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('MULTILINESTRING(
+SELECT 'arc7', ST_HasArc(ST_GeomFromEWKT('MULTIPOINT((0 0), (3 2))'));
+SELECT 'arc8', ST_HasArc(ST_GeomFromEWKT('MULTILINESTRING(
                 (0 0, 3 2),
                 (4 8, 9 8),
                 (2 9, 4 8))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('MULTICURVE(
+SELECT 'arc9', ST_HasArc(ST_GeomFromEWKT('MULTICURVE(
                 (0 0, 3 2),
                 (4 8, 9 8),
                 (2 9, 4 8))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('MULTICURVE((
+SELECT 'arc10', ST_HasArc(ST_GeomFromEWKT('MULTICURVE((
                 5 5 1 3,
                 3 5 2 2,
                 3 3 3 1,
@@ -45,15 +47,15 @@ SELECT ST_HasArc(ST_GeomFromEWKT('MULTICURVE((
                 0 0 0 0,
                 0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('MULTIPOLYGON(
+SELECT 'arc11', ST_HasArc(ST_GeomFromEWKT('MULTIPOLYGON(
                 ((-10 -10, 10 -10, 10 10, -10 10, -10 -10),
                 (5 0, 0 5, -5 0, 0 -5, 5 0)),
                 ((9 2, 3 8, 9 4, 9 2)))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('MULTISURFACE(
+SELECT 'arc12', ST_HasArc(ST_GeomFromEWKT('MULTISURFACE(
                 ((-10 -10, 10 -10, 10 10, -10 10, -10 -10),
                 (5 0, 0 5, -5 0, 0 -5, 5 0)),
                 ((9 2, 3 8, 9 4, 9 2)))'));
-SELECT ST_HasArc(ST_GeomFromEWKT('MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(
+SELECT 'arc13', ST_HasArc(ST_GeomFromEWKT('MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(
                 -2 0 0 0,
                 -1 -1 1 2,
                 0 0 2 4,
diff --git a/regress/core/sql-mm-general_expected b/regress/core/sql-mm-general_expected
index 786d4f9..58044c3 100644
--- a/regress/core/sql-mm-general_expected
+++ b/regress/core/sql-mm-general_expected
@@ -1,14 +1,16 @@
-f
-f
-t
-t
-f
-t
-f
-f
-f
-t
-f
-f
-t
+arc1|f
+arc2|f
+arc2a|f
+arc2b|t
+arc3|t
+arc4|t
+arc5|f
+arc6|t
+arc7|f
+arc8|f
+arc9|f
+arc10|t
+arc11|f
+arc12|f
+arc13|t
 LINESTRING(-13151357.927248 3913656.64539871,-13151419.0845266 3913664.12016378,-13151441.323537 3913666.61175286,-13151456.8908442 3913666.61175286,-13151476.9059536 3913666.61175286,-13151496.921063 3913666.61175287,-13151521.3839744 3913666.61175287,-13151591.4368571 3913665.36595828)
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 523fa66..956a49c 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1313,3 +1313,4 @@ SELECT '#4718',
 SELECT '#4727', _ST_DistanceTree('SRID=4326;POLYGON((-179.9 -85.05112877980659, -179.9 74.99999999999997, -152 80, -130 84.99999999999997, -115 85.05112877980659, -60 85.05112877980659, -60 79, -70 70, -130 50, -80 6, -65 -53, -100 -85.05112877980659, -179.9 -85.05112877980659))'::geography,
 				ST_MakePoint(-150,-40), 0.0, true);
 
+SELECT '#4796', st_astext(st_snaptogrid(st_normalize(st_simplifypreservetopology('MULTISURFACE(((178632.044 397744.007,178631.118 397743.786,178646.399 397679.574,178693.864 397690.889,178698.958 397669.487,178700.206 397669.784,178758.532 397683.689,178748.351 397726.468,178752.199 397727.384,178748.782 397741.904,178744.897 397740.98,178738.157 397769.303,178632.044 397744.007)))'::geometry,1)),1));
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index a60213f..1d56d2e 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -437,3 +437,4 @@ ERROR:  LWGEOM_addpoint: Invalid offset
 #4748|SRID=3031;POINT(-2399498.7 3213318.5)
 #4718|270.000|90.000
 #4727|0
+#4796|POLYGON((178632 397744,178738 397769,178745 397741,178749 397742,178752 397727,178748 397726,178759 397684,178699 397669,178694 397691,178646 397680,178632 397744))

-----------------------------------------------------------------------

Summary of changes:
 liblwgeom/liblwgeom.h.in             | 16 ++++++++++++++++
 liblwgeom/lwgeom_geos.c              |  2 +-
 liblwgeom/lwstroke.c                 | 18 +++++++++++++++---
 regress/core/sql-mm-general.sql      | 28 +++++++++++++++-------------
 regress/core/sql-mm-general_expected | 28 +++++++++++++++-------------
 regress/core/tickets.sql             |  1 +
 regress/core/tickets_expected        |  1 +
 7 files changed, 64 insertions(+), 30 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list