QGIS API Documentation 3.99.0-Master (c22de0620c0)
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
31#include "qgsmapsettings.h"
33#include "qgsrectangle.h"
34
35#include <Qt3DRender/QTextureImageDataPtr>
36
37#define SIP_NO_FILE
38
41class QgsMapLayer;
42class QgsMapOverlayTextureGenerator;
44
45
53class QgsMapOverlayEntity : public QgsOverlayTextureEntity
54{
55 Q_OBJECT
56
57 public:
58 explicit QgsMapOverlayEntity( QgsWindow3DEngine *engine, QgsOverlayTextureRenderView *debugTextureRenderView, Qgs3DMapSettings *mapSettings, Qt3DCore::QNode *parent = nullptr );
59
60 ~QgsMapOverlayEntity() override;
61
69 void update( const QgsRectangle &extent, const QVector<QgsPointXY> &frustumExtent, double rotationDegrees, bool showFrustum = false );
70
71 private slots:
72
73 void onLayersChanged();
74 void onTextureReady( const QImage &image );
75 void onSizeChanged();
76
77 private:
78 void invalidateMapImage();
79 void connectToLayersRepaintRequest();
80
81 static int SIZE()
82 {
83 static int size = []() {
84 constexpr int baseSize = 256;
85 QgsMapSettings mapSettings;
86 return static_cast<int>( std::round( baseSize * mapSettings.devicePixelRatio() ) );
87 }();
88
89 return size;
90 }
91
92 private:
93 QgsWindow3DEngine *mEngine = nullptr;
94 Qgs3DMapSettings *mMapSettings = nullptr;
95 QgsMapOverlayTextureGenerator *mTextureGenerator = nullptr;
96
97 Qt3DRender::QTextureImageDataPtr mImageDataPtr;
98
100 QList<QgsMapLayer *> mLayers;
101
102 QgsRectangle mExtent;
103 QVector<QgsPointXY> mFrustumExtent;
104 double mRotation;
105 bool mShowFrustum = false;
106};
107
109
110#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.