PostGIS  2.3.7dev-r@@SVN_REVISION@@
LWGEOM* lwgeom_offsetcurve ( const LWLINE lwline,
double  size,
int  quadsegs,
int  joinStyle,
double  mitreLimit 
)

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

References GEOS2LWGEOM(), LWDEBUGF, lwerror(), LWGEOM2GEOS(), lwgeom_geos_errmsg, lwgeom_geos_error(), lwgeom_get_srid(), lwgeom_has_z(), lwline_as_lwgeom(), and lwnotice().

Referenced by lwgeom_clip_to_ordinate_range(), and ST_OffsetCurve().

1608 {
1609  GEOSGeometry *g1, *g3;
1610  LWGEOM *lwgeom_result;
1611  LWGEOM *lwgeom_in = lwline_as_lwgeom(lwline);
1612 
1613  initGEOS(lwnotice, lwgeom_geos_error);
1614 
1615  g1 = (GEOSGeometry *)LWGEOM2GEOS(lwgeom_in, 0);
1616  if ( ! g1 )
1617  {
1618  lwerror("lwgeom_offsetcurve: Geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
1619  return NULL;
1620  }
1621 
1622  g3 = GEOSOffsetCurve(g1, size, quadsegs, joinStyle, mitreLimit);
1623 
1624  /* Don't need input geometry anymore */
1625  GEOSGeom_destroy(g1);
1626 
1627  if (g3 == NULL)
1628  {
1629  lwerror("GEOSOffsetCurve: %s", lwgeom_geos_errmsg);
1630  return NULL;
1631  }
1632 
1633  LWDEBUGF(3, "result: %s", GEOSGeomToWKT(g3));
1634 
1635  GEOSSetSRID(g3, lwgeom_get_srid(lwgeom_in));
1636  lwgeom_result = GEOS2LWGEOM(g3, lwgeom_has_z(lwgeom_in));
1637  GEOSGeom_destroy(g3);
1638 
1639  if (lwgeom_result == NULL)
1640  {
1641  lwerror("lwgeom_offsetcurve: GEOS2LWGEOM returned null");
1642  return NULL;
1643  }
1644 
1645  return lwgeom_result;
1646 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:89
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
Definition: lwgeom.c:835
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:849
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition: lwgeom.c:262
void lwgeom_geos_error(const char *fmt,...)
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102

Here is the call graph for this function:

Here is the caller graph for this function: