diff --git a/ApplicationCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp index 32aadf5f3e..2422e2e7f3 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp @@ -68,6 +68,12 @@ void RicExportToLasFileFeature::onActionTriggered( bool isChecked ) RicExportToLasFileResampleUi featureUi; featureUi.exportFolder = defaultDir; + if ( RicWellLogPlotCurveFeatureImpl::parentWellBoreStabilityPlot() ) + { + featureUi.filePrefix = "WBS_"; + featureUi.capitalizeFileName = true; + } + { std::vector wellNames; std::vector rkbDiffs; @@ -101,7 +107,7 @@ void RicExportToLasFileFeature::onActionTriggered( bool isChecked ) lasExporter.setRkbDiffs( wellNames, userDefRkbDiff ); } - lasExporter.writeToFolder( featureUi.exportFolder() ); + lasExporter.writeToFolder( featureUi.exportFolder(), featureUi.filePrefix(), featureUi.capitalizeFileName() ); // Remember the path to next time RiaApplication::instance()->setLastUsedDialogDirectory( "WELL_LOGS_DIR", featureUi.exportFolder() ); diff --git a/ApplicationCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp b/ApplicationCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp index 5bfa2c09fe..2616bf95ab 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp @@ -47,6 +47,8 @@ RicExportToLasFileResampleUi::RicExportToLasFileResampleUi( void ) CAF_PDM_InitField( &exportFolder, "ExportFolder", QString(), "Export Folder", "", "", "" ); exportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); + CAF_PDM_InitField( &filePrefix, "FilePrefix", QString( "" ), "File Prefix", "", "", "" ); + CAF_PDM_InitField( &capitalizeFileName, "CapitalizeFileName", false, "Capitalize File Name", "", "", "" ); CAF_PDM_InitField( &activateResample, "ActivateResample", false, "Resample Curve Data", "", "", "" ); activateResample.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); @@ -168,7 +170,8 @@ void RicExportToLasFileResampleUi::updateFieldVisibility() void RicExportToLasFileResampleUi::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { uiOrdering.add( &exportFolder ); - + uiOrdering.add( &filePrefix ); + uiOrdering.add( &capitalizeFileName ); { caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Resampling" ); diff --git a/ApplicationCode/Commands/ExportCommands/RicExportToLasFileResampleUi.h b/ApplicationCode/Commands/ExportCommands/RicExportToLasFileResampleUi.h index 86219a2675..b77b9bffea 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportToLasFileResampleUi.h +++ b/ApplicationCode/Commands/ExportCommands/RicExportToLasFileResampleUi.h @@ -47,6 +47,8 @@ public: ~RicExportToLasFileResampleUi() override; caf::PdmField exportFolder; + caf::PdmField filePrefix; + caf::PdmField capitalizeFileName; caf::PdmField activateResample; caf::PdmField resampleInterval; diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.cpp index 786fe6d53c..58334d94c4 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.cpp @@ -22,6 +22,7 @@ #include "RiaColorTables.h" #include "RimWellAllocationPlot.h" +#include "RimWellBoreStabilityPlot.h" #include "RimWellLogCurve.h" #include "RimWellRftPlot.h" @@ -102,3 +103,18 @@ RimWellRftPlot* RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() return wellRftPlot; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellBoreStabilityPlot* RicWellLogPlotCurveFeatureImpl::parentWellBoreStabilityPlot() +{ + caf::PdmObjectHandle* destinationObject = dynamic_cast( + caf::SelectionManager::instance()->selectedItem() ); + if ( !destinationObject ) return nullptr; + + RimWellBoreStabilityPlot* wbsPlot = nullptr; + destinationObject->firstAncestorOrThisOfType( wbsPlot ); + + return wbsPlot; +} diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.h b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.h index e32229137e..903b96af95 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.h +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.h @@ -21,6 +21,7 @@ #include "cafPdmFieldCvfColor.h" +class RimWellBoreStabilityPlot; class RimWellLogCurve; class RimWellAllocationPlot; class RimWellRftPlot; @@ -35,4 +36,5 @@ public: static std::vector selectedWellLogCurves(); static RimWellAllocationPlot* parentWellAllocationPlot(); static RimWellRftPlot* parentWellRftPlot(); + static RimWellBoreStabilityPlot* parentWellBoreStabilityPlot(); }; diff --git a/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp b/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp index 99682f2c8f..4ea206be85 100644 --- a/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp +++ b/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp @@ -374,7 +374,9 @@ void RigLasFileExporter::setRkbDiffs( const std::vector& wellNames, con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RigLasFileExporter::writeToFolder( const QString& exportFolder ) +bool RigLasFileExporter::writeToFolder( const QString& exportFolder, + const QString& filePrefix /*= ""*/, + bool capitalizeFileName /*= false*/ ) { std::vector lasFileDescriptions = createLasFileDescriptions( m_curves ); @@ -392,10 +394,15 @@ bool RigLasFileExporter::writeToFolder( const QString& exportFolder ) } QDir dir( exportFolder ); - QString fileName = dir.absoluteFilePath( QString::fromStdString( lasFileDescr.generateFilename() ) ); - if ( caf::Utils::fileExists( fileName ) ) + QString fileName = filePrefix + QString::fromStdString( lasFileDescr.generateFilename() ); + if ( capitalizeFileName ) { - QString txt = QString( "File %1 exists.\n\nDo you want to overwrite the file?" ).arg( fileName ); + fileName = fileName.toUpper(); + } + QString fullPathName = dir.absoluteFilePath( fileName ); + if ( caf::Utils::fileExists( fullPathName ) ) + { + QString txt = QString( "File %1 exists.\n\nDo you want to overwrite the file?" ).arg( fullPathName ); int ret = QMessageBox::question( nullptr, "LAS File Export", txt, @@ -406,7 +413,7 @@ bool RigLasFileExporter::writeToFolder( const QString& exportFolder ) } std::vector commentHeader; - lasFile.WriteToFile( fileName.toStdString(), commentHeader ); + lasFile.WriteToFile( fullPathName.toStdString(), commentHeader ); } return true; diff --git a/ApplicationCode/ReservoirDataModel/RigLasFileExporter.h b/ApplicationCode/ReservoirDataModel/RigLasFileExporter.h index 2293be732a..a5b4be6e2e 100644 --- a/ApplicationCode/ReservoirDataModel/RigLasFileExporter.h +++ b/ApplicationCode/ReservoirDataModel/RigLasFileExporter.h @@ -38,7 +38,7 @@ public: void wellPathsAndRkbDiff( std::vector* wellNames, std::vector* rkbDiffs ); void setRkbDiffs( const std::vector& wellNames, const std::vector& rkbDiffs ); - bool writeToFolder( const QString& exportFolder ); + bool writeToFolder( const QString& exportFolder, const QString& filePrefix = "", bool capitalizeFileName = false ); private: std::vector createLasFileDescriptions( const std::vector& curves );