PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ sfcgal_approximate_medial_axis()

Datum sfcgal_approximate_medial_axis ( PG_FUNCTION_ARGS  )

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

440 {
441 #if POSTGIS_SFCGAL_VERSION < 12
442  lwpgerror("The SFCGAL version this PostGIS binary "
443  "was compiled against (%d) doesn't support "
444  "'sfcgal_geometry_approximate_medial_axis' function (1.2.0+ required)",
446  PG_RETURN_NULL();
447 #else /* POSTGIS_SFCGAL_VERSION >= 12 */
448  GSERIALIZED *input, *output;
449  sfcgal_geometry_t *geom;
450  sfcgal_geometry_t *result;
451  srid_t srid;
452 
454 
455  input = PG_GETARG_GSERIALIZED_P(0);
456  srid = gserialized_get_srid(input);
457  geom = POSTGIS2SFCGALGeometry(input);
458  PG_FREE_IF_COPY(input, 0);
459 
460  result = sfcgal_geometry_approximate_medial_axis(geom);
461  sfcgal_geometry_delete(geom);
462 
463  output = SFCGALGeometry2POSTGIS(result, 0, srid);
464  sfcgal_geometry_delete(result);
465 
466  PG_RETURN_POINTER(output);
467 #endif /* POSTGIS_SFCGAL_VERSION >= 12 */
468 }
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:100
sfcgal_geometry_t * POSTGIS2SFCGALGeometry(GSERIALIZED *pglwgeom)
void sfcgal_postgis_init(void)
GSERIALIZED * SFCGALGeometry2POSTGIS(const sfcgal_geometry_t *geom, int force3D, int SRID)
#define POSTGIS_SFCGAL_VERSION
Definition: sqldefines.h:14

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

Here is the call graph for this function: