1 /***************************************************************************
2   qgs3dmapexportsettings.h
3   --------------------------------------
4   Date                 : July 2020
5   Copyright            : (C) 2020 by Belgacem Nedjima
6   Email                : gb underscore nedjima at esi dot dz
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 #ifndef QGS3DMAPEXPORTSETTINGS_H
17 #define QGS3DMAPEXPORTSETTINGS_H
18 
19 #include "qgis_3d.h"
20 
21 #include <QString>
22 #include <QObject>
23 #include <QDir>
24 
25 /**
26  * \brief Manages the various settings the user can choose from when exporting a 3D scene
27  * \ingroup 3d
28  * \since QGIS 3.16
29  */
30 class _3D_EXPORT Qgs3DMapExportSettings
31 {
32   public:
33     //! Constructor
34     Qgs3DMapExportSettings();
35 
36     //! destructor (save the export settings before deallocation)
37     ~Qgs3DMapExportSettings();
38 
39     //! Returns the scene name
sceneName()40     QString sceneName() const { return mSceneName; }
41     //! Returns the scene folder path
sceneFolderPath()42     QString sceneFolderPath() const { return mSceneFolderPath; }
43     //! Returns the terrain resolution
terrrainResolution()44     int terrrainResolution() const { return mTerrainResolution; }
45     //! Returns whether triangles edges will look smooth
smoothEdges()46     bool smoothEdges() const { return mSmoothEdges; }
47     //! Returns whether normals will be exported
exportNormals()48     bool exportNormals() const { return mExportNormals; }
49     //! Returns whether textures will be exported
exportTextures()50     bool exportTextures() const { return mExportTextures; }
51     //! Returns the terrain texture resolution
terrainTextureResolution()52     int terrainTextureResolution() const { return mTerrainTextureResolution; }
53     //! Returns the scale of the exported model
scale()54     float scale() const { return mScale; }
55 
56     //! Sets the scene name
setSceneName(const QString & sceneName)57     void setSceneName( const QString &sceneName ) { mSceneName = sceneName; }
58     //! Sets the scene's .obj file folder path
setSceneFolderPath(const QString & sceneFolderPath)59     void setSceneFolderPath( const QString &sceneFolderPath ) { mSceneFolderPath = sceneFolderPath; }
60     //! Sets the terrain resolution
setTerrainResolution(int resolution)61     void setTerrainResolution( int resolution ) { mTerrainResolution = resolution; }
62     //! Sets whether triangles edges will look smooth
setSmoothEdges(bool smoothEdges)63     void setSmoothEdges( bool smoothEdges ) { mSmoothEdges = smoothEdges; }
64     //! Sets whether normals should be exported
setExportNormals(bool exportNormals)65     void setExportNormals( bool exportNormals ) { mExportNormals = exportNormals; }
66     //! Sets whether textures will be exported
setExportTextures(bool exportTextures)67     void setExportTextures( bool exportTextures ) { mExportTextures = exportTextures; }
68     //! Sets the terrain texture resolution
setTerrainTextureResolution(int resolution)69     void setTerrainTextureResolution( int resolution ) { mTerrainTextureResolution = resolution; }
70     //! Sets the scale of exported model
setScale(float scale)71     void setScale( float scale ) { mScale = scale; }
72 
73   private:
74     QString mSceneName = QString( "Scene" );
75     QString mSceneFolderPath = QDir::homePath();
76     int mTerrainResolution = 128;
77     bool mSmoothEdges = false;
78     bool mExportNormals = true;
79     bool mExportTextures = false;
80     int mTerrainTextureResolution = 512;
81     float mScale = 1.0f;
82 };
83 
84 #endif // QGS3DMAPEXPORTSETTINGS_H
85