QGIS API Documentation
3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
src
core
tiledscene
qgstiledscenerendererregistry.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgstiledscenerendererregistry.cpp
3
---------------------
4
begin : August 2023
5
copyright : (C) 2023 by Nyall Dawson
6
email : nyall dot dawson 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
#include "
qgstiledscenerendererregistry.h
"
16
#include "
qgstiledscenerenderer.h
"
17
18
// default renderers
19
#include "
qgstiledscenetexturerenderer.h
"
20
#include "
qgstiledscenewireframerenderer.h
"
21
22
QgsTiledSceneRendererRegistry::QgsTiledSceneRendererRegistry
()
23
{
24
// add default renderers
25
addRenderer
(
new
QgsTiledSceneRendererMetadata
( QStringLiteral(
"texture"
),
26
QObject::tr(
"Textured"
),
27
QgsTiledSceneTextureRenderer::create
) );
28
addRenderer
(
new
QgsTiledSceneRendererMetadata
( QStringLiteral(
"wireframe"
),
29
QObject::tr(
"Wireframe"
),
30
QgsTiledSceneWireframeRenderer::create
) );
31
}
32
33
QgsTiledSceneRendererRegistry::~QgsTiledSceneRendererRegistry
()
34
{
35
qDeleteAll( mRenderers );
36
}
37
38
bool
QgsTiledSceneRendererRegistry::addRenderer
(
QgsTiledSceneRendererAbstractMetadata
*metadata )
39
{
40
if
( !metadata || mRenderers.contains( metadata->
name
() ) )
41
return
false
;
42
43
mRenderers[metadata->
name
()] = metadata;
44
mRenderersOrder << metadata->
name
();
45
return
true
;
46
}
47
48
bool
QgsTiledSceneRendererRegistry::removeRenderer
(
const
QString &rendererName )
49
{
50
if
( !mRenderers.contains( rendererName ) )
51
return
false
;
52
53
delete
mRenderers[rendererName];
54
mRenderers.remove( rendererName );
55
mRenderersOrder.removeAll( rendererName );
56
return
true
;
57
}
58
59
QgsTiledSceneRendererAbstractMetadata
*
QgsTiledSceneRendererRegistry::rendererMetadata
(
const
QString &rendererName )
60
{
61
return
mRenderers.value( rendererName );
62
}
63
64
QStringList
QgsTiledSceneRendererRegistry::renderersList
()
const
65
{
66
QStringList renderers;
67
for
(
const
QString &renderer : mRenderersOrder )
68
{
69
QgsTiledSceneRendererAbstractMetadata
*r = mRenderers.value( renderer );
70
if
( r )
71
renderers << renderer;
72
}
73
return
renderers;
74
}
75
76
QgsTiledSceneRenderer
*
QgsTiledSceneRendererRegistry::defaultRenderer
(
const
QgsTiledSceneLayer
* )
77
{
78
return
new
QgsTiledSceneTextureRenderer
();
79
}
80
QgsTiledSceneLayer
Represents a map layer supporting display of tiled scene objects.
Definition
qgstiledscenelayer.h:36
QgsTiledSceneRendererAbstractMetadata
Stores metadata about one tiled scene renderer class.
Definition
qgstiledscenerendererregistry.h:44
QgsTiledSceneRendererAbstractMetadata::name
QString name() const
Returns the unique name of the renderer.
Definition
qgstiledscenerendererregistry.h:65
QgsTiledSceneRendererMetadata
Convenience metadata class that uses static functions to create tiled scene renderer and its widget.
Definition
qgstiledscenerendererregistry.h:124
QgsTiledSceneRendererRegistry::rendererMetadata
QgsTiledSceneRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
Definition
qgstiledscenerendererregistry.cpp:59
QgsTiledSceneRendererRegistry::removeRenderer
bool removeRenderer(const QString &rendererName)
Removes a renderer from registry.
Definition
qgstiledscenerendererregistry.cpp:48
QgsTiledSceneRendererRegistry::defaultRenderer
static QgsTiledSceneRenderer * defaultRenderer(const QgsTiledSceneLayer *layer)
Returns a new default tiled scene renderer for a specified layer.
Definition
qgstiledscenerendererregistry.cpp:76
QgsTiledSceneRendererRegistry::renderersList
QStringList renderersList() const
Returns a list of available renderers.
Definition
qgstiledscenerendererregistry.cpp:64
QgsTiledSceneRendererRegistry::~QgsTiledSceneRendererRegistry
~QgsTiledSceneRendererRegistry()
Definition
qgstiledscenerendererregistry.cpp:33
QgsTiledSceneRendererRegistry::QgsTiledSceneRendererRegistry
QgsTiledSceneRendererRegistry()
Definition
qgstiledscenerendererregistry.cpp:22
QgsTiledSceneRendererRegistry::addRenderer
bool addRenderer(QgsTiledSceneRendererAbstractMetadata *metadata)
Adds a renderer to the registry.
Definition
qgstiledscenerendererregistry.cpp:38
QgsTiledSceneRenderer
Abstract base class for 2d tiled scene renderers.
Definition
qgstiledscenerenderer.h:123
QgsTiledSceneTextureRenderer
Renders tiled scene layers using textures.
Definition
qgstiledscenetexturerenderer.h:34
QgsTiledSceneTextureRenderer::create
static QgsTiledSceneRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates a textured renderer from an XML element.
Definition
qgstiledscenetexturerenderer.cpp:45
QgsTiledSceneWireframeRenderer::create
static QgsTiledSceneRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates a textured renderer from an XML element.
Definition
qgstiledscenewireframerenderer.cpp:49
qgstiledscenerenderer.h
qgstiledscenerendererregistry.h
qgstiledscenetexturerenderer.h
qgstiledscenewireframerenderer.h
Generated on Mon Oct 30 2023 18:42:25 for QGIS API Documentation by
1.9.8