add sfcgal_full_version

master
Loïc Bartoletti 2021-11-15 14:15:46 +01:00 committed by Regina Obe
parent 187152efe0
commit 1b2c2bbb50
7 changed files with 83 additions and 1 deletions

View File

@ -33,15 +33,56 @@
<refsection>
<title>Description</title>
<para>Returns the version of SFCGAL in use</para>
<para>Availability: 2.1.0</para>
<para>&sfcgal_required;</para>
<para>&Z_support;</para>
<para>&P_support;</para>
<para>&T_support;</para>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="postgis_sfcgal_full_version" /></para>
</refsection>
</refentry>
<refentry id="postgis_sfcgal_full_version">
<refnamediv>
<refname>postgis_sfcgal_full_version</refname>
<refpurpose>Returns the full version of SFCGAL in use including CGAL and Boost versions</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
<funcdef>text <function>postgis_sfcgal_full_version</function></funcdef>
<void/>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsection>
<title>Description</title>
<para>Returns the full version of SFCGAL in use including CGAL and Boost versions</para>
<para>Availability: 3.2.0</para>
<para>&sfcgal_required;</para>
<para>&Z_support;</para>
<para>&P_support;</para>
<para>&T_support;</para>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="postgis_sfcgal_version" /></para>
</refsection>
</refentry>
<refentry id="ST_Extrude">
<refnamediv>

View File

@ -23,6 +23,7 @@
**********************************************************************/
#include "lwgeom_sfcgal.h"
#include <stdio.h>
static int SFCGAL_type_to_lwgeom_type(sfcgal_geometry_type_t type);
static POINTARRAY *ptarray_from_SFCGAL(const sfcgal_geometry_t *geom, int force3D);
@ -36,6 +37,20 @@ lwgeom_sfcgal_version()
return version;
}
#define MAX_LENGTH_SFCGAL_FULL_VERSION 50
/* Return SFCGAL full version string */
const char *
lwgeom_sfcgal_full_version()
{
#if POSTGIS_SFCGAL_VERSION >= 10400
const char *version = sfcgal_full_version();
#else
char *version = (char*)malloc(MAX_LENGTH_SFCGAL_FULL_VERSION);
snprintf(version, MAX_LENGTH_SFCGAL_FULL_VERSION, "SFCGAL=\"%s\" CGAL=\"Unknown\" Boost=\"Unknown\"", sfcgal_version());
#endif
return version;
}
/*
* Mapping between SFCGAL and PostGIS types
*

View File

@ -28,6 +28,9 @@
/* return SFCGAL version string */
const char *lwgeom_sfcgal_version(void);
/* return SFCGAL full version string */
const char *lwgeom_sfcgal_full_version(void);
/* Convert SFCGAL structure to lwgeom PostGIS */
LWGEOM *SFCGAL2LWGEOM(const sfcgal_geometry_t *geom, int force3D, int32_t SRID);

View File

@ -3076,7 +3076,7 @@ BEGIN
RAISE DEBUG 'Function postgis_gdal_version() not found. Is raster support enabled and rtpostgis.sql installed?';
END;
BEGIN
SELECT @extschema@.postgis_sfcgal_version() INTO sfcgalver;
SELECT @extschema@.postgis_sfcgal_full_version() INTO sfcgalver;
BEGIN
SELECT @extschema@.postgis_sfcgal_scripts_installed() INTO sfcgal_scr_ver;
EXCEPTION

View File

@ -16,6 +16,8 @@ BEGIN;
DROP FUNCTION IF EXISTS postgis_sfcgal_version();
DROP FUNCTION IF EXISTS postgis_sfcgal_full_version();
DROP FUNCTION IF EXISTS ST_3DIntersection(geom1 geometry, geom2 geometry);
DROP FUNCTION IF EXISTS ST_Tesselate(geometry);

View File

@ -99,6 +99,10 @@ handleInterrupt(int sig)
Datum postgis_sfcgal_version(PG_FUNCTION_ARGS);
#if POSTGIS_SFCGAL_VERSION >= 10400
Datum postgis_sfcgal_full_version(PG_FUNCTION_ARGS);
#endif
Datum sfcgal_from_ewkt(PG_FUNCTION_ARGS);
Datum sfcgal_area3D(PG_FUNCTION_ARGS);
Datum sfcgal_intersection3D(PG_FUNCTION_ARGS);
@ -562,6 +566,16 @@ Datum postgis_sfcgal_version(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(result);
}
#if POSTGIS_SFCGAL_VERSION >= 10400
PG_FUNCTION_INFO_V1(postgis_sfcgal_full_version);
Datum postgis_sfcgal_full_version(PG_FUNCTION_ARGS)
{
const char *ver = lwgeom_sfcgal_full_version();
text *result = cstring_to_text(ver);
PG_RETURN_POINTER(result);
}
#endif
PG_FUNCTION_INFO_V1(sfcgal_is_solid);
Datum sfcgal_is_solid(PG_FUNCTION_ARGS)
{

View File

@ -27,6 +27,13 @@ CREATE OR REPLACE FUNCTION postgis_sfcgal_version() RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE 'c' IMMUTABLE;
#if POSTGIS_SFCGAL_VERSION >= 10400
-- Availability: 3.2.0
CREATE OR REPLACE FUNCTION postgis_sfcgal_full_version() RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE 'c' IMMUTABLE;
#endif
-- Availability: 3.0.0
CREATE OR REPLACE FUNCTION postgis_sfcgal_noop(geometry)
RETURNS geometry