PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum LWGEOM_affine ( PG_FUNCTION_ARGS  )

Definition at line 2523 of file lwgeom_functions_basic.c.

References AFFINE::afac, LWGEOM::bbox, AFFINE::bfac, AFFINE::cfac, AFFINE::dfac, AFFINE::efac, AFFINE::ffac, geometry_serialize(), AFFINE::gfac, AFFINE::hfac, AFFINE::ifac, lwgeom_add_bbox(), lwgeom_affine(), lwgeom_drop_bbox(), lwgeom_free(), lwgeom_from_gserialized(), AFFINE::xoff, AFFINE::yoff, and AFFINE::zoff.

2524 {
2525  GSERIALIZED *geom = (GSERIALIZED *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
2526  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
2527  GSERIALIZED *ret;
2528  AFFINE affine;
2529 
2530  affine.afac = PG_GETARG_FLOAT8(1);
2531  affine.bfac = PG_GETARG_FLOAT8(2);
2532  affine.cfac = PG_GETARG_FLOAT8(3);
2533  affine.dfac = PG_GETARG_FLOAT8(4);
2534  affine.efac = PG_GETARG_FLOAT8(5);
2535  affine.ffac = PG_GETARG_FLOAT8(6);
2536  affine.gfac = PG_GETARG_FLOAT8(7);
2537  affine.hfac = PG_GETARG_FLOAT8(8);
2538  affine.ifac = PG_GETARG_FLOAT8(9);
2539  affine.xoff = PG_GETARG_FLOAT8(10);
2540  affine.yoff = PG_GETARG_FLOAT8(11);
2541  affine.zoff = PG_GETARG_FLOAT8(12);
2542 
2543  POSTGIS_DEBUG(2, "LWGEOM_affine called.");
2544 
2545  lwgeom_affine(lwgeom, &affine);
2546 
2547  /* COMPUTE_BBOX TAINTING */
2548  if ( lwgeom->bbox )
2549  {
2550  lwgeom_drop_bbox(lwgeom);
2551  lwgeom_add_bbox(lwgeom);
2552  }
2553  ret = geometry_serialize(lwgeom);
2554 
2555  /* Release memory */
2556  lwgeom_free(lwgeom);
2557  PG_FREE_IF_COPY(geom, 0);
2558 
2559  PG_RETURN_POINTER(ret);
2560 }
GBOX * bbox
Definition: liblwgeom.h:354
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
double zoff
Definition: liblwgeom.h:226
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
Definition: lwgeom.c:542
double ifac
Definition: liblwgeom.h:226
double ffac
Definition: liblwgeom.h:226
double xoff
Definition: liblwgeom.h:226
double afac
Definition: liblwgeom.h:226
LWGEOM * geom
double cfac
Definition: liblwgeom.h:226
double dfac
Definition: liblwgeom.h:226
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
double efac
Definition: liblwgeom.h:226
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:555
double yoff
Definition: liblwgeom.h:226
double gfac
Definition: liblwgeom.h:226
double hfac
Definition: liblwgeom.h:226
double bfac
Definition: liblwgeom.h:226
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1611

Here is the call graph for this function: