QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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 );
66 void setCategoryPointSize( int row, double size );
68 void updateCategoriesPercentages( const QMap< int, float > &percentages ) { mPercentages = percentages; };
69
70 signals:
71 void categoriesChanged();
72
73 private:
74 QgsPointCloudCategoryList mCategories;
75 QMap< int, float > mPercentages;
76 QString mMimeFormat;
77};
78
83class QgsPointCloudClassifiedRendererViewStyle: public QgsProxyStyle
84{
85 Q_OBJECT
86
87 public:
88 explicit QgsPointCloudClassifiedRendererViewStyle( QWidget *parent );
89
90 void drawPrimitive( PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr ) const override;
91};
92
93
94class GUI_EXPORT QgsPointCloudClassifiedRendererWidget: public QgsPointCloudRendererWidget, private Ui::QgsPointCloudClassifiedRendererWidgetBase
95{
96 Q_OBJECT
97
98 public:
99 QgsPointCloudClassifiedRendererWidget( QgsPointCloudLayer *layer, QgsStyle *style );
101
102 QgsPointCloudRenderer *renderer() override;
103 QgsPointCloudCategoryList categoriesList();
104 QString attribute();
105
110 void setFromRenderer( const QgsPointCloudRenderer *r );
111 void setFromCategories( QgsPointCloudCategoryList categories, const QString &attribute );
112
113 private slots:
114
119 void addCategories();
120 void emitWidgetChanged();
121 void categoriesDoubleClicked( const QModelIndex &idx );
122 void addCategory();
123 void deleteCategories();
124 void deleteAllCategories();
125 void attributeChanged();
126 void changeCategoryColor();
127 void changeCategoryOpacity();
128 void changeCategoryPointSize();
129 private:
131 void initialize();
133 QList<int> selectedCategories();
135 int currentCategoryRow();
137 void updateCategoriesPercentages();
138
139 QgsPointCloudClassifiedRendererModel *mModel = nullptr;
140 bool mBlockChangedSignal = false;
141 QMenu *contextMenu = nullptr;
142};
143
145#endif
146
147#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,...
QList< QgsPointCloudCategory > QgsPointCloudCategoryList