QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsrubberband3d.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrubberband3d.h
3  --------------------------------------
4  Date : June 2021
5  Copyright : (C) 2021 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSRUBBERBAND3D_H
17 #define QGSRUBBERBAND3D_H
18 
19 #include "qgis_3d.h"
20 
21 #define SIP_NO_FILE
22 
24 
25 //
26 // W A R N I N G
27 // -------------
28 //
29 // This file is not part of the QGIS API. It exists purely as an
30 // implementation detail. This header file may change from version to
31 // version without notice, or even be removed.
32 //
33 
34 #include "qgslinestring.h"
35 
37 class QgsLineMaterial;
38 class Qgs3DMapSettings;
39 
40 namespace Qt3DCore
41 {
42  class QEntity;
43 }
44 namespace Qt3DRender
45 {
46  class QGeometry;
47  class QGeometryRenderer;
48  class QBuffer;
49  class QMaterial;
50  class QAttribute;
51 }
52 
64 class _3D_EXPORT QgsRubberBand3D
65 {
66  public:
67  QgsRubberBand3D( Qgs3DMapSettings &map, QgsCameraController *cameraController, Qt3DCore::QEntity *parentEntity );
68  ~QgsRubberBand3D();
69 
70  float width() const;
71  void setWidth( float width );
72 
73  QColor color() const;
74  void setColor( QColor color );
75 
76  void reset();
77 
78  void addPoint( const QgsPoint &pt );
79 
80  void removeLastPoint();
81 
82  private:
83  void updateGeometry();
84 
85  private:
86  QgsLineString mLineString;
87 
88  Qgs3DMapSettings *mMapSettings = nullptr; // not owned
89 
90  Qt3DCore::QEntity *mEntity = nullptr; // owned by parentEntity (from constructor)
91 
92  // all these are owned by mEntity
93  Qt3DRender::QGeometryRenderer *mGeomRenderer = nullptr;
94  Qt3DRender::QGeometry *mGeometry = nullptr;
95  Qt3DRender::QAttribute *mPositionAttribute = nullptr;
96  Qt3DRender::QAttribute *mIndexAttribute = nullptr;
97  QgsLineMaterial *mLineMaterial = nullptr;
98 };
99 
101 
102 #endif // QGSRUBBERBAND3D_H
Line string geometry type, with support for z-dimension and m-values.
Definition: qgslinestring.h:44
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49