QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
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"
26 #include "qgspointcloudattribute.h"
27 
28 class QgsPointCloudLayer;
29 class QgsStyle;
30 class QLineEdit;
32 class QgsPointCloud3DLayer3DRenderer;
33 
34 
35 #ifndef SIP_RUN
37 
38 class 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 
67  signals:
68  void categoriesChanged();
69 
70  private:
71  QgsPointCloudCategoryList mCategories;
72  QString mMimeFormat;
73 };
74 
79 class QgsPointCloudClassifiedRendererViewStyle: public QgsProxyStyle
80 {
81  Q_OBJECT
82 
83  public:
84  explicit QgsPointCloudClassifiedRendererViewStyle( QWidget *parent );
85 
86  void drawPrimitive( PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr ) const override;
87 };
88 
89 
90 class GUI_EXPORT QgsPointCloudClassifiedRendererWidget: public QgsPointCloudRendererWidget, private Ui::QgsPointCloudClassifiedRendererWidgetBase
91 {
92  Q_OBJECT
93 
94  public:
95  QgsPointCloudClassifiedRendererWidget( QgsPointCloudLayer *layer, QgsStyle *style );
97 
98  QgsPointCloudRenderer *renderer() override;
99  QgsPointCloudCategoryList categoriesList();
100  QString attribute();
101 
102  void setFromCategories( QgsPointCloudCategoryList categories, const QString &attribute );
103 
104  private slots:
105 
106  void emitWidgetChanged();
107  void categoriesDoubleClicked( const QModelIndex &idx );
108  void addCategories();
109  void addCategory();
110  void deleteCategories();
111  void deleteAllCategories();
112  private:
113  void setFromRenderer( const QgsPointCloudRenderer *r );
114  void changeCategorySymbol();
116  QList<int> selectedCategories();
118  int currentCategoryRow();
119 
120  QgsPointCloudClassifiedRendererModel *mModel = nullptr;
121  bool mBlockChangedSignal = false;
122 };
123 
125 #endif
126 
127 #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