QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgssimplelinematerialsettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssimplelinematerialsettings.h
3  --------------------------------------
4  Date : August 2020
5  Copyright : (C) 2020 by Nyall Dawson
6  Email : nyall dot dawson 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 
16 
17 #ifndef QGSSIMPLELINEMATERIALSETTINGS_H
18 #define QGSSIMPLELINEMATERIALSETTINGS_H
19 
20 #include "qgis_3d.h"
22 
23 #include <QColor>
24 
25 class QDomElement;
26 
37 {
38  public:
39 
44 
45  QString type() const override;
46 
50  static bool supportsTechnique( QgsMaterialSettingsRenderingTechnique technique );
51 
56 
58 
64  QColor ambient() const { return mAmbient; }
65 
71  void setAmbient( const QColor &ambient ) { mAmbient = ambient; }
72 
73  QMap<QString, QString> toExportParameters() const override;
74  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
75  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
76 #ifndef SIP_RUN
77  Qt3DRender::QMaterial *toMaterial( QgsMaterialSettingsRenderingTechnique technique, const QgsMaterialContext &context ) const override SIP_FACTORY;
78  void addParametersToEffect( Qt3DRender::QEffect *effect ) const override;
79 #endif
80 
81  // TODO c++20 - replace with = default
82  bool operator==( const QgsSimpleLineMaterialSettings &other ) const
83  {
84  return mAmbient == other.mAmbient;
85  }
86 
87  private:
88  QColor mAmbient{ QColor::fromRgbF( 0.1f, 0.1f, 0.1f, 1.0f ) };
89 
90 };
91 
92 
93 #endif // QGSSIMPLELINEMATERIALSETTINGS_H
QgsAbstractMaterialSettings::type
virtual QString type() const =0
Returns the unique type name for the material.
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsAbstractMaterialSettings::toExportParameters
virtual QMap< QString, QString > toExportParameters() const =0
Returns the parameters to be exported to .mtl file.
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsMaterialContext
Context settings for a material.
Definition: qgsabstractmaterialsettings.h:64
qgsabstractmaterialsettings.h
QgsAbstractMaterialSettings
Abstract base class for material settings.
Definition: qgsabstractmaterialsettings.h:114
QgsSimpleLineMaterialSettings::setAmbient
void setAmbient(const QColor &ambient)
Sets the ambient color component.
Definition: qgssimplelinematerialsettings.h:71
QgsAbstractMaterialSettings::addParametersToEffect
virtual void addParametersToEffect(Qt3DRender::QEffect *effect) const =0
Adds parameters from the material to a destination effect.
QgsAbstractMaterialSettings::writeXml
virtual void writeXml(QDomElement &element, const QgsReadWriteContext &) const
Writes settings to a DOM element.
Definition: qgsabstractmaterialsettings.cpp:27
QgsMaterialSettingsRenderingTechnique
QgsMaterialSettingsRenderingTechnique
Material rendering techniques.
Definition: qgsabstractmaterialsettings.h:43
QgsSimpleLineMaterialSettings::ambient
QColor ambient() const
Returns the ambient color component.
Definition: qgssimplelinematerialsettings.h:64
QgsAbstractMaterialSettings::toMaterial
virtual Qt3DRender::QMaterial * toMaterial(QgsMaterialSettingsRenderingTechnique technique, const QgsMaterialContext &context) const =0
Creates a new QMaterial object representing the material settings.
QgsSimpleLineMaterialSettings
Basic shading material used for rendering simple lines as solid line components.
Definition: qgssimplelinematerialsettings.h:36
QgsSimpleLineMaterialSettings::operator==
bool operator==(const QgsSimpleLineMaterialSettings &other) const
Definition: qgssimplelinematerialsettings.h:82
QgsAbstractMaterialSettings::readXml
virtual void readXml(const QDomElement &element, const QgsReadWriteContext &)
Reads settings from a DOM element.
Definition: qgsabstractmaterialsettings.cpp:20
QgsAbstractMaterialSettings::clone
virtual QgsAbstractMaterialSettings * clone() const =0
Clones the material settings.