QGIS API Documentation 4.3.0-Master (18b5e825726)
Loading...
Searching...
No Matches
qgsunlitmaterialsettings.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsunlitmaterialsettings.h
3 --------------------------------------
4 Date : June 2026
5 Copyright : (C) 2026 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#ifndef QGSUNLITMATERIALSETTINGS_H
17#define QGSUNLITMATERIALSETTINGS_H
18
19#include "qgis_core.h"
21
22#include <QColor>
23
24class QgsMaterial;
25class QDomElement;
26
39{
40 public:
42
43 QString type() const override;
44
49
54
56 bool equals( const QgsAbstractMaterialSettings *other ) const override;
58
64 QColor color() const { return mColor; }
65
71 void setColor( const QColor &color ) { mColor = color; }
72
73 QColor averageColor() const override;
74 void setColorsFromBase( const QColor &baseColor ) override;
75
76 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
77 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
78
79 // TODO c++20 - replace with = default
80 bool operator==( const QgsUnlitMaterialSettings &other ) const { return mColor == other.mColor && dataDefinedProperties() == other.dataDefinedProperties(); }
81
82 private:
83 QColor mColor { QColor::fromRgbF( 0.8f, 0.4f, 0.4f, 1.0f ) };
84};
85
86
87#endif // QGSUNLITMATERIALSETTINGS_H
MaterialRenderingTechnique
Material rendering techniques.
Definition qgis.h:4388
Abstract base class for material settings.
virtual void writeXml(QDomElement &element, const QgsReadWriteContext &) const
Writes settings to a DOM element.
virtual void readXml(const QDomElement &element, const QgsReadWriteContext &)
Reads settings from a DOM element.
virtual QColor averageColor() const =0
Returns an approximate color representing the blended material color.
virtual QString type() const =0
Returns the unique type name for the material.
virtual void setColorsFromBase(const QColor &baseColor)=0
Decomposes a base color into the material's color components, and sets the material's colors accordin...
QgsPropertyCollection dataDefinedProperties() const
Returns the symbol material property collection, used for data defined overrides.
Base class for all materials used within QGIS 3D views.
Definition qgsmaterial.h:40
A container for the context for various read/write operations on objects.
bool operator==(const QgsUnlitMaterialSettings &other) const
QgsUnlitMaterialSettings()=default
QColor color() const
Returns the material color.
bool equals(const QgsAbstractMaterialSettings *other) const override
Returns true if this settings exactly matches an other settings.
void setColor(const QColor &color)
Sets the material's color.
QSet< QgsAbstractMaterialSettings::Property > supportedProperties() const override
Returns the set of data-defined properties supported by this material.
QgsUnlitMaterialSettings * clone() const override
Clones the material settings.
static QgsAbstractMaterialSettings * create()
Returns a new instance of QgsUnlitMaterialSettings.
static bool supportsTechnique(Qgis::MaterialRenderingTechnique technique)
Returns true if the specified technique is supported by the material.
#define SIP_FACTORY
Definition qgis_sip.h:83