Skip to content
Permalink
Browse files

add constructor to QgsBox3d with a QgsRectangle

  • Loading branch information
Gustry authored and nyalldawson committed Dec 14, 2017
1 parent d0475cb commit abdd8759a060a1c63b126618dab3b5a3f8b507bf
@@ -37,6 +37,12 @@ class QgsBox3d
The box is normalized after construction.
%End

QgsBox3d( const QgsRectangle &rect );
%Docstring
Constructs a QgsBox3D from a rectangle.
Z Minimum and Z Maximum are set to 0.0.
%End

void setXMinimum( double x );
%Docstring
Sets the minimum ``x`` value.
@@ -32,6 +32,10 @@ QgsBox3d::QgsBox3d( const QgsPoint &p1, const QgsPoint &p2 )
mBounds2d.normalize();
}

QgsBox3d::QgsBox3d( const QgsRectangle &rect )
: mBounds2d( rect )
{}

void QgsBox3d::setXMinimum( double x )
{
mBounds2d.setXMinimum( x );
@@ -47,6 +47,12 @@ class CORE_EXPORT QgsBox3d
*/
QgsBox3d( const QgsPoint &p1, const QgsPoint &p2 );

/**
* Constructs a QgsBox3D from a rectangle.
* Z Minimum and Z Maximum are set to 0.0.
*/
QgsBox3d( const QgsRectangle &rect );

/**
* Sets the minimum \a x value.
* \see xMinimum()
@@ -52,6 +52,14 @@ def testCtor(self):
self.assertEqual(box.yMaximum(), 11.0)
self.assertEqual(box.zMaximum(), 12.0)

box = QgsBox3d(QgsRectangle(5, 6, 11, 13))
self.assertEqual(box.xMinimum(), 5.0)
self.assertEqual(box.yMinimum(), 6.0)
self.assertEqual(box.zMinimum(), 0.0)
self.assertEqual(box.xMaximum(), 11.0)
self.assertEqual(box.yMaximum(), 13.0)
self.assertEqual(box.zMaximum(), 0.0)

def testSetters(self):
box = QgsBox3d(5.0, 6.0, 7.0, 10.0, 11.0, 12.0)

0 comments on commit abdd875

Please sign in to comment.
You can’t perform that action at this time.