QGIS API Documentation 3.41.0-Master (af5edcb665c)
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#include <QColor>
22
23#define SIP_NO_FILE
24
26
27//
28// W A R N I N G
29// -------------
30//
31// This file is not part of the QGIS API. It exists purely as an
32// implementation detail. This header file may change from version to
33// version without notice, or even be removed.
34//
35
36#include "qgslinestring.h"
37
39class QgsLineMaterial;
42class QgsMarkerSymbol;
44
45namespace Qt3DCore
46{
47 class QEntity;
48#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
49 class QBuffer;
50 class QGeometry;
51 class QAttribute;
52#endif
53} // namespace Qt3DCore
54
55namespace Qt3DRender
56{
57#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
58 class QBuffer;
59 class QGeometry;
60 class QAttribute;
61#endif
62 class QGeometryRenderer;
63} // namespace Qt3DRender
64
76class _3D_EXPORT QgsRubberBand3D
77{
78 public:
80 enum MarkerType
81 {
82
86 Square,
87
91 Circle
92 };
93
94 QgsRubberBand3D( Qgs3DMapSettings &map, QgsWindow3DEngine *engine, Qt3DCore::QEntity *parentEntity, Qgis::GeometryType geometryType = Qgis::GeometryType::Line );
95 ~QgsRubberBand3D();
96
98 float width() const;
99
101 void setWidth( float width );
102
104 QColor color() const;
105
107 void setColor( QColor color );
108
112 void setMarkerType( MarkerType marker );
113
117 MarkerType markerType() const;
118
119 void reset();
120
121 void addPoint( const QgsPoint &pt );
122
123 void removeLastPoint();
124
125 void moveLastPoint( const QgsPoint &pt );
126
128 void setHideLastMarker( bool hide ) { mHideLastMarker = hide; }
129
130 private:
131 void updateGeometry();
132 void updateMarkerMaterial();
133
134 private:
135 QgsLineString mLineString;
136 bool mHideLastMarker = false;
137
138 Qgs3DMapSettings *mMapSettings = nullptr; // not owned
139 QgsWindow3DEngine *mEngine = nullptr;
141
143 MarkerType mMarkerType = Circle;
144 float mWidth = 3.f;
145 QColor mColor = Qt::red;
146
147 Qt3DCore::QEntity *mLineEntity = nullptr; // owned by parentEntity (from constructor)
148 Qt3DCore::QEntity *mMarkerEntity = nullptr; // owned by parentEntity (from constructor)
149
150 // all these are owned by mLineEntity
151 Qt3DRender::QGeometryRenderer *mLineGeomRenderer = nullptr;
152#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
153 Qt3DRender::QGeometry *mGeometry = nullptr;
154 Qt3DRender::QAttribute *mPositionAttribute = nullptr;
155 Qt3DRender::QAttribute *mIndexAttribute = nullptr;
156#else
157 Qt3DCore::QGeometry *mGeometry = nullptr;
158 Qt3DCore::QAttribute *mPositionAttribute = nullptr;
159 Qt3DCore::QAttribute *mIndexAttribute = nullptr;
160#endif
161 QgsLineMaterial *mLineMaterial = nullptr;
162
163 // and these are owned by mMarkerEntity
164 Qt3DRender::QGeometryRenderer *mMarkerGeometryRenderer = nullptr;
165 QgsBillboardGeometry *mMarkerGeometry = nullptr;
166 QgsPoint3DBillboardMaterial *mMarkerMaterial = nullptr;
167
168 std::unique_ptr<QgsMarkerSymbol> mMarkerSymbol;
169
170 // Disable copying as we have pointer members.
171 QgsRubberBand3D( const QgsRubberBand3D & ) = delete;
172 QgsRubberBand3D &operator=( const QgsRubberBand3D & ) = delete;
173};
174
176
177#endif // QGSRUBBERBAND3D_H
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:337
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