From 2c16524f236719c39cdb04b72dee2ebf47e2f85f Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Mon, 20 Jun 2011 09:29:31 +0000 Subject: [PATCH] #1040 -- ST_MinimumBoundingCircle -- replace X(), Y() deprecated calls with ST_X(), ST_Y(). Also changed to use default args. We really need regression tests for this function. Will put on separate task. git-svn-id: http://svn.osgeo.org/postgis/trunk@7430 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_processing.xml | 6 +----- postgis/postgis.sql.in.c | 18 +++++++----------- postgis/postgis_drop.sql.in.c | 4 +++- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/doc/reference_processing.xml b/doc/reference_processing.xml index 6ee12d86f..be574328e 100644 --- a/doc/reference_processing.xml +++ b/doc/reference_processing.xml @@ -1685,11 +1685,7 @@ SELECT ST_AsEWKT(ST_LineToCurve(ST_GeomFromEWKT('LINESTRING(1 2 3, 3 4 8, 5 6 4, geometry ST_MinimumBoundingCircle geometry geomA - - - geometry ST_MinimumBoundingCircle - geometry geomA - integer num_segs_per_qt_circ + integer num_segs_per_qt_circ=48 diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index 9cff04462..6c4f2e419 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -4938,7 +4938,7 @@ CREATE OR REPLACE FUNCTION ST_LineToCurve(geometry) -- Contributed by Bruce Rindahl -- Availability: 1.4.0 ----------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION ST_MinimumBoundingCircle(inputgeom geometry, segs_per_quarter integer) +CREATE OR REPLACE FUNCTION ST_MinimumBoundingCircle(inputgeom geometry, segs_per_quarter integer DEFAULT 48) RETURNS geometry AS $BODY$ DECLARE @@ -5011,20 +5011,20 @@ $BODY$ -- Compute the midpoint p1 = ST_line_interpolate_point(l1,0.5); -- Rotate the line 90 degrees around the midpoint (perpendicular bisector) - l1 = ST_Translate(ST_Rotate(ST_Translate(l1,-X(p1),-Y(p1)),pi()/2),X(p1),Y(p1)); + l1 = ST_Translate(ST_Rotate(ST_Translate(l1,-ST_X(p1),-ST_Y(p1)),pi()/2),ST_X(p1),ST_Y(p1)); -- Compute the azimuth of the bisector a1 = ST_Azimuth(ST_PointN(l1,1),ST_PointN(l1,2)); -- Extend the line in each direction the new computed distance to insure they will intersect - l1 = ST_AddPoint(l1,ST_Makepoint(X(ST_PointN(l1,2))+sin(a1)*dist,Y(ST_PointN(l1,2))+cos(a1)*dist),-1); - l1 = ST_AddPoint(l1,ST_Makepoint(X(ST_PointN(l1,1))-sin(a1)*dist,Y(ST_PointN(l1,1))-cos(a1)*dist),0); + l1 = ST_AddPoint(l1,ST_Makepoint(ST_X(ST_PointN(l1,2))+sin(a1)*dist,ST_Y(ST_PointN(l1,2))+cos(a1)*dist),-1); + l1 = ST_AddPoint(l1,ST_Makepoint(ST_X(ST_PointN(l1,1))-sin(a1)*dist,ST_Y(ST_PointN(l1,1))-cos(a1)*dist),0); -- Repeat for the line from the point to the other diameter point l2 = ST_Makeline(ST_PointN(ring,idx2),ST_PointN(ring,k)); p2 = ST_Line_interpolate_point(l2,0.5); - l2 = ST_Translate(ST_Rotate(ST_Translate(l2,-X(p2),-Y(p2)),pi()/2),X(p2),Y(p2)); + l2 = ST_Translate(ST_Rotate(ST_Translate(l2,-ST_X(p2),-ST_Y(p2)),pi()/2),ST_X(p2),ST_Y(p2)); a2 = ST_Azimuth(ST_PointN(l2,1),ST_PointN(l2,2)); - l2 = ST_AddPoint(l2,ST_Makepoint(X(ST_PointN(l2,2))+sin(a2)*dist,Y(ST_PointN(l2,2))+cos(a2)*dist),-1); - l2 = ST_AddPoint(l2,ST_Makepoint(X(ST_PointN(l2,1))-sin(a2)*dist,Y(ST_PointN(l2,1))-cos(a2)*dist),0); + l2 = ST_AddPoint(l2,ST_Makepoint(ST_X(ST_PointN(l2,2))+sin(a2)*dist,ST_Y(ST_PointN(l2,2))+cos(a2)*dist),-1); + l2 = ST_AddPoint(l2,ST_Makepoint(ST_X(ST_PointN(l2,1))-sin(a2)*dist,ST_Y(ST_PointN(l2,1))-cos(a2)*dist),0); -- The new center is the intersection of the two bisectors center = ST_Intersection(l1,l2); @@ -5040,10 +5040,6 @@ $BODY$ $BODY$ LANGUAGE 'plpgsql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION ST_MinimumBoundingCircle(geometry) - RETURNS geometry AS -'SELECT ST_MinimumBoundingCircle($1, 48)' - LANGUAGE 'sql' IMMUTABLE STRICT; -- ST_ConcaveHull and Helper functions starts here -- ----------------------------------------------------------------------- diff --git a/postgis/postgis_drop.sql.in.c b/postgis/postgis_drop.sql.in.c index 808c743cd..1272f340b 100644 --- a/postgis/postgis_drop.sql.in.c +++ b/postgis/postgis_drop.sql.in.c @@ -61,6 +61,7 @@ DROP FUNCTION IF EXISTS geosnoop(geometry); DROP FUNCTION IF EXISTS jtsnoop(geometry); DROP FUNCTION IF EXISTS st_noop(geometry); DROP FUNCTION IF EXISTS st_max_distance(geometry, geometry); +DROP FUNCTION IF EXISTS ST_MinimumBoundingCircle(geometry); --changed to use default parameters -- Drop internals that should never have existed -- DROP FUNCTION IF EXISTS st_geometry_analyze(internal); DROP FUNCTION IF EXISTS st_geometry_in(cstring); @@ -73,4 +74,5 @@ DROP FUNCTION IF EXISTS st_geometry_lt(geometry, geometry); DROP FUNCTION IF EXISTS st_geometry_gt(geometry, geometry); DROP FUNCTION IF EXISTS st_geometry_ge(geometry, geometry); DROP FUNCTION IF EXISTS st_geometry_eq(geometry, geometry); -DROP FUNCTION IF EXISTS st_geometry_cmp(geometry, geometry); \ No newline at end of file +DROP FUNCTION IF EXISTS st_geometry_cmp(geometry, geometry); +DROP FUNCTION IF EXISTS SnapToGrid(geometry, float8, float8); \ No newline at end of file -- 2.50.1