1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsbox3d.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsBox3D
{
%Docstring(signature="appended")
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.
.. note::
In QGIS 3.34 this class was renamed from :py:class:`QgsBox3d` to :py:class:`QgsBox3D`. The old :py:class:`QgsBox3d` name
remains available in PyQGIS for compatibility.
.. seealso:: :py:class:`QgsRectangle`
%End
%TypeHeaderCode
#include "qgsbox3d.h"
%End
public:
static const QMetaObject staticMetaObject;
public:
QgsBox3D( SIP_PYOBJECT x /TypeHint="Optional[Union[QgsPoint, QgsRectangle, float]]"/ = Py_None, SIP_PYOBJECT y /TypeHint="Optional[QgsPoint, float]"/ = Py_None, SIP_PYOBJECT z /TypeHint="Optional[Union[bool, float]]"/ = Py_None, SIP_PYOBJECT x2 /TypeHint="Optional[Union[bool, float]]"/ = Py_None, SIP_PYOBJECT y2 /TypeHint="Optional[float]"/ = Py_None, SIP_PYOBJECT z2 /TypeHint="Optional[float]"/ = Py_None, SIP_PYOBJECT n /TypeHint="Optional[bool]"/ = Py_None ) [( double x = 0.0, double y = 0.0, double z = 0.0, double x2 = 0.0, double y2 = 0.0, double z2 = 0.0, bool n = true )];
%Docstring
Constructor for QgsBox3D which accepts the ranges of x/y/z coordinates.
If ``normalize`` is ``False`` then the normalization step will not be
applied automatically.
%End
%MethodCode
if ( sipCanConvertToType( a0, sipType_QgsRectangle, SIP_NOT_NONE ) && a4 == Py_None && a5 == Py_None && a6 == Py_None )
{
int state;
sipIsErr = 0;
QgsRectangle *p = reinterpret_cast<QgsRectangle *>( sipConvertToType( a0, sipType_QgsRectangle, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
if ( !sipIsErr )
{
double z1 = a1 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a1 );
double z2 = a2 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a2 );
bool n = a3 == Py_None ? true : PyObject_IsTrue( a3 );
sipCpp = new QgsBox3D( *p, z1, z2, n );
}
sipReleaseType( p, sipType_QgsRectangle, state );
}
else if ( sipCanConvertToType( a0, sipType_QgsPoint, SIP_NOT_NONE ) && sipCanConvertToType( a1, sipType_QgsPoint, SIP_NOT_NONE ) && a3 == Py_None && a4 == Py_None && a5 == Py_None && a6 == Py_None )
{
int state;
sipIsErr = 0;
QgsPoint *pt1 = reinterpret_cast<QgsPoint *>( sipConvertToType( a0, sipType_QgsPoint, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
if ( !sipIsErr )
{
QgsPoint *pt2 = reinterpret_cast<QgsPoint *>( sipConvertToType( a1, sipType_QgsPoint, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
if ( !sipIsErr )
{
bool n = a2 == Py_None ? true : PyObject_IsTrue( a2 );
sipCpp = new QgsBox3D( *pt1, *pt2, n );
}
sipReleaseType( pt2, sipType_QgsPoint, state );
}
sipReleaseType( pt1, sipType_QgsPoint, state );
}
else if (
( a0 == Py_None || PyFloat_AsDouble( a0 ) != -1.0 || !PyErr_Occurred() ) &&
( a1 == Py_None || PyFloat_AsDouble( a1 ) != -1.0 || !PyErr_Occurred() ) &&
( a2 == Py_None || PyFloat_AsDouble( a2 ) != -1.0 || !PyErr_Occurred() ) &&
( a3 == Py_None || PyFloat_AsDouble( a3 ) != -1.0 || !PyErr_Occurred() ) &&
( a4 == Py_None || PyFloat_AsDouble( a3 ) != -1.0 || !PyErr_Occurred() ) &&
( a5 == Py_None || PyFloat_AsDouble( a3 ) != -1.0 || !PyErr_Occurred() ) &&
( a6 == Py_None || PyFloat_AsDouble( a3 ) != -1.0 || !PyErr_Occurred() ) )
{
double x1 = a0 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a0 );
double y1 = a1 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a1 );
double z1 = a2 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a2 );
double x2 = a3 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a3 );
double y2 = a4 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a4 );
double z2 = a5 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a5 );
bool n = a6 == Py_None ? true : PyObject_IsTrue( a6 );
sipCpp = new QgsBox3D( x1, y1, z1, x2, y2, z2, n );
}
else // Invalid ctor arguments
{
PyErr_SetString( PyExc_TypeError, QStringLiteral( "Invalid type in constructor arguments." ).toUtf8().constData() );
sipIsErr = 1;
}
%End
void set( double xMin, double yMin, double zMin, double xMax, double yMax, double zMax, bool normalize = true );
%Docstring
Sets the box from a set of (x,y,z) minimum and maximum coordinates.
.. versionadded:: 3.40
%End
void setXMinimum( double x ) /HoldGIL/;
%Docstring
Sets the minimum ``x`` value.
.. seealso:: :py:func:`xMinimum`
.. seealso:: :py:func:`setXMaximum`
%End
void setXMaximum( double x ) /HoldGIL/;
%Docstring
Sets the maximum ``x`` value.
.. seealso:: :py:func:`xMaximum`
.. seealso:: :py:func:`setXMinimum`
%End
double xMinimum() const /HoldGIL/;
%Docstring
Returns the minimum x value.
.. seealso:: :py:func:`setXMinimum`
.. seealso:: :py:func:`xMaximum`
%End
double xMaximum() const /HoldGIL/;
%Docstring
Returns the maximum x value.
.. seealso:: :py:func:`setXMaximum`
.. seealso:: :py:func:`xMinimum`
%End
void setYMinimum( double y ) /HoldGIL/;
%Docstring
Sets the minimum ``y`` value.
.. seealso:: :py:func:`yMinimum`
.. seealso:: :py:func:`setYMaximum`
%End
void setYMaximum( double y ) /HoldGIL/;
%Docstring
Sets the maximum ``y`` value.
.. seealso:: :py:func:`yMaximum`
.. seealso:: :py:func:`setYMinimum`
%End
double yMinimum() const /HoldGIL/;
%Docstring
Returns the minimum y value.
.. seealso:: :py:func:`setYMinimum`
.. seealso:: :py:func:`yMaximum`
%End
double yMaximum() const /HoldGIL/;
%Docstring
Returns the maximum y value.
.. seealso:: :py:func:`setYMaximum`
.. seealso:: :py:func:`yMinimum`
%End
void setZMinimum( double z ) /HoldGIL/;
%Docstring
Sets the minimum ``z`` value.
.. seealso:: :py:func:`zMinimum`
.. seealso:: :py:func:`setZMaximum`
%End
void setZMaximum( double z ) /HoldGIL/;
%Docstring
Sets the maximum ``z`` value.
.. seealso:: :py:func:`zMaximum`
.. seealso:: :py:func:`setZMinimum`
%End
double zMinimum() const /HoldGIL/;
%Docstring
Returns the minimum z value.
.. seealso:: :py:func:`setZMinimum`
.. seealso:: :py:func:`zMaximum`
%End
double zMaximum() const /HoldGIL/;
%Docstring
Returns the maximum z value.
.. seealso:: :py:func:`setZMaximum`
.. seealso:: :py:func:`zMinimum`
%End
void setNull() /HoldGIL/;
%Docstring
Mark a box as being null (holding no spatial information).
.. versionadded:: 3.34
%End
void normalize() /HoldGIL/;
%Docstring
Normalize the box so it has non-negative width/height/depth.
%End
double width() const /HoldGIL/;
%Docstring
Returns the width of the box.
.. seealso:: :py:func:`height`
.. seealso:: :py:func:`depth`
%End
double height() const /HoldGIL/;
%Docstring
Returns the height of the box.
.. seealso:: :py:func:`width`
.. seealso:: :py:func:`depth`
%End
double depth() const /HoldGIL/;
%Docstring
Returns the depth of the box.
.. seealso:: :py:func:`width`
.. seealso:: :py:func:`height`
%End
QgsVector3D center() const /HoldGIL/;
%Docstring
Returns the center of the box as a vector.
.. versionadded:: 3.34
%End
double area() const /HoldGIL/;
%Docstring
Returns the area of the box.
.. versionadded:: 3.40
%End
double volume() const /HoldGIL/;
%Docstring
Returns the volume of the box.
%End
QgsBox3D intersect( const QgsBox3D &other ) const /HoldGIL/;
%Docstring
Returns the intersection of this box and another 3D box.
%End
bool is2d() const /HoldGIL/;
%Docstring
Returns ``True`` if the box can be considered a 2-dimensional box, i.e.
it has equal minimum and maximum z values.
%End
bool is3D() const /HoldGIL/;
%Docstring
Returns ``True`` if the box can be considered a 3-dimensional box, i.e.
it has valid minimum and maximum z values. If the box is not normalized,
this returns ``False``.
.. versionadded:: 3.34
%End
bool intersects( const QgsBox3D &other ) const /HoldGIL/;
%Docstring
Returns ``True`` if box intersects with another box.
%End
bool contains( const QgsBox3D &other ) const /HoldGIL/;
%Docstring
Returns ``True`` when box contains other box.
%End
bool contains( const QgsPoint &point ) const /HoldGIL/;
%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.
%End
bool contains( double x, double y, double z ) const /HoldGIL/;
%Docstring
Returns ``True`` when box contains a point (``x``, ``y``, ``z``). A
point on the border of the box will also return ``True``
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.
.. versionadded:: 3.34
%End
void combineWith( const QgsBox3D &box ) /HoldGIL/;
%Docstring
Expands the bbox so that it covers both the original rectangle and the
given rectangle.
.. versionadded:: 3.34
%End
void combineWith( double x, double y, double z ) /HoldGIL/;
%Docstring
Expands the bbox so that it covers both the original rectangle and the
given point.
.. versionadded:: 3.34
%End
QgsRectangle toRectangle() const /HoldGIL/;
%Docstring
Converts the box to a 2D rectangle.
%End
double distanceTo( const QVector3D &point ) const /HoldGIL/;
%Docstring
Returns the smallest distance between the box and the point ``point``
(returns 0 if the point is inside the box)
.. versionadded:: 3.18
%End
bool operator==( const QgsBox3D &other ) const /HoldGIL/;
void scale( double scaleFactor, const QgsPoint ¢er = QgsPoint() ) /HoldGIL/;
%Docstring
Scale the rectangle around a ``center`` :py:class:`QgsPoint`.
If no ``center`` point is specified then the current center of the box
will be used.
.. versionadded:: 3.26
%End
void scale( double scaleFactor, double centerX, double centerY, double centerZ ) /HoldGIL/;
%Docstring
Scale the rectangle around a center coordinates.
.. versionadded:: 3.26
%End
bool isNull() const /HoldGIL/;
%Docstring
Test if the box is null (holding no spatial information).
A null box is also an empty box.
.. seealso:: :py:func:`setNull`
.. versionadded:: 3.34
%End
bool isEmpty() const /HoldGIL/;
%Docstring
Returns ``True`` if the box is empty. An empty box may still be non-null
if it contains valid spatial information (e.g. bounding box of a point
or of a vertical or horizontal segment).
.. versionadded:: 3.34
%End
QString toString( int precision = 16 ) const /HoldGIL/;
%Docstring
Returns a string representation of form xmin,ymin,zmin : xmax,ymax,zmax
Coordinates will be truncated to the specified precision. If the
specified precision is less than 0, a suitable minimum precision is
used.
.. versionadded:: 3.34
%End
QVector< QgsVector3D > corners() const /HoldGIL/;
%Docstring
Returns an array of all box corners as 3D vectors.
%End
QgsBox3D operator-( const QgsVector3D &v ) const /HoldGIL/;
QgsBox3D operator+( const QgsVector3D &v ) const /HoldGIL/;
QgsBox3D &operator-=( const QgsVector3D &v ) /HoldGIL/;
QgsBox3D &operator+=( const QgsVector3D &v ) /HoldGIL/;
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsBox3D(%1, %2, %3, %4, %5, %6)>" )
.arg( sipCpp->xMinimum() )
.arg( sipCpp->yMinimum() )
.arg( sipCpp->zMinimum() )
.arg( sipCpp->xMaximum() )
.arg( sipCpp->yMaximum() )
.arg( sipCpp->zMaximum() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsbox3d.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|