QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsabstractterrainsettings.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsabstractterrainsettings.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
17#include "qgis.h"
18#include <QDomElement>
19
21
25
27{
28 element.setAttribute( QStringLiteral( "exaggeration" ), mTerrainVerticalScale );
29 element.setAttribute( QStringLiteral( "texture-size" ), mMapTileResolution );
30 element.setAttribute( QStringLiteral( "max-terrain-error" ), mMaxTerrainScreenError );
31 element.setAttribute( QStringLiteral( "max-ground-error" ), mMaxTerrainGroundError );
32 element.setAttribute( QStringLiteral( "elevation-offset" ), mTerrainElevationOffset );
33}
34
36{
37 mTerrainVerticalScale = element.attribute( QStringLiteral( "exaggeration" ), QStringLiteral( "1" ) ).toDouble();
38 mMapTileResolution = element.attribute( QStringLiteral( "texture-size" ), QStringLiteral( "512" ) ).toInt();
39 mMaxTerrainScreenError = element.attribute( QStringLiteral( "max-terrain-error" ), QStringLiteral( "3" ) ).toDouble();
40 mMaxTerrainGroundError = element.attribute( QStringLiteral( "max-ground-error" ), QStringLiteral( "1" ) ).toDouble();
41 mTerrainElevationOffset = element.attribute( QStringLiteral( "elevation-offset" ), QStringLiteral( "0.0" ) ).toDouble();
42}
43
45{
46 mTerrainVerticalScale = source->mTerrainVerticalScale;
47 mMapTileResolution = source->mMapTileResolution;
48 mMaxTerrainScreenError = source->mMaxTerrainScreenError;
49 mMaxTerrainGroundError = source->mMaxTerrainGroundError;
50 mTerrainElevationOffset = source->mTerrainElevationOffset;
51}
52
54{
55 return mMapTileResolution == other->mMapTileResolution
56 && qgsDoubleNear( mTerrainVerticalScale, other->mTerrainVerticalScale )
57 && qgsDoubleNear( mMaxTerrainScreenError, other->mMaxTerrainScreenError )
58 && qgsDoubleNear( mMaxTerrainGroundError, other->mMaxTerrainGroundError )
59 && qgsDoubleNear( mTerrainElevationOffset, other->mTerrainElevationOffset );
60}
void copyCommonProperties(const QgsAbstractTerrainSettings *source)
Copies common properties from a source object.
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.
virtual void resolveReferences(const QgsProject *project)
After reading settings from XML, resolves references to any layers in a project that have been read a...
void readCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Reads common properties from the base class from the given DOM element.
virtual ~QgsAbstractTerrainSettings()
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
The class is used as a container of context for various read/write operations on other objects.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition qgis.h:6024