QGIS API Documentation 4.1.0-Master (376402f9aeb)
Loading...
Searching...
No Matches
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"
22
23#include <QColor>
24#include <QString>
25
26using namespace Qt::StringLiterals;
27
28class QDomElement;
30class QgsLineMaterial;
32
42{
43#ifdef SIP_RUN
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
74 {
75 sipType = 0;
76 }
78#endif
79
80 public:
81 virtual ~QgsAbstractMaterialSettings() = default;
82
86 virtual QString type() const = 0;
87
94
96 virtual void readXml( const QDomElement &element, const QgsReadWriteContext & );
97
99 virtual void writeXml( QDomElement &element, const QgsReadWriteContext & ) const;
100
106 virtual bool equals( const QgsAbstractMaterialSettings *other ) const = 0;
107
114 virtual bool requiresTextureCoordinates() const;
115
122 virtual bool requiresTangents() const;
123
124 // *INDENT-OFF*
127 {
128 Diffuse,
129 Ambient,
130 Warm,
131 Cool,
132 Specular
133 };
134 // *INDENT-ON*
135
140 void setDataDefinedProperties( const QgsPropertyCollection &collection );
141
146 QgsPropertyCollection dataDefinedProperties() const;
147
152 const QgsPropertiesDefinition &propertyDefinitions() const;
153
154 private:
155 QgsPropertyCollection mDataDefinedProperties;
156 static QgsPropertiesDefinition sPropertyDefinitions;
157 void initPropertyDefinitions() const;
158};
159
160
161#endif // QGSABSTRACTMATERIALSETTINGS_H
Abstract base class for material settings.
virtual void writeXml(QDomElement &element, const QgsReadWriteContext &) const
Writes settings to a DOM element.
virtual bool equals(const QgsAbstractMaterialSettings *other) const =0
Returns true if this settings exactly matches an other settings.
virtual void readXml(const QDomElement &element, const QgsReadWriteContext &)
Reads settings from a DOM element.
virtual QgsAbstractMaterialSettings * clone() const =0
Clones the material settings.
virtual bool requiresTangents() const
Returns true if the material requires tangents generated during triangulation.
virtual ~QgsAbstractMaterialSettings()=default
virtual QString type() const =0
Returns the unique type name for the material.
virtual bool requiresTextureCoordinates() const
Returns true if the material requires texture coordinates to be generated during triangulation.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
A container for the context for various read/write operations on objects.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:198
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:267
#define SIP_ABSTRACT
Definition qgis_sip.h:220
#define SIP_FACTORY
Definition qgis_sip.h:83
#define SIP_END
Definition qgis_sip.h:215
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.