[SCM] PostGIS branch master updated. 3.4.0rc1-773-g1c83391c6

git at osgeo.org git at osgeo.org
Tue Nov 14 22:04:45 PST 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  1c83391c6daec3651986813b7757549595ecb4e9 (commit)
       via  bb0793c7564bf0d37e42e98aa58d0e95aba34e23 (commit)
       via  50c097704b14f9b1ad87b3fffa3676e1ad35d143 (commit)
       via  6a9186c0775f6d18b2e20a616052cfe916e9b8f7 (commit)
       via  b7b285818894520d7a729c54bd502ac5d8e73ba7 (commit)
       via  21d70dbde72a5b9e6b0b017f5ed10ef409a28bb2 (commit)
      from  dc000e90e42a2cd85cef46ecb12b82c41f5d1a16 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1c83391c6daec3651986813b7757549595ecb4e9
Merge: dc000e90e bb0793c75
Author: Regina Obe <lr at pcorp.us>
Date:   Tue Nov 14 22:04:42 2023 -0800

    Merge pull request '[SFCGAL]: Add CG_Visibility' (!156) from lbartoletti/postgis:sfcgal_visibility into master
    
    Reviewed-on: https://git.osgeo.org/gitea/postgis/postgis/pulls/156


commit bb0793c7564bf0d37e42e98aa58d0e95aba34e23
Author: Loïc Bartoletti <loic.bartoletti at oslandia.com>
Date:   Tue Nov 14 14:39:57 2023 +0100

    NEWS: reorder and add gt-number

diff --git a/NEWS b/NEWS
index b08a8c6a0..9d4d58615 100644
--- a/NEWS
+++ b/NEWS
@@ -27,8 +27,8 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.5.0+ is needed.
            error with <> and != (Paul Ramsey)
   - Add ST_HasZ/ST_HasM (Loïc Bartoletti)
   - GT-123, postgis_sfcgal: CG_YMonotonePartition, CG_ApproxConvexPartition, CG_GreeneApproxConvexPartition and CG_OptimalConvexPartition (Loïc Bartoletti)
+  - GT-156, postgis_sfcgal: CG_Visibility (Loïc Bartoletti)
   - GT-157, postgis_sfcgal: Add ST_ExtrudeStraightSkeleton (Loïc Bartoletti)
-  - postgis_sfcgal: CG_Visibility (Loïc Bartoletti)
 
 * Enhancements *
 

commit 50c097704b14f9b1ad87b3fffa3676e1ad35d143
Author: Loïc Bartoletti <loic.bartoletti at oslandia.com>
Date:   Fri Nov 10 11:41:51 2023 +0100

    doc: fix documentation parameters

diff --git a/doc/reference_sfcgal.xml b/doc/reference_sfcgal.xml
index d9b91a1a0..6e30119ff 100644
--- a/doc/reference_sfcgal.xml
+++ b/doc/reference_sfcgal.xml
@@ -1393,14 +1393,14 @@ MULTIPOLYGON(
             <funcsynopsis>
                 <funcprototype>
                     <funcdef>geometry <function>CG_Visibility</function></funcdef>
-                    <paramdef><type>polygon</type> <parameter>geom</parameter></paramdef>
-                    <paramdef><type>point</type> <parameter>geom</parameter></paramdef>
+                    <paramdef><type>geometry</type> <parameter>polygon</parameter></paramdef>
+                    <paramdef><type>geometry</type> <parameter>point</parameter></paramdef>
                 </funcprototype>
                 <funcprototype>
                     <funcdef>geometry <function>CG_Visibility</function></funcdef>
-                    <paramdef><type>polygon</type> <parameter>geom</parameter></paramdef>
-                    <paramdef><type>point1</type> <parameter>geom</parameter></paramdef>
-                    <paramdef><type>point2</type> <parameter>geom</parameter></paramdef>
+                    <paramdef><type>geometry</type> <parameter>polygon</parameter></paramdef>
+                    <paramdef><type>geometry</type> <parameter>pointA</parameter></paramdef>
+                    <paramdef><type>geometry</type> <parameter>pointB</parameter></paramdef>
                 </funcprototype>
             </funcsynopsis>
         </refsynopsisdiv>
@@ -1408,7 +1408,7 @@ MULTIPOLYGON(
         <refsection>
             <title>Description</title>
 
-            <para role="availability" conformance="3.5.0">Availability: 3.5.0</para>
+            <para role="availability" conformance="3.5.0">Availability: 3.5.0 - requires SFCGAL >= 1.5.0.</para>
             <para>&sfcgal_required;</para>
             <para>&Z_support;</para>
             <para>&P_support;</para>
@@ -1511,7 +1511,6 @@ MULTIPOLYGON(
 
 	</refentry>
 
-<<<<<<< HEAD
     <refentry xml:id="CG_YMonotonePartition">
 	  <refnamediv>
 		<refname>CG_YMonotonePartition</refname>
@@ -1774,79 +1773,4 @@ MULTIPOLYGON(
 
 	</refentry>
 
-    <refentry xml:id="ST_Visibility">
-        <refnamediv>
-            <refname>ST_Visibility</refname>
-
-            <refpurpose>Compute a visibility polygon from a point or a segment in a polygon geometry</refpurpose>
-        </refnamediv>
-
-        <refsynopsisdiv>
-            <funcsynopsis>
-                <funcprototype>
-                    <funcdef>geometry <function>ST_Visibility</function></funcdef>
-                    <paramdef><type>polygon</type> <parameter>geom</parameter></paramdef>
-                    <paramdef><type>point</type> <parameter>geom</parameter></paramdef>
-                </funcprototype>
-                <funcprototype>
-                    <funcdef>geometry <function>ST_Visibility</function></funcdef>
-                    <paramdef><type>polygon</type> <parameter>geom</parameter></paramdef>
-                    <paramdef><type>point1</type> <parameter>geom</parameter></paramdef>
-                    <paramdef><type>point2</type> <parameter>geom</parameter></paramdef>
-                </funcprototype>
-            </funcsynopsis>
-        </refsynopsisdiv>
-
-        <refsection>
-            <title>Description</title>
-
-            <para role="availability" conformance="3.5.0">Availability: 3.5.0</para>
-            <para>&sfcgal_required;</para>
-            <para>&Z_support;</para>
-            <para>&P_support;</para>
-            <para>&T_support;</para>
-        </refsection>
-
-        <refsection><title>Examples</title>
-            <programlisting>SELECT ST_Visibility('Polygon ((1981593 5199143, 1981593 5199284, 1981737 5199284, 1981737 5199143, 1981593 5199143),(1981674 5199213, 1981674 5199155, 1981720 5199156, 1981719 5199214, 1981674 5199213),(1981673 5199269, 1981673 5199221, 1981700 5199222, 1981698 5199241, 1981708 5199241, 1981708 5199223, 1981718 5199224, 1981716 5199277, 1981673 5199269),(1981610 5199211, 1981610 5199154, 1981667 5199155, 1981665 5199185, 1981646 5199185, 1981645 5199212, 1981610 5199211),(1981608 5199262, 1981609 5199219, 1981664 5199221, 1981662 5199264, 1981608 5199262))'::geometry, 'Point (1981658 5199203)');</programlisting>
-
-            <programlisting>SELECT ST_Visibility('Polygon ((1981593 5199143, 1981593 5199284, 1981737 5199284, 1981737 5199143, 1981593 5199143),(1981674 5199213, 1981674 5199155, 1981720 5199156, 1981719 5199214, 1981674 5199213),(1981673 5199269, 1981673 5199221, 1981700 5199222, 1981698 5199241, 1981708 5199241, 1981708 5199223, 1981718 5199224, 1981716 5199277, 1981673 5199269),(1981610 5199211, 1981610 5199154, 1981667 5199155, 1981665 5199185, 1981646 5199185, 1981645 5199212, 1981610 5199211),(1981608 5199262, 1981609 5199219, 1981664 5199221, 1981662 5199264, 1981608 5199262))'::geometry,'Point (1981646 5199185)'::geometry, 'Point (1981665 5199185)');</programlisting>
-            <informaltable>
-                <tgroup cols="3">
-                    <tbody>
-                        <row>
-                            <entry><para><informalfigure>
-                                        <mediaobject>
-                                            <imageobject>
-                                                <imagedata fileref="images/st_visibility01.png"/>
-                                            </imageobject>
-                                            <caption><para>Original polygon</para></caption>
-                                        </mediaobject>
-                                </informalfigure></para>
-                            </entry>
-                            <entry><para><informalfigure>
-                                        <mediaobject>
-                                            <imageobject>
-                                                <imagedata fileref="images/st_visibility02.png"/>
-                                            </imageobject>
-                                            <caption><para>Visibility from the point</para></caption>
-                                        </mediaobject>
-                                </informalfigure></para>
-                            </entry>
-                            <entry><para><informalfigure>
-                                        <mediaobject>
-                                            <imageobject>
-                                                <imagedata fileref="images/st_visibility03.png"/>
-                                            </imageobject>
-                                            <caption><para>Visibility from the segment</para></caption>
-                                        </mediaobject>
-                                </informalfigure></para>
-                            </entry>
-                        </row>
-                    </tbody>
-                </tgroup>
-            </informaltable>
-        </refsection>
-
-    </refentry>
 </section>
diff --git a/sfcgal/sfcgal.sql.in b/sfcgal/sfcgal.sql.in
index 769a0ca83..7d64ee3c1 100644
--- a/sfcgal/sfcgal.sql.in
+++ b/sfcgal/sfcgal.sql.in
@@ -239,7 +239,7 @@ CREATE OR REPLACE FUNCTION CG_Visibility(polygon geometry, pointA geometry, poin
 COMMIT;
 
 -- Availability: 3.5.0
-CREATE OR REPLACE FUNCTION ST_Visibility(polygon geometry, point geometry)
+CREATE OR REPLACE FUNCTION CG_Visibility(polygon geometry, point geometry)
        RETURNS geometry
        AS 'MODULE_PATHNAME', 'sfcgal_visibility_point'
        LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE

commit 6a9186c0775f6d18b2e20a616052cfe916e9b8f7
Author: Loïc Bartoletti <loic.bartoletti at oslandia.com>
Date:   Fri Nov 10 07:01:12 2023 +0100

    Rename to CG_Visibility

diff --git a/NEWS b/NEWS
index b56cb892a..b08a8c6a0 100644
--- a/NEWS
+++ b/NEWS
@@ -28,7 +28,7 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.5.0+ is needed.
   - Add ST_HasZ/ST_HasM (Loïc Bartoletti)
   - GT-123, postgis_sfcgal: CG_YMonotonePartition, CG_ApproxConvexPartition, CG_GreeneApproxConvexPartition and CG_OptimalConvexPartition (Loïc Bartoletti)
   - GT-157, postgis_sfcgal: Add ST_ExtrudeStraightSkeleton (Loïc Bartoletti)
-  - postgis_sfcgal: ST_Visibility (Loïc Bartoletti)
+  - postgis_sfcgal: CG_Visibility (Loïc Bartoletti)
 
 * Enhancements *
 
diff --git a/doc/html/images/wkt/st_visibility01.wkt b/doc/html/images/wkt/cg_visibility01.wkt
similarity index 100%
rename from doc/html/images/wkt/st_visibility01.wkt
rename to doc/html/images/wkt/cg_visibility01.wkt
diff --git a/doc/html/images/wkt/st_visibility02.wkt b/doc/html/images/wkt/cg_visibility02.wkt
similarity index 100%
rename from doc/html/images/wkt/st_visibility02.wkt
rename to doc/html/images/wkt/cg_visibility02.wkt
diff --git a/doc/html/images/wkt/st_visibility03.wkt b/doc/html/images/wkt/cg_visibility03.wkt
similarity index 100%
rename from doc/html/images/wkt/st_visibility03.wkt
rename to doc/html/images/wkt/cg_visibility03.wkt
diff --git a/doc/reference_sfcgal.xml b/doc/reference_sfcgal.xml
index 83c9de2df..d9b91a1a0 100644
--- a/doc/reference_sfcgal.xml
+++ b/doc/reference_sfcgal.xml
@@ -1382,6 +1382,81 @@ MULTIPOLYGON(
 
 	</refentry>
 
+    <refentry xml:id="CG_Visibility">
+        <refnamediv>
+            <refname>CG_Visibility</refname>
+
+            <refpurpose>Compute a visibility polygon from a point or a segment in a polygon geometry</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+            <funcsynopsis>
+                <funcprototype>
+                    <funcdef>geometry <function>CG_Visibility</function></funcdef>
+                    <paramdef><type>polygon</type> <parameter>geom</parameter></paramdef>
+                    <paramdef><type>point</type> <parameter>geom</parameter></paramdef>
+                </funcprototype>
+                <funcprototype>
+                    <funcdef>geometry <function>CG_Visibility</function></funcdef>
+                    <paramdef><type>polygon</type> <parameter>geom</parameter></paramdef>
+                    <paramdef><type>point1</type> <parameter>geom</parameter></paramdef>
+                    <paramdef><type>point2</type> <parameter>geom</parameter></paramdef>
+                </funcprototype>
+            </funcsynopsis>
+        </refsynopsisdiv>
+
+        <refsection>
+            <title>Description</title>
+
+            <para role="availability" conformance="3.5.0">Availability: 3.5.0</para>
+            <para>&sfcgal_required;</para>
+            <para>&Z_support;</para>
+            <para>&P_support;</para>
+            <para>&T_support;</para>
+        </refsection>
+
+        <refsection><title>Examples</title>
+            <programlisting>SELECT CG_Visibility('Polygon ((1981593 5199143, 1981593 5199284, 1981737 5199284, 1981737 5199143, 1981593 5199143),(1981674 5199213, 1981674 5199155, 1981720 5199156, 1981719 5199214, 1981674 5199213),(1981673 5199269, 1981673 5199221, 1981700 5199222, 1981698 5199241, 1981708 5199241, 1981708 5199223, 1981718 5199224, 1981716 5199277, 1981673 5199269),(1981610 5199211, 1981610 5199154, 1981667 5199155, 1981665 5199185, 1981646 5199185, 1981645 5199212, 1981610 5199211),(1981608 5199262, 1981609 5199219, 1981664 5199221, 1981662 5199264, 1981608 5199262))'::geometry, 'Point (1981658 5199203)');</programlisting>
+
+            <programlisting>SELECT CG_Visibility('Polygon ((1981593 5199143, 1981593 5199284, 1981737 5199284, 1981737 5199143, 1981593 5199143),(1981674 5199213, 1981674 5199155, 1981720 5199156, 1981719 5199214, 1981674 5199213),(1981673 5199269, 1981673 5199221, 1981700 5199222, 1981698 5199241, 1981708 5199241, 1981708 5199223, 1981718 5199224, 1981716 5199277, 1981673 5199269),(1981610 5199211, 1981610 5199154, 1981667 5199155, 1981665 5199185, 1981646 5199185, 1981645 5199212, 1981610 5199211),(1981608 5199262, 1981609 5199219, 1981664 5199221, 1981662 5199264, 1981608 5199262))'::geometry,'Point (1981646 5199185)'::geometry, 'Point (1981665 5199185)');</programlisting>
+            <informaltable>
+                <tgroup cols="3">
+                    <tbody>
+                        <row>
+                            <entry><para><informalfigure>
+                                        <mediaobject>
+                                            <imageobject>
+                                                <imagedata fileref="images/cg_visibility01.png"/>
+                                            </imageobject>
+                                            <caption><para>Original polygon</para></caption>
+                                        </mediaobject>
+                                </informalfigure></para>
+                            </entry>
+                            <entry><para><informalfigure>
+                                        <mediaobject>
+                                            <imageobject>
+                                                <imagedata fileref="images/cg_visibility02.png"/>
+                                            </imageobject>
+                                            <caption><para>Visibility from the point</para></caption>
+                                        </mediaobject>
+                                </informalfigure></para>
+                            </entry>
+                            <entry><para><informalfigure>
+                                        <mediaobject>
+                                            <imageobject>
+                                                <imagedata fileref="images/cg_visibility03.png"/>
+                                            </imageobject>
+                                            <caption><para>Visibility from the segment</para></caption>
+                                        </mediaobject>
+                                </informalfigure></para>
+                            </entry>
+                        </row>
+                    </tbody>
+                </tgroup>
+            </informaltable>
+        </refsection>
+
+    </refentry>
 	<refentry xml:id="ST_Volume">
 	  <refnamediv>
 		<refname>ST_Volume</refname>
@@ -1436,6 +1511,7 @@ MULTIPOLYGON(
 
 	</refentry>
 
+<<<<<<< HEAD
     <refentry xml:id="CG_YMonotonePartition">
 	  <refnamediv>
 		<refname>CG_YMonotonePartition</refname>
diff --git a/sfcgal/regress/visibility.sql b/sfcgal/regress/visibility.sql
index 00af352c4..392bd40dd 100644
--- a/sfcgal/regress/visibility.sql
+++ b/sfcgal/regress/visibility.sql
@@ -1,4 +1,4 @@
-SELECT 'Visibility point in polygon', ST_AsText(ST_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0))', 'POINT(0.5 2.0)'), 2);
-SELECT 'Visibility point in polygon with hole', ST_AsText(ST_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0),(0.2 1.8,0.9 1.8,0.7 1.2,0.2 1.8))', 'POINT(0.5 2.0)'), 2);
-SELECT 'Visibility segment in polygon', ST_AsText(ST_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0))', 'POINT(1.0 2.0)', 'POINT(4.0 4.0)'), 2);
-SELECT 'Visibility segment in polygon with hole', ST_AsText(ST_Visibility('POLYGON((1.0 2.0,12.0 3.0,19.0 -2.0,12.0 6.0,14.0 14.0,9.0 5.0,1.0 2.0),(8.0 3.0,8.0 4.0,10.0 3.0,8.0 3.0),(10.0 6.0,11.0 7.0,11.0 6.0,10.0 6.0))', 'POINT(19.0 -2.0)', 'POINT(12.0 6.0)'), 2);
+SELECT 'Visibility point in polygon', ST_AsText(CG_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0))', 'POINT(0.5 2.0)'), 2);
+SELECT 'Visibility point in polygon with hole', ST_AsText(CG_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0),(0.2 1.8,0.9 1.8,0.7 1.2,0.2 1.8))', 'POINT(0.5 2.0)'), 2);
+SELECT 'Visibility segment in polygon', ST_AsText(CG_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0))', 'POINT(1.0 2.0)', 'POINT(4.0 4.0)'), 2);
+SELECT 'Visibility segment in polygon with hole', ST_AsText(CG_Visibility('POLYGON((1.0 2.0,12.0 3.0,19.0 -2.0,12.0 6.0,14.0 14.0,9.0 5.0,1.0 2.0),(8.0 3.0,8.0 4.0,10.0 3.0,8.0 3.0),(10.0 6.0,11.0 7.0,11.0 6.0,10.0 6.0))', 'POINT(19.0 -2.0)', 'POINT(12.0 6.0)'), 2);
diff --git a/sfcgal/sfcgal.sql.in b/sfcgal/sfcgal.sql.in
index 172cf0a62..769a0ca83 100644
--- a/sfcgal/sfcgal.sql.in
+++ b/sfcgal/sfcgal.sql.in
@@ -198,6 +198,7 @@ CREATE OR REPLACE FUNCTION CG_YMonotonePartition(g1 geometry)
        COST 100;
 COMMIT;
 
+-- Availability: 3.5.0
 CREATE OR REPLACE FUNCTION CG_ApproxConvexPartition(g1 geometry)
        RETURNS geometry
        AS 'MODULE_PATHNAME', 'sfcgal_approxconvexpartition'
@@ -230,7 +231,7 @@ CREATE OR REPLACE FUNCTION CG_ExtrudeStraightSkeleton(g1 geometry, top_height fl
 COMMIT;
 
 -- Availability: 3.5.0
-CREATE OR REPLACE FUNCTION ST_Visibility(polygon geometry, pointA geometry, pointB geometry)
+CREATE OR REPLACE FUNCTION CG_Visibility(polygon geometry, pointA geometry, pointB geometry)
        RETURNS geometry
        AS 'MODULE_PATHNAME', 'sfcgal_visibility_segment'
        LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE

commit b7b285818894520d7a729c54bd502ac5d8e73ba7
Author: Loïc Bartoletti <loic.bartoletti at oslandia.com>
Date:   Fri Nov 10 06:54:25 2023 +0100

    ST_Visibility: add doc

diff --git a/doc/html/images/wkt/st_visibility01.wkt b/doc/html/images/wkt/st_visibility01.wkt
new file mode 100644
index 000000000..2a6c7145e
--- /dev/null
+++ b/doc/html/images/wkt/st_visibility01.wkt
@@ -0,0 +1 @@
+Polygon ((1981593 5199143, 1981593 5199284, 1981737 5199284, 1981737 5199143, 1981593 5199143),(1981674 5199213, 1981674 5199155, 1981720 5199156, 1981719 5199214, 1981674 5199213),(1981673 5199269, 1981673 5199221, 1981700 5199222, 1981698 5199241, 1981708 5199241, 1981708 5199223, 1981718 5199224, 1981716 5199277, 1981673 5199269),(1981610 5199211, 1981610 5199154, 1981667 5199155, 1981665 5199185, 1981646 5199185, 1981645 5199212, 1981610 5199211),(1981608 5199262, 1981609 5199219, 1981664 5199221, 1981662 5199264, 1981608 5199262))
diff --git a/doc/html/images/wkt/st_visibility02.wkt b/doc/html/images/wkt/st_visibility02.wkt
new file mode 100644
index 000000000..4e4228e63
--- /dev/null
+++ b/doc/html/images/wkt/st_visibility02.wkt
@@ -0,0 +1 @@
+POLYGON((1981646 5199185,1981665 5199185,1981674 5199161.857142856,1981674 5199213,1981687.6692913384 5199221.543307086,1981673 5199221,1981673 5199248,1981664 5199221,1981633.5969289825 5199219.8944337815,1981645 5199212,1981646 5199185))
diff --git a/doc/html/images/wkt/st_visibility03.wkt b/doc/html/images/wkt/st_visibility03.wkt
new file mode 100644
index 000000000..0dff3c38a
--- /dev/null
+++ b/doc/html/images/wkt/st_visibility03.wkt
@@ -0,0 +1 @@
+POLYGON((1981646 5199185,1981665 5199185,1981667 5199155,1981667.7999999998 5199143,1981677.6 5199143,1981674 5199155,1981674 5199213,1981676.6144578313 5199221.133868808,1981673 5199221,1981673 5199269,1981674.4285714286 5199284,1981662.25 5199284,1981664 5199221,1981639.006557377 5199220.09114754,1981645 5199212,1981646 5199185))
diff --git a/doc/reference_sfcgal.xml b/doc/reference_sfcgal.xml
index b15f29b62..83c9de2df 100644
--- a/doc/reference_sfcgal.xml
+++ b/doc/reference_sfcgal.xml
@@ -1697,4 +1697,80 @@ MULTIPOLYGON(
 	  </refsection>
 
 	</refentry>
+
+    <refentry xml:id="ST_Visibility">
+        <refnamediv>
+            <refname>ST_Visibility</refname>
+
+            <refpurpose>Compute a visibility polygon from a point or a segment in a polygon geometry</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+            <funcsynopsis>
+                <funcprototype>
+                    <funcdef>geometry <function>ST_Visibility</function></funcdef>
+                    <paramdef><type>polygon</type> <parameter>geom</parameter></paramdef>
+                    <paramdef><type>point</type> <parameter>geom</parameter></paramdef>
+                </funcprototype>
+                <funcprototype>
+                    <funcdef>geometry <function>ST_Visibility</function></funcdef>
+                    <paramdef><type>polygon</type> <parameter>geom</parameter></paramdef>
+                    <paramdef><type>point1</type> <parameter>geom</parameter></paramdef>
+                    <paramdef><type>point2</type> <parameter>geom</parameter></paramdef>
+                </funcprototype>
+            </funcsynopsis>
+        </refsynopsisdiv>
+
+        <refsection>
+            <title>Description</title>
+
+            <para role="availability" conformance="3.5.0">Availability: 3.5.0</para>
+            <para>&sfcgal_required;</para>
+            <para>&Z_support;</para>
+            <para>&P_support;</para>
+            <para>&T_support;</para>
+        </refsection>
+
+        <refsection><title>Examples</title>
+            <programlisting>SELECT ST_Visibility('Polygon ((1981593 5199143, 1981593 5199284, 1981737 5199284, 1981737 5199143, 1981593 5199143),(1981674 5199213, 1981674 5199155, 1981720 5199156, 1981719 5199214, 1981674 5199213),(1981673 5199269, 1981673 5199221, 1981700 5199222, 1981698 5199241, 1981708 5199241, 1981708 5199223, 1981718 5199224, 1981716 5199277, 1981673 5199269),(1981610 5199211, 1981610 5199154, 1981667 5199155, 1981665 5199185, 1981646 5199185, 1981645 5199212, 1981610 5199211),(1981608 5199262, 1981609 5199219, 1981664 5199221, 1981662 5199264, 1981608 5199262))'::geometry, 'Point (1981658 5199203)');</programlisting>
+
+            <programlisting>SELECT ST_Visibility('Polygon ((1981593 5199143, 1981593 5199284, 1981737 5199284, 1981737 5199143, 1981593 5199143),(1981674 5199213, 1981674 5199155, 1981720 5199156, 1981719 5199214, 1981674 5199213),(1981673 5199269, 1981673 5199221, 1981700 5199222, 1981698 5199241, 1981708 5199241, 1981708 5199223, 1981718 5199224, 1981716 5199277, 1981673 5199269),(1981610 5199211, 1981610 5199154, 1981667 5199155, 1981665 5199185, 1981646 5199185, 1981645 5199212, 1981610 5199211),(1981608 5199262, 1981609 5199219, 1981664 5199221, 1981662 5199264, 1981608 5199262))'::geometry,'Point (1981646 5199185)'::geometry, 'Point (1981665 5199185)');</programlisting>
+            <informaltable>
+                <tgroup cols="3">
+                    <tbody>
+                        <row>
+                            <entry><para><informalfigure>
+                                        <mediaobject>
+                                            <imageobject>
+                                                <imagedata fileref="images/st_visibility01.png"/>
+                                            </imageobject>
+                                            <caption><para>Original polygon</para></caption>
+                                        </mediaobject>
+                                </informalfigure></para>
+                            </entry>
+                            <entry><para><informalfigure>
+                                        <mediaobject>
+                                            <imageobject>
+                                                <imagedata fileref="images/st_visibility02.png"/>
+                                            </imageobject>
+                                            <caption><para>Visibility from the point</para></caption>
+                                        </mediaobject>
+                                </informalfigure></para>
+                            </entry>
+                            <entry><para><informalfigure>
+                                        <mediaobject>
+                                            <imageobject>
+                                                <imagedata fileref="images/st_visibility03.png"/>
+                                            </imageobject>
+                                            <caption><para>Visibility from the segment</para></caption>
+                                        </mediaobject>
+                                </informalfigure></para>
+                            </entry>
+                        </row>
+                    </tbody>
+                </tgroup>
+            </informaltable>
+        </refsection>
+
+    </refentry>
 </section>

commit 21d70dbde72a5b9e6b0b017f5ed10ef409a28bb2
Author: Loïc Bartoletti <loic.bartoletti at oslandia.com>
Date:   Fri Sep 29 11:56:28 2023 +0200

    [Feature]: Add ST_Visibility from SFCGAL 1.5.0

diff --git a/NEWS b/NEWS
index 0d60e6781..b56cb892a 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.5.0+ is needed.
   - Add ST_HasZ/ST_HasM (Loïc Bartoletti)
   - GT-123, postgis_sfcgal: CG_YMonotonePartition, CG_ApproxConvexPartition, CG_GreeneApproxConvexPartition and CG_OptimalConvexPartition (Loïc Bartoletti)
   - GT-157, postgis_sfcgal: Add ST_ExtrudeStraightSkeleton (Loïc Bartoletti)
+  - postgis_sfcgal: ST_Visibility (Loïc Bartoletti)
 
 * Enhancements *
 
diff --git a/sfcgal/lwgeom_sfcgal.c b/sfcgal/lwgeom_sfcgal.c
index 0276d625e..e0abda13e 100644
--- a/sfcgal/lwgeom_sfcgal.c
+++ b/sfcgal/lwgeom_sfcgal.c
@@ -900,3 +900,79 @@ Datum sfcgal_extrudestraightskeleton(PG_FUNCTION_ARGS)
 	PG_RETURN_POINTER(output);
 #endif
 }
+
+PG_FUNCTION_INFO_V1(sfcgal_visibility_point);
+Datum sfcgal_visibility_point(PG_FUNCTION_ARGS)
+{
+#if POSTGIS_SFCGAL_VERSION < 10500
+  lwpgerror("The SFCGAL version this PostGIS binary "
+	          "was compiled against (%d) doesn't support "
+	          "'sfcgal_visibility_point' function (1.5.0+ required)",
+	          POSTGIS_SFCGAL_VERSION);
+	          PG_RETURN_NULL();
+#else /* POSTGIS_SFCGAL_VERSION >= 10500 */
+	GSERIALIZED *input0, *input1, *output;
+	sfcgal_geometry_t *polygon, *point;
+	sfcgal_geometry_t *result;
+	srid_t srid;
+
+	sfcgal_postgis_init();
+
+	input0 = PG_GETARG_GSERIALIZED_P(0);
+	srid = gserialized_get_srid(input0);
+	input1 = PG_GETARG_GSERIALIZED_P(1);
+	polygon = POSTGIS2SFCGALGeometry(input0);
+	PG_FREE_IF_COPY(input0, 0);
+	point = POSTGIS2SFCGALGeometry(input1);
+	PG_FREE_IF_COPY(input1, 1);
+
+	result = sfcgal_geometry_visibility_point(polygon, point);
+	sfcgal_geometry_delete(polygon);
+	sfcgal_geometry_delete(point);
+
+	output = SFCGALGeometry2POSTGIS(result, 0, srid);
+	sfcgal_geometry_delete(result);
+
+	PG_RETURN_POINTER(output);
+#endif
+}
+
+PG_FUNCTION_INFO_V1(sfcgal_visibility_segment);
+Datum sfcgal_visibility_segment(PG_FUNCTION_ARGS)
+{
+#if POSTGIS_SFCGAL_VERSION < 10500
+  lwpgerror("The SFCGAL version this PostGIS binary "
+	          "was compiled against (%d) doesn't support "
+	          "'sfcgal_visibility_segment' function (1.5.0+ required)",
+	          POSTGIS_SFCGAL_VERSION);
+	          PG_RETURN_NULL();
+#else /* POSTGIS_SFCGAL_VERSION >= 10500 */
+	GSERIALIZED *input0, *input1, *input2, *output;
+	sfcgal_geometry_t *polygon, *pointA, *pointB;
+	sfcgal_geometry_t *result;
+	srid_t srid;
+
+	sfcgal_postgis_init();
+
+	input0 = PG_GETARG_GSERIALIZED_P(0);
+	srid = gserialized_get_srid(input0);
+	input1 = PG_GETARG_GSERIALIZED_P(1);
+	input2 = PG_GETARG_GSERIALIZED_P(2);
+	polygon = POSTGIS2SFCGALGeometry(input0);
+	PG_FREE_IF_COPY(input0, 0);
+	pointA = POSTGIS2SFCGALGeometry(input1);
+	PG_FREE_IF_COPY(input1, 1);
+	pointB = POSTGIS2SFCGALGeometry(input2);
+	PG_FREE_IF_COPY(input1, 2);
+
+	result = sfcgal_geometry_visibility_segment(polygon, pointA, pointB);
+	sfcgal_geometry_delete(polygon);
+	sfcgal_geometry_delete(pointA);
+	sfcgal_geometry_delete(pointB);
+
+	output = SFCGALGeometry2POSTGIS(result, 0, srid);
+	sfcgal_geometry_delete(result);
+
+	PG_RETURN_POINTER(output);
+#endif
+}
diff --git a/sfcgal/lwgeom_sfcgal.h b/sfcgal/lwgeom_sfcgal.h
index 16fe536a1..e15bca110 100644
--- a/sfcgal/lwgeom_sfcgal.h
+++ b/sfcgal/lwgeom_sfcgal.h
@@ -58,6 +58,7 @@ Datum sfcgal_approxconvexpartition(PG_FUNCTION_ARGS);
 Datum sfcgal_greeneapproxconvexpartition(PG_FUNCTION_ARGS);
 Datum sfcgal_optimalconvexpartition(PG_FUNCTION_ARGS);
 Datum sfcgal_extrudestraigthskeleton(PG_FUNCTION_ARGS);
+Datum sfcgal_visibility(PG_FUNCTION_ARGS);
 
 /* Initialize sfcgal with PostGIS error handlers */
 void sfcgal_postgis_init(void);
diff --git a/sfcgal/regress/tests.mk.in b/sfcgal/regress/tests.mk.in
index e3bd2d342..58b18b747 100644
--- a/sfcgal/regress/tests.mk.in
+++ b/sfcgal/regress/tests.mk.in
@@ -25,5 +25,6 @@ endif
 ifeq ($(shell expr "$(POSTGIS_SFCGAL_VERSION)" ">=" 10500),1)
 	TESTS += \
 		$(top_srcdir)/sfcgal/regress/partition.sql \
-		$(top_srcdir)/sfcgal/regress/extrudestraigthskeleton.sql
+		$(top_srcdir)/sfcgal/regress/extrudestraigthskeleton.sql \
+		$(top_srcdir)/sfcgal/regress/visibility.sql
 endif
diff --git a/sfcgal/regress/visibility.sql b/sfcgal/regress/visibility.sql
new file mode 100644
index 000000000..00af352c4
--- /dev/null
+++ b/sfcgal/regress/visibility.sql
@@ -0,0 +1,4 @@
+SELECT 'Visibility point in polygon', ST_AsText(ST_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0))', 'POINT(0.5 2.0)'), 2);
+SELECT 'Visibility point in polygon with hole', ST_AsText(ST_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0),(0.2 1.8,0.9 1.8,0.7 1.2,0.2 1.8))', 'POINT(0.5 2.0)'), 2);
+SELECT 'Visibility segment in polygon', ST_AsText(ST_Visibility('POLYGON((0.0 4.0,0.0 0.0,3.0 2.0,4.0 0.0,4.0 4.0,1.0 2.0,0.0 4.0))', 'POINT(1.0 2.0)', 'POINT(4.0 4.0)'), 2);
+SELECT 'Visibility segment in polygon with hole', ST_AsText(ST_Visibility('POLYGON((1.0 2.0,12.0 3.0,19.0 -2.0,12.0 6.0,14.0 14.0,9.0 5.0,1.0 2.0),(8.0 3.0,8.0 4.0,10.0 3.0,8.0 3.0),(10.0 6.0,11.0 7.0,11.0 6.0,10.0 6.0))', 'POINT(19.0 -2.0)', 'POINT(12.0 6.0)'), 2);
diff --git a/sfcgal/regress/visibility_expected b/sfcgal/regress/visibility_expected
new file mode 100644
index 000000000..a42d87699
--- /dev/null
+++ b/sfcgal/regress/visibility_expected
@@ -0,0 +1,4 @@
+Visibility point in polygon|POLYGON((3 2,1 2,0 4,0 0,3 2))
+Visibility point in polygon with hole|POLYGON((0 1.67,0.2 1.8,0.9 1.8,1.93 1.29,3 2,1 2,0 4,0 1.67))
+Visibility segment in polygon|POLYGON((1 2,0 4,0 0,4 0,4 4,1 2))
+Visibility segment in polygon with hole|POLYGON((19 -2,12 6,14 14,10.43 7.57,11 7,11 6,10 6,9.56 6,9 5,1 2,4.67 2.33,8 4,10 3,9.87 2.81,12 3,19 -2))
diff --git a/sfcgal/sfcgal.sql.in b/sfcgal/sfcgal.sql.in
index 584235246..172cf0a62 100644
--- a/sfcgal/sfcgal.sql.in
+++ b/sfcgal/sfcgal.sql.in
@@ -198,7 +198,6 @@ CREATE OR REPLACE FUNCTION CG_YMonotonePartition(g1 geometry)
        COST 100;
 COMMIT;
 
--- Availability: 3.5.0
 CREATE OR REPLACE FUNCTION CG_ApproxConvexPartition(g1 geometry)
        RETURNS geometry
        AS 'MODULE_PATHNAME', 'sfcgal_approxconvexpartition'
@@ -229,3 +228,19 @@ CREATE OR REPLACE FUNCTION CG_ExtrudeStraightSkeleton(g1 geometry, top_height fl
        LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
        COST 100;
 COMMIT;
+
+-- Availability: 3.5.0
+CREATE OR REPLACE FUNCTION ST_Visibility(polygon geometry, pointA geometry, pointB geometry)
+       RETURNS geometry
+       AS 'MODULE_PATHNAME', 'sfcgal_visibility_segment'
+       LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
+       COST 100;
+COMMIT;
+
+-- Availability: 3.5.0
+CREATE OR REPLACE FUNCTION ST_Visibility(polygon geometry, point geometry)
+       RETURNS geometry
+       AS 'MODULE_PATHNAME', 'sfcgal_visibility_point'
+       LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
+       COST 100;
+COMMIT;

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                    |  1 +
 doc/html/images/wkt/cg_visibility01.wkt |  1 +
 doc/html/images/wkt/cg_visibility02.wkt |  1 +
 doc/html/images/wkt/cg_visibility03.wkt |  1 +
 doc/reference_sfcgal.xml                | 76 +++++++++++++++++++++++++++++++++
 sfcgal/lwgeom_sfcgal.c                  | 76 +++++++++++++++++++++++++++++++++
 sfcgal/lwgeom_sfcgal.h                  |  1 +
 sfcgal/regress/tests.mk.in              |  3 +-
 sfcgal/regress/visibility.sql           |  4 ++
 sfcgal/regress/visibility_expected      |  4 ++
 sfcgal/sfcgal.sql.in                    | 16 +++++++
 11 files changed, 183 insertions(+), 1 deletion(-)
 create mode 100644 doc/html/images/wkt/cg_visibility01.wkt
 create mode 100644 doc/html/images/wkt/cg_visibility02.wkt
 create mode 100644 doc/html/images/wkt/cg_visibility03.wkt
 create mode 100644 sfcgal/regress/visibility.sql
 create mode 100644 sfcgal/regress/visibility_expected


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list