There was a previous fix for this protecting some geos calls, but
on newer GEOS versions we get crashes with other methods (eg
calculating centroid) when using geos geometries with empty
interior rings.
Avoid this by ALWAYS defaulting to skipping empty rings when
creating GEOS polygons, UNLESS explicitly asked to. Then, only
explicitly ask to do this when we are using GEOS to validate
a geometry. In all other cases we don't need or want empty rings.
`QgsPolyhedralSurface` inherits from `QgsSurface` which implements
`QgsAbstractgeometry::isValid` by calling `isValid` from
GEOS. However, GEOS does not handle polyhedral surface. This means
that `isValid` will always return False even if the polyhedral surface
is valid.
This issue is fixed by implementing
`QgsPolyhedralSurface::isValid`. It checks that all the polygons of
the polyhedral surface are valid.
`surfaceToPolygon` is only useful for `QgsCurvePolygon` which inherits
from `QgsSurface`. The next commit will introduce
`QgsPolyhedralSurface` which also inherits from `QgsSurface`. For
`QgsPolyhedralSurface`, it does not make sense to have
`surfaceToPolygon`.
By moving `surfaceToPolygon` definition in `QgsCurvePolygon` this
allows to keep the functionality.
This method attempts to interpolate the point on a linestringM
where a specified m value falls. It does this by interpolating
M values along the line string segments, finding the first
segment at which the target M value falls. If the M value
corresponds to a part of the line with constant m values, then
the center point of this constant m value portion will be
returned.
Add QgsAbstractGeometry::simplifyByDistance, which is a direct
port of GEOS Douglas Peucker algorithm.
This is a trivial algorithm to implement, and we benefit from
avoiding the conversion to/from GEOS geometries.
Deprecating QgsGeometry::addPart in favor of QgsGeometry::addPartV2
to use Qgis::WkbType instead of Qgis::GeometryType because the latter
can't handle curved geometries (not specific enough).
Fixes#57255