mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7324 Export well path: Remove problematic characters in file name
This commit is contained in:
parent
4666c45f66
commit
b93be2f73b
@ -36,13 +36,12 @@
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <cafUtils.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicExportSelectedWellPathsFeature, "RicExportSelectedWellPathsFeature" );
|
||||
@ -55,9 +54,11 @@ void RicExportSelectedWellPathsFeature::exportWellPath( gsl::not_null<const RimW
|
||||
const QString& folder,
|
||||
bool writeProjectInfo )
|
||||
{
|
||||
auto fileName = wellPath->name() + ".dev";
|
||||
auto filePtr = openFileForExport( folder, fileName );
|
||||
auto stream = createOutputFileStream( *filePtr );
|
||||
auto fileName = caf::Utils::makeValidFileBasename( wellPath->name() );
|
||||
fileName += ".dev";
|
||||
|
||||
auto filePtr = openFileForExport( folder, fileName );
|
||||
auto stream = createOutputFileStream( *filePtr );
|
||||
|
||||
std::vector<double> xValues;
|
||||
std::vector<double> yValues;
|
||||
@ -69,6 +70,8 @@ void RicExportSelectedWellPathsFeature::exportWellPath( gsl::not_null<const RimW
|
||||
|
||||
writeWellPathGeometryToStream( *stream, wellPath->name(), xValues, yValues, tvdValues, mdValues, useMdRkb, writeProjectInfo );
|
||||
filePtr->close();
|
||||
|
||||
RiaLogging::info( QString( "Exported well geometry to %1" ).arg( filePtr->fileName() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -172,7 +175,7 @@ QTextStreamPtr RicExportSelectedWellPathsFeature::createOutputFileStream( QFile&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportSelectedWellPathsFeature::handleAction( const std::vector<RimWellPath*>& wellPaths )
|
||||
void RicExportSelectedWellPathsFeature::exportWellPathsToFile( const std::vector<RimWellPath*>& wellPaths )
|
||||
{
|
||||
if ( !wellPaths.empty() )
|
||||
{
|
||||
@ -211,7 +214,7 @@ void RicExportSelectedWellPathsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = caf::selectedObjectsByTypeStrict<RimWellPath*>();
|
||||
|
||||
handleAction( wellPaths );
|
||||
exportWellPathsToFile( wellPaths );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -45,7 +45,7 @@ class RicExportSelectedWellPathsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
static void handleAction( const std::vector<RimWellPath*>& wellPaths );
|
||||
static void exportWellPathsToFile( const std::vector<RimWellPath*>& wellPaths );
|
||||
static void exportWellPath( gsl::not_null<const RimWellPath*> wellPath,
|
||||
double mdStepSize,
|
||||
const QString& folder,
|
||||
|
@ -58,7 +58,7 @@ void RicExportVisibleWellPathsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = RicExportCompletionsForVisibleWellPathsFeature::visibleWellPaths();
|
||||
|
||||
RicExportSelectedWellPathsFeature::handleAction( wellPaths );
|
||||
RicExportSelectedWellPathsFeature::exportWellPathsToFile( wellPaths );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user