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

Definition at line 1631 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().

1632 {
1633  GEOSGeometry *g1, *g3;
1634  LWGEOM *lwgeom_result;
1635  LWGEOM *lwgeom_in = lwline_as_lwgeom(lwline);
1636 
1637  initGEOS(lwnotice, lwgeom_geos_error);
1638 
1639  g1 = (GEOSGeometry *)LWGEOM2GEOS(lwgeom_in, 0);
1640  if ( ! g1 )
1641  {
1642  lwerror("lwgeom_offsetcurve: Geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
1643  return NULL;
1644  }
1645 
1646  g3 = GEOSOffsetCurve(g1, size, quadsegs, joinStyle, mitreLimit);
1647 
1648  /* Don't need input geometry anymore */
1649  GEOSGeom_destroy(g1);
1650 
1651  if (g3 == NULL)
1652  {
1653  lwerror("GEOSOffsetCurve: %s", lwgeom_geos_errmsg);
1654  return NULL;
1655  }
1656 
1657  LWDEBUGF(3, "result: %s", GEOSGeomToWKT(g3));
1658 
1659  GEOSSetSRID(g3, lwgeom_get_srid(lwgeom_in));
1660  lwgeom_result = GEOS2LWGEOM(g3, lwgeom_has_z(lwgeom_in));
1661  GEOSGeom_destroy(g3);
1662 
1663  if (lwgeom_result == NULL)
1664  {
1665  lwerror("lwgeom_offsetcurve: GEOS2LWGEOM returned null");
1666  return NULL;
1667  }
1668 
1669  return lwgeom_result;
1670 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
Definition: lwgeom.c:909
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:923
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition: lwgeom.c:329
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:190

Here is the call graph for this function:

Here is the caller graph for this function: