21 #include <QDomElement>
34 mTerrainProvider = std::make_unique< QgsFlatTerrainProvider >();
40 if ( mTerrainProvider )
41 mTerrainProvider->resolveReferences( project );
46 const QDomElement providerElement = element.firstChildElement( QStringLiteral(
"terrainProvider" ) );
47 if ( !providerElement.isNull() )
49 const QString type = providerElement.attribute( QStringLiteral(
"type" ) );
50 if ( type.compare( QLatin1String(
"flat" ) ) == 0 )
51 mTerrainProvider = std::make_unique< QgsFlatTerrainProvider >();
52 else if ( type.compare( QLatin1String(
"raster" ) ) == 0 )
53 mTerrainProvider = std::make_unique< QgsRasterDemTerrainProvider >();
54 else if ( type.compare( QLatin1String(
"mesh" ) ) == 0 )
55 mTerrainProvider = std::make_unique< QgsMeshTerrainProvider >();
57 mTerrainProvider = std::make_unique< QgsFlatTerrainProvider >();
59 mTerrainProvider->readXml( providerElement, context );
63 mTerrainProvider = std::make_unique< QgsFlatTerrainProvider >();
72 QDomElement element = document.createElement( QStringLiteral(
"ElevationProperties" ) );
74 if ( mTerrainProvider )
76 QDomElement providerElement = document.createElement( QStringLiteral(
"terrainProvider" ) );
77 providerElement.setAttribute( QStringLiteral(
"type" ), mTerrainProvider->type() );
78 providerElement.appendChild( mTerrainProvider->writeXml( document, context ) );
79 element.appendChild( providerElement );
86 return mTerrainProvider.get();
91 if ( mTerrainProvider.get() == provider )
94 mTerrainProvider.reset( provider );