PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_affine()

Datum LWGEOM_affine ( PG_FUNCTION_ARGS  )

Definition at line 2482 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().

2483 {
2484  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P_COPY(0);
2485  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
2486  GSERIALIZED *ret;
2487  AFFINE affine;
2488 
2489  affine.afac = PG_GETARG_FLOAT8(1);
2490  affine.bfac = PG_GETARG_FLOAT8(2);
2491  affine.cfac = PG_GETARG_FLOAT8(3);
2492  affine.dfac = PG_GETARG_FLOAT8(4);
2493  affine.efac = PG_GETARG_FLOAT8(5);
2494  affine.ffac = PG_GETARG_FLOAT8(6);
2495  affine.gfac = PG_GETARG_FLOAT8(7);
2496  affine.hfac = PG_GETARG_FLOAT8(8);
2497  affine.ifac = PG_GETARG_FLOAT8(9);
2498  affine.xoff = PG_GETARG_FLOAT8(10);
2499  affine.yoff = PG_GETARG_FLOAT8(11);
2500  affine.zoff = PG_GETARG_FLOAT8(12);
2501 
2502  POSTGIS_DEBUG(2, "LWGEOM_affine called.");
2503 
2504  lwgeom_affine(lwgeom, &affine);
2505 
2506  /* COMPUTE_BBOX TAINTING */
2507  if ( lwgeom->bbox )
2508  {
2509  lwgeom_drop_bbox(lwgeom);
2510  lwgeom_add_bbox(lwgeom);
2511  }
2512  ret = geometry_serialize(lwgeom);
2513 
2514  /* Release memory */
2515  lwgeom_free(lwgeom);
2516  PG_FREE_IF_COPY(geom, 0);
2517 
2518  PG_RETURN_POINTER(ret);
2519 }
GBOX * bbox
Definition: liblwgeom.h:398
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
double zoff
Definition: liblwgeom.h:270
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
Definition: lwgeom.c:635
double ifac
Definition: liblwgeom.h:270
double ffac
Definition: liblwgeom.h:270
double xoff
Definition: liblwgeom.h:270
double afac
Definition: liblwgeom.h:270
LWGEOM * geom
double cfac
Definition: liblwgeom.h:270
double dfac
Definition: liblwgeom.h:270
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
double efac
Definition: liblwgeom.h:270
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:648
double yoff
Definition: liblwgeom.h:270
double gfac
Definition: liblwgeom.h:270
double hfac
Definition: liblwgeom.h:270
double bfac
Definition: liblwgeom.h:270
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1735
Here is the call graph for this function:
Here is the caller graph for this function: