QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
3d
qgs3dmapsceneentity.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgs3dmapsceneentity.h
3
--------------------------------------
4
Date : May 2023
5
Copyright : (C) 2023 by Stefanos Natsis
6
Email : uclaros 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 QGS3DMAPSCENEENTITY_H
17
#define QGS3DMAPSCENEENTITY_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 "
qgsrange.h
"
31
#include "
qgssettings.h
"
32
33
#include <QMatrix4x4>
34
#include <QString>
35
#include <QVector3D>
36
#include <Qt3DCore/QEntity>
37
38
#define SIP_NO_FILE
39
40
using namespace
Qt::StringLiterals;
41
42
class
Qgs3DMapSettings
;
43
44
50
class
Qgs3DMapSceneEntity :
public
Qt3DCore::QEntity
51
{
52
Q_OBJECT
53
public
:
55
Qgs3DMapSceneEntity( Qgs3DMapSettings *mapSettings, Qt3DCore::QNode *parent =
nullptr
)
56
: Qt3DCore::QEntity( parent )
57
, mMapSettings( mapSettings )
58
{
59
const
QgsSettings settings;
60
mGpuMemoryLimit = settings.
value
( u
"map3d/gpuMemoryLimit"
_s, 500.0,
QgsSettings::App
).toDouble();
61
}
62
64
struct
SceneContext
65
{
66
QVector3D cameraPos;
67
float
cameraFov;
68
int
screenSizePx;
69
QMatrix4x4 viewProjectionMatrix;
70
};
71
73
virtual
void
handleSceneUpdate(
const
SceneContext &sceneContext ) { Q_UNUSED( sceneContext ) }
74
76
virtual
int
pendingJobsCount()
const
{
return
0; }
77
79
virtual
bool
needsUpdate()
const
{
return
false
; }
80
82
virtual
QgsRange<float> getNearFarPlaneRange(
const
QMatrix4x4 &viewMatrix )
const
83
{
84
Q_UNUSED( viewMatrix )
85
return
QgsRange<float>( 1e9, 0 );
86
}
87
93
Qgs3DMapSettings *mapSettings() {
return
mMapSettings; }
94
96
void
setGpuMemoryLimit(
double
gpuMemoryLimit ) { mGpuMemoryLimit = gpuMemoryLimit; }
97
99
double
gpuMemoryLimit()
const
{
return
mGpuMemoryLimit; }
100
102
bool
hasReachedGpuMemoryLimit()
const
{
return
mHasReachedGpuMemoryLimit; }
103
104
protected
:
106
void
setHasReachedGpuMemoryLimit(
bool
reached ) { mHasReachedGpuMemoryLimit = reached; }
107
108
signals:
110
void
pendingJobsCountChanged();
111
113
void
newEntityCreated( Qt3DCore::QEntity *entity );
114
115
protected
:
116
Qgs3DMapSettings *mMapSettings =
nullptr
;
117
119
double
mGpuMemoryLimit = 500.0;
// in megabytes
121
bool
mHasReachedGpuMemoryLimit =
false
;
122
};
123
125
126
#endif
// QGS3DMAPSCENEENTITY_H
Qgs3DMapSettings
Definition of the world.
Definition
qgs3dmapsettings.h:59
QgsSettings::value
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
Definition
qgssettings.cpp:169
QgsSettings::App
@ App
Definition
qgssettings.h:80
qgsrange.h
qgssettings.h
Generated on
for QGIS API Documentation by
1.17.0