Fix #178: ST_XMax() and ST_YMax() return incorrect values. This was caused by the fact that the min/max routines did not check whether the result for each axis was actually the min or max, but instead simply returned the structure value. Hence if an inverted coordinate system were being used, the wrong value would be returned.

git-svn-id: http://svn.osgeo.org/postgis/trunk@4079 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Mark Cave-Ayland 2009-05-09 12:53:25 +00:00
parent 2c9c365a5c
commit fc2571e1a4

View file

@ -328,42 +328,42 @@ PG_FUNCTION_INFO_V1(BOX3D_xmin);
Datum BOX3D_xmin(PG_FUNCTION_ARGS)
{
BOX3D *box = (BOX3D *)PG_GETARG_POINTER(0);
PG_RETURN_FLOAT8(box->xmin);
PG_RETURN_FLOAT8(LWGEOM_Mind(box->xmin, box->xmax));
}
PG_FUNCTION_INFO_V1(BOX3D_ymin);
Datum BOX3D_ymin(PG_FUNCTION_ARGS)
{
BOX3D *box = (BOX3D *)PG_GETARG_POINTER(0);
PG_RETURN_FLOAT8(box->ymin);
PG_RETURN_FLOAT8(LWGEOM_Mind(box->ymin, box->ymax));
}
PG_FUNCTION_INFO_V1(BOX3D_zmin);
Datum BOX3D_zmin(PG_FUNCTION_ARGS)
{
BOX3D *box = (BOX3D *)PG_GETARG_POINTER(0);
PG_RETURN_FLOAT8(box->zmin);
PG_RETURN_FLOAT8(LWGEOM_Mind(box->zmin, box->zmax));
}
PG_FUNCTION_INFO_V1(BOX3D_xmax);
Datum BOX3D_xmax(PG_FUNCTION_ARGS)
{
BOX3D *box = (BOX3D *)PG_GETARG_POINTER(0);
PG_RETURN_FLOAT8(box->xmax);
PG_RETURN_FLOAT8(LWGEOM_Maxd(box->xmin, box->xmax));
}
PG_FUNCTION_INFO_V1(BOX3D_ymax);
Datum BOX3D_ymax(PG_FUNCTION_ARGS)
{
BOX3D *box = (BOX3D *)PG_GETARG_POINTER(0);
PG_RETURN_FLOAT8(box->ymax);
PG_RETURN_FLOAT8(LWGEOM_Maxd(box->ymin, box->ymax));
}
PG_FUNCTION_INFO_V1(BOX3D_zmax);
Datum BOX3D_zmax(PG_FUNCTION_ARGS)
{
BOX3D *box = (BOX3D *)PG_GETARG_POINTER(0);
PG_RETURN_FLOAT8(box->zmax);
PG_RETURN_FLOAT8(LWGEOM_Maxd(box->zmin, box->zmax));
}