QGIS API Documentation 4.3.0-Master (7c7bd4d7018)
Loading...
Searching...
No Matches
qgsprocessingparameterreliefcolors.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingparameterreliefcolors.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 QGSPROCESSINGPARAMETERRELIEFCOLORS_H
17#define QGSPROCESSINGPARAMETERRELIEFCOLORS_H
18
22#include "qgsrasterlayerutils.h"
23
24#include <QString>
25
26using namespace Qt::StringLiterals;
27
28
36{
37 public:
39 QgsProcessingParameterReliefColors( const QString &name, const QString &description = QString(), const QString &parentLayerParameter = QString(), bool optional = true );
40
42 QString type() const override;
44 static QString typeName() { return u"reliefcolors"_s; } // cppcheck-suppress duplInheritedMember
46 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
47 QVariantMap toVariantMap() const override;
48 bool fromVariantMap( const QVariantMap &map ) override;
49
53 QString parentLayerParameter() const { return mParentLayer; }
54
58 QList< QgsRasterReliefColor> valueAsReliefColors( const QVariant &value, const QgsProcessingContext &context ) const;
59
63 static QVariant colorsAsVariant( const QList< QgsRasterReliefColor> &colors );
64
65 private:
66 QString mParentLayer;
67};
68
69#ifndef SIP_RUN
71
79class CORE_EXPORT QgsProcessingParameterTypeReliefColors : public QgsProcessingParameterType
80{
81 public:
82 QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY { return new QgsProcessingParameterReliefColors( name ); }
83
84 QString description() const override { return QCoreApplication::translate( "Processing", "An input allowing setting the output colors for relief algorithms." ); }
85
86 QString name() const override { return QCoreApplication::translate( "Processing", "Relief colors" ); }
87
88 QString id() const override { return QgsProcessingParameterReliefColors::typeName(); }
89
90 QString pythonImportString() const override { return u"from qgis.core import QgsProcessingParameterReliefColors"_s; }
91
92 QString className() const override { return u"QgsProcessingParameterReliefColors"_s; }
93
94 QStringList acceptedPythonTypes() const override { return QStringList() << u"str"_s; }
95
96 QStringList acceptedStringValues() const override
97 {
98 return QStringList() << QObject::tr( "Concatenated string value with format of 'min_elevation,max_elevation,red,green,blue;' for each color range" );
99 }
100
101 QStringList acceptedParameterTypes() const override { return QStringList() << QgsProcessingParameterString::typeName() << QgsProcessingParameterReliefColors::typeName(); }
102
103 QStringList acceptedOutputTypes() const override { return QStringList() << QgsProcessingOutputVariant::typeName() << QgsProcessingOutputString::typeName(); }
104
105 QColor modelColor() const override { return QColor( 255, 131, 23 ); /* orange */ };
106};
107
109#endif
110
111#endif // QGSPROCESSINGPARAMETERRELIEFCOLORS_H
Contains information about the context in which a processing algorithm is executed.
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the output class.
QString description() const
Returns the description for the parameter.
QString name() const
Returns the name of the parameter.
virtual bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const
Checks whether the specified input value is acceptable for the parameter.
virtual QColor modelColor() const
Returns the color to use for the parameter in model designer windows.
QString parentLayerParameter() const
Returns the linked parent layer parameter name.
QgsProcessingParameterReliefColors(const QString &name, const QString &description=QString(), const QString &parentLayerParameter=QString(), bool optional=true)
Constructor for QgsProcessingParameterReliefColors.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterString(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool multiLine=false, bool optional=false)
Constructor for QgsProcessingParameterString.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
Makes metadata of processing parameters available.
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
#define SIP_FACTORY
Definition qgis_sip.h:83