#4893 Formations : Make sure "layer_zone_table.txt" is defined once

This commit is contained in:
Magne Sjaastad 2019-10-18 14:45:12 +02:00
parent 3f617c93d2
commit 6d7b29bb29
4 changed files with 20 additions and 5 deletions

View File

@ -75,11 +75,15 @@ void RicImportFormationNamesFeature::onActionTriggered( bool isChecked )
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory( "BINARY_GRID" );
QStringList fileNames = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
QString filterText = QString(
"Formation Names description File (*.lyr);;FMU Layer Zone Table(%1);;All Files (*.*)" )
.arg( RimFormationNames::layerZoneTableFileName() );
QStringList fileNames = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
"Import Formation Names",
defaultDir,
"Formation Names description File (*.lyr);;FMU Layer Zone "
"Table(layer_zone_table.txt);;All Files (*.*)" );
filterText );
if ( fileNames.isEmpty() ) return;

View File

@ -26,6 +26,7 @@
#include "RifReaderFmuRft.h"
#include "RimFormationNames.h"
#include "RimObservedDataCollection.h"
#include "RimObservedFmuRftData.h"
#include "RimObservedSummaryData.h"
@ -88,7 +89,7 @@ void RicImportObservedFmuDataFeature::selectObservedDataPathInDialog()
{
importedData = observedDataCollection->createAndAddFmuRftDataFromPath( subDir );
QDir dir( subDir );
QString layerZoneFile = dir.absoluteFilePath( "layer_zone_table.txt" );
QString layerZoneFile = dir.absoluteFilePath( RimFormationNames::layerZoneTableFileName() );
if ( QFileInfo::exists( layerZoneFile ) )
{
QStringList fileNames;

View File

@ -151,7 +151,7 @@ void RimFormationNames::readFormationNamesFile( QString* errorMessage )
QFileInfo fileInfo( m_formationNamesFileName() );
if ( fileInfo.fileName() == "layer_zone_table.txt" )
if ( fileInfo.fileName() == RimFormationNames::layerZoneTableFileName() )
{
readFmuFormationNameFile( stream, errorMessage );
}
@ -174,6 +174,14 @@ void RimFormationNames::updateFilePathsFromProjectPath( const QString& newProjec
nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFormationNames::layerZoneTableFileName()
{
return "layer_zone_table.txt";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -49,6 +49,8 @@ public:
void readFormationNamesFile( QString* errorMessage );
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
static QString layerZoneTableFileName();
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,