PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_offsetcurve()

static LWGEOM* lwcollection_offsetcurve ( const LWCOLLECTION col,
double  size,
int  quadsegs,
int  joinStyle,
double  mitreLimit 
)
static

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

1383 {
1384  const LWGEOM *geom = lwcollection_as_lwgeom(col);
1385  int32_t srid = RESULT_SRID(geom);
1386  uint8_t is3d = FLAGS_GET_Z(col->flags);
1387  LWCOLLECTION *result;
1388  LWGEOM *tmp;
1389  uint32_t i;
1390  if (srid == SRID_INVALID) return NULL;
1391 
1392  result = lwcollection_construct_empty(MULTILINETYPE, srid, is3d, LW_FALSE);
1393 
1394  for (i = 0; i < col->ngeoms; i++)
1395  {
1396  tmp = lwgeom_offsetcurve(col->geoms[i], size, quadsegs, joinStyle, mitreLimit);
1397 
1398  if (!tmp)
1399  {
1400  lwcollection_free(result);
1401  return NULL;
1402  }
1403 
1404  if (!lwgeom_is_empty(tmp))
1405  {
1406  if (lwgeom_is_collection(tmp))
1408  else
1409  result = lwcollection_add_lwgeom(result, tmp);
1410 
1411  if (!result)
1412  {
1413  lwgeom_free(tmp);
1414  return NULL;
1415  }
1416  }
1417  }
1418 
1419  if (result->ngeoms == 1)
1420  {
1421  tmp = result->geoms[0];
1422  lwcollection_release(result);
1423  return tmp;
1424  }
1425  else
1426  return lwcollection_as_lwgeom(result);
1427 }
LWGEOM * lwgeom_offsetcurve(const LWGEOM *geom, double size, int quadsegs, int joinStyle, double mitreLimit)
#define RESULT_SRID(...)
#define LW_FALSE
Definition: liblwgeom.h:77
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:300
#define SRID_INVALID
Definition: liblwgeom.h:192
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
void lwcollection_release(LWCOLLECTION *lwcollection)
Definition: lwcollection.c:36
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:356
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwgeom.c:1393
LWCOLLECTION * lwcollection_concat_in_place(LWCOLLECTION *col1, const LWCOLLECTION *col2)
Appends all geometries from col2 to col1 in place.
Definition: lwcollection.c:240
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:187
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:224
uint32_t ngeoms
Definition: liblwgeom.h:510
uint8_t flags
Definition: liblwgeom.h:507
LWGEOM ** geoms
Definition: liblwgeom.h:512
unsigned int uint32_t
Definition: uthash.h:78
unsigned char uint8_t
Definition: uthash.h:79

References LWCOLLECTION::flags, FLAGS_GET_Z, LWCOLLECTION::geoms, LW_FALSE, lwcollection_add_lwgeom(), lwcollection_as_lwgeom(), lwcollection_concat_in_place(), lwcollection_construct_empty(), lwcollection_free(), lwcollection_release(), lwgeom_as_lwcollection(), lwgeom_free(), lwgeom_is_collection(), lwgeom_is_empty(), lwgeom_offsetcurve(), MULTILINETYPE, LWCOLLECTION::ngeoms, RESULT_SRID, and SRID_INVALID.

Referenced by lwgeom_offsetcurve().

Here is the call graph for this function:
Here is the caller graph for this function: