]> granicus.if.org Git - postgis/commitdiff
Had translate compute bbox cache translating input one if present.
authorSandro Santilli <strk@keybit.net>
Wed, 5 Jan 2005 22:48:29 +0000 (22:48 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 5 Jan 2005 22:48:29 +0000 (22:48 +0000)
Cleanups.

git-svn-id: http://svn.osgeo.org/postgis/trunk@1224 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/BBOXCACHE_BEHAVIOURS
lwgeom/lwgeom_functions_basic.c
lwgeom/lwgeom_transform.c

index eed4d6d3800202b6beb77a4855e4bc02afc9142b..5ea3ca502a575d0bf98aa76e124d78773b3927c1 100644 (file)
@@ -78,10 +78,8 @@ section also use it.
        simplify(geometry, float8) *LWG*
 
        #### could use WHEN_SIMPLE
-       #### translating and transforming an eventually present
-       #### bbox cache in input
-       translate(geometry,float8,float8,[float8]) *SRL*
-       transform(geometry,integer) *SRL*
+       #### transforming an eventually present bbox cache in input
+       transform(geometry,integer) **SRL**
 
 [ WHEN_SIMPLE (use input bbox if present) ]
        noop(geometry) *LWG*
@@ -101,10 +99,11 @@ section also use it.
        collect(geometry, geometry) *LWG*
        collect_garray (geometry[]) *LWG*
 
-       ## apply grid to eventually present box in input
-       apply_grid(geometry, float8, float8, float8, float8);
+       ## transform eventually present box in input
+       apply_grid(geometry, float8, float8, float8, float8); *LWG*
+       translate(geometry,float8,float8,[float8]) **SRL**
 
-       ## These use LWGEOM as a mean to access and modigy SERIALIZED form
+       ## These use LWGEOM as a mean to access and modify SERIALIZED form
        reverse(geometry) *LWG* **SRL**
        ForceRHR(geometry) *LWG* **SRL**
 
index d83c7ad900d31efae9d1c4224196581c294a6429..8f7676bbae1291fa26f5792e865184d4f7a7f66b 100644 (file)
@@ -1479,8 +1479,8 @@ PG_FUNCTION_INFO_V1(LWGEOM_translate);
 Datum LWGEOM_translate(PG_FUNCTION_ARGS)
 {
        PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
-       PG_LWGEOM *oldgeom;
        char *srl = SERIALIZED_FORM(geom);
+       BOX2DFLOAT4 *box;
 
        double xoff =  PG_GETARG_FLOAT8(1);
        double yoff =  PG_GETARG_FLOAT8(2);
@@ -1488,14 +1488,13 @@ Datum LWGEOM_translate(PG_FUNCTION_ARGS)
 
        lwgeom_translate_recursive(srl, xoff, yoff, zoff);
 
-       if ( TYPE_HASBBOX(geom->type) ) 
+       /* COMPUTE_BBOX WHEN_SIMPLE */
+       if ( (box = getbox2d_internal(srl)) )
        {
-               if ( ! compute_serialized_bbox_p(srl, getbox2d_internal(srl)) )
-               {
-                       oldgeom = geom;
-                       geom = PG_LWGEOM_construct(srl, pglwgeom_getSRID(geom), 0);
-                       lwfree(oldgeom);
-               }
+               box->xmin += xoff;
+               box->xmax += xoff;
+               box->ymin += yoff;
+               box->ymax += yoff;
        }
 
        PG_RETURN_POINTER(geom);
index 3dfec6af03a482dc35a7f1876998ade7562f77fd..650ca35db96705816ed9853425e8d9328e23b768 100644 (file)
@@ -301,17 +301,16 @@ Datum transform_geom(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
        }
 
-       //great, now we have a geometry, and input/output PJ* structs. 
-       //Excellent.
+       /* now we have a geometry, and input/output PJ structs. */
        lwgeom_transform_recursive(SERIALIZED_FORM(result),
                input_pj, output_pj);
 
-       // clean up
+       /* clean up */
        pj_free(input_pj);
        pj_free(output_pj);
        pfree(input_proj4); pfree(output_proj4);
 
-       // Compute bbox if input had one
+       /* Compute bbox if input had one */
        if ( TYPE_HASBBOX(result->type) ) 
        {
                srl = SERIALIZED_FORM(result);