27#include "qgsmeshterraingenerator.h"
46 qDeleteAll( mMetadata );
51 if ( !metadata || mMetadata.contains( metadata->
type() ) )
54 mMetadata[metadata->
type()] = metadata;
55 mTerrainOrder << metadata->
type();
61 if ( !mMetadata.contains( type ) )
64 return mMetadata[type]->createTerrainSettings();
69 if ( !mMetadata.contains( type ) )
72 return mMetadata[type]->createTerrainGenerator();
79 std::unique_ptr<QgsFlatTerrainSettings> flatTerrain = std::make_unique<QgsFlatTerrainSettings>();
81 return flatTerrain.release();
87 std::unique_ptr<QgsDemTerrainSettings> demTerrain = std::make_unique<QgsDemTerrainSettings>();
88 demTerrain->setLayer( rasterProvider->
layer() );
91 return demTerrain.release();
97 std::unique_ptr<QgsMeshTerrainSettings> meshTerrain = std::make_unique<QgsMeshTerrainSettings>();
98 meshTerrain->setLayer( meshProvider->
layer() );
101 return meshTerrain.release();
105 std::unique_ptr<QgsFlatTerrainSettings> flatTerrain = std::make_unique<QgsFlatTerrainSettings>();
106 return flatTerrain.release();
112 return mMetadata.value( type );
118 for (
const QString &type : mTerrainOrder )
120 if ( mMetadata.value( type ) )
QgsAbstractTerrainSettings * configureTerrainFromProject(QgsProjectElevationProperties *properties)
Create terrain settings directly from a project's elevation properties.
QgsAbstractTerrainSettings * createTerrainSettings(const QString &type) const
Creates a new instance of the terrain settings of the specified type.
QgsTerrainGenerator * createTerrainGenerator(const QString &type) const
Creates a new instance of the terrain generator of the specified type.
Qgs3DTerrainAbstractMetadata * terrainMetadata(const QString &type) const
Returns metadata for specified terrain type. Returns nullptr if not found.
QStringList types() const
Returns a list of all available terrain types.
bool addType(Qgs3DTerrainAbstractMetadata *metadata)
Registers a new terrain type. Takes ownership of the metadata instance.
virtual QString type() const =0
Returns the unique type ID string for the provider.
double offset() const
Returns the vertical offset value, used for adjusting the heights from the terrain provider.
double scale() const
Returns the vertical scale factor, which can be used to exaggerate vertical heights.
static QgsTerrainGenerator * create()
Creates a new instance of a QgsDemTerrainGenerator object.
static QgsAbstractTerrainSettings * create()
Creates a new instance of a QgsDemTerrainSettings object.
static QgsTerrainGenerator * create() SIP_FACTORY
Creates a new instance of a QgsFlatTerrainGenerator object.
static QgsAbstractTerrainSettings * create()
Creates a new instance of a QgsFlatTerrainSettings object.
A terrain provider that uses the Z values of a mesh layer to build a terrain surface.
QgsMeshLayer * layer() const
Returns the mesh layer to be used as the terrain source.
static QgsAbstractTerrainSettings * create()
Creates a new instance of a QgsMeshTerrainSettings object.
static QgsAbstractTerrainSettings * create()
Creates a new instance of a QgsOnlineDemTerrainSettings object.
static QgsTerrainGenerator * create() SIP_FACTORY
Creates a new instance of a QgsOnlineTerrainGenerator object.
Contains elevation properties for a QgsProject.
QgsAbstractTerrainProvider * terrainProvider()
Returns the project's terrain provider.
static QgsTerrainGenerator * create()
Creates a new instance of a QgsQuantizedMeshTerrainGenerator object.
static QgsAbstractTerrainSettings * create()
Creates a new instance of a QgsQuantizedMeshTerrainSettings object.
A terrain provider where the terrain source is a raster DEM layer.
QgsRasterLayer * layer() const
Returns the raster layer with elevation model to be used as the terrain source.