QGIS API Documentation 3.99.0-Master (26c88405ac0)
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
21#include "ui_qgspointcloudclassifiedrendererwidgetbase.h"
22
23#include "qgis_gui.h"
27#include "qgsproxystyle.h"
28
30class QgsStyle;
31class QLineEdit;
33class QgsPointCloud3DLayer3DRenderer;
34
35
36#ifndef SIP_RUN
38
39class GUI_EXPORT QgsPointCloudClassifiedRendererModel : public QAbstractItemModel
40{
41 Q_OBJECT
42 public:
43 QgsPointCloudClassifiedRendererModel( QObject *parent = nullptr );
44 Qt::ItemFlags flags( const QModelIndex &index ) const override;
45 Qt::DropActions supportedDropActions() const override;
46 QVariant data( const QModelIndex &index, int role ) const override;
47 bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
48 QVariant headerData( int section, Qt::Orientation orientation, int role ) const override;
49 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
50 int columnCount( const QModelIndex & = QModelIndex() ) const override;
51 QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const override;
52 QModelIndex parent( const QModelIndex &index ) const override;
53 QStringList mimeTypes() const override;
54 QMimeData *mimeData( const QModelIndexList &indexes ) const override;
55 bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override;
56
57 void setRendererCategories( const QgsPointCloudCategoryList &categories );
58
59 void addCategory( const QgsPointCloudCategory &cat );
60 QgsPointCloudCategory category( const QModelIndex &index );
61 void deleteRows( QList<int> rows );
62 void removeAllRows();
63
64 QgsPointCloudCategoryList categories() const { return mCategories; }
65
66 void setCategoryColor( int row, const QColor &color );
67 void setCategoryPointSize( int row, double size );
69 void updateCategoriesPercentages( const QMap<int, float> &percentages ) { mPercentages = percentages; };
70
71 signals:
72 void categoriesChanged();
73
75 void rowsMoved();
76
77 private:
78 QgsPointCloudCategoryList mCategories;
79 QMap<int, float> mPercentages;
80 QString mMimeFormat;
81};
82
87class QgsPointCloudClassifiedRendererViewStyle : public QgsProxyStyle
88{
89 Q_OBJECT
90
91 public:
92 explicit QgsPointCloudClassifiedRendererViewStyle( QWidget *parent );
93
94 void drawPrimitive( PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr ) const override;
95};
96
97
98class GUI_EXPORT QgsPointCloudClassifiedRendererWidget : public QgsPointCloudRendererWidget, private Ui::QgsPointCloudClassifiedRendererWidgetBase
99{
100 Q_OBJECT
101
102 public:
103 QgsPointCloudClassifiedRendererWidget( QgsPointCloudLayer *layer, QgsStyle *style );
104 static QgsPointCloudRendererWidget *create( QgsPointCloudLayer *layer, QgsStyle *style, QgsPointCloudRenderer * );
105
106 QgsPointCloudRenderer *renderer() override;
107 QgsPointCloudCategoryList categoriesList() const;
108 QString attribute() const;
109
114 void setFromRenderer( const QgsPointCloudRenderer *r );
115 void setFromCategories( QgsPointCloudCategoryList categories, const QString &attribute );
116
117 private slots:
118
123 void addCategories();
124 void emitWidgetChanged();
125 void categoriesDoubleClicked( const QModelIndex &idx );
126 void addCategory();
127 void deleteCategories();
128 void deleteAllCategories();
129 void attributeChanged();
130 void changeCategoryColor();
131 void changeCategoryOpacity();
132 void changeCategoryPointSize();
133 void rowsMoved();
134
135 private:
137 void initialize();
139 QList<int> selectedCategories();
141 int currentCategoryRow();
143 void updateCategoriesPercentages();
144
145 QgsPointCloudClassifiedRendererModel *mModel = nullptr;
146 bool mBlockChangedSignal = false;
147 QMenu *contextMenu = nullptr;
148};
149
151#endif
152
153#endif // QGSPOINTCLOUDCLASSIFIEDRENDERERWIDGET_H
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.
A QProxyStyle subclass which correctly sets the base style to match the QGIS application style,...
A database of saved style entities, including symbols, color ramps, text formats and others.
Definition qgsstyle.h:88
QList< QgsPointCloudCategory > QgsPointCloudCategoryList