#3325 Well Path export. Command file command for exporting well paths

This commit is contained in:
Bjørn Erik Jensen
2018-09-25 09:09:13 +02:00
parent f61b82dd35
commit c422ffc6ed
10 changed files with 142 additions and 26 deletions

View File

@@ -83,6 +83,13 @@ void RicExportSelectedWellPathsFeature::exportWellPath(const RimWellPath* wellPa
QFilePtr RicExportSelectedWellPathsFeature::openFileForExport(const QString& folderName, const QString& fileName)
{
QDir exportFolder = QDir(folderName);
if (!exportFolder.exists())
{
bool createdPath = exportFolder.mkpath(".");
if (createdPath)
RiaLogging::info("Created export folder " + folderName);
}
QString filePath = exportFolder.filePath(fileName);
QFilePtr exportFile(new QFile(filePath));
if (!exportFile->open(QIODevice::WriteOnly))

View File

@@ -55,7 +55,7 @@ void RicExportVisibleWellPathsFeature::exportWellPath(const RimWellPath* wellPat
double endMd = geom->measureDepths().back();
auto fileName = wellPath->name() + ".dev";
auto filePtr = openFileForExport(folder, fileName);
auto filePtr = RicExportSelectedWellPathsFeature::openFileForExport(folder, fileName);
QTextStream stream(filePtr.get());
stream.setRealNumberNotation(QTextStream::FixedNotation);
@@ -76,22 +76,6 @@ void RicExportVisibleWellPathsFeature::exportWellPath(const RimWellPath* wellPat
filePtr->close();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QFilePtr RicExportVisibleWellPathsFeature::openFileForExport(const QString& folderName, const QString& fileName)
{
QDir exportFolder = QDir(folderName);
QString filePath = exportFolder.filePath(fileName);
QFilePtr exportFile(new QFile(filePath));
if (!exportFile->open(QIODevice::WriteOnly))
{
auto errorMessage = QString("Export Well Path: Could not open the file: %1").arg(filePath);
RiaLogging::error(errorMessage);
}
return exportFile;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -40,7 +40,6 @@ class RicExportVisibleWellPathsFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;
void exportWellPath(const RimWellPath* wellPath, double mdStepSize, const QString& folder);
QFilePtr openFileForExport(const QString& folderName, const QString& fileName);
private:
bool isCommandEnabled() override;