PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_perimeter()

double lwgeom_perimeter ( const LWGEOM geom)

Definition at line 2022 of file lwgeom.c.

2023 {
2024  int type = geom->type;
2025  if ( type == POLYGONTYPE )
2026  return lwpoly_perimeter((LWPOLY*)geom);
2027  else if ( type == CURVEPOLYTYPE )
2028  return lwcurvepoly_perimeter((LWCURVEPOLY*)geom);
2029  else if ( type == TRIANGLETYPE )
2030  return lwtriangle_perimeter((LWTRIANGLE*)geom);
2031  else if ( lwgeom_is_collection(geom) )
2032  {
2033  double perimeter = 0.0;
2034  uint32_t i;
2035  LWCOLLECTION *col = (LWCOLLECTION*)geom;
2036  for ( i = 0; i < col->ngeoms; i++ )
2037  perimeter += lwgeom_perimeter(col->geoms[i]);
2038  return perimeter;
2039  }
2040  else
2041  return 0.0;
2042 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:111
#define POLYGONTYPE
Definition: liblwgeom.h:104
#define TRIANGLETYPE
Definition: liblwgeom.h:115
double lwtriangle_perimeter(const LWTRIANGLE *triangle)
Definition: lwtriangle.c:201
double lwcurvepoly_perimeter(const LWCURVEPOLY *poly)
Definition: lwcurvepoly.c:147
double lwpoly_perimeter(const LWPOLY *poly)
Compute the sum of polygon rings length.
Definition: lwpoly.c:466
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition: lwgeom.c:1125
double lwgeom_perimeter(const LWGEOM *geom)
Definition: lwgeom.c:2022
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:580
LWGEOM ** geoms
Definition: liblwgeom.h:575
uint8_t type
Definition: liblwgeom.h:462

References CURVEPOLYTYPE, LWCOLLECTION::geoms, lwcurvepoly_perimeter(), lwgeom_is_collection(), lwgeom_perimeter(), lwpoly_perimeter(), lwtriangle_perimeter(), LWCOLLECTION::ngeoms, POLYGONTYPE, TRIANGLETYPE, LWGEOM::type, and ovdump::type.

Referenced by lwgeom_perimeter(), LWGEOM_perimeter_poly(), and test_raster_surface().

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