Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: describe empty geometry for getNumGeometries #950

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading