QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
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#include "qgsmaterial.h"
23
24#include <QColor>
25
26class QDomElement;
27
38{
39 public:
40
42
43 QString type() const override;
44
48 static bool supportsTechnique( QgsMaterialSettingsRenderingTechnique technique );
49
54
55 QgsSimpleLineMaterialSettings *clone() const override SIP_FACTORY;
56
62 QColor ambient() const { return mAmbient; }
63
69 void setAmbient( const QColor &ambient ) { mAmbient = ambient; }
70
71 QMap<QString, QString> toExportParameters() const override;
72 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
73 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
74#ifndef SIP_RUN
76 void addParametersToEffect( Qt3DRender::QEffect *effect, const QgsMaterialContext &materialContext ) const override;
77 QByteArray dataDefinedVertexColorsAsByte( const QgsExpressionContext &expressionContext ) const override;
78#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
79 void applyDataDefinedToGeometry( Qt3DRender::QGeometry *geometry, int vertexCount, const QByteArray &data ) const override;
80#else
81 void applyDataDefinedToGeometry( Qt3DCore::QGeometry *geometry, int vertexCount, const QByteArray &data ) const override;
82#endif
83#endif
84
85 // TODO c++20 - replace with = default
86 bool operator==( const QgsSimpleLineMaterialSettings &other ) const
87 {
88 return mAmbient == other.mAmbient;
89 }
90
91 private:
92 QColor mAmbient{ QColor::fromRgbF( 0.1f, 0.1f, 0.1f, 1.0f ) };
93
94};
95
96
97#endif // QGSSIMPLELINEMATERIALSETTINGS_H
virtual void writeXml(QDomElement &element, const QgsReadWriteContext &) const
Writes settings to a DOM element.
virtual QByteArray dataDefinedVertexColorsAsByte(const QgsExpressionContext &expressionContext) const
Returns byte array corresponding to the data defined colors depending of the expressionContext,...
virtual QMap< QString, QString > toExportParameters() const =0
Returns the parameters to be exported to .mtl file.
virtual void readXml(const QDomElement &element, const QgsReadWriteContext &)
Reads settings from a DOM element.
virtual void addParametersToEffect(Qt3DRender::QEffect *effect, const QgsMaterialContext &materialContext) const =0
Adds parameters from the material to a destination effect.
virtual QString type() const =0
Returns the unique type name for the material.
virtual void applyDataDefinedToGeometry(Qt3DCore::QGeometry *geometry, int vertexCount, const QByteArray &dataDefinedBytes) const
Applies the data defined bytes, dataDefinedBytes, on the geometry by filling a specific vertex buffer...
virtual QgsMaterial * toMaterial(QgsMaterialSettingsRenderingTechnique technique, const QgsMaterialContext &context) const =0
Creates a new QgsMaterial object representing the material settings.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The class is used as a container of context for various read/write operations on other objects.
bool operator==(const QgsSimpleLineMaterialSettings &other) const
void setAmbient(const QColor &ambient)
Sets the ambient color component.
QgsMaterialSettingsRenderingTechnique
Material rendering techniques 3.
#define SIP_FACTORY
Definition qgis_sip.h:76