QGIS API Documentation 3.99.0-Master (e9821da5c6b)
Loading...
Searching...
No Matches
qgsselectivemaskingsource.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsselectivemaskingsource.h
3 ---------------------------
4 begin : January 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 QGSSELECTIVEMASKINGSOURCE_H
17#define QGSSELECTIVEMASKINGSOURCE_H
18
19#include "qgis.h"
20#include "qgis_core.h"
21#include "qgis_sip.h"
22
23#include <QString>
24
25using namespace Qt::StringLiterals;
26
35class CORE_EXPORT QgsSelectiveMaskSource
36{
37 public:
38
43
51 QgsSelectiveMaskSource( const QString &layerId, Qgis::SelectiveMaskSourceType sourceType, const QString &sourceId = QString() );
52
56 bool isValid() const { return !mLayerId.isEmpty(); }
57
63 QString layerId() const { return mLayerId; }
64
70 void setLayerId( const QString &id ) { mLayerId = id; }
71
77 Qgis::SelectiveMaskSourceType sourceType() const { return mSourceType; }
78
84 void setSourceType( Qgis::SelectiveMaskSourceType type ) { mSourceType = type; }
85
91 QString sourceId() const { return mSourceId; }
92
98 void setSourceId( const QString &id ) { mSourceId = id; }
99
100#ifdef SIP_RUN
101 SIP_PYOBJECT __repr__();
102 % MethodCode
103 if ( !sipCpp->isValid() )
104 {
105 sipRes = PyUnicode_FromString( "<QgsSelectiveMaskSource: invalid>" );
106 }
107 else if ( sipCpp->sourceId().isEmpty() )
108 {
109 const QString str = u"<QgsSelectiveMaskSource: %1 (%2)>"_s.arg(
110 sipCpp->layerId(),
111 qgsEnumValueToKey( sipCpp->sourceType() ) );
112 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
113 }
114 else
115 {
116 const QString str = u"<QgsSelectiveMaskSource: %1 - %2 (%3)>"_s.arg(
117 sipCpp->layerId(),
118 sipCpp->sourceId(),
119 qgsEnumValueToKey( sipCpp->sourceType() ) );
120 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
121 }
122 % End
123#endif
124
125 bool operator==( const QgsSelectiveMaskSource &other ) const = default;
126 bool operator!=( const QgsSelectiveMaskSource &other ) const = default;
127
128 private:
129 QString mLayerId;
131 QString mSourceId;
132};
133
134#endif //QGSSELECTIVEMASKINGSOURCE_H
SelectiveMaskSourceType
Selective masking source types.
Definition qgis.h:3125
@ SymbolLayer
A mask generated from a symbol layer.
Definition qgis.h:3126
QString layerId() const
Returns the source layer id.
QgsSelectiveMaskSource()=default
Constructor for an invalid QgsSelectiveMaskSource.
void setSourceId(const QString &id)
Sets the symbol layer or label rule id.
void setLayerId(const QString &id)
Sets the source layer id.
bool isValid() const
Returns true if the source is valid (i.e.
bool operator!=(const QgsSelectiveMaskSource &other) const =default
Qgis::SelectiveMaskSourceType sourceType() const
Returns the type of masking source.
void setSourceType(Qgis::SelectiveMaskSourceType type)
Sets the source type.
QString sourceId() const
Returns the symbol layer or label rule ID.
bool operator==(const QgsSelectiveMaskSource &other) const =default
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition qgis.h:7115