]> granicus.if.org Git - postgis/commitdiff
Remove pglwgeom_has_bbox, pglwgeom_has_z, pglwgeom_has_m
authorPaul Ramsey <pramsey@cleverelephant.ca>
Sat, 29 Oct 2011 00:58:06 +0000 (00:58 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Sat, 29 Oct 2011 00:58:06 +0000 (00:58 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8039 b70326c6-7e19-0410-871a-916f4a2858ee

libpgcommon/lwgeom_pg.c
libpgcommon/lwgeom_pg.h
postgis/lwgeom_functions_basic.c
postgis/lwgeom_functions_lrs.c
postgis/lwgeom_geos.c
postgis/lwgeom_gist.c
postgis/lwgeom_inout.c
postgis/lwgeom_ogc.c

index 02c37b61a5f3a45171752f81a5dade6da15b3b69..115f19e7ca61e93372dbd62cb78e827b2ea33668 100644 (file)
@@ -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);
index 55723e9368302df5bff629c10c9150a5b5347ca0..b0847d66ebfd422a3ae46c8e88e627d17ad9d1b0 100644 (file)
@@ -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.
index bfc4763a1e0576398fcd552170e977bb771d155e..6b0fb384f961386632d7163ec8d3d5929e2a91d7 100644 (file)
@@ -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);
 }
index 6e41b821c39f9da781d0cd8e0d9211ee8f6edf4d..a240b734ac2ac06beb4754efe82fbca9d31ca6e8 100644 (file)
@@ -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 )
index 5e1c4ccc202d5e285354910f6027d2218ecf41b9..c5d2316b9fe2b31392e204053bd37cde58786754 100644 (file)
@@ -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)
        {
index a5fd1a50fa6bce1c5284c8daa2f97e055d4315f2..f3fe68b2761bc61b2a345f37e0f39b37b32d7b97 100644 (file)
@@ -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);
        }
index dd5c59ac4392b93ab0ac86b6f0a7ade30be72899..62c202ae547c174f83e4705610368a5cdd3f4723 100644 (file)
@@ -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));
index 0e37f1f7a63ad4f256aafe59c9d7648767cdac09..78fea64ea57abf089361a8eccad090b090c6c067 100644 (file)
@@ -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");
        }