diff --git a/libpgcommon/lwgeom_pg.c b/libpgcommon/lwgeom_pg.c index 02c37b61a5f..115f19e7ca6 100644 --- a/libpgcommon/lwgeom_pg.c +++ b/libpgcommon/lwgeom_pg.c @@ -209,24 +209,6 @@ pglwgeom_get_zm(const GSERIALIZED *lwgeom) return 2 * FLAGS_GET_Z(lwgeom->flags) + FLAGS_GET_M(lwgeom->flags); } -bool -pglwgeom_has_bbox(const GSERIALIZED *lwgeom) -{ - return FLAGS_GET_BBOX(lwgeom->flags); -} - -bool -pglwgeom_has_z(const GSERIALIZED *lwgeom) -{ - return FLAGS_GET_Z(lwgeom->flags); -} - -bool -pglwgeom_has_m(const GSERIALIZED *lwgeom) -{ - return FLAGS_GET_M(lwgeom->flags); -} - GSERIALIZED* pglwgeom_drop_bbox(GSERIALIZED *geom) { return gserialized_drop_gidx(geom); diff --git a/libpgcommon/lwgeom_pg.h b/libpgcommon/lwgeom_pg.h index 55723e93683..b0847d66ebf 100644 --- a/libpgcommon/lwgeom_pg.h +++ b/libpgcommon/lwgeom_pg.h @@ -101,9 +101,6 @@ extern int pglwgeom_get_zm(const GSERIALIZED *lwgeom); extern GSERIALIZED* pglwgeom_drop_bbox(GSERIALIZED *geom); extern size_t pglwgeom_size(const GSERIALIZED *geom); extern int pglwgeom_ndims(const GSERIALIZED *geom); -extern bool pglwgeom_has_bbox(const GSERIALIZED *lwgeom); -extern bool pglwgeom_has_z(const GSERIALIZED *lwgeom); -extern bool pglwgeom_has_m(const GSERIALIZED *lwgeom); extern int pglwgeom_is_empty(const GSERIALIZED *geom); /* * Get the 2d bounding box of the given geometry, in FLOAT4 format. diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index bfc4763a1e0..6b0fb384f96 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -357,7 +357,7 @@ Datum LWGEOM_force_3dz(PG_FUNCTION_ARGS) LWGEOM *lwg_in, *lwg_out; /* already 3d */ - if ( pglwgeom_ndims(pg_geom_in) == 3 && pglwgeom_has_z(pg_geom_in) ) + if ( pglwgeom_ndims(pg_geom_in) == 3 && gserialized_has_z(pg_geom_in) ) PG_RETURN_POINTER(pg_geom_in); lwg_in = lwgeom_from_gserialized(pg_geom_in); @@ -379,7 +379,7 @@ Datum LWGEOM_force_3dm(PG_FUNCTION_ARGS) LWGEOM *lwg_in, *lwg_out; /* already 3d */ - if ( pglwgeom_ndims(pg_geom_in) == 3 && pglwgeom_has_m(pg_geom_in) ) + if ( pglwgeom_ndims(pg_geom_in) == 3 && gserialized_has_m(pg_geom_in) ) PG_RETURN_POINTER(pg_geom_in); lwg_in = lwgeom_from_gserialized(pg_geom_in); @@ -433,7 +433,7 @@ Datum LWGEOM_force_collection(PG_FUNCTION_ARGS) * automatic bbox addition FOR_COMPLEX_GEOMS. */ if ( gserialized_get_type(geom) == COLLECTIONTYPE && - pglwgeom_has_bbox(geom) ) + gserialized_has_bbox(geom) ) { PG_RETURN_POINTER(geom); } @@ -485,7 +485,7 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS) ** automatic bbox addition FOR_COMPLEX_GEOMS. */ if ( lwtype_is_collection(gserialized_get_type(geom)) && - pglwgeom_has_bbox(geom) ) + gserialized_has_bbox(geom) ) { PG_RETURN_POINTER(geom); } @@ -1906,8 +1906,8 @@ Datum LWGEOM_zmflag(PG_FUNCTION_ARGS) int ret = 0; in = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); - if ( pglwgeom_has_z(in) ) ret += 2; - if ( pglwgeom_has_m(in) ) ret += 1; + if ( gserialized_has_z(in) ) ret += 2; + if ( gserialized_has_m(in) ) ret += 1; PG_FREE_IF_COPY(in, 0); PG_RETURN_INT16(ret); } @@ -1916,14 +1916,14 @@ PG_FUNCTION_INFO_V1(LWGEOM_hasz); Datum LWGEOM_hasz(PG_FUNCTION_ARGS) { GSERIALIZED *in = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); - PG_RETURN_BOOL(pglwgeom_has_z(in)); + PG_RETURN_BOOL(gserialized_has_z(in)); } PG_FUNCTION_INFO_V1(LWGEOM_hasm); Datum LWGEOM_hasm(PG_FUNCTION_ARGS) { GSERIALIZED *in = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); - PG_RETURN_BOOL(pglwgeom_has_m(in)); + PG_RETURN_BOOL(gserialized_has_m(in)); } @@ -1931,7 +1931,7 @@ PG_FUNCTION_INFO_V1(LWGEOM_hasBBOX); Datum LWGEOM_hasBBOX(PG_FUNCTION_ARGS) { GSERIALIZED *in = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); - char res = pglwgeom_has_bbox(in); + char res = gserialized_has_bbox(in); PG_FREE_IF_COPY(in, 0); PG_RETURN_BOOL(res); } diff --git a/postgis/lwgeom_functions_lrs.c b/postgis/lwgeom_functions_lrs.c index 6e41b821c39..a240b734ac2 100644 --- a/postgis/lwgeom_functions_lrs.c +++ b/postgis/lwgeom_functions_lrs.c @@ -468,8 +468,8 @@ Datum LWGEOM_locate_between_m(PG_FUNCTION_ARGS) double start_measure = PG_GETARG_FLOAT8(1); double end_measure = PG_GETARG_FLOAT8(2); LWGEOM *lwin, *lwout; - int hasz = pglwgeom_has_z(gin); - int hasm = pglwgeom_has_m(gin); + int hasz = gserialized_has_z(gin); + int hasm = gserialized_has_m(gin); int type; if ( end_measure < start_measure ) diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c index 5e1c4ccc202..c5d2316b9fe 100644 --- a/postgis/lwgeom_geos.c +++ b/postgis/lwgeom_geos.c @@ -314,7 +314,7 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS) { srid = gserialized_get_srid(pggeom); gotsrid = 1; - if ( pglwgeom_has_z(pggeom) ) is3d = 1; + if ( gserialized_has_z(pggeom) ) is3d = 1; } else { @@ -474,7 +474,7 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS) POSTGIS_DEBUGF(3, "geom %d @ %p", i, geom); /* Check is3d flag */ - if ( pglwgeom_has_z(geom) ) is3d = 1; + if ( gserialized_has_z(geom) ) is3d = 1; /* Check SRID homogeneity and initialize geos result */ if ( ! geos_result ) @@ -586,7 +586,7 @@ Datum ST_UnaryUnion(PG_FUNCTION_ARGS) if ( pglwgeom_is_empty(geom1) ) PG_RETURN_POINTER(geom1); - is3d = ( pglwgeom_has_z(geom1) ); + is3d = ( gserialized_has_z(geom1) ); srid = gserialized_get_srid(geom1); @@ -744,7 +744,7 @@ Datum boundary(PG_FUNCTION_ARGS) GEOSSetSRID(g3, srid); - result = GEOS2POSTGIS(g3, pglwgeom_has_z(geom1)); + result = GEOS2POSTGIS(g3, gserialized_has_z(geom1)); if (result == NULL) { @@ -805,7 +805,7 @@ Datum convexhull(PG_FUNCTION_ARGS) GEOSSetSRID(g3, srid); - lwout = GEOS2LWGEOM(g3, pglwgeom_has_z(geom1)); + lwout = GEOS2LWGEOM(g3, gserialized_has_z(geom1)); if (lwout == NULL) { @@ -879,7 +879,7 @@ Datum topologypreservesimplify(PG_FUNCTION_ARGS) GEOSSetSRID(g3, gserialized_get_srid(geom1)); - result = GEOS2POSTGIS(g3, pglwgeom_has_z(geom1)); + result = GEOS2POSTGIS(g3, gserialized_has_z(geom1)); if (result == NULL) { @@ -1086,7 +1086,7 @@ Datum buffer(PG_FUNCTION_ARGS) GEOSSetSRID(g3, gserialized_get_srid(geom1)); - result = GEOS2POSTGIS(g3, pglwgeom_has_z(geom1)); + result = GEOS2POSTGIS(g3, gserialized_has_z(geom1)); if (result == NULL) { @@ -1259,7 +1259,7 @@ Datum offsetcurve(PG_FUNCTION_ARGS) GEOSSetSRID(g3, gserialized_get_srid(geom1)); - result = GEOS2POSTGIS(g3, pglwgeom_has_z(geom1)); + result = GEOS2POSTGIS(g3, gserialized_has_z(geom1)); if (result == NULL) { @@ -1387,7 +1387,7 @@ Datum pointonsurface(PG_FUNCTION_ARGS) GEOSSetSRID(g3, gserialized_get_srid(geom1)); - result = GEOS2POSTGIS(g3, pglwgeom_has_z(geom1)); + result = GEOS2POSTGIS(g3, gserialized_has_z(geom1)); if (result == NULL) { @@ -1438,7 +1438,7 @@ Datum centroid(PG_FUNCTION_ARGS) GEOSSetSRID(geosresult, gserialized_get_srid(geom)); - result = GEOS2POSTGIS(geosresult, pglwgeom_has_z(geom)); + result = GEOS2POSTGIS(geosresult, gserialized_has_z(geom)); if (result == NULL) { @@ -3236,7 +3236,7 @@ Datum GEOSnoop(PG_FUNCTION_ARGS) geosgeom = (GEOSGeometry *)POSTGIS2GEOS(geom); if ( ! geosgeom ) PG_RETURN_NULL(); - lwgeom_result = GEOS2POSTGIS(geosgeom, pglwgeom_has_z(geom)); + lwgeom_result = GEOS2POSTGIS(geosgeom, gserialized_has_z(geom)); GEOSGeom_destroy(geosgeom); @@ -3369,7 +3369,7 @@ Datum linemerge(PG_FUNCTION_ARGS) GEOSSetSRID(g3, gserialized_get_srid(geom1)); - result = GEOS2POSTGIS(g3, pglwgeom_has_z(geom1)); + result = GEOS2POSTGIS(g3, gserialized_has_z(geom1)); if (result == NULL) { diff --git a/postgis/lwgeom_gist.c b/postgis/lwgeom_gist.c index a5fd1a50fa6..f3fe68b2761 100644 --- a/postgis/lwgeom_gist.c +++ b/postgis/lwgeom_gist.c @@ -600,7 +600,7 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS) ** If not, pull the full toasted data out, and call the standard box ** retrieval function, which will calculate the box from scratch. */ - if ( pglwgeom_has_bbox(query) ) + if ( gserialized_has_bbox(query) ) { pglwgeom_getbox2d_p(query, &box); } diff --git a/postgis/lwgeom_inout.c b/postgis/lwgeom_inout.c index dd5c59ac439..62c202ae547 100644 --- a/postgis/lwgeom_inout.c +++ b/postgis/lwgeom_inout.c @@ -401,7 +401,7 @@ Datum LWGEOM_dropBBOX(PG_FUNCTION_ARGS) GSERIALIZED *geom = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); /* No box? we're done already! */ - if ( ! pglwgeom_has_bbox(geom) ) + if ( ! gserialized_has_bbox(geom) ) PG_RETURN_POINTER(geom); PG_RETURN_POINTER(pglwgeom_drop_bbox(geom)); diff --git a/postgis/lwgeom_ogc.c b/postgis/lwgeom_ogc.c index 0e37f1f7a63..78fea64ea57 100644 --- a/postgis/lwgeom_ogc.c +++ b/postgis/lwgeom_ogc.c @@ -152,7 +152,7 @@ Datum LWGEOM_getTYPE(PG_FUNCTION_ARGS) else strcpy(result,"UNKNOWN"); - if ( pglwgeom_has_m(lwgeom) && ! pglwgeom_has_z(lwgeom) ) + if ( gserialized_has_m(lwgeom) && ! gserialized_has_z(lwgeom) ) strcat(result, "M"); size = strlen(result) + VARHDRSZ ; @@ -636,7 +636,7 @@ Datum LWGEOM_z_point(PG_FUNCTION_ARGS) PG_RETURN_NULL(); /* no Z in input */ - if ( ! pglwgeom_has_z(geom) ) PG_RETURN_NULL(); + if ( ! gserialized_has_z(geom) ) PG_RETURN_NULL(); getPoint3dz_p(point->point, 0, &p); @@ -790,7 +790,7 @@ Datum LWGEOM_from_WKB(PG_FUNCTION_ARGS) geom = (GSERIALIZED *)DatumGetPointer(DirectFunctionCall1( LWGEOMFromWKB, PG_GETARG_DATUM(0))); - if ( gserialized_get_srid(geom) != SRID_UNKNOWN || pglwgeom_has_z(geom) != 0 ) + if ( gserialized_get_srid(geom) != SRID_UNKNOWN || gserialized_has_z(geom) != 0 ) { elog(WARNING, "OGC WKB expected, EWKB provided - use GeometryFromEWKB() for this"); }