QGIS API Documentation 3.99.0-Master (8e76e220402)
Loading...
Searching...
No Matches
qgsmapoverlayentity.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmapoverlayentity.h
3 --------------------------------------
4 Date : July 2025
5 Copyright : (C) 2025 by Jean Felder
6 Email : jean dot felder at oslandia 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 QGSMAPOVERLAYENTITY_H
17#define QGSMAPOVERLAYENTITY_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#define SIP_NO_FILE
31
32#include "qgsmapsettings.h"
34#include "qgsrectangle.h"
35
38class QgsMapLayer;
39class QgsMapOverlayTextureGenerator;
41
42
50class QgsMapOverlayEntity : public QgsOverlayTextureEntity
51{
52 Q_OBJECT
53
54 public:
55 explicit QgsMapOverlayEntity( QgsWindow3DEngine *engine, QgsOverlayTextureRenderView *debugTextureRenderView, Qgs3DMapSettings *mapSettings, Qt3DCore::QNode *parent = nullptr );
56
57 ~QgsMapOverlayEntity() override;
58
66 void update( const QgsRectangle &extent, const QVector<QgsPointXY> &frustumExtent, double rotationDegrees, bool showFrustum = false );
67
68 private slots:
69
70 void onLayersChanged();
71 void onTextureReady( const QImage &image );
72 void onSizeChanged();
73
74 private:
75 void invalidateMapImage();
76 void connectToLayersRepaintRequest();
77
78 static int SIZE()
79 {
80 static int size = []() {
81 constexpr int baseSize = 256;
82 QgsMapSettings mapSettings;
83 return static_cast<int>( std::round( baseSize * mapSettings.devicePixelRatio() ) );
84 }();
85
86 return size;
87 }
88
89 private:
90 QgsWindow3DEngine *mEngine = nullptr;
91 Qgs3DMapSettings *mMapSettings = nullptr;
92 QgsMapOverlayTextureGenerator *mTextureGenerator = nullptr;
93
94 Qt3DRender::QTextureImageDataPtr mImageDataPtr;
95
97 QList<QgsMapLayer *> mLayers;
98
99 QgsRectangle mExtent;
100 QVector<QgsPointXY> mFrustumExtent;
101 double mRotation;
102 bool mShowFrustum = false;
103};
104
106
107#endif // QGSMAPOVERLAYENTITY_H
Definition of the world.
Base class for all map layer types.
Definition qgsmaplayer.h:83
float devicePixelRatio() const
Returns the device pixel ratio.
An entity responsible for rendering an overlay texture in 3D view.
Simple render view to preview overlay textures in 3D view.
On-screen 3D engine: it creates an OpenGL window (QWindow) and displays rendered 3D scenes there.