PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ LWGEOM_affine()

Datum LWGEOM_affine ( PG_FUNCTION_ARGS  )

Definition at line 2454 of file lwgeom_functions_basic.c.

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

Referenced by optimistic_overlap().

2455 {
2456  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P_COPY(0);
2457  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
2458  GSERIALIZED *ret;
2459  AFFINE affine;
2460 
2461  affine.afac = PG_GETARG_FLOAT8(1);
2462  affine.bfac = PG_GETARG_FLOAT8(2);
2463  affine.cfac = PG_GETARG_FLOAT8(3);
2464  affine.dfac = PG_GETARG_FLOAT8(4);
2465  affine.efac = PG_GETARG_FLOAT8(5);
2466  affine.ffac = PG_GETARG_FLOAT8(6);
2467  affine.gfac = PG_GETARG_FLOAT8(7);
2468  affine.hfac = PG_GETARG_FLOAT8(8);
2469  affine.ifac = PG_GETARG_FLOAT8(9);
2470  affine.xoff = PG_GETARG_FLOAT8(10);
2471  affine.yoff = PG_GETARG_FLOAT8(11);
2472  affine.zoff = PG_GETARG_FLOAT8(12);
2473 
2474  POSTGIS_DEBUG(2, "LWGEOM_affine called.");
2475 
2476  lwgeom_affine(lwgeom, &affine);
2477 
2478  /* COMPUTE_BBOX TAINTING */
2479  if ( lwgeom->bbox )
2480  {
2481  lwgeom_drop_bbox(lwgeom);
2482  lwgeom_add_bbox(lwgeom);
2483  }
2484  ret = geometry_serialize(lwgeom);
2485 
2486  /* Release memory */
2487  lwgeom_free(lwgeom);
2488  PG_FREE_IF_COPY(geom, 0);
2489 
2490  PG_RETURN_POINTER(ret);
2491 }
GBOX * bbox
Definition: liblwgeom.h:382
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
double zoff
Definition: liblwgeom.h:254
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
Definition: lwgeom.c:586
double ifac
Definition: liblwgeom.h:254
double ffac
Definition: liblwgeom.h:254
double xoff
Definition: liblwgeom.h:254
double afac
Definition: liblwgeom.h:254
LWGEOM * geom
double cfac
Definition: liblwgeom.h:254
double dfac
Definition: liblwgeom.h:254
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
double efac
Definition: liblwgeom.h:254
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:599
double yoff
Definition: liblwgeom.h:254
double gfac
Definition: liblwgeom.h:254
double hfac
Definition: liblwgeom.h:254
double bfac
Definition: liblwgeom.h:254
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1691
Here is the call graph for this function:
Here is the caller graph for this function: