QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgsphongmaterialsettings.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsphongmaterialsettings.cpp
3  --------------------------------------
4  Date : July 2017
5  Copyright : (C) 2017 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 
17 
18 #include "qgssymbollayerutils.h"
19 
20 
21 void QgsPhongMaterialSettings::readXml( const QDomElement &elem )
22 {
23  mAmbient = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "ambient" ) ) );
24  mDiffuse = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "diffuse" ) ) );
25  mSpecular = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "specular" ) ) );
26  mShininess = elem.attribute( QStringLiteral( "shininess" ) ).toFloat();
27 }
28 
29 void QgsPhongMaterialSettings::writeXml( QDomElement &elem ) const
30 {
31  elem.setAttribute( QStringLiteral( "ambient" ), QgsSymbolLayerUtils::encodeColor( mAmbient ) );
32  elem.setAttribute( QStringLiteral( "diffuse" ), QgsSymbolLayerUtils::encodeColor( mDiffuse ) );
33  elem.setAttribute( QStringLiteral( "specular" ), QgsSymbolLayerUtils::encodeColor( mSpecular ) );
34  elem.setAttribute( QStringLiteral( "shininess" ), mShininess );
35 }
static QString encodeColor(const QColor &color)
void readXml(const QDomElement &elem)
Reads settings from a DOM element.
void writeXml(QDomElement &elem) const
Writes settings to a DOM element.
static QColor decodeColor(const QString &str)