mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-23 06:18:13 -06:00
#15061: Add new ensemble well log plot command and default to EGRID in create dialog
This commit is contained in:
1 parent
a4dfebff58
commit
be03f23b61
4 files changed
+185
-11
No files matched your search
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "RicCreateEnsembleWellLogFeature.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
#include "RiaLogging.h"
|
||||
@@ -32,13 +31,13 @@
|
||||
#include "RicImportGeneralDataFeature.h"
|
||||
#include "RicRecursiveFileSearchDialog.h"
|
||||
#include "RifReaderSettings.h"
|
||||
#include "WellLogCommands/RicNewEnsembleWellLogPlotFeature.h"
|
||||
#include "WellPathCommands/RicImportWellPaths.h"
|
||||
|
||||
#include "RigLasFileExporter.h"
|
||||
|
||||
#include "RimDialogData.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEnsembleWellLogCurveSet.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
@@ -60,6 +59,7 @@
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QIcon>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -83,8 +83,9 @@ void RicCreateEnsembleWellLogFeature::openDialogAndExecuteCommand()
|
||||
defaultDir,
|
||||
pathFilter,
|
||||
fileNameFilter,
|
||||
{ RicRecursiveFileSearchDialog::FileType::GRDECL,
|
||||
RicRecursiveFileSearchDialog::FileType::EGRID } );
|
||||
{ RicRecursiveFileSearchDialog::FileType::EGRID,
|
||||
RicRecursiveFileSearchDialog::FileType::GRDECL },
|
||||
true );
|
||||
if ( !result.ok || result.files.isEmpty() )
|
||||
{
|
||||
return;
|
||||
@@ -238,16 +239,10 @@ void RicCreateEnsembleWellLogFeature::executeCommand( const RicCreateEnsembleWel
|
||||
for ( const auto& property : properties )
|
||||
{
|
||||
// Create well log track
|
||||
cvf::Color3f color = RiaColorTables::normalPaletteColors().cycledColor3f( trackNum );
|
||||
QString title = QString( "Track %1" ).arg( trackNum );
|
||||
RimWellLogTrack* wellLogTrack =
|
||||
RimcWellLogPlot_newWellLogTrack::createWellLogTrack( wellLogPlot, eclipseCase, wellPath, title );
|
||||
auto* ensembleWellLogCurveSet = new RimEnsembleWellLogCurveSet();
|
||||
ensembleWellLogCurveSet->setEnsembleWellLogs( ensembleWellLog );
|
||||
ensembleWellLogCurveSet->setColor( color );
|
||||
ensembleWellLogCurveSet->setWellLogChannelName( property.first );
|
||||
wellLogTrack->setEnsembleWellLogCurveSet( ensembleWellLogCurveSet );
|
||||
ensembleWellLogCurveSet->loadDataAndUpdate( true );
|
||||
RicNewEnsembleWellLogPlotFeature::addEnsembleCurveSetToTrack( wellLogTrack, ensembleWellLog, property.first, trackNum );
|
||||
trackNum++;
|
||||
}
|
||||
|
||||
@@ -302,4 +297,5 @@ void RicCreateEnsembleWellLogFeature::onActionTriggered( bool isChecked )
|
||||
void RicCreateEnsembleWellLogFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Create Ensemble Well Log..." );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogFile.svg" ) );
|
||||
}
|
||||
@@ -27,6 +27,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellBoreStabilityPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellMeasurementCurveFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleWellLogCurveSetFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleWellLogPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPhaseRftSegmentPlotFeature.cpp
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewEnsembleWellLogPlotFeature.h"
|
||||
|
||||
#include "RicNewWellLogPlotFeatureImpl.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
#include "RimEnsembleWellLogCurveSet.h"
|
||||
#include "RimEnsembleWellLogs.h"
|
||||
#include "RimWellLogChannel.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
#include <set>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewEnsembleWellLogPlotFeature, "RicNewEnsembleWellLogPlotFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleWellLogCurveSet* RicNewEnsembleWellLogPlotFeature::addEnsembleCurveSetToTrack( RimWellLogTrack* track,
|
||||
RimEnsembleWellLogs* ensembleWellLogs,
|
||||
const QString& channelName,
|
||||
int colorIndex )
|
||||
{
|
||||
auto* curveSet = new RimEnsembleWellLogCurveSet();
|
||||
curveSet->setEnsembleWellLogs( ensembleWellLogs );
|
||||
curveSet->setColor( RiaColorTables::normalPaletteColors().cycledColor3f( colorIndex ) );
|
||||
if ( !channelName.isEmpty() ) curveSet->setWellLogChannelName( channelName );
|
||||
track->setEnsembleWellLogCurveSet( curveSet );
|
||||
if ( !channelName.isEmpty() ) curveSet->loadDataAndUpdate( true );
|
||||
|
||||
return curveSet;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewEnsembleWellLogPlotFeature::isCommandEnabled() const
|
||||
{
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEnsembleWellLogs>() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewEnsembleWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto* ensembleWellLogs = caf::SelectionManager::instance()->selectedItemOfType<RimEnsembleWellLogs>();
|
||||
if ( !ensembleWellLogs ) return;
|
||||
|
||||
// Collect available channels (alphabetically, as in the channel list), excluding depth channels
|
||||
const QStringList depthChannels = { "DEPT", "DEPTH", "MD", "MDEPTH", "TVDMSL", "TVDRKB", RiaResultNames::indexKResultName().toUpper() };
|
||||
std::set<QString> channelNames;
|
||||
for ( auto* wellLogFile : ensembleWellLogs->wellLogFiles() )
|
||||
{
|
||||
for ( auto* channel : wellLogFile->wellLogChannels() )
|
||||
{
|
||||
if ( !depthChannels.contains( channel->name().toUpper() ) ) channelNames.insert( channel->name() );
|
||||
}
|
||||
}
|
||||
|
||||
RimDepthTrackPlot* plot = nullptr;
|
||||
RimEnsembleWellLogCurveSet* firstCurveSet = nullptr;
|
||||
int trackIndex = 0;
|
||||
for ( const QString& channelName : channelNames )
|
||||
{
|
||||
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( true, channelName, plot );
|
||||
plot = plotTrack->firstAncestorOrThisOfType<RimDepthTrackPlot>();
|
||||
if ( trackIndex == 0 )
|
||||
{
|
||||
// The automatic plot name is built from well/case data and is empty without a well path
|
||||
plot->nameConfig()->setCustomName( ensembleWellLogs->name() );
|
||||
plot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
}
|
||||
|
||||
auto* curveSet = addEnsembleCurveSetToTrack( plotTrack, ensembleWellLogs, channelName, trackIndex );
|
||||
if ( !firstCurveSet ) firstCurveSet = curveSet;
|
||||
trackIndex++;
|
||||
}
|
||||
|
||||
if ( !plot )
|
||||
{
|
||||
// No channels found: create an empty track with a curve set the user can configure
|
||||
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
||||
plot = plotTrack->firstAncestorOrThisOfType<RimDepthTrackPlot>();
|
||||
|
||||
firstCurveSet = addEnsembleCurveSetToTrack( plotTrack, ensembleWellLogs, QString(), 0 );
|
||||
}
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
if ( auto* wellLogPlot = dynamic_cast<RimWellLogPlot*>( plot ) ) wellLogPlot->zoomAll();
|
||||
|
||||
RiuPlotMainWindowTools::onObjectAppended( firstCurveSet );
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewEnsembleWellLogPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Well Log Plot" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimEnsembleWellLogCurveSet;
|
||||
class RimEnsembleWellLogs;
|
||||
class RimWellLogTrack;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewEnsembleWellLogPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
// Add a curve set for the given channel to the track. The color is picked from the default palette by colorIndex.
|
||||
// The curve set is left unconfigured and not loaded if channelName is empty.
|
||||
static RimEnsembleWellLogCurveSet*
|
||||
addEnsembleCurveSetToTrack( RimWellLogTrack* track, RimEnsembleWellLogs* ensembleWellLogs, const QString& channelName, int colorIndex );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
Reference in new issue
Block a user