mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3325 Well Path export. Command file command for exporting well paths
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user