PostGIS 3.6.2dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches
liblwgeom/lwgeom_geos.h
Go to the documentation of this file.
1/**********************************************************************
2 *
3 * PostGIS - Spatial Types for PostgreSQL
4 * http://postgis.net
5 *
6 * PostGIS is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * PostGIS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18 *
19 **********************************************************************
20 *
21 * Copyright 2011 Sandro Santilli <strk@kbt.io>
22 * Copyright 2018 Darafei Praliaskouski <me@komzpa.net>
23 *
24 **********************************************************************/
25
26#if POSTGIS_GEOS_VERSION < 31300
27/* See https://github.com/libgeos/geos/pull/1097 */
28typedef void (*GEOSMessageHandler)(const char *fmt, ...) __attribute__ (( format(printf, 1, 2) ));
29#endif
30
31#include "geos_c.h"
32
33#include "liblwgeom.h"
34#include "lwunionfind.h"
35
36/*
37** Public prototypes for GEOS utility functions.
38*/
39LWGEOM* GEOS2LWGEOM(const GEOSGeometry* geom, uint8_t want3d);
40GEOSGeometry* LWGEOM2GEOS(const LWGEOM* g, uint8_t autofix);
41GEOSGeometry* GBOX2GEOS(const GBOX* g);
42GEOSGeometry* make_geos_point(double x, double y);
43GEOSGeometry* make_geos_segment(double x1, double y1, double x2, double y2);
44
45int cluster_intersecting(GEOSGeometry **geoms, uint32_t num_geoms, GEOSGeometry ***clusterGeoms, uint32_t *num_clusters);
46int union_intersecting_pairs(GEOSGeometry** geoms, uint32_t num_geoms, UNIONFIND* uf);
47int cluster_within_distance(LWGEOM **geoms, uint32_t num_geoms, double tolerance, LWGEOM ***clusterGeoms, uint32_t *num_clusters);
48int union_dbscan(LWGEOM **geoms, uint32_t num_geoms, UNIONFIND *uf, double eps, uint32_t min_points, char **is_in_cluster_ret);
49
50POINTARRAY* ptarray_from_GEOSCoordSeq(const GEOSCoordSequence* cs, uint8_t want3d);
51
52extern char lwgeom_geos_errmsg[];
53extern void lwgeom_geos_error(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
54
55
56/*
57 * Debug macros
58 */
59#if POSTGIS_DEBUG_LEVEL > 0
60
61/* Display a notice and a WKT representation of a geometry
62 * at the given debug level */
63#define LWDEBUGGEOS(level, geom, msg) \
64 if (POSTGIS_DEBUG_LEVEL >= level) \
65 do { \
66 GEOSWKTWriter *wktwriter = GEOSWKTWriter_create(); \
67 char *wkt = GEOSWKTWriter_write(wktwriter, (geom)); \
68 LWDEBUGF(1, msg " (GEOS): %s", wkt); \
69 GEOSFree(wkt); \
70 GEOSWKTWriter_destroy(wktwriter); \
71 } while (0);
72
73#else /* POSTGIS_DEBUG_LEVEL <= 0 */
74
75/* Empty prototype that can be optimised away by the compiler
76 * for non-debug builds */
77#define LWDEBUGGEOS(level, geom, msg) \
78 ((void) 0)
79
80#endif /*POSTGIS_DEBUG_LEVEL <= 0 */
void(*) LWGEOM GEOS2LWGEOM)(const GEOSGeometry *geom, uint8_t want3d)
GEOSGeometry * GBOX2GEOS(const GBOX *g)
void(* GEOSMessageHandler)(const char *fmt,...) __attribute__((format(printf
GEOSGeometry * make_geos_segment(double x1, double y1, double x2, double y2)
GEOSGeometry * make_geos_point(double x, double y)
int cluster_within_distance(LWGEOM **geoms, uint32_t num_geoms, double tolerance, LWGEOM ***clusterGeoms, uint32_t *num_clusters)
Takes an array of LWGEOM* and constructs an array of LWGEOM*, where each element in the constructed a...
int union_intersecting_pairs(GEOSGeometry **geoms, uint32_t num_geoms, UNIONFIND *uf)
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *g, uint8_t autofix)
POINTARRAY * ptarray_from_GEOSCoordSeq(const GEOSCoordSequence *cs, uint8_t want3d)
void lwgeom_geos_error(const char *fmt,...) __attribute__((format(printf
int cluster_intersecting(GEOSGeometry **geoms, uint32_t num_geoms, GEOSGeometry ***clusterGeoms, uint32_t *num_clusters)
Takes an array of GEOSGeometry* and constructs an array of GEOSGeometry*, where each element in the c...
char lwgeom_geos_errmsg[]
int union_dbscan(LWGEOM **geoms, uint32_t num_geoms, UNIONFIND *uf, double eps, uint32_t min_points, char **is_in_cluster_ret)
#define __attribute__(x)
Definition liblwgeom.h:228
This library is the generic geometry handling section of PostGIS.