Cleanup (and rename?) QgsGeometry #28

nyalldawson opened this Issue Dec 16, 2015 · 0 comments


None yet

1 participant


Since the merge of the new geometry engine, the role of QgsGeometry is undefined. It currently acts as just an implicitly shared container for a QgsAbstractGeometryV2, plus a random bunch of methods for modifying and converting the geometry.

I'd like to see this refined in QGIS 3.0. My thoughts:

  • rename QgsGeometry to QgsGeometryContainer, to better indicate what it's used for and differentiate it from QgsAbstractGeometryV2
  • move all geometry modification (eg buffer, addRing, addPart, ...) and relation methods ( eg contains, crosses, ...) out of this class. Many are already implemented in either QgsGeometryEngine, QgsAbstractGeometryV2 or QgsGeometryUtils and the QgsGeometry versions are just wrappers around these
  • move all the creation methods (eg fromQPointF, ... ) to QgsGeometryFactory (or to their relevant geometry class, eg QgsPointV2::fromQPointF )

What would remain in QgsGeometryContainer would be:

  • methods for accessing and setting the contained QgsAbstractGeometryV2, isEmpty()
  • some conversion routines, eg convertToMultiType, convertToSingleType, segmentize, and a general "bool convertTo( QgsWKBTypes::Type )" and "bool canConvertTo( QgsWKBTypes::Type )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment