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*
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**
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);
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);
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);