#3309 Toolbar buttons for well log plot data source and make sure only visible curves and zonation/attributes affect the data source.

* This also required adding some updateConnectedEditors for updating the selected property views when changing the toolbar.
This commit is contained in:
Gaute Lindkvist 2018-09-10 09:55:07 +02:00
parent 742b7aab11
commit 0460eb2ac2
12 changed files with 136 additions and 20 deletions

View File

@ -202,6 +202,8 @@ void RicDeleteItemExec::redo()
{
wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->updateDepthZoom();
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
mainPlotWindow->updateWellLogPlotToolBar();
}
RimWellLogTrack* wellLogPlotTrack;
@ -209,6 +211,8 @@ void RicDeleteItemExec::redo()
if (wellLogPlotTrack)
{
wellLogPlotTrack->calculateXZoomRangeAndUpdateQwt();
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
mainPlotWindow->updateWellLogPlotToolBar();
}
// Update due to delete plots
@ -226,6 +230,8 @@ void RicDeleteItemExec::redo()
project->updateConnectedEditors();
}
}
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
mainPlotWindow->updateWellLogPlotToolBar();
}
// Linked views

View File

@ -27,6 +27,7 @@
#include "RimSummaryCurveFilter.h"
#include "RimSummaryPlot.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuRimQwtPlotCurve.h"
#include "cafPdmUiComboBoxEditor.h"
@ -191,6 +192,7 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
m_qwtPlotCurve->showErrorBars(m_showErrorBars);
updateCurveAppearance();
}
RiuPlotMainWindowTools::refreshToolbars();
if (m_parentQwtPlot) m_parentQwtPlot->replot();
}

View File

@ -209,6 +209,10 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions(const std::vector<Rim
std::set<int> uniqueBranchIndex;
for (RimWellLogCurve* curve : curves)
{
if (!curve->isCurveVisible())
{
continue;
}
RimWellLogExtractionCurve* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>(curve);
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>(curve);
if (extractionCurve)
@ -229,10 +233,16 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions(const std::vector<Rim
}
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 (track->showWellPathAttributes())
{
uniqueTrajectoryTypes.insert(static_cast<int>(RimWellLogExtractionCurve::WELL_PATH));
uniqueWellPaths.insert(track->wellPathAttributeSource());
}
if (track->showFormations())
{
uniqueCases.insert(track->formationNamesCase());
uniqueWellPaths.insert(track->formationWellPath());
}
}
@ -297,6 +307,10 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks(std::vector<RimWellL
std::set<RimWellLogPlot*> plots;
for (RimWellLogCurve* curve : curves)
{
if (!curve->isCurveVisible())
{
continue;
}
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>(curve);
RimWellLogExtractionCurve* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>(curve);
if (fileCurve)
@ -367,6 +381,7 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks(std::vector<RimWellL
RimWellLogPlot* parentPlot = nullptr;
extractionCurve->firstAncestorOrThisOfTypeAsserted(parentPlot);
plots.insert(parentPlot);
curve->updateConnectedEditors();
}
}
}
@ -376,15 +391,25 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks(std::vector<RimWellL
bool updatedSomething = false;
if (caseToApply() != nullptr)
{
track->setFormationCase(caseToApply());
updatedSomething = true;
if (track->showFormations())
{
track->setFormationCase(caseToApply());
updatedSomething = true;
}
}
if (wellPathToApply() != nullptr)
{
track->setWellPathAttributesSource(wellPathToApply());
track->setFormationWellPath(wellPathToApply());
updatedSomething = true;
if (track->showWellPathAttributes())
{
track->setWellPathAttributesSource(wellPathToApply());
updatedSomething = true;
}
if (track->showFormations())
{
track->setFormationWellPath(wellPathToApply());
updatedSomething = true;
}
}
if (updatedSomething)
@ -392,6 +417,7 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks(std::vector<RimWellL
RimWellLogPlot* parentPlot = nullptr;
track->firstAncestorOrThisOfTypeAsserted(parentPlot);
plots.insert(parentPlot);
track->updateConnectedEditors();
}
}
@ -482,6 +508,28 @@ void RimWellLogCurveCommonDataSource::applyNextTimeStep()
modifyCurrentIndex(&m_timeStep, 1);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmFieldHandle *> RimWellLogCurveCommonDataSource::fieldsToShowInToolbar()
{
updateDefaultOptions();
std::vector<caf::PdmFieldHandle*> fieldsToDisplay;
fieldsToDisplay.push_back(&m_case);
if (trajectoryTypeToApply() == RimWellLogExtractionCurve::WELL_PATH)
{
fieldsToDisplay.push_back(&m_wellPath);
}
else if (trajectoryTypeToApply() == RimWellLogExtractionCurve::SIMULATION_WELL)
{
fieldsToDisplay.push_back(&m_simWellName);
}
fieldsToDisplay.push_back(&m_timeStep);
return fieldsToDisplay;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -70,6 +70,7 @@ public:
void applyPrevTimeStep();
void applyNextTimeStep();
std::vector<caf::PdmFieldHandle *> fieldsToShowInToolbar();
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,

View File

@ -56,6 +56,7 @@
#include "RimWellPathCollection.h"
#include "RimWellPlotTools.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuQwtPlotCurve.h"
#include "RiuWellLogTrack.h"

View File

@ -749,6 +749,14 @@ void RimWellLogPlot::handleKeyPressEvent(QKeyEvent* keyEvent)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogCurveCommonDataSource* RimWellLogPlot::commonDataSource() const
{
return m_commonDataSource;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -126,7 +126,7 @@ public:
void updateHolder() override;
void handleKeyPressEvent(QKeyEvent* keyEvent);
RimWellLogCurveCommonDataSource* commonDataSource() const;
protected:
// Overridden PDM methods

View File

@ -58,6 +58,7 @@
#include "RiuMainWindow.h"
#include "RiuPlotAnnotationTool.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuWellLogPlot.h"
#include "RiuWellLogTrack.h"
@ -337,7 +338,8 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
}
}
loadDataAndUpdate();
loadDataAndUpdate(true);
RimWellRftPlot* rftPlot(nullptr);
firstAncestorOrThisOfType(rftPlot);
@ -371,15 +373,15 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
m_formationSimWellName = QString("None");
}
loadDataAndUpdate();
loadDataAndUpdate(true);
}
else if (changedField == &m_formationWellPathForSourceCase)
{
loadDataAndUpdate();
loadDataAndUpdate(true);
}
else if (changedField == &m_formationSimWellName)
{
loadDataAndUpdate();
loadDataAndUpdate(true);
}
else if (changedField == &m_formationTrajectoryType)
{
@ -396,18 +398,18 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
}
}
loadDataAndUpdate();
loadDataAndUpdate(true);
}
else if (changedField == &m_formationBranchIndex ||
changedField == &m_formationBranchDetection)
{
m_formationBranchIndex = RiaSimWellBranchTools::clampBranchIndex(m_formationSimWellName, m_formationBranchIndex, m_formationBranchDetection);
loadDataAndUpdate();
loadDataAndUpdate(true);
}
else if (changedField == &m_formationWellPathForSourceWellPath)
{
loadDataAndUpdate();
loadDataAndUpdate(true);
}
else if (changedField == &m_formationLevel)
{
@ -422,11 +424,15 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
changedField == &m_wellPathAttributesInLegend)
{
updateWellPathAttributesOnPlot();
updateParentPlotLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if (changedField == &m_wellPathAttributeSource)
{
updateWellPathAttributesCollection();
updateWellPathAttributesOnPlot();
updateParentPlotLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
}
@ -709,7 +715,7 @@ void RimWellLogTrack::availableDepthRange(double* minimumDepth, double* maximumD
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::loadDataAndUpdate()
void RimWellLogTrack::loadDataAndUpdate(bool updateParentPlotAndToolbars)
{
RimWellLogPlot* wellLogPlot = nullptr;
firstAncestorOrThisOfType(wellLogPlot);
@ -757,6 +763,12 @@ void RimWellLogTrack::loadDataAndUpdate()
m_xAxisGridVisibility.uiCapability()->setUiReadOnly(emptyRange);
updateAllLegendItems();
if (updateParentPlotAndToolbars)
{
updateParentPlotLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -100,7 +100,7 @@ public:
void detachAllCurves();
void reattachAllCurves();
void loadDataAndUpdate();
void loadDataAndUpdate(bool updateParentPlotAndToolbars = false);
void setAndUpdateWellPathFormationNamesData(RimCase* rimCase, RimWellPath* wellPath);

View File

@ -27,6 +27,7 @@
#include "RimSummaryPlot.h"
#include "RimViewWindow.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogPlot.h"
#include "RiuDragDrop.h"
@ -114,6 +115,7 @@ void RiuPlotMainWindow::cleanupGuiBeforeProjectClose()
cleanUpTemporaryWidgets();
m_wellLogPlotToolBarEditor->clear();
m_summaryPlotToolBarEditor->clear();
setWindowTitle("Plots - ResInsight");
@ -317,6 +319,9 @@ void RiuPlotMainWindow::createToolBars()
}
}
m_wellLogPlotToolBarEditor = new caf::PdmUiToolBarEditor("Well Log Plot", this);
m_wellLogPlotToolBarEditor->hide();
m_summaryPlotToolBarEditor = new caf::PdmUiToolBarEditor("Summary Plot", this);
m_summaryPlotToolBarEditor->hide();
}
@ -461,6 +466,32 @@ void RiuPlotMainWindow::addToTemporaryWidgets(QWidget* widget)
m_temporaryWidgets.push_back(widget);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateWellLogPlotToolBar()
{
RimWellLogPlot* wellLogPlot = dynamic_cast<RimWellLogPlot*>(m_activePlotViewWindow.p());
if (wellLogPlot)
{
std::vector<caf::PdmFieldHandle*> toolBarFields;
toolBarFields = wellLogPlot->commonDataSource()->fieldsToShowInToolbar();
m_wellLogPlotToolBarEditor->setFields(toolBarFields);
m_wellLogPlotToolBarEditor->updateUi();
m_wellLogPlotToolBarEditor->show();
}
else
{
m_wellLogPlotToolBarEditor->clear();
m_wellLogPlotToolBarEditor->hide();
}
refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -603,6 +634,7 @@ void RiuPlotMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
m_activePlotViewWindow = viewWindow;
}
updateWellLogPlotToolBar();
updateSummaryPlotToolBar();
}

View File

@ -80,6 +80,7 @@ public:
void setWidthOfMdiWindow(QWidget* mdiWindowWidget, int newWidth);
void addToTemporaryWidgets(QWidget* widget);
void updateWellLogPlotToolBar();
void updateSummaryPlotToolBar();
protected:
@ -117,6 +118,7 @@ private:
QMenu* m_windowMenu;
caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor;
caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor;
std::unique_ptr<caf::PdmUiDragDropInterface> m_dragDropInterface;

View File

@ -65,7 +65,11 @@ void RiuPlotMainWindowTools::refreshToolbars()
{
RiuPlotMainWindow* mpw = RiaApplication::instance()->mainPlotWindow();
if (mpw) mpw->updateSummaryPlotToolBar();
if (mpw)
{
mpw->updateSummaryPlotToolBar();
mpw->updateWellLogPlotToolBar();
}
}