PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ lwgeom_perimeter_2d()

double lwgeom_perimeter_2d ( const LWGEOM geom)

Definition at line 1953 of file lwgeom.c.

1954 {
1955  int type = geom->type;
1956  if ( type == POLYGONTYPE )
1957  return lwpoly_perimeter_2d((LWPOLY*)geom);
1958  else if ( type == CURVEPOLYTYPE )
1959  return lwcurvepoly_perimeter_2d((LWCURVEPOLY*)geom);
1960  else if ( type == TRIANGLETYPE )
1961  return lwtriangle_perimeter_2d((LWTRIANGLE*)geom);
1962  else if ( lwgeom_is_collection(geom) )
1963  {
1964  double perimeter = 0.0;
1965  uint32_t i;
1966  LWCOLLECTION *col = (LWCOLLECTION*)geom;
1967  for ( i = 0; i < col->ngeoms; i++ )
1968  perimeter += lwgeom_perimeter_2d(col->geoms[i]);
1969  return perimeter;
1970  }
1971  else
1972  return 0.0;
1973 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:126
#define POLYGONTYPE
Definition: liblwgeom.h:119
#define TRIANGLETYPE
Definition: liblwgeom.h:130
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 can contain sub-geometries or not.
Definition: lwgeom.c:1097
double lwgeom_perimeter_2d(const LWGEOM *geom)
Definition: lwgeom.c:1953
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:595
LWGEOM ** geoms
Definition: liblwgeom.h:590
uint8_t type
Definition: liblwgeom.h:477

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: