QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsbox3d.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbox3d.h
3  ----------
4  begin : April 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSBOX3D_H
19 #define QGSBOX3D_H
20 
21 #include "qgis_core.h"
22 #include "qgsrectangle.h"
23 
24 class QgsPoint;
25 
36 class CORE_EXPORT QgsBox3d
37 {
38  public:
39 
43  QgsBox3d( double xmin = 0, double ymin = 0, double zmin = 0, double xmax = 0, double ymax = 0, double zmax = 0 ) SIP_HOLDGIL;
44 
49  QgsBox3d( const QgsPoint &p1, const QgsPoint &p2 ) SIP_HOLDGIL;
50 
55  QgsBox3d( const QgsRectangle &rect ) SIP_HOLDGIL;
56 
62  void setXMinimum( double x ) SIP_HOLDGIL;
63 
69  void setXMaximum( double x ) SIP_HOLDGIL;
70 
76  double xMinimum() const SIP_HOLDGIL { return mBounds2d.xMinimum(); }
77 
83  double xMaximum() const SIP_HOLDGIL { return mBounds2d.xMaximum(); }
84 
90  void setYMinimum( double y ) SIP_HOLDGIL;
91 
97  void setYMaximum( double y ) SIP_HOLDGIL;
98 
104  double yMinimum() const SIP_HOLDGIL { return mBounds2d.yMinimum(); }
105 
111  double yMaximum() const SIP_HOLDGIL { return mBounds2d.yMaximum(); }
112 
118  void setZMinimum( double z ) SIP_HOLDGIL;
119 
125  void setZMaximum( double z ) SIP_HOLDGIL;
126 
132  double zMinimum() const SIP_HOLDGIL { return mZmin; }
133 
139  double zMaximum() const SIP_HOLDGIL { return mZmax; }
140 
144  void normalize();
145 
151  double width() const SIP_HOLDGIL { return mBounds2d.width(); }
152 
158  double height() const SIP_HOLDGIL { return mBounds2d.height(); }
159 
165  double depth() const SIP_HOLDGIL { return mZmax - mZmin; }
166 
170  double volume() const SIP_HOLDGIL { return mBounds2d.area() * ( mZmax - mZmin ); }
171 
175  QgsBox3d intersect( const QgsBox3d &other ) const;
176 
181  bool is2d() const SIP_HOLDGIL;
182 
186  bool intersects( const QgsBox3d &other ) const;
187 
191  bool contains( const QgsBox3d &other ) const;
192 
199  bool contains( const QgsPoint &point ) const;
200 
204  QgsRectangle toRectangle() const { return mBounds2d; }
205 
206  bool operator==( const QgsBox3d &other ) const;
207 
208  private:
209 
210  QgsRectangle mBounds2d;
211  double mZmin = 0.0;
212  double mZmax = 0.0;
213 
214 };
215 
216 #endif // QGSBOX3D_H
QgsBox3d::volume
double volume() const SIP_HOLDGIL
Returns the volume of the box.
Definition: qgsbox3d.h:170
QgsBox3d::xMaximum
double xMaximum() const SIP_HOLDGIL
Returns the maximum x value.
Definition: qgsbox3d.h:83
qgsrectangle.h
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:400
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:38
QgsBox3d::width
double width() const SIP_HOLDGIL
Returns the width of the box.
Definition: qgsbox3d.h:151
QgsBox3d::height
double height() const SIP_HOLDGIL
Returns the height of the box.
Definition: qgsbox3d.h:158
QgsBox3d::zMaximum
double zMaximum() const SIP_HOLDGIL
Returns the maximum z value.
Definition: qgsbox3d.h:139
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsBox3d::zMinimum
double zMinimum() const SIP_HOLDGIL
Returns the minimum z value.
Definition: qgsbox3d.h:132
SIP_HOLDGIL
#define SIP_HOLDGIL
Definition: qgis_sip.h:157
QgsBox3d::yMinimum
double yMinimum() const SIP_HOLDGIL
Returns the minimum y value.
Definition: qgsbox3d.h:104
QgsBox3d::yMaximum
double yMaximum() const SIP_HOLDGIL
Returns the maximum y value.
Definition: qgsbox3d.h:111
QgsBox3d
A 3-dimensional box composed of x, y, z coordinates.
Definition: qgsbox3d.h:37
QgsBox3d::depth
double depth() const SIP_HOLDGIL
Returns the depth of the box.
Definition: qgsbox3d.h:165
QgsBox3d::xMinimum
double xMinimum() const SIP_HOLDGIL
Returns the minimum x value.
Definition: qgsbox3d.h:76