QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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 class QMaterial;
62}
63
75class _3D_EXPORT QgsRubberBand3D
76{
77 public:
78 QgsRubberBand3D( Qgs3DMapSettings &map, QgsWindow3DEngine *engine, Qt3DCore::QEntity *parentEntity );
79 ~QgsRubberBand3D();
80
81 float width() const;
82 void setWidth( float width );
83
84 QColor color() const;
85 void setColor( QColor color );
86
87 void reset();
88
89 void addPoint( const QgsPoint &pt );
90
91 void removeLastPoint();
92
93 void moveLastPoint( const QgsPoint &pt );
94
96 void setShowLastMarker( bool show ) { mShowLastMarker = show; }
97
98 private:
99 void updateGeometry();
100 void updateMarkerMaterial();
101
102 private:
103 QgsLineString mLineString;
104 bool mShowLastMarker = false;
105
106 Qgs3DMapSettings *mMapSettings = nullptr; // not owned
107 QgsWindow3DEngine *mEngine = nullptr;
108
109 Qt3DCore::QEntity *mLineEntity = nullptr; // owned by parentEntity (from constructor)
110 Qt3DCore::QEntity *mMarkerEntity = nullptr; // owned by parentEntity (from constructor)
111
112 // all these are owned by mLineEntity
113 Qt3DRender::QGeometryRenderer *mGeomRenderer = nullptr;
114#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
115 Qt3DRender::QGeometry *mGeometry = nullptr;
116 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
117 Qt3DRender::QAttribute *mIndexAttribute = nullptr;
118#else
119 Qt3DCore::QGeometry *mGeometry = nullptr;
120 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
121 Qt3DCore::QAttribute *mIndexAttribute = nullptr;
122#endif
123 QgsLineMaterial *mLineMaterial = nullptr;
124
125 // and these are owned by mMarkerEntity
126 Qt3DRender::QGeometryRenderer *mMarkerGeometryRenderer = nullptr;
127 QgsBillboardGeometry *mMarkerGeometry = nullptr;
128 QgsPoint3DBillboardMaterial *mMarkerMaterial = nullptr;
129 QgsMarkerSymbol *mMarkerSymbol = nullptr;
130
131 // Disable copying as we have pointer members.
132 QgsRubberBand3D( const QgsRubberBand3D & ) = delete;
133 QgsRubberBand3D &operator= ( const QgsRubberBand3D & ) = delete;
134};
135
137
138#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