mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Always use export folder if defined
Rename to m_customFileNameIncludingPath, and split into folder and file name for export object
This commit is contained in:
parent
947185bdcc
commit
6ad42817c6
@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include "cafPdmFieldScriptingCapability.h"
|
#include "cafPdmFieldScriptingCapability.h"
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RicfExportWellPathCompletions, "exportWellPathCompletions" );
|
CAF_PDM_SOURCE_INIT( RicfExportWellPathCompletions, "exportWellPathCompletions" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -81,7 +83,7 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
|||||||
|
|
||||||
CAF_PDM_InitScriptableField( &m_exportDataSourceAsComments, "exportComments", true, "Export Data Source as Comments" );
|
CAF_PDM_InitScriptableField( &m_exportDataSourceAsComments, "exportComments", true, "Export Data Source as Comments" );
|
||||||
CAF_PDM_InitScriptableField( &m_exportWelspec, "exportWelspec", true, "Export WELSPEC keyword" );
|
CAF_PDM_InitScriptableField( &m_exportWelspec, "exportWelspec", true, "Export WELSPEC keyword" );
|
||||||
CAF_PDM_InitScriptableField( &m_customFileName, "customFileName", QString(), "Custom Filename" );
|
CAF_PDM_InitScriptableField( &m_customFileNameIncludingPath, "customFileName", QString(), "Custom Filename" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -121,7 +123,32 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
|||||||
|
|
||||||
exportSettings.setExportDataSourceAsComment( m_exportDataSourceAsComments );
|
exportSettings.setExportDataSourceAsComment( m_exportDataSourceAsComments );
|
||||||
exportSettings.setExportWelspec( m_exportWelspec );
|
exportSettings.setExportWelspec( m_exportWelspec );
|
||||||
exportSettings.setCustomFileName( m_customFileName );
|
|
||||||
|
QString exportFolderPath;
|
||||||
|
if ( m_customFileNameIncludingPath().isEmpty() )
|
||||||
|
{
|
||||||
|
exportFolderPath =
|
||||||
|
RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::ExportType::COMPLETIONS );
|
||||||
|
if ( exportFolderPath.isNull() )
|
||||||
|
{
|
||||||
|
exportFolderPath = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath( "completions" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFileInfo fi( m_customFileNameIncludingPath );
|
||||||
|
auto fileName = fi.fileName();
|
||||||
|
|
||||||
|
exportSettings.setCustomFileName( fileName );
|
||||||
|
|
||||||
|
auto pathCandidate = fi.path();
|
||||||
|
if ( pathCandidate.size() > 2 )
|
||||||
|
{
|
||||||
|
exportFolderPath = pathCandidate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exportSettings.folder = exportFolderPath;
|
||||||
|
|
||||||
{
|
{
|
||||||
auto eclipseCase = TOOLS::caseFromId( m_caseId() );
|
auto eclipseCase = TOOLS::caseFromId( m_caseId() );
|
||||||
@ -134,14 +161,6 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
|||||||
exportSettings.caseToApply = eclipseCase;
|
exportSettings.caseToApply = eclipseCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString exportFolder =
|
|
||||||
RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::ExportType::COMPLETIONS );
|
|
||||||
if ( exportFolder.isNull() )
|
|
||||||
{
|
|
||||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath( "completions" );
|
|
||||||
}
|
|
||||||
exportSettings.folder = exportFolder;
|
|
||||||
|
|
||||||
caf::PdmScriptResponse response;
|
caf::PdmScriptResponse response;
|
||||||
|
|
||||||
std::vector<RimWellPath*> wellPaths;
|
std::vector<RimWellPath*> wellPaths;
|
||||||
|
@ -60,7 +60,10 @@ private:
|
|||||||
caf::PdmField<bool> m_includeFractures;
|
caf::PdmField<bool> m_includeFractures;
|
||||||
caf::PdmField<bool> m_excludeMainBoreForFishbones;
|
caf::PdmField<bool> m_excludeMainBoreForFishbones;
|
||||||
|
|
||||||
caf::PdmField<bool> m_exportDataSourceAsComments;
|
caf::PdmField<bool> m_exportDataSourceAsComments;
|
||||||
caf::PdmField<bool> m_exportWelspec;
|
caf::PdmField<bool> m_exportWelspec;
|
||||||
caf::PdmField<QString> m_customFileName;
|
|
||||||
|
// This text field can contain a file name, optionally including the full path. When the full path is specified,
|
||||||
|
// the path and file name is split in RicfExportWellPathCompletions::execute()
|
||||||
|
caf::PdmField<QString> m_customFileNameIncludingPath;
|
||||||
};
|
};
|
||||||
|
@ -268,22 +268,14 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
|||||||
|
|
||||||
if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::UNIFIED_FILE )
|
if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::UNIFIED_FILE )
|
||||||
{
|
{
|
||||||
QString fileName;
|
QString fileName = exportSettings.customFileName();
|
||||||
QString folderName;
|
if ( fileName.isEmpty() )
|
||||||
if ( exportSettings.customFileName().isEmpty() )
|
|
||||||
{
|
{
|
||||||
fileName = QString( "UnifiedCompletions_%1" ).arg( eclipseCaseName );
|
fileName = QString( "UnifiedCompletions_%1" ).arg( eclipseCaseName );
|
||||||
folderName = exportSettings.folder;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fileName = exportSettings.customFileName();
|
|
||||||
QFileInfo fi( fileName );
|
|
||||||
folderName = fi.absolutePath();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sortAndExportCompletionsToFile( exportSettings.caseToApply,
|
sortAndExportCompletionsToFile( exportSettings.caseToApply,
|
||||||
folderName,
|
exportSettings.folder,
|
||||||
fileName,
|
fileName,
|
||||||
completions,
|
completions,
|
||||||
fractureDataReportItems,
|
fractureDataReportItems,
|
||||||
|
@ -72,22 +72,19 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QString folderName;
|
|
||||||
|
|
||||||
QFileInfo fi( exportSettings.customFileName() );
|
QFileInfo fi( exportSettings.customFileName() );
|
||||||
if ( !exportSettings.customFileName().isEmpty() )
|
if ( !exportSettings.customFileName().isEmpty() )
|
||||||
{
|
{
|
||||||
fileName = fi.baseName() + "_MSW";
|
fileName = fi.baseName() + "_MSW";
|
||||||
folderName = fi.absolutePath();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileName = QString( "UnifiedCompletions_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() );
|
fileName = QString( "UnifiedCompletions_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() );
|
||||||
folderName = exportSettings.folder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unifiedExportFile =
|
unifiedExportFile =
|
||||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName,
|
RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder,
|
||||||
fileName,
|
fileName,
|
||||||
fi.suffix(),
|
fi.suffix(),
|
||||||
exportSettings.exportDataSourceAsComment() );
|
exportSettings.exportDataSourceAsComment() );
|
||||||
@ -95,22 +92,19 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions(
|
|||||||
|
|
||||||
{
|
{
|
||||||
QString lgrFileName;
|
QString lgrFileName;
|
||||||
QString folderName;
|
|
||||||
QFileInfo fi( exportSettings.customFileName() );
|
QFileInfo fi( exportSettings.customFileName() );
|
||||||
if ( !exportSettings.customFileName().isEmpty() )
|
if ( !exportSettings.customFileName().isEmpty() )
|
||||||
{
|
{
|
||||||
lgrFileName = fi.baseName() + "_LGR_MSW";
|
lgrFileName = fi.baseName() + "_LGR_MSW";
|
||||||
folderName = fi.absolutePath();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lgrFileName =
|
lgrFileName =
|
||||||
QString( "UnifiedCompletions_LGR_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() );
|
QString( "UnifiedCompletions_LGR_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() );
|
||||||
folderName = exportSettings.folder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unifiedLgrExportFile =
|
unifiedLgrExportFile =
|
||||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName,
|
RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder,
|
||||||
lgrFileName,
|
lgrFileName,
|
||||||
fi.suffix(),
|
fi.suffix(),
|
||||||
exportSettings.exportDataSourceAsComment() );
|
exportSettings.exportDataSourceAsComment() );
|
||||||
|
Loading…
Reference in New Issue
Block a user