Branch data Line data Source code
1 : : /*************************************************************************** 2 : : qgsmeshsimplificationsettings.h 3 : : --------------------- 4 : : begin : February 2020 5 : : copyright : (C) 2020 by Vincent Cloarec 6 : : email : vcloarec 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 QGSMESHSIMPLIFICATONSETTINGS_H 19 : : #define QGSMESHSIMPLIFICATONSETTINGS_H 20 : : 21 : : #include <QDomElement> 22 : : 23 : : #include "qgis_core.h" 24 : : #include "qgis.h" 25 : : #include "qgsreadwritecontext.h" 26 : : 27 : : SIP_NO_FILE 28 : : 29 : : /** 30 : : * \ingroup core 31 : : * 32 : : * \brief Represents a overview renderer settings 33 : : * 34 : : * \note The API is considered EXPERIMENTAL and can be changed without a notice 35 : : * 36 : : * \since QGIS 3.14 37 : : */ 38 : : 39 : 0 : class CORE_EXPORT QgsMeshSimplificationSettings 40 : : { 41 : : public: 42 : : //! Returns if the overview is active 43 : : bool isEnabled() const; 44 : : //! Sets if the overview is active 45 : : void setEnabled( bool isEnabled ); 46 : : 47 : : /** 48 : : * Returns the reduction factor used to build simplified mesh. 49 : : */ 50 : : double reductionFactor() const; 51 : : 52 : : /** 53 : : * Sets the reduction factor used to build simplified mesh. 54 : : * The triangles count of the simplified mesh equals apromativly the triangles count of base mesh divised by this factor. 55 : : * This reduction factor is used for simplification of each successive simplified mesh. For example, if the base mesh has 5M faces, 56 : : * and the reduction factor is 10, the first simplified mesh will have approximativly 500 000 faces, the second 50 000 faces, 57 : : * the third 5000, ... 58 : : * If highter reduction factor leads to simpler meshes, it produces also fewer levels of detail. 59 : : * The reduction factor has to be strictly greater than 1. If not, the simplification processus will render nothing. 60 : : */ 61 : : void setReductionFactor( double value ); 62 : : 63 : : //! Writes configuration to a new DOM element 64 : : QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const; 65 : : //! Reads configuration from the given DOM element 66 : : void readXml( const QDomElement &elem, const QgsReadWriteContext &context ); 67 : : 68 : : //! Returns the mesh resolution e.i., the minimum size (average) of triangles in pixels 69 : : int meshResolution() const; 70 : : 71 : : /** 72 : : * Sets the mesh resolution e.i., the minimum size (average) of triangles in pixels 73 : : * This value is used during map rendering to choose the most appropriate mesh from he list of simplified mesh. 74 : : * The first mesh which has its average triangle size greater this value will be chosen. 75 : : */ 76 : : void setMeshResolution( int meshResolution ); 77 : : 78 : : private: 79 : 0 : bool mEnabled = false; 80 : 0 : double mReductionFactor = 10; 81 : 0 : int mMeshResolution = 5; 82 : : }; 83 : : #endif // QGSMESHSIMPLIFICATONSETTINGS_H