[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha1-113-g5cea21d
git at osgeo.org
git at osgeo.org
Fri May 8 11:17:41 PDT 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 5cea21d4ade82fa18a321a629892b0550f1ed398 (commit)
from 10d2f810601b7c226fab12848f943479dd3d53b1 (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 5cea21d4ade82fa18a321a629892b0550f1ed398
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri May 8 11:17:36 2020 -0700
move declarations to top of block (c90), references #4687
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index 47054d7..6f7b2fb 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -384,47 +384,49 @@ Datum ST_MaximumInscribedCircle(PG_FUNCTION_ARGS)
}
else
{
- GEOSGeometry *g1;
- GEOSGeometry *g2;
+ GEOSGeometry *ginput, *gcircle, *gcenter, *gnearest;
+ double width, height, size, tolerance;
GBOX gbox;
+ int gtype;
+
if (!gserialized_get_gbox_p(geom, &gbox))
PG_RETURN_NULL();
- initGEOS(lwpgnotice, lwgeom_geos_error);
+ width = gbox.xmax - gbox.xmin;
+ height = gbox.ymax - gbox.ymin;
+ size = width > height ? width : height;
+ tolerance = size / 1000.0;
- double width = gbox.xmax - gbox.xmin;
- double height = gbox.ymax - gbox.ymin;
- double size = width > height ? width : height;
- double tolerance = size / 1000.0;
+ initGEOS(lwpgnotice, lwgeom_geos_error);
- g1 = POSTGIS2GEOS(geom);
- if (!g1)
+ ginput = POSTGIS2GEOS(geom);
+ if (!ginput)
HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
- int gtype = gserialized_get_type(geom);
+ gtype = gserialized_get_type(geom);
if (gtype == POLYGONTYPE || gtype == MULTIPOLYGONTYPE)
{
- g2 = GEOSMaximumInscribedCircle(g1, tolerance);
- if (!g2)
+ gcircle = GEOSMaximumInscribedCircle(ginput, tolerance);
+ if (!gcircle)
{
lwpgerror("Error calculating GEOSMaximumInscribedCircle.");
- GEOSGeom_destroy(g1);
+ GEOSGeom_destroy(ginput);
PG_RETURN_NULL();
}
}
else
{
- g2 = GEOSLargestEmptyCircle(g1, NULL, tolerance);
- if (!g2)
+ gcircle = GEOSLargestEmptyCircle(ginput, NULL, tolerance);
+ if (!gcircle)
{
lwpgerror("Error calculating GEOSLargestEmptyCircle.");
- GEOSGeom_destroy(g1);
+ GEOSGeom_destroy(ginput);
PG_RETURN_NULL();
}
}
- GEOSGeometry *gcenter = GEOSGeomGetStartPoint(g2);
- GEOSGeometry *gnearest = GEOSGeomGetEndPoint(g2);
+ gcenter = GEOSGeomGetStartPoint(gcircle);
+ gnearest = GEOSGeomGetEndPoint(gcircle);
GEOSDistance(gcenter, gnearest, &radius);
GEOSSetSRID(gcenter, srid);
GEOSSetSRID(gnearest, srid);
@@ -433,8 +435,8 @@ Datum ST_MaximumInscribedCircle(PG_FUNCTION_ARGS)
nearest = GEOS2POSTGIS(gnearest, is3d);
GEOSGeom_destroy(gcenter);
GEOSGeom_destroy(gnearest);
- GEOSGeom_destroy(g2);
- GEOSGeom_destroy(g1);
+ GEOSGeom_destroy(gcircle);
+ GEOSGeom_destroy(ginput);
}
get_call_result_type(fcinfo, NULL, &resultTupleDesc);
-----------------------------------------------------------------------
Summary of changes:
postgis/lwgeom_geos.c | 42 ++++++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 20 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list