QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsflatterrainsettings.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsflatterrainsettings.cpp
3 --------------------------------------
4 Date : August 2024
5 Copyright : (C) 2024 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
18#include "qgs3drendercontext.h"
19#include "qgs3dutils.h"
20
25
30
32{
33 return QStringLiteral( "flat" );
34}
35
36void QgsFlatTerrainSettings::readXml( const QDomElement &element, const QgsReadWriteContext &context )
37{
38 readCommonProperties( element, context );
39}
40
41void QgsFlatTerrainSettings::writeXml( QDomElement &element, const QgsReadWriteContext &context ) const
42{
43 writeCommonProperties( element, context );
44}
45
47{
48 const QgsFlatTerrainSettings *otherFlatTerrain = dynamic_cast<const QgsFlatTerrainSettings *>( other );
49 if ( !otherFlatTerrain )
50 return false;
51
52 return equalsCommon( otherFlatTerrain );
53}
54
55std::unique_ptr<QgsTerrainGenerator> QgsFlatTerrainSettings::createTerrainGenerator( const Qgs3DRenderContext &context ) const
56{
57 std::unique_ptr<QgsFlatTerrainGenerator> generator = std::make_unique<QgsFlatTerrainGenerator>();
58 generator->setCrs( context.crs(), context.transformContext() );
59 generator->setExtent( context.extent() );
60 return generator;
61}
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system used in the 3D scene.
QgsRectangle extent() const
Returns the 3D scene's 2D extent in the 3D scene's CRS.
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
void writeCommonProperties(QDomElement &element, const QgsReadWriteContext &context) const
Writes common properties from the base class into an XML element.
bool equalsCommon(const QgsAbstractTerrainSettings *other) const
Returns true if common base class settings from other match this object.
void readCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Reads common properties from the base class from the given DOM element.
QgsFlatTerrainSettings * clone() const final
Returns a copy of the terrain settings.
QString type() const final
Returns the unique type name for the terrain generator.
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const final
Writes settings to a DOM element.
static QgsAbstractTerrainSettings * create()
Creates a new instance of a QgsFlatTerrainSettings object.
void readXml(const QDomElement &element, const QgsReadWriteContext &context) final
Reads settings from a DOM element.
std::unique_ptr< QgsTerrainGenerator > createTerrainGenerator(const Qgs3DRenderContext &context) const override
Creates a new instance of a terrain generator which matches the terrain settings.
bool equals(const QgsAbstractTerrainSettings *other) const final
Returns true if this settings is exactly equal to another other settings.
The class is used as a container of context for various read/write operations on other objects.