(#428) Selecting well log plot in tree view when its viewer is activated

This commit is contained in:
Pål Hagen 2015-09-07 19:22:11 +02:00
parent 613f028779
commit c1d2a32f6e
3 changed files with 43 additions and 0 deletions

View File

@ -30,6 +30,8 @@
#include "RimGeoMechCase.h"
#include "RigGeoMechWellLogExtractor.h"
#include "cvfAssert.h"
CAF_PDM_SOURCE_INIT(RimWellLogPlotCollection, "WellLogPlotCollection");
//--------------------------------------------------------------------------------------------------
@ -102,3 +104,22 @@ RigGeoMechWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor(RimW
return extractor.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RimWellLogPlotCollection::wellLogPlotFromViewer(RiuWellLogPlot* viewer) const
{
CVF_ASSERT(viewer);
for (size_t pIdx = 0; pIdx < wellLogPlots.size(); pIdx++)
{
RimWellLogPlot* wellLogPlot = wellLogPlots[pIdx];
if (wellLogPlot->viewer() == viewer)
{
return wellLogPlot;
}
}
return NULL;
}

View File

@ -30,6 +30,8 @@ class RigGeoMechWellLogExtractor;
class RimGeoMechCase;
class RimWellPath;
class RimEclipseCase;
class RiuWellLogPlot;
//==================================================================================================
///
///
@ -44,6 +46,8 @@ public:
RigEclipseWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase);
RigGeoMechWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimGeoMechCase* eclCase);
RimWellLogPlot* wellLogPlotFromViewer(RiuWellLogPlot* viewer) const;
caf::PdmChildArrayField<RimWellLogPlot*> wellLogPlots;
private:
cvf::Collection<RigEclipseWellLogExtractor> m_extractors;

View File

@ -52,6 +52,8 @@
#include "RimWellPathCollection.h"
#include "RimWellPathImport.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RiuMultiCaseImportDialog.h"
#include "RiuProcessMonitor.h"
@ -1354,6 +1356,22 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
if (!proj) return;
if (!subWindow) return;
RiuWellLogPlot* wellLogPlotViewer = dynamic_cast<RiuWellLogPlot*>(subWindow->widget());
if (wellLogPlotViewer)
{
RimMainPlotCollection* mainPlotColl = proj->mainPlotCollection();
RimWellLogPlotCollection* wellPlotColl = mainPlotColl ? mainPlotColl->wellLogPlotCollection() : NULL;
if (wellPlotColl)
{
RimWellLogPlot* wellLogPlot = wellPlotColl->wellLogPlotFromViewer(wellLogPlotViewer);
if (wellLogPlot)
{
projectTreeView()->selectAsCurrentItem(wellLogPlot);
return;
}
}
}
// Iterate all cases in each oil field
std::vector<RimCase*> allCases;
proj->allCases(allCases);