Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #4349 from nyalldawson/box3d
Initial framework for 3D box class
  • Loading branch information
nyalldawson committed Apr 12, 2017
2 parents 6726214 + b64c7b7 commit 3bb3f59
Show file tree
Hide file tree
Showing 15 changed files with 1,337 additions and 373 deletions.
1 change: 0 additions & 1 deletion python/auto_sip.blacklist
Expand Up @@ -95,7 +95,6 @@ core/qgspropertycollection.sip
core/qgsprovidermetadata.sip
core/qgsproviderregistry.sip
core/qgspythonrunner.sip
core/qgsrectangle.sip
core/qgsrelation.sip
core/qgsrelationmanager.sip
core/qgsrenderchecker.sip
Expand Down
3 changes: 2 additions & 1 deletion python/core/core.sip
Expand Up @@ -126,7 +126,6 @@
%Include qgsprovidermetadata.sip
%Include qgsproviderregistry.sip
%Include qgspythonrunner.sip
%Include qgsrectangle.sip
%Include qgsrelation.sip
%Include qgsrelationmanager.sip
%Include qgsrenderchecker.sip
Expand Down Expand Up @@ -357,6 +356,7 @@
%Include dxf/qgsdxfexport.sip

%Include geometry/qgsabstractgeometry.sip
%Include geometry/qgsbox3d.sip
%Include geometry/qgscircularstring.sip
%Include geometry/qgscompoundcurve.sip
%Include geometry/qgscurvepolygon.sip
Expand All @@ -373,6 +373,7 @@
%Include geometry/qgsmultisurface.sip
%Include geometry/qgspointv2.sip
%Include geometry/qgspolygon.sip
%Include geometry/qgsrectangle.sip
%Include geometry/qgssurface.sip
%Include geometry/qgstriangle.sip
%Include geometry/qgswkbtypes.sip
Expand Down
206 changes: 206 additions & 0 deletions python/core/geometry/qgsbox3d.sip
@@ -0,0 +1,206 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsbox3d.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsBox3d
{
%Docstring
A 3-dimensional box composed of x, y, z coordinates.

A box composed of x/y/z minimum and maximum values. It is often used to return the 3D
extent of a geometry or collection of geometries.

.. versionadded:: 3.0
\see QgsRectangle
%End

%TypeHeaderCode
#include "qgsbox3d.h"
%End
public:

QgsBox3d( double xmin = 0, double ymin = 0, double mZmin = 0, double xmax = 0, double ymax = 0, double mZmax = 0 );
%Docstring
Constructor for QgsBox3D which accepts the ranges of x/y/z coordinates.
%End

QgsBox3d( const QgsPointV2 &p1, const QgsPointV2 &p2 );
%Docstring
Constructs a QgsBox3D from two points representing opposite corners of the box.
The box is normalized after construction.
%End

void setXMinimum( double x );
%Docstring
Sets the minimum x value.
\see xMinimum()
\see setXMaximum()
%End

void setXMaximum( double x );
%Docstring
Sets the maximum x value.
\see xMaximum()
\see setXMinimum()
%End

double xMinimum() const;
%Docstring
Returns the minimum x value.
\see setXMinimum()
\see xMaximum()
:rtype: float
%End

double xMaximum() const;
%Docstring
Returns the maximum x value.
\see setXMaximum()
\see xMinimum()
:rtype: float
%End

void setYMinimum( double y );
%Docstring
Sets the minimum y value.
\see yMinimum()
\see setYMaximum()
%End

void setYMaximum( double y );
%Docstring
Sets the maximum y value.
\see yMaximum()
\see setYMinimum()
%End

double yMinimum() const;
%Docstring
Returns the minimum y value.
\see setYMinimum()
\see yMaximum()
:rtype: float
%End

double yMaximum() const;
%Docstring
Returns the maximum y value.
\see setYMaximum()
\see yMinimum()
:rtype: float
%End

void setZMinimum( double z );
%Docstring
Sets the minimum z value.
\see zMinimum()
\see setZMaximum()
%End

void setZMaximum( double z );
%Docstring
Sets the maximum z value.
\see zMaximum()
\see setZMinimum()
%End

double zMinimum() const;
%Docstring
Returns the minimum z value.
\see setZMinimum()
\see zMaximum()
:rtype: float
%End

double zMaximum() const;
%Docstring
Returns the maximum z value.
\see setZMaximum()
\see zMinimum()
:rtype: float
%End

void normalize();
%Docstring
Normalize the box so it has non-negative width/height/depth.
%End

double width() const;
%Docstring
Returns the width of the box.
\see height()
\see depth()
:rtype: float
%End

double height() const;
%Docstring
Returns the height of the box.
\see width()
\see depth()
:rtype: float
%End

double depth() const;
%Docstring
Returns the depth of the box.
\see width()
\see height()
:rtype: float
%End

double volume() const;
%Docstring
Returns the volume of the box.
:rtype: float
%End

QgsBox3d intersect( const QgsBox3d &other ) const;
%Docstring
Returns the intersection of this box and another 3D box.
:rtype: QgsBox3d
%End

bool intersects( const QgsBox3d &other ) const;
%Docstring
Returns true if box intersects with another box.
:rtype: bool
%End

bool contains( const QgsBox3d &other ) const;
%Docstring
Returns true when box contains other box.
:rtype: bool
%End

bool contains( const QgsPointV2 &point ) const;
%Docstring
Returns true when box contains a point.

If the point is a 2D point (no z-coordinate), then the containment test
will be performed on the x/y extent of the box only.
:rtype: bool
%End

QgsRectangle toRectangle() const;
%Docstring
Converts the box to a 2D rectangle.
:rtype: QgsRectangle
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsbox3d.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit 3bb3f59

Please sign in to comment.