QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgspointcloudclassifiedrendererwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspointcloudclassifiedrendererwidget.h
3 ---------------------
4 begin : November 2020
5 copyright : (C) 2020 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 QGSPOINTCLOUDCLASSIFIEDRENDERERWIDGET_H
19#define QGSPOINTCLOUDCLASSIFIEDRENDERERWIDGET_H
20
23#include "ui_qgspointcloudclassifiedrendererwidgetbase.h"
24#include "qgis_gui.h"
25#include "qgsproxystyle.h"
27
29class QgsStyle;
30class QLineEdit;
32class QgsPointCloud3DLayer3DRenderer;
33
34
35#ifndef SIP_RUN
37
38class GUI_EXPORT QgsPointCloudClassifiedRendererModel : public QAbstractItemModel
39{
40 Q_OBJECT
41 public:
42 QgsPointCloudClassifiedRendererModel( QObject *parent = nullptr );
43 Qt::ItemFlags flags( const QModelIndex &index ) const override;
44 Qt::DropActions supportedDropActions() const override;
45 QVariant data( const QModelIndex &index, int role ) const override;
46 bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
47 QVariant headerData( int section, Qt::Orientation orientation, int role ) const override;
48 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
49 int columnCount( const QModelIndex & = QModelIndex() ) const override;
50 QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const override;
51 QModelIndex parent( const QModelIndex &index ) const override;
52 QStringList mimeTypes() const override;
53 QMimeData *mimeData( const QModelIndexList &indexes ) const override;
54 bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override;
55
56 void setRendererCategories( const QgsPointCloudCategoryList &categories );
57
58 void addCategory( const QgsPointCloudCategory &cat );
59 QgsPointCloudCategory category( const QModelIndex &index );
60 void deleteRows( QList<int> rows );
61 void removeAllRows();
62
63 QgsPointCloudCategoryList categories() const { return mCategories; }
64
65 void setCategoryColor( int row, const QColor &color );
67 void updateCategoriesPercentages( const QMap< int, float > &percentages ) { mPercentages = percentages; };
68
69 signals:
70 void categoriesChanged();
71
72 private:
73 QgsPointCloudCategoryList mCategories;
74 QMap< int, float > mPercentages;
75 QString mMimeFormat;
76};
77
82class QgsPointCloudClassifiedRendererViewStyle: public QgsProxyStyle
83{
84 Q_OBJECT
85
86 public:
87 explicit QgsPointCloudClassifiedRendererViewStyle( QWidget *parent );
88
89 void drawPrimitive( PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr ) const override;
90};
91
92
93class GUI_EXPORT QgsPointCloudClassifiedRendererWidget: public QgsPointCloudRendererWidget, private Ui::QgsPointCloudClassifiedRendererWidgetBase
94{
95 Q_OBJECT
96
97 public:
98 QgsPointCloudClassifiedRendererWidget( QgsPointCloudLayer *layer, QgsStyle *style );
100
101 QgsPointCloudRenderer *renderer() override;
102 QgsPointCloudCategoryList categoriesList();
103 QString attribute();
104
109 void setFromRenderer( const QgsPointCloudRenderer *r );
110 void setFromCategories( QgsPointCloudCategoryList categories, const QString &attribute );
111
112 private slots:
113
118 void addCategories();
119 void emitWidgetChanged();
120 void categoriesDoubleClicked( const QModelIndex &idx );
121 void addCategory();
122 void deleteCategories();
123 void deleteAllCategories();
124 void attributeChanged();
125 private:
127 void initialize();
128 void changeCategorySymbol();
130 QList<int> selectedCategories();
132 int currentCategoryRow();
134 void updateCategoriesPercentages();
135
136 QgsPointCloudClassifiedRendererModel *mModel = nullptr;
137 bool mBlockChangedSignal = false;
138};
139
141#endif
142
143#endif // QGSPOINTCLOUDCLASSIFIEDRENDERERWIDGET_H
Represents an individual category (class) from a QgsPointCloudClassifiedRenderer.
Renders point clouds by a classification attribute.
Represents a map layer supporting display of point clouds.
Base class for point cloud 2D renderer settings widgets.
Abstract base class for 2d point cloud renderers.
A QProxyStyle subclass which correctly sets the base style to match the QGIS application style,...
Definition: qgsproxystyle.h:31
QList< QgsPointCloudCategory > QgsPointCloudCategoryList