mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3184 Enable creation of plots within plot window.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogFile.h"
|
||||
@@ -43,9 +44,10 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMath.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDateTime>
|
||||
@@ -60,12 +62,6 @@ CAF_CMD_SOURCE_INIT(RicNewWellBoreStabilityPlotFeature, "RicNewWellBoreStability
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewWellBoreStabilityPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimWellPath* selectedWellPath = RicWellLogTools::findWellPathFromSelection();
|
||||
if (!selectedWellPath)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
|
||||
if (!view) return false;
|
||||
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view);
|
||||
@@ -77,8 +73,27 @@ bool RicNewWellBoreStabilityPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellBoreStabilityPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellPath* selectedWellPath = RicWellLogTools::findWellPathFromSelection();
|
||||
if (!selectedWellPath) return;
|
||||
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
|
||||
RimWellLogPlotCollection* plotCollection = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogPlotCollection>();
|
||||
if (!wellPath)
|
||||
{
|
||||
if (plotCollection)
|
||||
{
|
||||
RimProject* project = nullptr;
|
||||
plotCollection->firstAncestorOrThisOfTypeAsserted(project);
|
||||
std::vector<RimWellPath*> allWellPaths;
|
||||
project->descendantsIncludingThisOfType(allWellPaths);
|
||||
if (!allWellPaths.empty())
|
||||
{
|
||||
wellPath = allWellPaths.front();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!wellPath)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
|
||||
if (!view) return;
|
||||
@@ -93,13 +108,13 @@ void RicNewWellBoreStabilityPlotFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
QString plotName("Well Bore Stability");
|
||||
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot(false, plotName);
|
||||
createFormationTrack(plot, selectedWellPath, geoMechCase);
|
||||
createFormationTrack(plot, wellPath, geoMechCase);
|
||||
progInfo.incrementProgressAndUpdateNextStep(3, "Creating casing shoe size track");
|
||||
createCasingShoeTrack(plot, selectedWellPath, geoMechCase);
|
||||
createCasingShoeTrack(plot, wellPath, geoMechCase);
|
||||
progInfo.incrementProgressAndUpdateNextStep(75, "Creating stability curves track");
|
||||
createStabilityCurvesTrack(plot, selectedWellPath, geoMechView);
|
||||
createStabilityCurvesTrack(plot, wellPath, geoMechView);
|
||||
progInfo.incrementProgressAndUpdateNextStep(15, "Creating angles track");
|
||||
createAnglesTrack(plot, selectedWellPath, geoMechView);
|
||||
createAnglesTrack(plot, wellPath, geoMechView);
|
||||
progInfo.incrementProgressAndUpdateNextStep(5, "Updating all tracks");
|
||||
plot->enableAllAutoNameTags(true);
|
||||
plot->setPlotTitleVisible(true);
|
||||
@@ -151,27 +166,18 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack(RimWellLogPlot* p
|
||||
casingShoeTrack->setShowFormations(true);
|
||||
casingShoeTrack->setShowFormationLabels(false);
|
||||
casingShoeTrack->setVisibleXRange(0.0, 0.0);
|
||||
std::vector<RimWellLogFile*> wellLogFiles = wellPath->wellLogFiles();
|
||||
for (RimWellLogFile* logFile : wellLogFiles)
|
||||
{
|
||||
std::vector<RimWellLogFileChannel*> channels = logFile->wellLogChannels();
|
||||
for (RimWellLogFileChannel* channel : channels)
|
||||
{
|
||||
if (channel->name() == "CASING_SIZE")
|
||||
{
|
||||
RimWellLogFile* foundLogFile = wellPath->firstWellLogFileMatchingChannelName("CASING_SIZE");
|
||||
|
||||
// foundLogFile may be nullptr. Create the curve anyway so it exists when changing well.
|
||||
RimWellLogFileCurve* fileCurve = RicWellLogTools::addFileCurve(casingShoeTrack, false);
|
||||
fileCurve->setWellLogFile(logFile);
|
||||
fileCurve->setWellLogFile(foundLogFile);
|
||||
fileCurve->setWellPath(wellPath);
|
||||
fileCurve->setWellLogChannelName(channel->name());
|
||||
fileCurve->setWellLogChannelName("CASING_SIZE");
|
||||
fileCurve->setCustomName(QString("Casing size [in]"));
|
||||
fileCurve->setLineThickness(2);
|
||||
fileCurve->loadDataAndUpdate(false);
|
||||
casingShoeTrack->setAutoScaleXEnabled(true);
|
||||
casingShoeTrack->calculateXZoomRangeAndUpdateQwt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -64,10 +64,7 @@ void RicPasteWellLogTrackFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return;
|
||||
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
||||
|
||||
RimWellLogPlot* wellLogPlot = nullptr;
|
||||
destinationObject->firstAncestorOrThisOfType(wellLogPlot);
|
||||
RimWellLogPlot* wellLogPlot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogPlot>();
|
||||
if (!wellLogPlot)
|
||||
{
|
||||
return;
|
||||
|
@@ -430,6 +430,8 @@ size_t RigFemPartGrid::cellIndexFromIJK(size_t i, size_t j, size_t k) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigFemPartGrid::ijkFromCellIndex(size_t cellIndex, size_t* i, size_t* j, size_t* k) const
|
||||
{
|
||||
if (cellIndex < m_ijkPrElement.size())
|
||||
{
|
||||
int signed_i = m_ijkPrElement[cellIndex][0];
|
||||
int signed_j = m_ijkPrElement[cellIndex][1];
|
||||
int signed_k = m_ijkPrElement[cellIndex][2];
|
||||
@@ -441,7 +443,7 @@ bool RigFemPartGrid::ijkFromCellIndex(size_t cellIndex, size_t* i, size_t* j, si
|
||||
*k = signed_k;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -373,6 +373,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicPasteWellLogPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewWellLogPlotFeature";
|
||||
menuBuilder << "RicNewWellBoreStabilityPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimRftPlotCollection*>(uiItem))
|
||||
{
|
||||
|
@@ -24,7 +24,9 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogFileCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
@@ -225,8 +227,24 @@ void RimWellLogCurveCommonDataSource::updateCurves(std::vector<RimWellLogCurve*>
|
||||
std::set<RimWellLogPlot*> plots;
|
||||
for (RimWellLogCurve* curve : curves)
|
||||
{
|
||||
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>(curve);
|
||||
RimWellLogExtractionCurve* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>(curve);
|
||||
if (extractionCurve)
|
||||
if (fileCurve)
|
||||
{
|
||||
if (wellPathToApply() != nullptr)
|
||||
{
|
||||
fileCurve->setWellPath(wellPathToApply());
|
||||
if (!fileCurve->wellLogChannelName().isEmpty())
|
||||
{
|
||||
RimWellLogFile* logFile = wellPathToApply()->firstWellLogFileMatchingChannelName(fileCurve->wellLogChannelName());
|
||||
fileCurve->setWellLogFile(logFile);
|
||||
RimWellLogPlot* parentPlot = nullptr;
|
||||
fileCurve->firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||
plots.insert(parentPlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (extractionCurve)
|
||||
{
|
||||
bool updatedSomething = false;
|
||||
if (caseToApply() != nullptr)
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellPathAttributeCollection.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
@@ -377,6 +378,27 @@ std::vector<RimWellLogFile*> RimWellPath::wellLogFiles() const
|
||||
{
|
||||
return std::vector<RimWellLogFile*>(m_wellLogFiles.begin(), m_wellLogFiles.end());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogFile* RimWellPath::firstWellLogFileMatchingChannelName(const QString& channelName) const
|
||||
{
|
||||
std::vector<RimWellLogFile*> allWellLogFiles = wellLogFiles();
|
||||
for (RimWellLogFile* logFile : allWellLogFiles)
|
||||
{
|
||||
std::vector<RimWellLogFileChannel*> channels = logFile->wellLogChannels();
|
||||
for (RimWellLogFileChannel* channel : channels)
|
||||
{
|
||||
if (channel->name() == channelName)
|
||||
{
|
||||
return logFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -90,6 +90,7 @@ public:
|
||||
void deleteWellLogFile(RimWellLogFile* logFileInfo);
|
||||
void detachWellLogFile(RimWellLogFile* logFileInfo);
|
||||
std::vector<RimWellLogFile*> wellLogFiles() const;
|
||||
RimWellLogFile* firstWellLogFileMatchingChannelName(const QString& channelName) const;
|
||||
|
||||
void setFormationsGeometry(cvf::ref<RigWellPathFormations> wellPathFormations);
|
||||
bool readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
|
||||
|
Reference in New Issue
Block a user