QGIS API Documentation 3.99.0-Master (18a1e75d814)
Loading...
Searching...
No Matches
qgsfeature3dhandler_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfeature3dhandler_p.h
3 --------------------------------------
4 Date : January 2019
5 Copyright : (C) 2019 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 QGSFEATURE3DHANDLER_P_H
17#define QGSFEATURE3DHANDLER_P_H
18
20
21//
22// W A R N I N G
23// -------------
24//
25// This file is not part of the QGIS API. It exists purely as an
26// implementation detail. This header file may change from version to
27// version without notice, or even be removed.
28//
29
30#include "qgsbox3d.h"
31#include "qgsvector3d.h"
32
33#include <QSet>
34#include <QString>
35#include <QVector>
36
37#define SIP_NO_FILE
38
39namespace Qt3DCore
40{
41 class QEntity;
42}
43
45class QgsFeature;
46class QgsGeometry;
47
48
53class QgsFeature3DHandler
54{
55 public:
56 virtual ~QgsFeature3DHandler() = default;
57
62 virtual bool prepare( const Qgs3DRenderContext &context, QSet<QString> &attributeNames, const QgsBox3D &chunkExtent ) = 0;
63
68 virtual void processFeature( const QgsFeature &feature, const Qgs3DRenderContext &context ) = 0;
69
74 virtual void finalize( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context ) = 0;
75
80 float zMinimum() const { return mZMin; }
81
86 float zMaximum() const { return mZMax; }
87
91 int featureCount() const { return mFeatureCount; }
92
98 void setHighlightingEnabled( bool enable ) { mHighlightingEnabled = enable; }
99
104 bool highlightingEnabled() const { return mHighlightingEnabled; }
105
106 protected:
108 void updateZRangeFromPositions( const QVector<QVector3D> &positions );
109
114 bool clipGeometryIfTooLarge( QgsGeometry &geom ) const;
115
116 protected:
117 float mZMin = std::numeric_limits<float>::max();
118 float mZMax = std::numeric_limits<float>::lowest();
119 int mFeatureCount = 0;
120 bool mHighlightingEnabled = false;
121
126 QgsVector3D mChunkOrigin;
127
129 QgsBox3D mChunkExtent;
130
131 private:
133 static constexpr double MAX_GEOM_BBOX_SIZE = 1e6;
134};
135
136
138
139#endif // QGSFEATURE3DHANDLER_P_H
Rendering context for preparation of 3D entities.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
A geometry is the spatial representation of a feature.