QGIS API Documentation 3.99.0-Master (c22de0620c0)
Loading...
Searching...
No Matches
qgsprocessingmodelcomponent.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingmodelcomponent.h
3 -----------------------------
4 begin : June 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPROCESSINGMODELCOMPONENT_H
19#define QGSPROCESSINGMODELCOMPONENT_H
20
21#include "qgis.h"
22#include "qgis_core.h"
23
24#include <QColor>
25#include <QPointF>
26#include <QSizeF>
27
28class QgsProcessingModelComment;
29
31
36class CORE_EXPORT QgsProcessingModelComponent
37{
38
39#ifdef SIP_RUN
41 if ( dynamic_cast<QgsProcessingModelChildAlgorithm *>( sipCpp ) != NULL )
42 sipType = sipType_QgsProcessingModelChildAlgorithm;
43 else if ( dynamic_cast<QgsProcessingModelComment *>( sipCpp ) != NULL )
44 sipType = sipType_QgsProcessingModelComment;
45 else if ( dynamic_cast<QgsProcessingModelGroupBox *>( sipCpp ) != NULL )
46 sipType = sipType_QgsProcessingModelGroupBox;
47 else if ( dynamic_cast<QgsProcessingModelOutput *>( sipCpp ) != NULL )
48 sipType = sipType_QgsProcessingModelOutput;
49 else if ( dynamic_cast<QgsProcessingModelParameter *>( sipCpp ) != NULL )
50 sipType = sipType_QgsProcessingModelParameter;
51 else
52 sipType = NULL;
54#endif
55
56 public:
57
58 virtual ~QgsProcessingModelComponent() = default;
59
64 QString description() const;
65
70 void setDescription( const QString &description );
71
76 QPointF position() const;
77
82 void setPosition( QPointF position );
83
89 QSizeF size() const;
90
96 void setSize( QSizeF size );
97
106 QColor color() const;
107
115 void setColor( const QColor &color );
116
121 bool linksCollapsed( Qt::Edge edge ) const;
122
128 void setLinksCollapsed( Qt::Edge edge, bool collapsed );
129
134 SIP_SKIP virtual const QgsProcessingModelComment *comment() const { return nullptr; }
135
140 virtual QgsProcessingModelComment *comment() { return nullptr; }
141
146 virtual void setComment( const QgsProcessingModelComment &comment );
147
153 virtual QgsProcessingModelComponent *clone() const = 0 SIP_FACTORY;
154
155 protected:
156
158 QgsProcessingModelComponent( const QString &description = QString() );
159
161 QgsProcessingModelComponent( const QgsProcessingModelComponent &other ) = default;
162
164 QgsProcessingModelComponent &operator=( const QgsProcessingModelComponent &other ) = default;
165
170 void saveCommonProperties( QVariantMap &map ) const;
171
176 void restoreCommonProperties( const QVariantMap &map );
177
186 void copyNonDefinitionProperties( const QgsProcessingModelComponent &other );
187
188 private:
189
190 static constexpr double DEFAULT_COMPONENT_WIDTH = 200;
191 static constexpr double DEFAULT_COMPONENT_HEIGHT = 30;
192
194 QPointF mPosition;
195
196 QString mDescription;
197
198 QSizeF mSize = QSizeF( DEFAULT_COMPONENT_WIDTH, DEFAULT_COMPONENT_HEIGHT );
199 QColor mColor;
200
201 bool mTopEdgeLinksCollapsed = true;
202 bool mBottomEdgeLinksCollapsed = true;
203
204};
205
207
208#endif // QGSPROCESSINGMODELCOMPONENT_H
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:198
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_FACTORY
Definition qgis_sip.h:83
#define SIP_END
Definition qgis_sip.h:215