From: David Blasby Date: Fri, 15 Mar 2002 17:10:49 +0000 (+0000) Subject: ADD xmin(box3d) etc... for box3d's. X-Git-Tag: pgis_0_7_0~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dca40f3c7e785f101d818cbb77bd1f3509f09e66;p=postgis ADD xmin(box3d) etc... for box3d's. git-svn-id: http://svn.osgeo.org/postgis/trunk@129 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis.h b/postgis.h index b85aceced..6244242a8 100644 --- a/postgis.h +++ b/postgis.h @@ -477,6 +477,14 @@ Datum factor_chip(PG_FUNCTION_ARGS); Datum segmentize(PG_FUNCTION_ARGS); +Datum box3d_xmin(PG_FUNCTION_ARGS); +Datum box3d_ymin(PG_FUNCTION_ARGS); +Datum box3d_zmin(PG_FUNCTION_ARGS); + +Datum box3d_xmax(PG_FUNCTION_ARGS); +Datum box3d_ymax(PG_FUNCTION_ARGS); +Datum box3d_zmax(PG_FUNCTION_ARGS); + Datum transform_geom(PG_FUNCTION_ARGS); diff --git a/postgis.sql.in b/postgis.sql.in index c310570b2..87b9503c9 100644 --- a/postgis.sql.in +++ b/postgis.sql.in @@ -632,6 +632,39 @@ CREATE FUNCTION centroid(GEOMETRY) AS '@MODULE_FILENAME@' LANGUAGE 'c' with (isstrict); + +------- bbox ops + +CREATE FUNCTION xmin(BOX3D) + RETURNS FLOAT8 + AS '@MODULE_FILENAME@','box3d_xmin' + LANGUAGE 'c' with (isstrict,iscachable); + +CREATE FUNCTION ymin(BOX3D) + RETURNS FLOAT8 + AS '@MODULE_FILENAME@','box3d_ymin' + LANGUAGE 'c' with (isstrict,iscachable); + +CREATE FUNCTION zmin(BOX3D) + RETURNS FLOAT8 + AS '@MODULE_FILENAME@','box3d_zmin' + LANGUAGE 'c' with (isstrict,iscachable); + +CREATE FUNCTION xmax(BOX3D) + RETURNS FLOAT8 + AS '@MODULE_FILENAME@','box3d_xmax' + LANGUAGE 'c' with (isstrict,iscachable); + +CREATE FUNCTION ymax(BOX3D) + RETURNS FLOAT8 + AS '@MODULE_FILENAME@','box3d_ymax' + LANGUAGE 'c' with (isstrict,iscachable); + +CREATE FUNCTION zmax(BOX3D) + RETURNS FLOAT8 + AS '@MODULE_FILENAME@','box3d_zmax' + LANGUAGE 'c' with (isstrict,iscachable); + ------- Aggregate CREATE FUNCTION combine_bbox(BOX3D,GEOMETRY) @@ -698,6 +731,8 @@ CREATE FUNCTION force_collection(GEOMETRY) RETURNS GEOMETRY AS '@MODULE_FILENAME@' LANGUAGE 'c' with (isstrict); + + -------- GiST support functions create function ggeometry_consistent(opaque,GEOMETRY,int4) returns bool as '@MODULE_FILENAME@' language 'C'; diff --git a/postgis_ops.c b/postgis_ops.c index 5823b5cb3..46d1d0f8e 100644 --- a/postgis_ops.c +++ b/postgis_ops.c @@ -1294,3 +1294,47 @@ GISTENTRY *rtree_decompress(PG_FUNCTION_ARGS) return((GISTENTRY*)PG_GETARG_POINTER(0)); } + +PG_FUNCTION_INFO_V1(box3d_xmin); +Datum box3d_xmin(PG_FUNCTION_ARGS) +{ + BOX3D *box1 = (BOX3D *) PG_GETARG_POINTER(0); + + PG_RETURN_FLOAT8(box1->LLB.x); +} + +PG_FUNCTION_INFO_V1(box3d_ymin); +Datum box3d_ymin(PG_FUNCTION_ARGS) +{ + BOX3D *box1 = (BOX3D *) PG_GETARG_POINTER(0); + + PG_RETURN_FLOAT8(box1->LLB.y); +} +PG_FUNCTION_INFO_V1(box3d_zmin); +Datum box3d_zmin(PG_FUNCTION_ARGS) +{ + BOX3D *box1 = (BOX3D *) PG_GETARG_POINTER(0); + + PG_RETURN_FLOAT8(box1->LLB.z); +} +PG_FUNCTION_INFO_V1(box3d_xmax); +Datum box3d_xmax(PG_FUNCTION_ARGS) +{ + BOX3D *box1 = (BOX3D *) PG_GETARG_POINTER(0); + + PG_RETURN_FLOAT8(box1->URT.x); +} +PG_FUNCTION_INFO_V1(box3d_ymax); +Datum box3d_ymax(PG_FUNCTION_ARGS) +{ + BOX3D *box1 = (BOX3D *) PG_GETARG_POINTER(0); + + PG_RETURN_FLOAT8(box1->URT.y); +} +PG_FUNCTION_INFO_V1(box3d_zmax); +Datum box3d_zmax(PG_FUNCTION_ARGS) +{ + BOX3D *box1 = (BOX3D *) PG_GETARG_POINTER(0); + + PG_RETURN_FLOAT8(box1->URT.z); +}