Skip to content

Commit

Permalink
Doc: describe empty geometry for getNumGeometries (#950)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews authored Aug 28, 2023
1 parent 40da3a6 commit 15185e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions capi/geos_c.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,8 @@ extern void GEOS_DLL *GEOSGeom_getUserData(const GEOSGeometry* g);
* multi-geometry or collection or 1 for a simple geometry.
* For nested collections, remember to check if returned
* sub-geometries are **themselves** also collections.
* Empty collection or multi-geometry types return 0,
* and empty simple geometry types return 1.
* \param g Input geometry
* \return Number of direct children in this collection
* \warning For GEOS < 3.2 this function may crash when fed simple geometries
Expand Down
9 changes: 7 additions & 2 deletions include/geos/geom/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,13 @@ class GEOS_DLL Geometry {
/// Return an integer representation of this Geometry type
virtual GeometryTypeId getGeometryTypeId() const = 0; //Abstract

/// Returns the number of geometries in this collection
/// (or 1 if this is not a collection)
/**
* \brief Returns the number of geometries in this collection,
* or 1 if this is not a collection.
*
* Empty collection or multi-geometry types return 0,
* and empty simple geometry types return 1.
*/
virtual std::size_t
getNumGeometries() const
{
Expand Down

0 comments on commit 15185e6

Please sign in to comment.