PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ lwgeom_sharedpaths()

LWGEOM* lwgeom_sharedpaths ( const LWGEOM geom1,
const LWGEOM geom2 
)

Definition at line 1255 of file liblwgeom/lwgeom_geos.c.

References AUTOFIX, LWGEOM::flags, FLAGS_GET_Z, GEOS2LWGEOM(), GEOS_FAIL, GEOS_FREE, GEOS_FREE_AND_FAIL, LWGEOM2GEOS(), lwgeom_geos_error(), lwnotice(), RESULT_SRID, and SRID_INVALID.

Referenced by ST_SharedPaths().

1256 {
1257  LWGEOM* result;
1258  int32_t srid = RESULT_SRID(geom1, geom2);
1259  uint8_t is3d = (FLAGS_GET_Z(geom1->flags) || FLAGS_GET_Z(geom2->flags));
1260  GEOSGeometry *g1, *g2, *g3;
1261 
1262  if (srid == SRID_INVALID) return NULL;
1263 
1264  initGEOS(lwnotice, lwgeom_geos_error);
1265 
1266  if (!(g1 = LWGEOM2GEOS(geom1, AUTOFIX))) GEOS_FAIL();
1267  if (!(g2 = LWGEOM2GEOS(geom2, AUTOFIX))) GEOS_FREE_AND_FAIL(g1);
1268 
1269  g3 = GEOSSharedPaths(g1, g2);
1270 
1271  if (!g3) GEOS_FREE_AND_FAIL(g1, g2);
1272  GEOSSetSRID(g3, srid);
1273 
1274  if (!(result = GEOS2LWGEOM(g3, is3d)))
1275  GEOS_FREE_AND_FAIL(g1, g2, g3);
1276 
1277  GEOS_FREE(g1, g2, g3);
1278  return result;
1279 }
#define GEOS_FAIL()
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, uint8_t want3d)
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
uint8_t flags
Definition: liblwgeom.h:400
#define GEOS_FREE_AND_FAIL(...)
#define GEOS_FREE(...)
#define RESULT_SRID(...)
#define AUTOFIX
void lwgeom_geos_error(const char *fmt,...)
#define SRID_INVALID
Definition: liblwgeom.h:192
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
unsigned char uint8_t
Definition: uthash.h:79
Here is the call graph for this function:
Here is the caller graph for this function: