QGIS API Documentation 3.41.0-Master (d5b93354e9c)
Loading...
Searching...
No Matches
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
37class QgsLineMaterial;
40class QgsMarkerSymbol;
42
43namespace Qt3DCore
44{
45 class QEntity;
46#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
47 class QBuffer;
48 class QGeometry;
49 class QAttribute;
50#endif
51}
52
53namespace Qt3DRender
54{
55#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
56 class QBuffer;
57 class QGeometry;
58 class QAttribute;
59#endif
60 class QGeometryRenderer;
61}
62
74class _3D_EXPORT QgsRubberBand3D
75{
76 public:
77 QgsRubberBand3D( Qgs3DMapSettings &map, QgsWindow3DEngine *engine, Qt3DCore::QEntity *parentEntity );
78 ~QgsRubberBand3D();
79
80 float width() const;
81 void setWidth( float width );
82
83 QColor color() const;
84 void setColor( QColor color );
85
86 void reset();
87
88 void addPoint( const QgsPoint &pt );
89
90 void removeLastPoint();
91
92 void moveLastPoint( const QgsPoint &pt );
93
95 void setShowLastMarker( bool show ) { mShowLastMarker = show; }
96
97 private:
98 void updateGeometry();
99 void updateMarkerMaterial();
100
101 private:
102 QgsLineString mLineString;
103 bool mShowLastMarker = false;
104
105 Qgs3DMapSettings *mMapSettings = nullptr; // not owned
106 QgsWindow3DEngine *mEngine = nullptr;
107
108 Qt3DCore::QEntity *mLineEntity = nullptr; // owned by parentEntity (from constructor)
109 Qt3DCore::QEntity *mMarkerEntity = nullptr; // owned by parentEntity (from constructor)
110
111 // all these are owned by mLineEntity
112 Qt3DRender::QGeometryRenderer *mGeomRenderer = nullptr;
113#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
114 Qt3DRender::QGeometry *mGeometry = nullptr;
115 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
116 Qt3DRender::QAttribute *mIndexAttribute = nullptr;
117#else
118 Qt3DCore::QGeometry *mGeometry = nullptr;
119 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
120 Qt3DCore::QAttribute *mIndexAttribute = nullptr;
121#endif
122 QgsLineMaterial *mLineMaterial = nullptr;
123
124 // and these are owned by mMarkerEntity
125 Qt3DRender::QGeometryRenderer *mMarkerGeometryRenderer = nullptr;
126 QgsBillboardGeometry *mMarkerGeometry = nullptr;
127 QgsPoint3DBillboardMaterial *mMarkerMaterial = nullptr;
128 QgsMarkerSymbol *mMarkerSymbol = nullptr;
129
130 // Disable copying as we have pointer members.
131 QgsRubberBand3D( const QgsRubberBand3D & ) = delete;
132 QgsRubberBand3D &operator= ( const QgsRubberBand3D & ) = delete;
133};
134
136
137#endif // QGSRUBBERBAND3D_H
Line string geometry type, with support for z-dimension and m-values.
A marker symbol type, for rendering Point and MultiPoint geometries.
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49