Implement canonical text output for GIDX and BOX2DF

They make spatial indexes inspectable with Gevel:
http://www.sai.msu.su/~megera/wiki/Gevel

git-svn-id: http://svn.osgeo.org/postgis/trunk@13297 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2015-03-03 10:26:01 +00:00
parent db823406cb
commit 63aa799510
5 changed files with 8 additions and 14 deletions

1
NEWS
View file

@ -26,6 +26,7 @@ PostGIS 2.2.0
* New Features *
- Canonical output for index key types
- ST_SwapOrdinates (Sandro Santilli / Boundless)
- #3040, KNN GiST index based centroid (<<->>) and box (<<#>>)
n-D distance operators (Sandro Santilli / Boundless)

View file

@ -29,7 +29,6 @@
/* Generate human readable form for GIDX. */
#if POSTGIS_DEBUG_LEVEL > 0
char* gidx_to_string(GIDX *a)
{
char *str, *rv;
@ -38,7 +37,7 @@ char* gidx_to_string(GIDX *a)
if ( a == NULL )
return pstrdup("<NULLPTR>");
str = (char*)palloc(128);
str = (char*)palloc(128); /* 15*2*4+8==128 */
rv = str;
ndims = GIDX_NDIMS(a);
@ -52,7 +51,6 @@ char* gidx_to_string(GIDX *a)
return rv;
}
#endif
static uint8_t

View file

@ -56,9 +56,7 @@ void gidx_expand(GIDX *a, float d);
/* Generate human readable form for GIDX. */
#if POSTGIS_DEBUG_LEVEL > 0
char* gidx_to_string(GIDX *a) ;
#endif
/* typedef to correct array-bounds checking for casts to GIDX - do not
use this ANYWHERE except in the casts below */

View file

@ -108,7 +108,6 @@ Datum gserialized_distance_centroid_2d(PG_FUNCTION_ARGS);
typedef bool (*box2df_predicate)(const BOX2DF *a, const BOX2DF *b);
#if POSTGIS_DEBUG_LEVEL > 0
static char* box2df_to_string(const BOX2DF *a)
{
char *rv = NULL;
@ -120,8 +119,6 @@ static char* box2df_to_string(const BOX2DF *a)
sprintf(rv, "BOX2DF(%.12g %.12g, %.12g %.12g)", a->xmin, a->ymin, a->xmax, a->ymax);
return rv;
}
#endif
/* Allocate a new copy of BOX2DF */
static BOX2DF* box2df_copy(BOX2DF *b)
@ -2207,7 +2204,7 @@ Datum box2df_in(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(box2df_out);
Datum box2df_out(PG_FUNCTION_ARGS)
{
ereport(ERROR,(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("function box2df_out not implemented")));
PG_RETURN_POINTER(NULL);
BOX2DF *box = (BOX2DF *) PG_GETARG_POINTER(0);
char *result = box2df_to_string(box);
PG_RETURN_CSTRING(result);
}

View file

@ -1496,7 +1496,7 @@ Datum gidx_in(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(gidx_out);
Datum gidx_out(PG_FUNCTION_ARGS)
{
ereport(ERROR,(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("function gidx_out not implemented")));
PG_RETURN_POINTER(NULL);
GIDX *box = (GIDX *) PG_GETARG_POINTER(0);
char *result = gidx_to_string(box);
PG_RETURN_CSTRING(result);
}