QGIS API Documentation  3.0.2-Girona (307d082)
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( "ambient" ) );
24  mDiffuse = QgsSymbolLayerUtils::decodeColor( elem.attribute( "diffuse" ) );
25  mSpecular = QgsSymbolLayerUtils::decodeColor( elem.attribute( "specular" ) );
26  mShininess = elem.attribute( "shininess" ).toFloat();
27 }
28 
29 void QgsPhongMaterialSettings::writeXml( QDomElement &elem ) const
30 {
31  elem.setAttribute( "ambient", QgsSymbolLayerUtils::encodeColor( mAmbient ) );
32  elem.setAttribute( "diffuse", QgsSymbolLayerUtils::encodeColor( mDiffuse ) );
33  elem.setAttribute( "specular", QgsSymbolLayerUtils::encodeColor( mSpecular ) );
34  elem.setAttribute( "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)