PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwcollection_offsetcurve()

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

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

1399 {
1400  const LWGEOM *geom = lwcollection_as_lwgeom(col);
1401  int32_t srid = RESULT_SRID(geom);
1402  uint8_t is3d = FLAGS_GET_Z(col->flags);
1403  LWCOLLECTION *result;
1404  LWGEOM *tmp;
1405  uint32_t i;
1406  if (srid == SRID_INVALID) return NULL;
1407 
1408  result = lwcollection_construct_empty(MULTILINETYPE, srid, is3d, LW_FALSE);
1409 
1410  for (i = 0; i < col->ngeoms; i++)
1411  {
1412  tmp = lwgeom_offsetcurve(col->geoms[i], size, quadsegs, joinStyle, mitreLimit);
1413 
1414  if (!tmp)
1415  {
1416  lwcollection_free(result);
1417  return NULL;
1418  }
1419 
1420  if (!lwgeom_is_empty(tmp))
1421  {
1422  if (lwgeom_is_collection(tmp))
1424  else
1425  result = lwcollection_add_lwgeom(result, tmp);
1426 
1427  if (!result)
1428  {
1429  lwgeom_free(tmp);
1430  return NULL;
1431  }
1432  }
1433  }
1434 
1435  if (result->ngeoms == 1)
1436  {
1437  tmp = result->geoms[0];
1438  lwcollection_release(result);
1439  return tmp;
1440  }
1441  else
1442  return lwcollection_as_lwgeom(result);
1443 }
LWGEOM * lwgeom_offsetcurve(const LWGEOM *geom, double size, int quadsegs, int joinStyle, double mitreLimit)
#define RESULT_SRID(...)
#define LW_FALSE
Definition: liblwgeom.h:108
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:291
#define SRID_INVALID
Definition: liblwgeom.h:233
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
#define MULTILINETYPE
Definition: liblwgeom.h:120
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:179
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1079
void lwcollection_release(LWCOLLECTION *lwcollection)
Definition: lwcollection.c:36
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:357
LWCOLLECTION * lwcollection_concat_in_place(LWCOLLECTION *col1, const LWCOLLECTION *col2)
Appends all geometries from col2 to col1 in place.
Definition: lwcollection.c:241
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:188
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:215
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:193
lwflags_t flags
Definition: liblwgeom.h:563
uint32_t ngeoms
Definition: liblwgeom.h:566
LWGEOM ** geoms
Definition: liblwgeom.h:561

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: