mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6878 Export Completion: Allow suffix in custom file name
This commit is contained in:
parent
3fa4986f37
commit
d002ee1d6e
@ -916,8 +916,9 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile(
|
||||
{
|
||||
try
|
||||
{
|
||||
QFileInfo fi( fileName );
|
||||
std::shared_ptr<QFile> exportFile =
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName, fileName );
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName, fi.baseName(), fi.suffix() );
|
||||
|
||||
std::map<QString, std::vector<RigCompletionData>> completionsForGrid;
|
||||
completionsForGrid.insert( std::pair<QString, std::vector<RigCompletionData>>( "", completionsForMainGrid ) );
|
||||
@ -938,9 +939,11 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile(
|
||||
{
|
||||
try
|
||||
{
|
||||
QString lgrFileName = fileName + "_LGR";
|
||||
QFileInfo fi( fileName );
|
||||
|
||||
QString lgrFileName = fi.baseName() + "_LGR";
|
||||
std::shared_ptr<QFile> exportFile =
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName, lgrFileName );
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName, lgrFileName, fi.suffix() );
|
||||
|
||||
exportWellPathFractureReport( eclipseCase, exportFile, wellPathFractureReportItems );
|
||||
if ( exportWelspec )
|
||||
|
@ -50,7 +50,8 @@ std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFileForExport(
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFileForExport( const QString& folderName,
|
||||
const QString& fileName )
|
||||
const QString& fileName,
|
||||
const QString& suffix )
|
||||
{
|
||||
QString validFileName = caf::Utils::makeValidFileBasename( fileName );
|
||||
|
||||
@ -68,7 +69,8 @@ std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFileForExport(
|
||||
}
|
||||
}
|
||||
|
||||
QString filePath = exportFolder.filePath( validFileName );
|
||||
QString filePath = exportFolder.filePath( validFileName );
|
||||
if ( !suffix.isEmpty() ) filePath += "." + suffix;
|
||||
std::shared_ptr<QFile> exportFile( new QFile( filePath ) );
|
||||
if ( !exportFile->open( QIODevice::WriteOnly | QIODevice::Text ) )
|
||||
{
|
||||
@ -79,6 +81,15 @@ std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFileForExport(
|
||||
return exportFile;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFileForExport( const QString& folderName,
|
||||
const QString& fileName )
|
||||
{
|
||||
return openFileForExport( folderName, fileName, "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -36,6 +36,8 @@ public:
|
||||
};
|
||||
|
||||
static std::shared_ptr<QFile> openFileForExport( const QString& folderName, const QString& fileName );
|
||||
static std::shared_ptr<QFile>
|
||||
openFileForExport( const QString& folderName, const QString& fileName, const QString& suffix );
|
||||
static std::shared_ptr<QFile> openFileForExport( const QString& fullFileName );
|
||||
static const RimWellPath* findWellPathFromExportName( const QString& wellNameForExport );
|
||||
};
|
||||
};
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "RimWellPathValve.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -69,18 +70,30 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
|
||||
std::shared_ptr<QFile> unifiedLgrExportFile;
|
||||
if ( exportSettings.fileSplit() == RicExportCompletionDataSettingsUi::UNIFIED_FILE )
|
||||
{
|
||||
QString fileName;
|
||||
{
|
||||
QString fileName;
|
||||
QFileInfo fi( exportSettings.customFileName() );
|
||||
if ( !exportSettings.customFileName().isEmpty() )
|
||||
fileName = fi.baseName() + "_MSW";
|
||||
else
|
||||
fileName = QString( "UnifiedCompletions_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() );
|
||||
|
||||
if ( !exportSettings.customFileName().isEmpty() )
|
||||
fileName = exportSettings.customFileName() + "_MSW";
|
||||
else
|
||||
fileName = QString( "UnifiedCompletions_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() );
|
||||
unifiedExportFile =
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, fileName, fi.suffix() );
|
||||
}
|
||||
|
||||
unifiedExportFile = RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, fileName );
|
||||
{
|
||||
QString lgrFileName;
|
||||
QFileInfo fi( exportSettings.customFileName() );
|
||||
if ( !exportSettings.customFileName().isEmpty() )
|
||||
lgrFileName = fi.baseName() + "_LGR_MSW";
|
||||
else
|
||||
lgrFileName =
|
||||
QString( "UnifiedCompletions_LGR_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() );
|
||||
|
||||
QString lgrFileName = fileName + "_LGR";
|
||||
unifiedLgrExportFile =
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, lgrFileName );
|
||||
unifiedLgrExportFile =
|
||||
RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, lgrFileName, fi.suffix() );
|
||||
}
|
||||
}
|
||||
|
||||
for ( const auto& wellPath : wellPaths )
|
||||
|
Loading…
Reference in New Issue
Block a user