18 #include <QDomDocument>
24 : mSkyboxType( other.mSkyboxType )
25 , mPanoramicTexturePath( other.mPanoramicTexturePath )
26 , mCubeMapFacesPaths( other.mCubeMapFacesPaths )
33 this->mSkyboxType = rhs.mSkyboxType;
34 this->mPanoramicTexturePath = rhs.mPanoramicTexturePath;
35 this->mCubeMapFacesPaths = rhs.mCubeMapFacesPaths;
42 QString skyboxTypeStr = element.attribute( QStringLiteral(
"skybox-type" ) );
43 if ( skyboxTypeStr == QLatin1String(
"Distinct Faces" ) )
45 else if ( skyboxTypeStr == QLatin1String(
"Panoramic Texture" ) )
47 mPanoramicTexturePath = pathResolver.
readPath( element.attribute( QStringLiteral(
"panoramic-texture-path" ) ) );
48 mCubeMapFacesPaths.clear();
49 mCubeMapFacesPaths[ QStringLiteral(
"posX" ) ] = pathResolver.
readPath( element.attribute( QStringLiteral(
"posX-texture-path" ) ) );
50 mCubeMapFacesPaths[ QStringLiteral(
"posY" ) ] = pathResolver.
readPath( element.attribute( QStringLiteral(
"posY-texture-path" ) ) );
51 mCubeMapFacesPaths[ QStringLiteral(
"posZ" ) ] = pathResolver.
readPath( element.attribute( QStringLiteral(
"posZ-texture-path" ) ) );
52 mCubeMapFacesPaths[ QStringLiteral(
"negX" ) ] = pathResolver.
readPath( element.attribute( QStringLiteral(
"negX-texture-path" ) ) );
53 mCubeMapFacesPaths[ QStringLiteral(
"negY" ) ] = pathResolver.
readPath( element.attribute( QStringLiteral(
"negY-texture-path" ) ) );
54 mCubeMapFacesPaths[ QStringLiteral(
"negZ" ) ] = pathResolver.
readPath( element.attribute( QStringLiteral(
"negZ-texture-path" ) ) );
59 switch ( mSkyboxType )
62 element.setAttribute( QStringLiteral(
"skybox-type" ), QStringLiteral(
"Distinct Faces" ) );
65 element.setAttribute( QStringLiteral(
"skybox-type" ), QStringLiteral(
"Panoramic Texture" ) );
70 element.setAttribute( QStringLiteral(
"panoramic-texture-path" ), pathResolver.
writePath( mPanoramicTexturePath ) );
71 element.setAttribute( QStringLiteral(
"posX-texture-path" ), pathResolver.
writePath( mCubeMapFacesPaths[ QStringLiteral(
"posX" ) ] ) );
72 element.setAttribute( QStringLiteral(
"posY-texture-path" ), pathResolver.
writePath( mCubeMapFacesPaths[ QStringLiteral(
"posY" ) ] ) );
73 element.setAttribute( QStringLiteral(
"posZ-texture-path" ), pathResolver.
writePath( mCubeMapFacesPaths[ QStringLiteral(
"posZ" ) ] ) );
74 element.setAttribute( QStringLiteral(
"negX-texture-path" ), pathResolver.
writePath( mCubeMapFacesPaths[ QStringLiteral(
"negX" ) ] ) );
75 element.setAttribute( QStringLiteral(
"negY-texture-path" ), pathResolver.
writePath( mCubeMapFacesPaths[ QStringLiteral(
"negY" ) ] ) );
76 element.setAttribute( QStringLiteral(
"negZ-texture-path" ), pathResolver.
writePath( mCubeMapFacesPaths[ QStringLiteral(
"negZ" ) ] ) );
Resolves relative paths into absolute paths and vice versa.
QString writePath(const QString &filename) const
Prepare a filename to save it to the project file.
QString readPath(const QString &filename) const
Turn filename read from the project file to an absolute path.
The class is used as a container of context for various read/write operations on other objects.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
Contains the configuration of a skybox entity.
QgsSkyboxSettings()=default
default constructor
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from a DOM element.
QgsSkyboxSettings & operator=(QgsSkyboxSettings const &rhs)
delete assignment operator
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to a DOM element.