diff --git a/src/analysis/processing/qgsalgorithmorientedminimumboundingbox.cpp b/src/analysis/processing/qgsalgorithmorientedminimumboundingbox.cpp index c793f395786..e61d8d4453b 100644 --- a/src/analysis/processing/qgsalgorithmorientedminimumboundingbox.cpp +++ b/src/analysis/processing/qgsalgorithmorientedminimumboundingbox.cpp @@ -57,7 +57,7 @@ Qgis::WkbType QgsOrientedMinimumBoundingBoxAlgorithm::outputWkbType( Qgis::WkbTy QString QgsOrientedMinimumBoundingBoxAlgorithm::shortHelpString() const { - return QObject::tr( "This algorithm calculates the minimum area rotated rectangle which covers each feature in an input layer." ) + QStringLiteral( "\n\n" ) + QObject::tr( "For singlepart point features, the output corresponds to the bounding box of the geometry." ) + QStringLiteral( "\n\n" ) + QObject::tr( "See the 'Minimum bounding geometry' algorithm for a oriented bounding box calculation which covers the whole layer or grouped subsets of features." ); + return QObject::tr( "This algorithm calculates the minimum area rotated rectangle which covers each feature in an input layer." ) + QStringLiteral( "\n\n" ) + QObject::tr( "For singlepart point features, the output corresponds to the bounding box of the geometry." ) + QStringLiteral( "\n\n" ) + QObject::tr( "See the 'Minimum bounding geometry' algorithm for an oriented bounding box calculation which covers the whole layer or grouped subsets of features." ); } QString QgsOrientedMinimumBoundingBoxAlgorithm::shortDescription() const diff --git a/tests/src/core/testqgsexpression.cpp b/tests/src/core/testqgsexpression.cpp index 8992ed0e361..472d12cff59 100644 --- a/tests/src/core/testqgsexpression.cpp +++ b/tests/src/core/testqgsexpression.cpp @@ -1755,7 +1755,7 @@ class TestQgsExpression : public QObject QTest::newRow( "main angle polygon" ) << "round(main_angle( geom_from_wkt('POLYGON((0 0,2 9,9 2,0 0))')))" << false << QVariant( 77 ); QTest::newRow( "main angle polygon edge case" ) << "round(main_angle( geom_from_wkt('POLYGON((353542.63843526 378974.92373469, 353544.95808017 378975.73690545, 353545.27173175 378974.84218528, 353542.95208684 378974.02901451, 353542.63843526 378974.92373469))')))" << false << QVariant( 71 ); QTest::newRow( "main angle multi polygon" ) << "round(main_angle( geom_from_wkt('MULTIPOLYGON(((0 0,3 10,1 10,1 6,0 0)))')))" << false << QVariant( 17 ); - QTest::newRow( "main angle point" ) << "main_angle( geom_from_wkt('POINT (1.5 0.5)') )" << true << QVariant(); + QTest::newRow( "main angle point" ) << "main_angle( geom_from_wkt('POINT (1.5 0.5)') )" << false << QVariant( 0.0 ); QTest::newRow( "main angle line" ) << "round(main_angle( geom_from_wkt('LINESTRING (-1 2, 9 12)') ))" << false << QVariant( 45 ); QTest::newRow( "main angle not geom" ) << "main_angle('g')" << true << QVariant(); QTest::newRow( "main angle null" ) << "main_angle(NULL)" << false << QVariant(); diff --git a/tests/src/python/test_qgsgeometry.py b/tests/src/python/test_qgsgeometry.py index 92f95a6c3b2..882bb9793eb 100644 --- a/tests/src/python/test_qgsgeometry.py +++ b/tests/src/python/test_qgsgeometry.py @@ -10235,10 +10235,20 @@ class TestQgsGeometry(QgisTestCase): bbox, area, angle, width, height = empty.orientedMinimumBoundingBox() self.assertFalse(bbox) - # not a useful geometry + # Special case: singlepart point geometry point = QgsGeometry.fromWkt("Point(1 2)") bbox, area, angle, width, height = point.orientedMinimumBoundingBox() - self.assertFalse(bbox) + exp = "Polygon ((1 2, 1 2, 1 2, 1 2, 1 2))" + result = bbox.asWkt(2) + + self.assertTrue( + compareWkt(result, exp), + f"Oriented MBBR: mismatch Expected:\n{exp}\nGot:\n{result}\n", + ) + self.assertEqual(area, 0) + self.assertEqual(angle, 0) + self.assertEqual(width, 0) + self.assertEqual(height, 0) # polygon polygon = QgsGeometry.fromWkt(