From d12b8fccf1b2dc4e8bef06339ffd780b0d62f53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bartoletti?= Date: Wed, 28 Feb 2024 15:39:13 +0100 Subject: [PATCH] expose vtk method to capi --- src/capi/sfcgal_c.cpp | 8 ++++++++ src/capi/sfcgal_c.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/capi/sfcgal_c.cpp b/src/capi/sfcgal_c.cpp index 8a1dc6d4..d5178cea 100644 --- a/src/capi/sfcgal_c.cpp +++ b/src/capi/sfcgal_c.cpp @@ -23,6 +23,7 @@ #include "SFCGAL/io/ewkt.h" #include "SFCGAL/io/wkb.h" #include "SFCGAL/io/wkt.h" +#include "SFCGAL/io/vtk.h" #if !_MSC_VER #include "SFCGAL/algorithm/alphaShapes.h" @@ -280,6 +281,13 @@ sfcgal_geometry_as_wkb(const sfcgal_geometry_t *pgeom, char **buffer, strncpy(*buffer, wkb.c_str(), *len);) } +extern "C" void +sfcgal_geometry_as_vtk(const sfcgal_geometry_t *pgeom, char *filename) +{ + SFCGAL_GEOMETRY_CONVERT_CATCH_TO_ERROR_NO_RET( + io::vtk(*reinterpret_cast(pgeom), filename);) +} + /** * Point */ diff --git a/src/capi/sfcgal_c.h b/src/capi/sfcgal_c.h index 7e5a5fa7..3d404f2c 100644 --- a/src/capi/sfcgal_c.h +++ b/src/capi/sfcgal_c.h @@ -170,6 +170,13 @@ sfcgal_geometry_as_text_decim(const sfcgal_geometry_t *, int numDecimals, SFCGAL_API void sfcgal_geometry_as_wkb(const sfcgal_geometry_t *, char **buffer, size_t *len); +/** + * Creates a VTK file of the given geometry + * @ingroup capi + */ +SFCGAL_API void +sfcgal_geometry_as_vtk(const sfcgal_geometry_t *, char *filename); + /** * Creates an empty point * @ingroup capi