PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_perimeter()

double lwgeom_perimeter ( const LWGEOM geom)

Definition at line 1994 of file lwgeom.c.

1995 {
1996  int type = geom->type;
1997  if ( type == POLYGONTYPE )
1998  return lwpoly_perimeter((LWPOLY*)geom);
1999  else if ( type == CURVEPOLYTYPE )
2000  return lwcurvepoly_perimeter((LWCURVEPOLY*)geom);
2001  else if ( type == TRIANGLETYPE )
2002  return lwtriangle_perimeter((LWTRIANGLE*)geom);
2003  else if ( lwgeom_is_collection(geom) )
2004  {
2005  double perimeter = 0.0;
2006  uint32_t i;
2007  LWCOLLECTION *col = (LWCOLLECTION*)geom;
2008  for ( i = 0; i < col->ngeoms; i++ )
2009  perimeter += lwgeom_perimeter(col->geoms[i]);
2010  return perimeter;
2011  }
2012  else
2013  return 0.0;
2014 }
#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:467
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(const LWGEOM *geom)
Definition: lwgeom.c:1994
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: