mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3304 Implement common data source changing for zonation and well path attributes
This commit is contained in:
@@ -24,9 +24,13 @@
|
|||||||
#include "RimWellLogCurve.h"
|
#include "RimWellLogCurve.h"
|
||||||
#include "RimWellLogCurveCommonDataSource.h"
|
#include "RimWellLogCurveCommonDataSource.h"
|
||||||
#include "RimWellLogExtractionCurve.h"
|
#include "RimWellLogExtractionCurve.h"
|
||||||
|
#include "RimWellLogFileCurve.h"
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
#include "RimWellLogTrack.h"
|
||||||
#include "RimWellPath.h"
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
#include "cafPdmUiPropertyViewDialog.h"
|
#include "cafPdmUiPropertyViewDialog.h"
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
@@ -42,9 +46,10 @@ bool RicChangeDataSourceFeature::isCommandEnabled()
|
|||||||
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
|
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
|
||||||
if (RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()) return false;
|
if (RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()) return false;
|
||||||
|
|
||||||
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
|
std::vector<RimWellLogCurve*> curves;
|
||||||
|
std::vector<RimWellLogTrack*> tracks;
|
||||||
|
|
||||||
return curves.size() > 0;
|
return selectedTracksAndCurves(&curves, &tracks);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -52,20 +57,24 @@ bool RicChangeDataSourceFeature::isCommandEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicChangeDataSourceFeature::onActionTriggered(bool isChecked)
|
void RicChangeDataSourceFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return;
|
std::vector<caf::PdmObject*> selectedObjects;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectedObjects);
|
||||||
|
|
||||||
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
|
std::vector<RimWellLogCurve*> curves;
|
||||||
if (curves.size() == 0) return;
|
std::vector<RimWellLogTrack*> tracks;
|
||||||
|
|
||||||
RimWellLogCurveCommonDataSource featureUi;
|
if (selectedTracksAndCurves(&curves, &tracks))
|
||||||
featureUi.updateDefaultOptions(curves);
|
|
||||||
|
|
||||||
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Change Data Source for Multiple Curves", "");
|
|
||||||
propertyDialog.resize(QSize(500, 200));
|
|
||||||
|
|
||||||
if (propertyDialog.exec() == QDialog::Accepted)
|
|
||||||
{
|
{
|
||||||
featureUi.updateCurves(curves);
|
RimWellLogCurveCommonDataSource featureUi;
|
||||||
|
featureUi.updateDefaultOptions(curves, tracks);
|
||||||
|
|
||||||
|
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Change Data Source for Multiple Curves", "");
|
||||||
|
propertyDialog.resize(QSize(500, 200));
|
||||||
|
|
||||||
|
if (propertyDialog.exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
featureUi.updateCurvesAndTracks(curves, tracks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,3 +86,36 @@ void RicChangeDataSourceFeature::setupActionLook(QAction* actionToSetup)
|
|||||||
actionToSetup->setText("Change Data Source");
|
actionToSetup->setText("Change Data Source");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicChangeDataSourceFeature::selectedTracksAndCurves(std::vector<RimWellLogCurve*>* curves, std::vector<RimWellLogTrack*>* tracks)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(curves && tracks);
|
||||||
|
std::vector<caf::PdmObject*> selectedObjects;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectedObjects);
|
||||||
|
|
||||||
|
if (selectedObjects.empty()) return false;
|
||||||
|
|
||||||
|
for (caf::PdmObject* selectedObject : selectedObjects)
|
||||||
|
{
|
||||||
|
RimWellLogTrack* wellLogTrack = dynamic_cast<RimWellLogTrack*>(selectedObject);
|
||||||
|
RimWellLogExtractionCurve* wellLogExtractionCurve = dynamic_cast<RimWellLogExtractionCurve*>(selectedObject);
|
||||||
|
RimWellLogFileCurve* wellLogFileCurve = dynamic_cast<RimWellLogFileCurve*>(selectedObject);
|
||||||
|
if (wellLogTrack)
|
||||||
|
{
|
||||||
|
tracks->push_back(wellLogTrack);
|
||||||
|
}
|
||||||
|
else if (wellLogExtractionCurve)
|
||||||
|
{
|
||||||
|
curves->push_back(wellLogExtractionCurve);
|
||||||
|
}
|
||||||
|
else if (wellLogFileCurve)
|
||||||
|
{
|
||||||
|
curves->push_back(wellLogFileCurve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selectedObjects.size() == (curves->size() + tracks->size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class RimWellLogCurve;
|
class RimWellLogCurve;
|
||||||
|
class RimWellLogTrack;
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -34,4 +34,7 @@ protected:
|
|||||||
virtual bool isCommandEnabled() override;
|
virtual bool isCommandEnabled() override;
|
||||||
virtual void onActionTriggered( bool isChecked ) override;
|
virtual void onActionTriggered( bool isChecked ) override;
|
||||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool selectedTracksAndCurves(std::vector<RimWellLogCurve*>* curves, std::vector<RimWellLogTrack*>* tracks);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "RimWellLogFileCurve.h"
|
#include "RimWellLogFileCurve.h"
|
||||||
#include "RimWellLogPlot.h"
|
#include "RimWellLogPlot.h"
|
||||||
#include "RimWellLogPlotCollection.h"
|
#include "RimWellLogPlotCollection.h"
|
||||||
|
#include "RimWellLogTrack.h"
|
||||||
#include "RimWellPath.h"
|
#include "RimWellPath.h"
|
||||||
#include "RimWellPathCollection.h"
|
#include "RimWellPathCollection.h"
|
||||||
|
|
||||||
@@ -193,7 +194,7 @@ void RimWellLogCurveCommonDataSource::resetDefaultOptions()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogCurveCommonDataSource::updateDefaultOptions(const std::vector<RimWellLogCurve*>& curves)
|
void RimWellLogCurveCommonDataSource::updateDefaultOptions(const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks)
|
||||||
{
|
{
|
||||||
// Reset all options in the UI
|
// Reset all options in the UI
|
||||||
resetDefaultOptions();
|
resetDefaultOptions();
|
||||||
@@ -226,6 +227,13 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions(const std::vector<Rim
|
|||||||
uniqueWellNames.insert(fileCurve->wellName());
|
uniqueWellNames.insert(fileCurve->wellName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (RimWellLogTrack* track : tracks)
|
||||||
|
{
|
||||||
|
uniqueTrajectoryTypes.insert(static_cast<int>(RimWellLogExtractionCurve::WELL_PATH));
|
||||||
|
uniqueWellPaths.insert(track->wellPathAttributeSource());
|
||||||
|
uniqueCases.insert(track->formationNamesCase());
|
||||||
|
uniqueWellPaths.insert(track->formationWellPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (uniqueCases.size() == 1u)
|
if (uniqueCases.size() == 1u)
|
||||||
@@ -273,14 +281,18 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions()
|
|||||||
{
|
{
|
||||||
std::vector<RimWellLogCurve*> curves;
|
std::vector<RimWellLogCurve*> curves;
|
||||||
parentPlot->descendantsIncludingThisOfType(curves);
|
parentPlot->descendantsIncludingThisOfType(curves);
|
||||||
this->updateDefaultOptions(curves);
|
|
||||||
|
std::vector<RimWellLogTrack*> tracks;
|
||||||
|
parentPlot->descendantsIncludingThisOfType(tracks);
|
||||||
|
|
||||||
|
this->updateDefaultOptions(curves, tracks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogCurveCommonDataSource::updateCurves(std::vector<RimWellLogCurve*>& curves)
|
void RimWellLogCurveCommonDataSource::updateCurvesAndTracks(std::vector<RimWellLogCurve*>& curves, std::vector<RimWellLogTrack*>& tracks)
|
||||||
{
|
{
|
||||||
std::set<RimWellLogPlot*> plots;
|
std::set<RimWellLogPlot*> plots;
|
||||||
for (RimWellLogCurve* curve : curves)
|
for (RimWellLogCurve* curve : curves)
|
||||||
@@ -359,12 +371,55 @@ void RimWellLogCurveCommonDataSource::updateCurves(std::vector<RimWellLogCurve*>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (RimWellLogTrack* track : tracks)
|
||||||
|
{
|
||||||
|
bool updatedSomething = false;
|
||||||
|
if (caseToApply() != nullptr)
|
||||||
|
{
|
||||||
|
track->setFormationCase(caseToApply());
|
||||||
|
updatedSomething = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wellPathToApply() != nullptr)
|
||||||
|
{
|
||||||
|
track->setWellPathAttributesSource(wellPathToApply());
|
||||||
|
track->setFormationWellPath(wellPathToApply());
|
||||||
|
updatedSomething = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updatedSomething)
|
||||||
|
{
|
||||||
|
RimWellLogPlot* parentPlot = nullptr;
|
||||||
|
track->firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||||
|
plots.insert(parentPlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (RimWellLogPlot* plot : plots)
|
for (RimWellLogPlot* plot : plots)
|
||||||
{
|
{
|
||||||
plot->loadDataAndUpdate();
|
plot->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::updateCurvesAndTracks()
|
||||||
|
{
|
||||||
|
RimWellLogPlot* parentPlot = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(parentPlot);
|
||||||
|
if (parentPlot)
|
||||||
|
{
|
||||||
|
std::vector<RimWellLogCurve*> curves;
|
||||||
|
parentPlot->descendantsIncludingThisOfType(curves);
|
||||||
|
|
||||||
|
std::vector<RimWellLogTrack*> tracks;
|
||||||
|
parentPlot->descendantsIncludingThisOfType(tracks);
|
||||||
|
|
||||||
|
this->updateCurvesAndTracks(curves, tracks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -445,13 +500,7 @@ void RimWellLogCurveCommonDataSource::fieldChangedByUi(const caf::PdmFieldHandle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parentPlot)
|
this->updateCurvesAndTracks();
|
||||||
{
|
|
||||||
std::vector<RimWellLogCurve*> wellLogCurves;
|
|
||||||
parentPlot->descendantsIncludingThisOfType(wellLogCurves);
|
|
||||||
this->updateCurves(wellLogCurves);
|
|
||||||
parentPlot->updateConnectedEditors();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -461,14 +510,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogCurveCommonDataSource::calculateValueOpt
|
|||||||
{
|
{
|
||||||
QList<caf::PdmOptionItemInfo> options;
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
|
||||||
RimWellLogPlot* parentPlot = nullptr;
|
this->updateDefaultOptions();
|
||||||
this->firstAncestorOrThisOfType(parentPlot);
|
|
||||||
if (parentPlot)
|
|
||||||
{
|
|
||||||
std::vector<RimWellLogCurve*> wellLogCurves;
|
|
||||||
parentPlot->descendantsIncludingThisOfType(wellLogCurves);
|
|
||||||
this->updateDefaultOptions(wellLogCurves);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fieldNeedingOptions == &m_case)
|
if (fieldNeedingOptions == &m_case)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
class RimCase;
|
class RimCase;
|
||||||
class RimWellLogCurve;
|
class RimWellLogCurve;
|
||||||
class RimWellLogPlot;
|
class RimWellLogPlot;
|
||||||
|
class RimWellLogTrack;
|
||||||
class RimWellPath;
|
class RimWellPath;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -57,10 +58,10 @@ public:
|
|||||||
void setTimeStepToApply(int val);
|
void setTimeStepToApply(int val);
|
||||||
|
|
||||||
void resetDefaultOptions();
|
void resetDefaultOptions();
|
||||||
void updateDefaultOptions(const std::vector<RimWellLogCurve*>& curves);
|
void updateDefaultOptions(const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks);
|
||||||
void updateDefaultOptions();
|
void updateDefaultOptions();
|
||||||
void updateCurves(std::vector<RimWellLogCurve*>& curves);
|
void updateCurvesAndTracks(std::vector<RimWellLogCurve*>& curves, std::vector<RimWellLogTrack*>& tracks);
|
||||||
|
void updateCurvesAndTracks();
|
||||||
void applyPrevCase();
|
void applyPrevCase();
|
||||||
void applyNextCase();
|
void applyNextCase();
|
||||||
|
|
||||||
|
|||||||
@@ -844,6 +844,14 @@ void RimWellLogTrack::setFormationWellPath(RimWellPath* wellPath)
|
|||||||
m_formationWellPathForSourceCase = wellPath;
|
m_formationWellPathForSourceCase = wellPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimWellPath* RimWellLogTrack::formationWellPath() const
|
||||||
|
{
|
||||||
|
return m_formationWellPathForSourceCase;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1106,6 +1114,14 @@ void RimWellLogTrack::setShowFormations(bool on)
|
|||||||
m_showFormations = on;
|
m_showFormations = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimWellLogTrack::showFormations() const
|
||||||
|
{
|
||||||
|
return m_showFormations;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1122,6 +1138,14 @@ void RimWellLogTrack::setShowWellPathAttributes(bool on)
|
|||||||
m_showWellPathAttributes = on;
|
m_showWellPathAttributes = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimWellLogTrack::showWellPathAttributes() const
|
||||||
|
{
|
||||||
|
return m_showWellPathAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1131,6 +1155,14 @@ void RimWellLogTrack::setWellPathAttributesSource(RimWellPath* wellPath)
|
|||||||
updateWellPathAttributesCollection();
|
updateWellPathAttributesCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimWellPath* RimWellLogTrack::wellPathAttributeSource() const
|
||||||
|
{
|
||||||
|
return m_wellPathAttributeSource;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public:
|
|||||||
void setWidthScaleFactor(WidthScaleFactor scaleFactor);
|
void setWidthScaleFactor(WidthScaleFactor scaleFactor);
|
||||||
|
|
||||||
void setFormationWellPath(RimWellPath* wellPath);
|
void setFormationWellPath(RimWellPath* wellPath);
|
||||||
|
RimWellPath* formationWellPath() const;
|
||||||
void setFormationSimWellName(const QString& simWellName);
|
void setFormationSimWellName(const QString& simWellName);
|
||||||
void setFormationBranchIndex(int branchIndex);
|
void setFormationBranchIndex(int branchIndex);
|
||||||
void setFormationCase(RimCase* rimCase);
|
void setFormationCase(RimCase* rimCase);
|
||||||
@@ -116,15 +117,18 @@ public:
|
|||||||
void setTickIntervals(double majorTickInterval, double minorTickInterval);
|
void setTickIntervals(double majorTickInterval, double minorTickInterval);
|
||||||
void setXAxisGridVisibility(RimWellLogPlot::AxisGridVisibility gridLines);
|
void setXAxisGridVisibility(RimWellLogPlot::AxisGridVisibility gridLines);
|
||||||
void setShowFormations(bool on);
|
void setShowFormations(bool on);
|
||||||
|
bool showFormations() const;
|
||||||
void setShowFormationLabels(bool on);
|
void setShowFormationLabels(bool on);
|
||||||
void setShowWellPathAttributes(bool on);
|
void setShowWellPathAttributes(bool on);
|
||||||
|
bool showWellPathAttributes() const;
|
||||||
void setWellPathAttributesSource(RimWellPath* wellPath);
|
void setWellPathAttributesSource(RimWellPath* wellPath);
|
||||||
|
|
||||||
|
RimWellPath* wellPathAttributeSource() const;
|
||||||
RiuWellLogTrack* viewer();
|
RiuWellLogTrack* viewer();
|
||||||
|
|
||||||
RimWellLogCurve* curveDefinitionFromCurve(const QwtPlotCurve* curve) const;
|
RimWellLogCurve* curveDefinitionFromCurve(const QwtPlotCurve* curve) const;
|
||||||
|
|
||||||
void setLogarithmicScale(bool enable);
|
void setLogarithmicScale(bool enable);
|
||||||
|
|
||||||
std::map<int, std::vector<RimWellFlowRateCurve*>> visibleStackedCurves();
|
std::map<int, std::vector<RimWellFlowRateCurve*>> visibleStackedCurves();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user