Skip to content
Permalink
Browse files
add mesh & raster backup crs
  • Loading branch information
roya0045 authored and github-actions committed Dec 22, 2021
1 parent 38a2343 commit 0e5b1af8c5ad78a94eafa8f31c3095417924f89e
@@ -80,6 +80,7 @@ QgsMeshLayerProperties::QgsMeshLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *
connect( lyr->styleManager(), &QgsMapLayerStyleManager::currentStyleChanged, this, &QgsMeshLayerProperties::syncAndRepaint );

connect( this, &QDialog::accepted, this, &QgsMeshLayerProperties::apply );
connect( this, &QDialog::rejected, this, &QgsMeshLayerProperties::onCancel );
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsMeshLayerProperties::apply );

connect( mMeshLayer, &QgsMeshLayer::dataChanged, this, &QgsMeshLayerProperties::syncAndRepaint );
@@ -104,6 +105,7 @@ QgsMeshLayerProperties::QgsMeshLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *
layout->addWidget( mMetadataWidget );
metadataFrame->setLayout( layout );
mOptsPage_Metadata->setContentsMargins( 0, 0, 0, 0 );
mBackupCrs = mMeshLayer->crs();

mTemporalDateTimeStart->setDisplayFormat( "yyyy-MM-dd HH:mm:ss" );
mTemporalDateTimeEnd->setDisplayFormat( "yyyy-MM-dd HH:mm:ss" );
@@ -394,6 +396,8 @@ void QgsMeshLayerProperties::apply()

mMetadataWidget->acceptMetadata();

mBackupCrs = mMeshLayer->crs();

if ( needMeshUpdating )
mMeshLayer->reload();

@@ -547,3 +551,9 @@ void QgsMeshLayerProperties::saveMetadataAs()
else
QMessageBox::information( this, tr( "Save Metadata" ), message );
}

void QgsMeshLayerProperties::onCancel()
{
if ( mBackupCrs != mMeshLayer->crs() )
mMeshLayer->setCrs( mBackupCrs );
}
@@ -84,6 +84,8 @@ class GUI_EXPORT QgsMeshLayerProperties : public QgsOptionsDialogBase, private U
void aboutToShowStyleMenu();
//! Reloads temporal properties from the provider
void reloadTemporalProperties();
//! \brief Called when cancel button is pressed
void onCancel();

void onTimeReferenceChange();

@@ -122,6 +124,8 @@ class GUI_EXPORT QgsMeshLayerProperties : public QgsOptionsDialogBase, private U
friend class TestQgsMeshLayerPropertiesDialog;

void showHelp();

QgsCoordinateReferenceSystem mBackupCrs;
};


@@ -232,6 +232,8 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanv
return;
}

mBackupCrs = mRasterLayer->crs();

// Handles window modality raising canvas
if ( mMapCanvas && mRasterTransparencyWidget->pixelSelectorTool() )
{
@@ -880,6 +882,7 @@ void QgsRasterLayerProperties::apply()
mRasterLayer->setRenderer( rendererWidget->renderer() );
}

mBackupCrs = mRasterLayer->crs();
mMetadataWidget->acceptMetadata();
mMetadataFilled = false;

@@ -1795,6 +1798,8 @@ void QgsRasterLayerProperties::onCancel()
mRasterLayer->importNamedStyle( doc, myMessage );
syncToLayer();
}
if ( mBackupCrs != mRasterLayer->crs() )
mRasterLayer->setCrs( mBackupCrs );
}

void QgsRasterLayerProperties::showHelp()
@@ -294,5 +294,7 @@ class GUI_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private
QgsExpressionContext mContext;

friend class QgsAppScreenShots;

QgsCoordinateReferenceSystem mBackupCrs;
};
#endif

0 comments on commit 0e5b1af

Please sign in to comment.