Skip to content
10 changes: 10 additions & 0 deletions capi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ set(VERSION_MAJOR ${GEOS_VERSION_MAJOR})
set(VERSION_MINOR ${GEOS_VERSION_MINOR})
set(VERSION_PATCH ${GEOS_VERSION_PATCH})

set(INPUT_CURVES_CONVERTED_TO_LINES "This function does not support curved types directly. If curve-to-line
* conversion parameters are registered with the context, curved
* inputs will be automatically converted to lines. Otherwise, the
* operation will fail.")
set(OUTPUT_LINES_CONVERTED_TO_CURVES "This function outputs linear geometry types only. If line-to-curve
* conversion parameters are registered with the context, and a
* curved input was provided, outputs will be automatically
* converted to curved types.")


configure_file(
${CMAKE_CURRENT_LIST_DIR}/geos_c.h.in
${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
Expand Down
63 changes: 63 additions & 0 deletions capi/geos_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*
***********************************************************************/

#include <geos/algorithm/CurveToLineParams.h>
#include <geos/algorithm/LineToCurveParams.h>
#include <geos/geom/prep/PreparedGeometryFactory.h>
#include <geos/index/strtree/TemplateSTRtree.h>
#include <geos/io/WKTReader.h>
Expand Down Expand Up @@ -43,7 +45,9 @@
#define GEOSPreparedGeometry geos::geom::prep::PreparedGeometry
#define GEOSClusterInfo geos::operation::cluster::Clusters
#define GEOSCoordSequence geos::geom::CoordinateSequence
#define GEOSCurveToLineParams geos::algorithm::CurveToLineParams
#define GEOSBufferParams geos::operation::buffer::BufferParameters
#define GEOSLineToCurveParams geos::algorithm::LineToCurveParams
#define GEOSSTRtree geos::index::strtree::TemplateSTRtree<void*>
#define GEOSWKTReader geos::io::WKTReader
#define GEOSWKTWriter geos::io::WKTWriter
Expand Down Expand Up @@ -217,6 +221,65 @@ extern "C" {
return GEOSCoveredBy_r(handle, g1, g2);
}

GEOSCurveToLineParams*
GEOSCurveToLineParams_create()
{
return new geos::algorithm::CurveToLineParams;
}

int
GEOSCurveToLineParams_setTolerance(GEOSCurveToLineParams* params, int toleranceType, double toleranceValue)
{
return GEOSCurveToLineParams_setTolerance_r(handle, params, toleranceType, toleranceValue);
}

void
GEOSCurveToLineParams_destroy(GEOSCurveToLineParams* params)
{
delete params;
}

GEOSGeometry*
GEOSCurveToLine(const GEOSGeometry* g, const GEOSCurveToLineParams* params)
{
return GEOSCurveToLine_r(handle, g, params);
}

GEOSGeometry*
GEOSLineToCurve(const GEOSGeometry* g, const GEOSLineToCurveParams* params)
{
return GEOSLineToCurve_r(handle, g, params);
}

GEOSLineToCurveParams*
GEOSLineToCurveParams_create()
{
return new geos::algorithm::LineToCurveParams;
}

void
GEOSLineToCurveParams_destroy(GEOSLineToCurveParams* params)
{
delete params;
}

int
GEOSLineToCurveParams_setRadiusTolerance(GEOSLineToCurveParams* params, double tolerance)
{
return GEOSLineToCurveParams_setRadiusTolerance_r(handle, params, tolerance);
}

int
GEOSLineToCurveParams_setMaxStepDegrees(GEOSLineToCurveParams* params, double tolerance)
{
return GEOSLineToCurveParams_setMaxStepDegrees_r(handle, params, tolerance);
}

int
GEOSLineToCurveParams_setMaxAngleDifferenceDegrees(GEOSLineToCurveParams* params, double tolerance)
{
return GEOSLineToCurveParams_setMaxAngleDifferenceDegrees_r(handle, params, tolerance);
}

//-------------------------------------------------------------------
// low-level relate functions
Expand Down
Loading
Loading