QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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 <Qt3DCore/QEntity>
31 
32 class QgsFeature;
33 
34 
35 #include "qgsexpressioncontext.h"
36 
37 class Qgs3DMapSettings;
38 
39 #define SIP_NO_FILE
40 
41 
48 class Qgs3DRenderContext
49 {
50  public:
51  Qgs3DRenderContext( const Qgs3DMapSettings &map ) : mMap( map ) {}
52 
53  const Qgs3DMapSettings &map() const { return mMap; }
54 
60  void setExpressionContext( const QgsExpressionContext &context ) { mExpressionContext = context; }
61 
67  QgsExpressionContext &expressionContext() { return mExpressionContext; }
68 
75  const QgsExpressionContext &expressionContext() const { return mExpressionContext; } SIP_SKIP
76 
77  private:
78  const Qgs3DMapSettings &mMap;
80  QgsExpressionContext mExpressionContext;
81 
82 };
83 
84 
89 class QgsFeature3DHandler
90 {
91  public:
92  virtual ~QgsFeature3DHandler() = default;
93 
98  virtual bool prepare( const Qgs3DRenderContext &context, QSet<QString> &attributeNames ) = 0;
99 
104  virtual void processFeature( const QgsFeature &feature, const Qgs3DRenderContext &context ) = 0;
105 
110  virtual void finalize( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context ) = 0;
111 
116  float zMinimum() const { return mZMin; }
117 
122  float zMaximum() const { return mZMax; }
123 
124  protected:
126  void updateZRangeFromPositions( const QVector<QVector3D> &positions );
127 
128  protected:
129  float mZMin = std::numeric_limits<float>::max();
130  float mZMax = std::numeric_limits<float>::lowest();
131 };
132 
133 
134 class Qgs3DMapSettings;
135 class QgsVectorLayer;
136 
137 namespace Qgs3DSymbolImpl
138 {
140  Qt3DCore::QEntity *entityFromHandler( QgsFeature3DHandler *handler, const Qgs3DMapSettings &map, QgsVectorLayer *layer );
141 }
142 
143 
145 
146 #endif // QGSFEATURE3DHANDLER_P_H
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
Represents a vector layer which manages a vector based data sets.
#define SIP_SKIP
Definition: qgis_sip.h:126