Skip to content

Commit

Permalink
revert back Qgs3DMapSettings::worldToMapCoordinates and add copy cons…
Browse files Browse the repository at this point in the history
…tructors
  • Loading branch information
NEDJIMAbelgacem committed Nov 9, 2020
1 parent d008400 commit f2b14d3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/3d/qgs3dmapsettings.cpp
Expand Up @@ -42,6 +42,7 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
, mMapTileResolution( other.mMapTileResolution )
, mMaxTerrainScreenError( other.mMaxTerrainScreenError )
, mMaxTerrainGroundError( other.mMaxTerrainGroundError )
, mTerrainElevationOffset( other.mTerrainElevationOffset )
, mTerrainShadingEnabled( other.mTerrainShadingEnabled )
, mTerrainShadingMaterial( other.mTerrainShadingMaterial )
, mTerrainMapTheme( other.mTerrainMapTheme )
Expand All @@ -60,8 +61,17 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
, mPathResolver( other.mPathResolver )
, mMapThemes( other.mMapThemes )
, mIsSkyboxEnabled( other.mIsSkyboxEnabled )
, mSkyboxSettings()
, mShadowSettings()
, mSkyboxSettings( other.mSkyboxSettings )
, mShadowSettings( other.mShadowSettings )
, mEyeDomeLightingEnabled( other.mEyeDomeLightingEnabled )
, mEyeDomeLightingStrength( other.mEyeDomeLightingStrength )
, mEyeDomeLightingDistance( other.mEyeDomeLightingDistance )
, mDebugShadowMapEnabled( other.mDebugShadowMapEnabled )
, mDebugShadowMapCorner( other.mDebugShadowMapCorner )
, mDebugShadowMapSize( other.mDebugShadowMapSize )
, mDebugDepthMapEnabled( other.mDebugDepthMapEnabled )
, mDebugDepthMapCorner( other.mDebugDepthMapCorner )
, mDebugDepthMapSize( other.mDebugDepthMapSize )
{
Q_FOREACH ( QgsAbstract3DRenderer *renderer, other.mRenderers )
{
Expand Down Expand Up @@ -415,12 +425,12 @@ void Qgs3DMapSettings::resolveReferences( const QgsProject &project )

QgsVector3D Qgs3DMapSettings::mapToWorldCoordinates( const QgsVector3D &mapCoords ) const
{
return Qgs3DUtils::mapToWorldCoordinates( mapCoords, mOrigin ) + QgsVector3D( 0.0f, mTerrainElevationOffset, 0.0f );
return Qgs3DUtils::mapToWorldCoordinates( mapCoords, mOrigin );
}

QgsVector3D Qgs3DMapSettings::worldToMapCoordinates( const QgsVector3D &worldCoords ) const
{
return Qgs3DUtils::worldToMapCoordinates( worldCoords - QgsVector3D( 0.0f, mTerrainElevationOffset, 0.0f ), mOrigin );
return Qgs3DUtils::worldToMapCoordinates( worldCoords, mOrigin );
}

void Qgs3DMapSettings::setCrs( const QgsCoordinateReferenceSystem &crs )
Expand Down
10 changes: 10 additions & 0 deletions src/3d/qgsshadowsettings.cpp
Expand Up @@ -20,6 +20,16 @@
#include "qgsreadwritecontext.h"
#include "qgssymbollayerutils.h"

QgsShadowSettings::QgsShadowSettings( const QgsShadowSettings &other )
: mRenderShadows( other.mRenderShadows )
, mSelectedDirectionalLight( other.mSelectedDirectionalLight )
, mMaximumShadowRenderingDistance( other.mMaximumShadowRenderingDistance )
, mShadowBias( other.mShadowBias )
, mShadowMapResolution( other.mShadowMapResolution )
{

}

void QgsShadowSettings::readXml( const QDomElement &element, const QgsReadWriteContext &context )
{
Q_UNUSED( context );
Expand Down
4 changes: 4 additions & 0 deletions src/3d/qgsshadowsettings.h
Expand Up @@ -34,6 +34,10 @@ class QDomElement;
class _3D_EXPORT QgsShadowSettings
{
public:
//! Default constructor
QgsShadowSettings() = default;
//! Copy constructor
QgsShadowSettings( const QgsShadowSettings &other );

//! Reads settings from a DOM \a element
void readXml( const QDomElement &element, const QgsReadWriteContext &context );
Expand Down
8 changes: 8 additions & 0 deletions src/3d/qgsskyboxsettings.cpp
Expand Up @@ -20,6 +20,14 @@
#include "qgsreadwritecontext.h"
#include "qgssymbollayerutils.h"

QgsSkyboxSettings::QgsSkyboxSettings( const QgsSkyboxSettings &other )
: mSkyboxType( other.mSkyboxType )
, mPanoramicTexturePath( other.mPanoramicTexturePath )
, mCubeMapFacesPaths( other.mCubeMapFacesPaths )
{

}

void QgsSkyboxSettings::readXml( const QDomElement &element, const QgsReadWriteContext &context )
{
const QgsPathResolver &pathResolver = context.pathResolver();
Expand Down
4 changes: 4 additions & 0 deletions src/3d/qgsskyboxsettings.h
Expand Up @@ -35,6 +35,10 @@ class QDomElement;
class _3D_EXPORT QgsSkyboxSettings
{
public:
// default constructor
QgsSkyboxSettings() = default;
// copy constructor
QgsSkyboxSettings( const QgsSkyboxSettings &other );

//! Reads settings from a DOM \a element
void readXml( const QDomElement &element, const QgsReadWriteContext &context );
Expand Down

0 comments on commit f2b14d3

Please sign in to comment.