QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
3d
materials
qgsabstractmaterialsettings.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsabstractmaterialsettings.h
3
--------------------------------------
4
Date : July 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
#ifndef QGSABSTRACTMATERIALSETTINGS_H
17
#define QGSABSTRACTMATERIALSETTINGS_H
18
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
#include "
qgspropertycollection.h
"
22
23
#include <QColor>
24
#include <QString>
25
26
using namespace
Qt::StringLiterals;
27
28
class
QDomElement;
29
class
QgsReadWriteContext
;
30
class
QgsLineMaterial;
31
class
QgsExpressionContext
;
32
41
class
CORE_EXPORT
QgsAbstractMaterialSettings
SIP_ABSTRACT
42
{
43
#ifdef SIP_RUN
44
SIP_CONVERT_TO_SUBCLASS_CODE
45
if
( sipCpp->type() ==
"gooch"
_L1 )
46
{
47
sipType = sipType_QgsGoochMaterialSettings;
48
}
49
else
if
( sipCpp->type() ==
"phong"
_L1 )
50
{
51
sipType = sipType_QgsPhongMaterialSettings;
52
}
53
else
if
( sipCpp->type() ==
"phongtextured"
)
54
{
55
sipType = sipType_QgsPhongTexturedMaterialSettings;
56
}
57
else
if
( sipCpp->type() ==
"simpleline"
)
58
{
59
sipType = sipType_QgsSimpleLineMaterialSettings;
60
}
61
else
if
( sipCpp->type() ==
"null"
)
62
{
63
sipType = sipType_QgsNullMaterialSettings;
64
}
65
else
if
( sipCpp->type() ==
"metalrough"
)
66
{
67
sipType = sipType_QgsMetalRoughMaterialSettings;
68
}
69
else
if
( sipCpp->type() ==
"metalroughtextured"
)
70
{
71
sipType = sipType_QgsMetalRoughTexturedMaterialSettings;
72
}
73
else
if
( sipCpp->type() ==
"unlit"
)
74
{
75
sipType = sipType_QgsUnlitMaterialSettings;
76
}
77
else
78
{
79
sipType = 0;
80
}
81
SIP_END
82
#endif
83
84
public
:
85
virtual
~QgsAbstractMaterialSettings
() =
default
;
86
90
virtual
QString
type
()
const
= 0;
91
97
virtual
QgsAbstractMaterialSettings
*
clone
()
const
= 0
SIP_FACTORY
;
98
100
virtual
void
readXml
(
const
QDomElement &element,
const
QgsReadWriteContext
& );
101
103
virtual
void
writeXml
( QDomElement &element,
const
QgsReadWriteContext
& )
const
;
104
110
virtual
bool
equals
(
const
QgsAbstractMaterialSettings
*other )
const
= 0;
111
118
virtual
bool
requiresTextureCoordinates
()
const
;
119
126
virtual
bool
requiresTangents
()
const
;
127
128
// *INDENT-OFF*
130
enum class
Property
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
(
QgsAbstractMaterialSettings
,
Property
) : int
131
{
132
Diffuse,
133
Ambient,
134
Warm,
135
Cool,
136
Specular,
137
BaseColor,
138
EmissionColor,
139
TextureScale,
140
TextureRotation,
141
TextureOffset,
142
};
143
// *INDENT-ON*
144
150
virtual
QSet< QgsAbstractMaterialSettings::Property > supportedProperties()
const
;
151
156
void
setDataDefinedProperties(
const
QgsPropertyCollection
&collection );
157
162
QgsPropertyCollection
dataDefinedProperties()
const
;
163
168
const
QgsPropertiesDefinition
&propertyDefinitions()
const
;
169
175
virtual
QColor
averageColor
()
const
= 0;
176
184
virtual
void
setColorsFromBase
(
const
QColor &baseColor ) = 0;
185
186
private
:
187
QgsPropertyCollection
mDataDefinedProperties;
188
static
QgsPropertiesDefinition
sPropertyDefinitions;
189
void
initPropertyDefinitions()
const
;
190
};
191
192
193
#endif
// QGSABSTRACTMATERIALSETTINGS_H
QgsAbstractMaterialSettings
Abstract base class for material settings.
Definition
qgsabstractmaterialsettings.h:42
QgsAbstractMaterialSettings::writeXml
virtual void writeXml(QDomElement &element, const QgsReadWriteContext &) const
Writes settings to a DOM element.
Definition
qgsabstractmaterialsettings.cpp:31
QgsAbstractMaterialSettings::equals
virtual bool equals(const QgsAbstractMaterialSettings *other) const =0
Returns true if this settings exactly matches an other settings.
QgsAbstractMaterialSettings::readXml
virtual void readXml(const QDomElement &element, const QgsReadWriteContext &)
Reads settings from a DOM element.
Definition
qgsabstractmaterialsettings.cpp:24
QgsAbstractMaterialSettings::clone
virtual QgsAbstractMaterialSettings * clone() const =0
Clones the material settings.
QgsAbstractMaterialSettings::requiresTangents
virtual bool requiresTangents() const
Returns true if the material requires tangents generated during triangulation.
Definition
qgsabstractmaterialsettings.cpp:44
QgsAbstractMaterialSettings::Property
Property
Data definable properties.
Definition
qgsabstractmaterialsettings.h:131
QgsAbstractMaterialSettings::~QgsAbstractMaterialSettings
virtual ~QgsAbstractMaterialSettings()=default
QgsAbstractMaterialSettings::averageColor
virtual QColor averageColor() const =0
Returns an approximate color representing the blended material color.
QgsAbstractMaterialSettings::type
virtual QString type() const =0
Returns the unique type name for the material.
QgsAbstractMaterialSettings::setColorsFromBase
virtual void setColorsFromBase(const QColor &baseColor)=0
Decomposes a base color into the material's color components, and sets the material's colors accordin...
QgsAbstractMaterialSettings::requiresTextureCoordinates
virtual bool requiresTextureCoordinates() const
Returns true if the material requires texture coordinates to be generated during triangulation.
Definition
qgsabstractmaterialsettings.cpp:39
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition
qgsexpressioncontext.h:491
QgsPropertyCollection
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
Definition
qgspropertycollection.h:348
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
qgis_sip.h
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition
qgis_sip.h:203
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition
qgis_sip.h:270
SIP_ABSTRACT
#define SIP_ABSTRACT
Definition
qgis_sip.h:225
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
SIP_END
#define SIP_END
Definition
qgis_sip.h:220
qgspropertycollection.h
QgsPropertiesDefinition
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
Definition
qgspropertycollection.h:32
Generated on
for QGIS API Documentation by
1.17.0