PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_perimeter_2d()

double lwgeom_perimeter_2d ( const LWGEOM geom)

Definition at line 2016 of file lwgeom.c.

2017 {
2018  int type = geom->type;
2019  if ( type == POLYGONTYPE )
2020  return lwpoly_perimeter_2d((LWPOLY*)geom);
2021  else if ( type == CURVEPOLYTYPE )
2022  return lwcurvepoly_perimeter_2d((LWCURVEPOLY*)geom);
2023  else if ( type == TRIANGLETYPE )
2024  return lwtriangle_perimeter_2d((LWTRIANGLE*)geom);
2025  else if ( lwgeom_is_collection(geom) )
2026  {
2027  double perimeter = 0.0;
2028  uint32_t i;
2029  LWCOLLECTION *col = (LWCOLLECTION*)geom;
2030  for ( i = 0; i < col->ngeoms; i++ )
2031  perimeter += lwgeom_perimeter_2d(col->geoms[i]);
2032  return perimeter;
2033  }
2034  else
2035  return 0.0;
2036 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:111
#define POLYGONTYPE
Definition: liblwgeom.h:104
#define TRIANGLETYPE
Definition: liblwgeom.h:115
double lwtriangle_perimeter_2d(const LWTRIANGLE *triangle)
Definition: lwtriangle.c:210
double lwpoly_perimeter_2d(const LWPOLY *poly)
Compute the sum of polygon rings length (forcing 2d computation).
Definition: lwpoly.c:485
double lwcurvepoly_perimeter_2d(const LWCURVEPOLY *poly)
Definition: lwcurvepoly.c:159
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:1097
double lwgeom_perimeter_2d(const LWGEOM *geom)
Definition: lwgeom.c:2016
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_2d(), lwgeom_is_collection(), lwgeom_perimeter_2d(), lwpoly_perimeter_2d(), lwtriangle_perimeter_2d(), LWCOLLECTION::ngeoms, POLYGONTYPE, TRIANGLETYPE, LWGEOM::type, and ovdump::type.

Referenced by LWGEOM_perimeter2d_poly(), and lwgeom_perimeter_2d().

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