QGIS API Documentation 3.99.0-Master (d270888f95f)
Loading...
Searching...
No Matches
qgsfeature3dhandler_p.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsfeature3dhandler_p.cpp
3 --------------------------------------
4 Date : January 2019
5 Copyright : (C) 2019 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16
18
19#include "qgsgeometry.h"
20
21#include <QVector>
22#include <QVector3D>
23
25
26void QgsFeature3DHandler::updateZRangeFromPositions( const QVector<QVector3D> &positions )
27{
28 for ( const QVector3D &pos : positions )
29 {
30 if ( pos.z() < mZMin )
31 mZMin = pos.z();
32 if ( pos.z() > mZMax )
33 mZMax = pos.z();
34 }
35}
36
37bool QgsFeature3DHandler::clipGeometryIfTooLarge( QgsGeometry &geom ) const
38{
39 // let's clip gigantic geometries to the chunk's extents
40 const QgsRectangle bbox = geom.boundingBox();
41 if ( bbox.width() > MAX_GEOM_BBOX_SIZE || bbox.height() > MAX_GEOM_BBOX_SIZE )
42 {
43 geom = geom.clipped( mChunkExtent.toRectangle() );
44 return true;
45 }
46 return false;
47}
48
A geometry is the spatial representation of a feature.
QgsGeometry clipped(const QgsRectangle &rectangle)
Clips the geometry using the specified rectangle.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
A rectangle specified with double values.