mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4817 #4830 #4832 #4837 #4839 Python commands for WBS creation, well path import and well log file import (#4838)
* Better minimum width for well log tracks * Fix alignment of scrollbar in Well log plots * Better Well Log Plot export * Hide scroll bar before plotting * Better borders * Create plots through Python * #4817 Create WBS plots with Python * Rebase Summary and WellLogPlot on top of a new RimPlot * Also Python: Allow setting folder as a parameter to export_snapshots * #4832 Prepare for well path import command * Well Path import WIP * #4830 #4832 Import well paths and well log files from file using Python. * #4837 Implement import of formation names in Python * Fix debug build issue * Fix RiaLogging build issue * Fix warnings * Yet another RiaLogging.h import added * #4839 Import exporting of las and ascii files from well log plots
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -38,6 +40,73 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicExportToLasFileFeature, "RicExportToLasFileFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString& exportFolder,
|
||||
const QString& exportPrefix,
|
||||
const RimWellLogPlot* plot,
|
||||
bool exportTvdRkb,
|
||||
bool capitalizeFileNames,
|
||||
double resampleInterval )
|
||||
{
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
std::vector<RimWellLogTrack*> tracks = plot->visibleTracks();
|
||||
|
||||
for ( RimWellLogTrack* track : tracks )
|
||||
{
|
||||
std::vector<RimWellLogCurve*> curves = track->visibleCurvesVector();
|
||||
allCurves.insert( allCurves.end(), curves.begin(), curves.end() );
|
||||
}
|
||||
|
||||
std::vector<QString> wellNames;
|
||||
std::vector<double> rkbDiffs;
|
||||
{
|
||||
RigLasFileExporter lasExporter( allCurves );
|
||||
lasExporter.wellPathsAndRkbDiff( &wellNames, &rkbDiffs );
|
||||
|
||||
return exportToLasFiles( exportFolder,
|
||||
exportPrefix,
|
||||
allCurves,
|
||||
wellNames,
|
||||
rkbDiffs,
|
||||
capitalizeFileNames,
|
||||
resampleInterval );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString& exportFolder,
|
||||
const QString& filePrefix,
|
||||
std::vector<RimWellLogCurve*> curves,
|
||||
const std::vector<QString>& wellNames,
|
||||
const std::vector<double>& rkbDiffs,
|
||||
bool capitalizeFileNames,
|
||||
double resampleInterval )
|
||||
{
|
||||
RigLasFileExporter lasExporter( curves );
|
||||
|
||||
std::vector<QString> writtenFiles;
|
||||
|
||||
if ( resampleInterval > 0.0 )
|
||||
{
|
||||
lasExporter.setResamplingInterval( resampleInterval );
|
||||
}
|
||||
|
||||
if ( !rkbDiffs.empty() )
|
||||
{
|
||||
lasExporter.setRkbDiffs( wellNames, rkbDiffs );
|
||||
}
|
||||
|
||||
writtenFiles = lasExporter.writeToFolder( exportFolder, filePrefix, capitalizeFileNames );
|
||||
|
||||
// Remember the path to next time
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory( "WELL_LOGS_DIR", exportFolder );
|
||||
return writtenFiles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -89,28 +158,33 @@ void RicExportToLasFileFeature::onActionTriggered( bool isChecked )
|
||||
RicExportFeatureImpl::configureForExport( propertyDialog.dialogButtonBox() );
|
||||
propertyDialog.resize( QSize( 400, 330 ) );
|
||||
|
||||
std::vector<QString> writtenFiles;
|
||||
|
||||
if ( propertyDialog.exec() == QDialog::Accepted && !featureUi.exportFolder().isEmpty() )
|
||||
{
|
||||
double resampleInterval = 0.0;
|
||||
if ( featureUi.activateResample )
|
||||
{
|
||||
lasExporter.setResamplingInterval( featureUi.resampleInterval() );
|
||||
resampleInterval = featureUi.resampleInterval();
|
||||
}
|
||||
|
||||
std::vector<QString> wellNames;
|
||||
std::vector<double> rkbDiffs;
|
||||
if ( featureUi.exportTvdrkb )
|
||||
{
|
||||
std::vector<QString> wellNames;
|
||||
std::vector<double> rkbDiffs;
|
||||
lasExporter.wellPathsAndRkbDiff( &wellNames, &rkbDiffs );
|
||||
|
||||
std::vector<double> userDefRkbDiff;
|
||||
featureUi.tvdrkbDiffForWellPaths( &userDefRkbDiff );
|
||||
lasExporter.setRkbDiffs( wellNames, userDefRkbDiff );
|
||||
rkbDiffs = userDefRkbDiff;
|
||||
}
|
||||
|
||||
lasExporter.writeToFolder( featureUi.exportFolder(), featureUi.filePrefix(), featureUi.capitalizeFileName() );
|
||||
|
||||
// Remember the path to next time
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory( "WELL_LOGS_DIR", featureUi.exportFolder() );
|
||||
exportToLasFiles( featureUi.exportFolder(),
|
||||
featureUi.filePrefix(),
|
||||
curves,
|
||||
wellNames,
|
||||
rkbDiffs,
|
||||
featureUi.capitalizeFileName,
|
||||
resampleInterval );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,12 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimWellLogCurve;
|
||||
class RimWellLogPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -32,6 +35,22 @@ class RicExportToLasFileFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static std::vector<QString> exportToLasFiles( const QString& exportFolder,
|
||||
const QString& filePrefix,
|
||||
const RimWellLogPlot* plot,
|
||||
bool exportTvdRkb = false,
|
||||
bool capitalizeFileNames = false,
|
||||
double resampleInterval = 0.0 );
|
||||
|
||||
static std::vector<QString> exportToLasFiles( const QString& exportFolder,
|
||||
const QString& filePrefix,
|
||||
std::vector<RimWellLogCurve*> curves,
|
||||
const std::vector<QString>& wellNames = std::vector<QString>(),
|
||||
const std::vector<double>& rkbDiffs = std::vector<double>(),
|
||||
bool capitalizeFileNames = false,
|
||||
double resampleInterval = 0.0 );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
|
||||
@@ -57,7 +57,7 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
|
||||
// Save images in snapshot catalog relative to project directory
|
||||
QString snapshotFolderName = app->createAbsolutePathFromProjectRelativePath( "snapshots" );
|
||||
|
||||
exportSnapshotOfAllPlotsIntoFolder( snapshotFolderName );
|
||||
exportSnapshotOfPlotsIntoFolder( snapshotFolderName );
|
||||
|
||||
QString text = QString( "Exported snapshots to folder : \n%1" ).arg( snapshotFolderName );
|
||||
RiaLogging::info( text );
|
||||
@@ -66,8 +66,9 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( const QString& snapshotFolderName,
|
||||
const QString& prefix )
|
||||
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName,
|
||||
const QString& prefix,
|
||||
int viewId )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
@@ -87,7 +88,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( const
|
||||
|
||||
for ( auto viewWindow : viewWindows )
|
||||
{
|
||||
if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() )
|
||||
if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() && ( viewId == -1 || viewId == viewWindow->id() ) )
|
||||
{
|
||||
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName( viewWindow );
|
||||
if ( !prefix.isEmpty() )
|
||||
|
||||
@@ -32,7 +32,9 @@ class RicSnapshotAllPlotsToFileFeature : public caf::CmdFeature
|
||||
public:
|
||||
static void saveAllPlots();
|
||||
|
||||
static void exportSnapshotOfAllPlotsIntoFolder( const QString& snapshotFolderName, const QString& prefix = "" );
|
||||
static void exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName,
|
||||
const QString& prefix = "",
|
||||
int viewId = -1 );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
@@ -75,6 +75,8 @@ void RicAddStoredFlowCharacteristicsPlotFeature::onActionTriggered( bool isCheck
|
||||
sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( flowCharacteristicsPlot );
|
||||
|
||||
RiaApplication::instance()->project()->assignViewIdToView( flowCharacteristicsPlot );
|
||||
|
||||
flowPlotColl->addFlowCharacteristicsPlotToStoredPlots( flowCharacteristicsPlot );
|
||||
flowCharacteristicsPlot->resolveReferencesRecursively();
|
||||
|
||||
|
||||
@@ -73,6 +73,8 @@ void RicAddStoredWellAllocationPlotFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(
|
||||
sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
RiaApplication::instance()->project()->assignViewIdToView( wellAllocationPlot );
|
||||
CVF_ASSERT( wellAllocationPlot );
|
||||
|
||||
flowPlotColl->addWellAllocPlotToStoredPlots( wellAllocationPlot );
|
||||
|
||||
@@ -169,6 +169,7 @@ RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename ExtractionCurveType>
|
||||
ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack* plotTrack,
|
||||
RimCase* caseToApply,
|
||||
Rim3dView* view,
|
||||
RimWellPath* wellPath,
|
||||
const RimSimWellInView* simWell,
|
||||
@@ -182,28 +183,26 @@ ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
|
||||
curve->setColor( curveColor );
|
||||
|
||||
RimCase* caseToApply = nullptr;
|
||||
RimWellLogPlot* plot = nullptr;
|
||||
RimWellLogPlot* plot = nullptr;
|
||||
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
|
||||
RimWellLogCurveCommonDataSource* commonDataSource = plot->commonDataSource();
|
||||
|
||||
if ( view )
|
||||
if ( !caseToApply )
|
||||
{
|
||||
caseToApply = view->ownerCase();
|
||||
}
|
||||
else if ( commonDataSource->caseToApply() )
|
||||
{
|
||||
caseToApply = commonDataSource->caseToApply();
|
||||
}
|
||||
else if ( plotTrack->formationNamesCase() )
|
||||
{
|
||||
caseToApply = plotTrack->formationNamesCase();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RimCase*> allCases;
|
||||
RiaApplication::instance()->project()->allCases( allCases );
|
||||
if ( !allCases.empty() ) caseToApply = allCases.front();
|
||||
if ( commonDataSource->caseToApply() )
|
||||
{
|
||||
caseToApply = commonDataSource->caseToApply();
|
||||
}
|
||||
else if ( plotTrack->formationNamesCase() )
|
||||
{
|
||||
caseToApply = plotTrack->formationNamesCase();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RimCase*> allCases;
|
||||
RiaApplication::instance()->project()->allCases( allCases );
|
||||
if ( !allCases.empty() ) caseToApply = allCases.front();
|
||||
}
|
||||
}
|
||||
|
||||
QString ownerSimWellName;
|
||||
@@ -267,7 +266,10 @@ ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
|
||||
curve->setCase( caseToApply );
|
||||
}
|
||||
|
||||
curve->setPropertiesFromView( view );
|
||||
if ( view )
|
||||
{
|
||||
curve->setPropertiesFromView( view );
|
||||
}
|
||||
|
||||
plotTrack->addCurve( curve );
|
||||
|
||||
@@ -370,6 +372,7 @@ RimWellLogFileCurve* RicWellLogTools::addFileCurve( RimWellLogTrack* plotTrack,
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogExtractionCurve* RicWellLogTools::addWellLogExtractionCurve( RimWellLogTrack* plotTrack,
|
||||
RimCase* rimCase,
|
||||
Rim3dView* view,
|
||||
RimWellPath* wellPath,
|
||||
const RimSimWellInView* simWell,
|
||||
@@ -378,6 +381,7 @@ RimWellLogExtractionCurve* RicWellLogTools::addWellLogExtractionCurve( RimWellLo
|
||||
bool showPlotWindow /*= true */ )
|
||||
{
|
||||
return addExtractionCurve<RimWellLogExtractionCurve>( plotTrack,
|
||||
rimCase,
|
||||
view,
|
||||
wellPath,
|
||||
simWell,
|
||||
@@ -389,18 +393,19 @@ RimWellLogExtractionCurve* RicWellLogTools::addWellLogExtractionCurve( RimWellLo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogWbsCurve* RicWellLogTools::addWellLogWbsCurve( RimWellLogTrack* plotTrack,
|
||||
Rim3dView* view,
|
||||
RimWellPath* wellPath,
|
||||
const RimSimWellInView* simWell,
|
||||
int branchIndex,
|
||||
bool useBranchDetection,
|
||||
bool showPlotWindow /*= true */ )
|
||||
RimWellLogWbsCurve* RicWellLogTools::addWellLogWbsCurve( RimWellLogTrack* plotTrack,
|
||||
RimCase* rimCase,
|
||||
Rim3dView* view,
|
||||
RimWellPath* wellPath,
|
||||
int branchIndex,
|
||||
bool useBranchDetection,
|
||||
bool showPlotWindow /*= true */ )
|
||||
{
|
||||
return addExtractionCurve<RimWellLogWbsCurve>( plotTrack,
|
||||
rimCase,
|
||||
view,
|
||||
wellPath,
|
||||
simWell,
|
||||
nullptr,
|
||||
branchIndex,
|
||||
useBranchDetection,
|
||||
showPlotWindow );
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimCase;
|
||||
class RimSimWellInView;
|
||||
class Rim3dView;
|
||||
class Rim3dWellLogCurveCollection;
|
||||
@@ -51,23 +52,25 @@ public:
|
||||
static RimWellLogFileCurve* addFileCurve( RimWellLogTrack* plotTrack, bool showPlotWindow = true );
|
||||
|
||||
static RimWellLogExtractionCurve* addWellLogExtractionCurve( RimWellLogTrack* plotTrack,
|
||||
RimCase* rimCase,
|
||||
Rim3dView* view,
|
||||
RimWellPath* wellPath,
|
||||
const RimSimWellInView* simWell,
|
||||
int branchIndex,
|
||||
bool useBranchDetection,
|
||||
bool showPlotWindow = true );
|
||||
static RimWellLogWbsCurve* addWellLogWbsCurve( RimWellLogTrack* plotTrack,
|
||||
Rim3dView* view,
|
||||
RimWellPath* wellPath,
|
||||
const RimSimWellInView* simWell,
|
||||
int branchIndex,
|
||||
bool useBranchDetection,
|
||||
bool showPlotWindow = true );
|
||||
static RimWellLogWbsCurve* addWellLogWbsCurve( RimWellLogTrack* plotTrack,
|
||||
RimCase* rimCase,
|
||||
Rim3dView* view,
|
||||
RimWellPath* wellPath,
|
||||
int branchIndex,
|
||||
bool useBranchDetection,
|
||||
bool showPlotWindow = true );
|
||||
|
||||
private:
|
||||
template <typename ExtractionCurveType>
|
||||
static ExtractionCurveType* addExtractionCurve( RimWellLogTrack* plotTrack,
|
||||
RimCase* rimCase,
|
||||
Rim3dView* view,
|
||||
RimWellPath* wellPath,
|
||||
const RimSimWellInView* simWell,
|
||||
|
||||
@@ -115,7 +115,8 @@ void RicWellPathsImportSsihubFeature::onActionTriggered( bool isChecked )
|
||||
QStringList wellPaths = wellImportwizard.absoluteFilePathsToWellPaths();
|
||||
if ( wellPaths.size() > 0 )
|
||||
{
|
||||
app->addWellPathsToModel( wellPaths );
|
||||
QStringList errorMessages;
|
||||
app->addWellPathsToModel( wellPaths, &errorMessages );
|
||||
app->project()->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,21 @@ void RicAsciiExportWellLogPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
actionToSetup->setIcon( QIcon( ":/Save.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicAsciiExportWellLogPlotFeature::makeValidExportFileName( const RimWellLogPlot* wellLogPlot,
|
||||
const QString& folder,
|
||||
const QString& prefix,
|
||||
bool capitalizeFileName )
|
||||
{
|
||||
QString fileName = folder + "/" + prefix + caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
|
||||
if ( capitalizeFileName ) fileName = fileName.toUpper();
|
||||
|
||||
QDir dir( folder );
|
||||
return dir.absoluteFilePath( fileName );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimWellLogPlot;
|
||||
|
||||
//==================================================================================================
|
||||
@@ -29,11 +31,15 @@ class RicAsciiExportWellLogPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static QString makeValidExportFileName( const RimWellLogPlot* wellLogPlot,
|
||||
const QString& folder,
|
||||
const QString& prefix,
|
||||
bool capitalizeFileName );
|
||||
static bool exportAsciiForWellLogPlot( const QString& fileName, const RimWellLogPlot* wellLogPlot );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
static bool exportAsciiForWellLogPlot( const QString& fileName, const RimWellLogPlot* wellLogPlot );
|
||||
};
|
||||
|
||||
@@ -68,6 +68,8 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
|
||||
QString wellName = selectedWellName();
|
||||
|
||||
RimWellRftPlot* rftPlot = new RimWellRftPlot();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( rftPlot );
|
||||
|
||||
rftPlot->setSimWellOrWellPathName( wellName );
|
||||
|
||||
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
||||
|
||||
@@ -58,6 +58,63 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewWellBoreStabilityPlotFeature, "RicNewWellBoreStabilityPlotFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellBoreStabilityPlot*
|
||||
RicNewWellBoreStabilityPlotFeature::createPlot( RimGeoMechCase* geoMechCase, RimWellPath* wellPath, int timeStep )
|
||||
{
|
||||
caf::ProgressInfo progInfo( 100, "Creating Well Bore Stability Plot" );
|
||||
|
||||
RimWellBoreStabilityPlot* plot = RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( false,
|
||||
"Well Bore Stability" );
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating formation track", 2 );
|
||||
createFormationTrack( plot, wellPath, geoMechCase );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating well design track", 3 );
|
||||
createCasingShoeTrack( plot, wellPath, geoMechCase );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating parameters track", 15 );
|
||||
createParametersTrack( plot, wellPath, geoMechCase, timeStep );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating stability curves track", 60 );
|
||||
createStabilityCurvesTrack( plot, wellPath, geoMechCase, timeStep );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating angles track", 15 );
|
||||
createAnglesTrack( plot, wellPath, geoMechCase, timeStep );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Updating all tracks", 5 );
|
||||
|
||||
plot->enableAllAutoNameTags( true );
|
||||
plot->setPlotTitleVisible( true );
|
||||
plot->setTrackLegendsVisible( true );
|
||||
plot->setTrackLegendsHorizontal( true );
|
||||
plot->setDepthType( RimWellLogPlot::TRUE_VERTICAL_DEPTH );
|
||||
plot->setDepthAutoZoom( true );
|
||||
|
||||
RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot );
|
||||
}
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
|
||||
|
||||
// Make sure the summary plot window is visible
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -103,54 +160,14 @@ void RicNewWellBoreStabilityPlotFeature::onActionTriggered( bool isChecked )
|
||||
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
|
||||
if ( !geoMechView ) return;
|
||||
|
||||
caf::ProgressInfo progInfo( 100, "Creating Well Bore Stability Plot" );
|
||||
|
||||
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||
RimWellBoreStabilityPlot* plot = RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( false,
|
||||
"Well Bore Stability" );
|
||||
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||
|
||||
if ( !geoMechCase )
|
||||
{
|
||||
auto task = progInfo.task( "Creating formation track", 2 );
|
||||
createFormationTrack( plot, wellPath, geoMechCase );
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating well design track", 3 );
|
||||
createCasingShoeTrack( plot, wellPath, geoMechCase );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating parameters track", 15 );
|
||||
createParametersTrack( plot, wellPath, geoMechView );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating stability curves track", 60 );
|
||||
createStabilityCurvesTrack( plot, wellPath, geoMechView );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating angles track", 15 );
|
||||
createAnglesTrack( plot, wellPath, geoMechView );
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Updating all tracks", 5 );
|
||||
|
||||
plot->enableAllAutoNameTags( true );
|
||||
plot->setPlotTitleVisible( true );
|
||||
plot->setTrackLegendsVisible( true );
|
||||
plot->setTrackLegendsHorizontal( true );
|
||||
plot->setDepthType( RimWellLogPlot::TRUE_VERTICAL_DEPTH );
|
||||
plot->setDepthAutoZoom( true );
|
||||
|
||||
RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot );
|
||||
}
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
|
||||
|
||||
// Make sure the summary plot window is visible
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
createPlot( geoMechCase, wellPath, view->currentTimeStep() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -203,7 +220,8 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabilityPlot* plot,
|
||||
RimWellPath* wellPath,
|
||||
RimGeoMechView* geoMechView )
|
||||
RimGeoMechCase* geoMechCase,
|
||||
int timeStep )
|
||||
{
|
||||
RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
|
||||
"WBS Parameters",
|
||||
@@ -213,7 +231,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
|
||||
paramCurvesTrack->setTickIntervals( 0.5, 0.05 );
|
||||
paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
|
||||
paramCurvesTrack->setFormationWellPath( wellPath );
|
||||
paramCurvesTrack->setFormationCase( geoMechView->geoMechCase() );
|
||||
paramCurvesTrack->setFormationCase( geoMechCase );
|
||||
paramCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::CURVE_ANNOTATIONS );
|
||||
paramCurvesTrack->setShowRegionLabels( true );
|
||||
paramCurvesTrack->setVisible( false );
|
||||
@@ -226,14 +244,15 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
|
||||
const QString& resultName = resultNames[i];
|
||||
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
|
||||
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( paramCurvesTrack,
|
||||
geoMechView,
|
||||
geoMechCase,
|
||||
nullptr,
|
||||
wellPath,
|
||||
nullptr,
|
||||
-1,
|
||||
false,
|
||||
false );
|
||||
curve->setGeoMechResultAddress( resAddr );
|
||||
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
|
||||
curve->setCurrentTimeStep( timeStep );
|
||||
curve->setColor( colors[i % colors.size()] );
|
||||
curve->setLineThickness( 2 );
|
||||
curve->loadDataAndUpdate( false );
|
||||
@@ -247,7 +266,8 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot,
|
||||
RimWellPath* wellPath,
|
||||
RimGeoMechView* geoMechView )
|
||||
RimGeoMechCase* geoMechCase,
|
||||
int timeStep )
|
||||
{
|
||||
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
|
||||
"Stability Curves",
|
||||
@@ -257,7 +277,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
|
||||
stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 );
|
||||
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
|
||||
stabilityCurvesTrack->setFormationWellPath( wellPath );
|
||||
stabilityCurvesTrack->setFormationCase( geoMechView->geoMechCase() );
|
||||
stabilityCurvesTrack->setFormationCase( geoMechCase );
|
||||
stabilityCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::NO_ANNOTATIONS );
|
||||
stabilityCurvesTrack->setShowRegionLabels( true );
|
||||
|
||||
@@ -274,14 +294,14 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
|
||||
const QString& resultName = resultNames[i];
|
||||
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
|
||||
RimWellLogWbsCurve* curve = RicWellLogTools::addWellLogWbsCurve( stabilityCurvesTrack,
|
||||
geoMechView,
|
||||
wellPath,
|
||||
geoMechCase,
|
||||
nullptr,
|
||||
wellPath,
|
||||
-1,
|
||||
false,
|
||||
false );
|
||||
curve->setGeoMechResultAddress( resAddr );
|
||||
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
|
||||
curve->setCurrentTimeStep( timeStep );
|
||||
curve->setAutoNameComponents( false, true, false, false, false );
|
||||
curve->setColor( colors[i % colors.size()] );
|
||||
curve->setLineThickness( 2 );
|
||||
@@ -297,7 +317,8 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStabilityPlot* plot,
|
||||
RimWellPath* wellPath,
|
||||
RimGeoMechView* geoMechView )
|
||||
RimGeoMechCase* geoMechCase,
|
||||
int timeStep )
|
||||
{
|
||||
RimWellLogTrack* wellPathAnglesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
|
||||
"Well Path Angles",
|
||||
@@ -315,14 +336,15 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
|
||||
const QString& resultName = resultNames[i];
|
||||
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
|
||||
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( wellPathAnglesTrack,
|
||||
geoMechView,
|
||||
geoMechCase,
|
||||
nullptr,
|
||||
wellPath,
|
||||
nullptr,
|
||||
-1,
|
||||
false,
|
||||
false );
|
||||
curve->setGeoMechResultAddress( resAddr );
|
||||
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
|
||||
curve->setCurrentTimeStep( timeStep );
|
||||
curve->setCustomName( resultName );
|
||||
|
||||
curve->setColor( colors[i % colors.size()] );
|
||||
@@ -349,7 +371,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
|
||||
wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 );
|
||||
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
|
||||
wellPathAnglesTrack->setFormationWellPath( wellPath );
|
||||
wellPathAnglesTrack->setFormationCase( geoMechView->geoMechCase() );
|
||||
wellPathAnglesTrack->setFormationCase( geoMechCase );
|
||||
wellPathAnglesTrack->setAnnotationType( RiuPlotAnnotationTool::NO_ANNOTATIONS );
|
||||
wellPathAnglesTrack->setShowRegionLabels( false );
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ class RicNewWellBoreStabilityPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static RimWellBoreStabilityPlot* createPlot( RimGeoMechCase* geoMechCase, RimWellPath* wellPath, int timeStep );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
@@ -39,9 +42,18 @@ protected:
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
void createFormationTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
|
||||
void createCasingShoeTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
|
||||
void createParametersTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView );
|
||||
void createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView );
|
||||
void createAnglesTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView );
|
||||
static void createFormationTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
|
||||
static void createCasingShoeTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
|
||||
static void createParametersTrack( RimWellBoreStabilityPlot* plot,
|
||||
RimWellPath* wellPath,
|
||||
RimGeoMechCase* geoMechCase,
|
||||
int timeStep );
|
||||
static void createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot,
|
||||
RimWellPath* wellPath,
|
||||
RimGeoMechCase* geoMechCase,
|
||||
int timeStep );
|
||||
static void createAnglesTrack( RimWellBoreStabilityPlot* plot,
|
||||
RimWellPath* wellPath,
|
||||
RimGeoMechCase* geoMechCase,
|
||||
int timeStep );
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
|
||||
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
|
||||
if ( wellLogPlotTrack )
|
||||
{
|
||||
RicWellLogTools::addWellLogExtractionCurve( wellLogPlotTrack, nullptr, nullptr, nullptr, -1, true );
|
||||
RicWellLogTools::addWellLogExtractionCurve( wellLogPlotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -108,12 +108,15 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
|
||||
newWellLogPlotTrack->setFormationBranchDetection( useBranchDetection );
|
||||
}
|
||||
|
||||
RimCase* ownerCase = nullptr;
|
||||
if ( view )
|
||||
{
|
||||
ownerCase = view->ownerCase();
|
||||
newWellLogPlotTrack->setFormationCase( view->ownerCase() );
|
||||
}
|
||||
|
||||
RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addWellLogExtractionCurve( newWellLogPlotTrack,
|
||||
ownerCase,
|
||||
view,
|
||||
wellPath,
|
||||
simWell,
|
||||
|
||||
@@ -53,12 +53,8 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
|
||||
void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
||||
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( plotTrack,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
-1,
|
||||
true );
|
||||
RimWellLogExtractionCurve* curve =
|
||||
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
|
||||
curve->loadDataAndUpdate( true );
|
||||
RimWellLogPlot* plot = nullptr;
|
||||
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
|
||||
|
||||
@@ -53,6 +53,7 @@ RimWellBoreStabilityPlot*
|
||||
|
||||
RimWellBoreStabilityPlot* plot = new RimWellBoreStabilityPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( plot );
|
||||
|
||||
wellLogPlotColl->wellLogPlots().push_back( plot );
|
||||
|
||||
@@ -87,6 +88,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC
|
||||
|
||||
RimWellLogPlot* plot = new RimWellLogPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( plot );
|
||||
|
||||
wellLogPlotColl->wellLogPlots().push_back( plot );
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered( bool isChecked )
|
||||
plotTrack->setDescription( QString( "Track %1" ).arg( wellLogPlot->trackCount() ) );
|
||||
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>( wellLogPlot->viewWidget() );
|
||||
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
|
||||
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
|
||||
|
||||
plotWindow->setWidthOfMdiWindow( viewWidget, viewWidget->preferredWidth() );
|
||||
wellLogPlot->updateConnectedEditors();
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#include "RicWellLogsImportFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
@@ -27,9 +30,38 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicWellLogsImportFileFeature, "RicWellLogsImportFileFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFile*> RicWellLogsImportFileFeature::importWellLogFiles( const QStringList& wellLogFilePaths,
|
||||
QStringList* errorMessages )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "WELL_LOGS_DIR", QFileInfo( wellLogFilePaths.last() ).absolutePath() );
|
||||
|
||||
std::vector<RimWellLogFile*> wellLogFiles = app->addWellLogsToModel( wellLogFilePaths, errorMessages );
|
||||
|
||||
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
|
||||
|
||||
return wellLogFiles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RicWellLogsImportFileFeature::wellLogFileNameFilters()
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << "*.las";
|
||||
return nameFilters;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -44,21 +76,29 @@ bool RicWellLogsImportFileFeature::isCommandEnabled()
|
||||
void RicWellLogsImportFileFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
// Open dialog box to select well path files
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "WELL_LOGS_DIR" );
|
||||
QStringList wellLogFilePaths = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "WELL_LOGS_DIR" );
|
||||
QString nameFilterString = QString( "Well Logs (%1);;All Files (*.*)" ).arg( wellLogFileNameFilters().join( " " ) );
|
||||
QStringList wellLogFilePaths = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Well Logs",
|
||||
defaultDir,
|
||||
"Well Logs (*.las);;All Files (*.*)" );
|
||||
nameFilterString );
|
||||
|
||||
if ( wellLogFilePaths.size() < 1 ) return;
|
||||
if ( wellLogFilePaths.size() >= 1 )
|
||||
{
|
||||
QStringList errorMessages;
|
||||
importWellLogFiles( wellLogFilePaths, &errorMessages );
|
||||
if ( !errorMessages.empty() )
|
||||
{
|
||||
QString displayMessage = "Errors opening the LAS files: \n" + errorMessages.join( "\n" );
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "WELL_LOGS_DIR", QFileInfo( wellLogFilePaths.last() ).absolutePath() );
|
||||
|
||||
app->addWellLogsToModel( wellLogFilePaths );
|
||||
|
||||
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
{
|
||||
QMessageBox::warning( Riu3DMainWindowTools::mainWindowWidget(), "File open error", displayMessage );
|
||||
}
|
||||
RiaLogging::warning( displayMessage );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -21,12 +21,19 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimWellLogFile;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicWellLogsImportFileFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
static std::vector<RimWellLogFile*> importWellLogFiles( const QStringList& wellLogFilePaths,
|
||||
QStringList* errorMessages );
|
||||
static QStringList wellLogFileNameFilters();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "RicWellPathsImportFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
@@ -30,9 +32,56 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicWellPathsImportFileFeature, "RicWellPathsImportFileFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimFileWellPath*> RicWellPathsImportFileFeature::importWellPaths( const QStringList& wellPathFilePaths,
|
||||
QStringList* errorMessages )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );
|
||||
|
||||
std::vector<RimFileWellPath*> wellPaths = app->addWellPathsToModel( wellPathFilePaths, errorMessages );
|
||||
|
||||
RimProject* project = app->project();
|
||||
|
||||
if ( project )
|
||||
{
|
||||
project->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
|
||||
if ( oilField && oilField->wellPathCollection->wellPaths().size() > 0 )
|
||||
{
|
||||
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
|
||||
if ( wellPath )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( wellPath );
|
||||
}
|
||||
}
|
||||
}
|
||||
return wellPaths;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RicWellPathsImportFileFeature::wellPathNameFilters()
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << "*.json"
|
||||
<< "*.asc"
|
||||
<< " *.asci"
|
||||
<< "*.ascii"
|
||||
<< "*.dev";
|
||||
return nameFilters;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -50,35 +99,28 @@ void RicWellPathsImportFileFeature::onActionTriggered( bool isChecked )
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString lastUsedGridFolder = app->lastUsedDialogDirectory( "BINARY_GRID" );
|
||||
QString defaultDir = app->lastUsedDialogDirectoryWithFallback( "WELLPATH_DIR", lastUsedGridFolder );
|
||||
QStringList wellPathFilePaths =
|
||||
QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Well Paths",
|
||||
defaultDir,
|
||||
"Well Paths (*.json *.asc *.asci *.ascii *.dev);;All Files (*.*)" );
|
||||
|
||||
if ( wellPathFilePaths.size() < 1 ) return;
|
||||
QString nameList = QString( "Well Paths (%1);;All Files (*.*)" ).arg( wellPathNameFilters().join( " " ) );
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );
|
||||
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Well Paths",
|
||||
defaultDir,
|
||||
nameList );
|
||||
|
||||
app->addWellPathsToModel( wellPathFilePaths );
|
||||
|
||||
RimProject* project = app->project();
|
||||
|
||||
if ( project )
|
||||
if ( wellPathFilePaths.size() >= 1 )
|
||||
{
|
||||
project->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
QStringList errorMessages;
|
||||
importWellPaths( wellPathFilePaths, &errorMessages );
|
||||
|
||||
if ( !oilField ) return;
|
||||
|
||||
if ( oilField->wellPathCollection->wellPaths().size() > 0 )
|
||||
if ( !errorMessages.empty() )
|
||||
{
|
||||
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
|
||||
if ( wellPath )
|
||||
QString displayMessage = "Errors loading well path files: \n" + errorMessages.join( "\n" );
|
||||
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( wellPath );
|
||||
QMessageBox::warning( Riu3DMainWindowTools::mainWindowWidget(), "File open error", displayMessage );
|
||||
}
|
||||
RiaLogging::warning( displayMessage );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimFileWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -28,6 +32,11 @@ class RicWellPathsImportFileFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static std::vector<RimFileWellPath*> importWellPaths( const QStringList& wellPathFilePaths,
|
||||
QStringList* errorMessages );
|
||||
static QStringList wellPathNameFilters();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
|
||||
Reference in New Issue
Block a user