QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
127  int featureCount() const { return mFeatureCount; }
128 
129  protected:
131  void updateZRangeFromPositions( const QVector<QVector3D> &positions );
132 
133  protected:
134  float mZMin = std::numeric_limits<float>::max();
135  float mZMax = std::numeric_limits<float>::lowest();
136  int mFeatureCount = 0;
137 };
138 
139 
140 class Qgs3DMapSettings;
141 class QgsVectorLayer;
142 
143 namespace Qgs3DSymbolImpl
144 {
146  Qt3DCore::QEntity *entityFromHandler( QgsFeature3DHandler *handler, const Qgs3DMapSettings &map, QgsVectorLayer *layer );
147 }
148 
149 
151 
152 #endif // QGSFEATURE3DHANDLER_P_H
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:406
qgsexpressioncontext.h
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
Qgs3DMapSettings
Definition of the world.
Definition: qgs3dmapsettings.h:57
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:55