1 /***************************************************************************
2   qgsskyboxsettings.h
3   --------------------------------------
4   Date                 : August 2020
5   Copyright            : (C) 2020 by Belgacem Nedjima
6   Email                : gb uderscore 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 QGSSKYBOXSETTINGS_H
17 #define QGSSKYBOXSETTINGS_H
18 
19 #include <QString>
20 #include <QMap>
21 
22 #include "qgis_3d.h"
23 #include "qgsskyboxentity.h"
24 
25 class QgsReadWriteContext;
26 class QDomElement;
27 
28 #define SIP_NO_FILE
29 
30 /**
31  * \brief Contains the configuration of a skybox entity.
32  *
33  * \ingroup 3d
34  * \since QGIS 3.16
35  */
36 class _3D_EXPORT QgsSkyboxSettings
37 {
38   public:
39     //! default constructor
40     QgsSkyboxSettings() = default;
41     //! copy constructor
42     QgsSkyboxSettings( const QgsSkyboxSettings &other );
43     //! delete assignment operator
44     QgsSkyboxSettings &operator=( QgsSkyboxSettings const &rhs );
45 
46     //! Reads settings from a DOM \a element
47     void readXml( const QDomElement &element, const QgsReadWriteContext &context );
48     //! Writes settings to a DOM \a element
49     void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
50 
51     //! Returns the type of the skybox
skyboxType()52     QgsSkyboxEntity::SkyboxType skyboxType() const { return mSkyboxType; }
53     //! Sets the type of the skybox
setSkyboxType(QgsSkyboxEntity::SkyboxType type)54     void setSkyboxType( QgsSkyboxEntity::SkyboxType type ) { mSkyboxType = type; }
55 
56     //! Returns the panoramic texture path of a skybox of type "Panormaic skybox"
panoramicTexturePath()57     QString panoramicTexturePath() const { return mPanoramicTexturePath; }
58     //! Sets the panoramic texture path of a skybox of type "Panoramic skybox"
setPanoramicTexturePath(const QString & texturePath)59     void setPanoramicTexturePath( const QString &texturePath ) { mPanoramicTexturePath = texturePath; }
60 
61     /**
62      * Returns a map containing the path of each texture specified by the user.
63      * The map will contain the following keys corresponding to each face "posX", "posY", "posZ", "negX", "negY", "negZ".
64      */
cubeMapFacesPaths()65     QMap<QString, QString> cubeMapFacesPaths() const { return mCubeMapFacesPaths; }
66 
67     /**
68      * Sets a face of one of the skybox 6 textures
69      * The face parameter needs to be one of the followings: "posX", "posY", "posZ", "negX", "negY", "negZ"
70      */
setCubeMapFace(const QString & face,const QString & path)71     void setCubeMapFace( const QString &face, const QString &path ) { mCubeMapFacesPaths[face] = path; }
72 
73   private:
74     QgsSkyboxEntity::SkyboxType mSkyboxType;
75     //
76     QString mPanoramicTexturePath;
77     //
78     QMap<QString, QString> mCubeMapFacesPaths;
79 };
80 
81 #endif // QGSSKYBOXSETTINGS_H
82