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

Definition at line 421 of file postgis/lwgeom_sfcgal.c.

References gserialized_get_srid(), POSTGIS2SFCGALGeometry(), result, sfcgal_postgis_init(), and SFCGALGeometry2POSTGIS().

422 {
423  GSERIALIZED *input0, *input1, *output;
424  sfcgal_geometry_t *geom0, *geom1;
425  sfcgal_geometry_t *result;
426  srid_t srid;
427 
429 
430  input0 = (GSERIALIZED*) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
431  srid = gserialized_get_srid(input0);
432  input1 = (GSERIALIZED*) PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
433  geom0 = POSTGIS2SFCGALGeometry(input0);
434  PG_FREE_IF_COPY(input0, 0);
435  geom1 = POSTGIS2SFCGALGeometry(input1);
436  PG_FREE_IF_COPY(input1, 1);
437 
438  result = sfcgal_geometry_intersection(geom0, geom1);
439  sfcgal_geometry_delete(geom0);
440  sfcgal_geometry_delete(geom1);
441 
442  output = SFCGALGeometry2POSTGIS(result, 0, srid);
443  sfcgal_geometry_delete(result);
444 
445  PG_RETURN_POINTER(output);
446 }
sfcgal_geometry_t * POSTGIS2SFCGALGeometry(GSERIALIZED *pglwgeom)
GSERIALIZED * SFCGALGeometry2POSTGIS(const sfcgal_geometry_t *geom, int force3D, int SRID)
char ** result
Definition: liblwgeom.h:218
void sfcgal_postgis_init(void)
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: g_serialized.c:70

Here is the call graph for this function: