QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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#ifdef SIP_RUN
40 if ( dynamic_cast<QgsProcessingModelChildAlgorithm *>( sipCpp ) != NULL )
41 sipType = sipType_QgsProcessingModelChildAlgorithm;
42 else if ( dynamic_cast<QgsProcessingModelComment *>( sipCpp ) != NULL )
43 sipType = sipType_QgsProcessingModelComment;
44 else if ( dynamic_cast<QgsProcessingModelGroupBox *>( sipCpp ) != NULL )
45 sipType = sipType_QgsProcessingModelGroupBox;
46 else if ( dynamic_cast<QgsProcessingModelOutput *>( sipCpp ) != NULL )
47 sipType = sipType_QgsProcessingModelOutput;
48 else if ( dynamic_cast<QgsProcessingModelParameter *>( sipCpp ) != NULL )
49 sipType = sipType_QgsProcessingModelParameter;
50 else
51 sipType = NULL;
53#endif
54
55 public:
56
57 virtual ~QgsProcessingModelComponent() = default;
58
63 QString description() const;
64
69 void setDescription( const QString &description );
70
75 QPointF position() const;
76
81 void setPosition( QPointF position );
82
88 QSizeF size() const;
89
95 void setSize( QSizeF size );
96
105 QColor color() const;
106
114 void setColor( const QColor &color );
115
120 bool linksCollapsed( Qt::Edge edge ) const;
121
127 void setLinksCollapsed( Qt::Edge edge, bool collapsed );
128
133 SIP_SKIP virtual const QgsProcessingModelComment *comment() const { return nullptr; }
134
139 virtual QgsProcessingModelComment *comment() { return nullptr; }
140
145 virtual void setComment( const QgsProcessingModelComment &comment );
146
152 virtual QgsProcessingModelComponent *clone() const = 0 SIP_FACTORY;
153
154 protected:
156 QgsProcessingModelComponent( const QString &description = QString() );
157
159 QgsProcessingModelComponent( const QgsProcessingModelComponent &other ) = default;
160
162 QgsProcessingModelComponent &operator=( const QgsProcessingModelComponent &other ) = default;
163
168 void saveCommonProperties( QVariantMap &map ) const;
169
174 void restoreCommonProperties( const QVariantMap &map );
175
184 void copyNonDefinitionProperties( const QgsProcessingModelComponent &other );
185
186 private:
187 static constexpr double DEFAULT_COMPONENT_WIDTH = 200;
188 static constexpr double DEFAULT_COMPONENT_HEIGHT = 30;
189
191 QPointF mPosition;
192
193 QString mDescription;
194
195 QSizeF mSize = QSizeF( DEFAULT_COMPONENT_WIDTH, DEFAULT_COMPONENT_HEIGHT );
196 QColor mColor;
197
198 bool mTopEdgeLinksCollapsed = true;
199 bool mBottomEdgeLinksCollapsed = true;
200};
201
203
204#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