PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_perimeter_2d()

double lwgeom_perimeter_2d ( const LWGEOM geom)

Definition at line 1917 of file lwgeom.c.

1918 {
1919  int type = geom->type;
1920  if ( type == POLYGONTYPE )
1921  return lwpoly_perimeter_2d((LWPOLY*)geom);
1922  else if ( type == CURVEPOLYTYPE )
1923  return lwcurvepoly_perimeter_2d((LWCURVEPOLY*)geom);
1924  else if ( type == TRIANGLETYPE )
1925  return lwtriangle_perimeter_2d((LWTRIANGLE*)geom);
1926  else if ( lwgeom_is_collection(geom) )
1927  {
1928  double perimeter = 0.0;
1929  uint32_t i;
1930  LWCOLLECTION *col = (LWCOLLECTION*)geom;
1931  for ( i = 0; i < col->ngeoms; i++ )
1932  perimeter += lwgeom_perimeter_2d(col->geoms[i]);
1933  return perimeter;
1934  }
1935  else
1936  return 0.0;
1937 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:98
double lwtriangle_perimeter_2d(const LWTRIANGLE *triangle)
Definition: lwtriangle.c:217
double lwpoly_perimeter_2d(const LWPOLY *poly)
Compute the sum of polygon rings length (forcing 2d computation).
Definition: lwpoly.c:492
double lwcurvepoly_perimeter_2d(const LWCURVEPOLY *poly)
Definition: lwcurvepoly.c:160
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
double lwgeom_perimeter_2d(const LWGEOM *geom)
Definition: lwgeom.c:1917
type
Definition: ovdump.py:41
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
uint8_t type
Definition: liblwgeom.h:399
unsigned int uint32_t
Definition: uthash.h:78

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: