#1174 Create TOF property filter with selected tracer

This commit is contained in:
Magne Sjaastad 2017-02-13 15:00:49 +01:00
parent 07dc89bceb
commit 73053b0bb7
3 changed files with 66 additions and 7 deletions

View File

@ -22,11 +22,15 @@
#include "RimDefines.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimWellAllocationPlot.h"
#include "RiuMainWindow.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFeature");
@ -76,6 +80,27 @@ void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
}
}
// Disable all existing property filters, and
// create a new property filter based on TOF for current well
RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection();
for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
{
f->isActive = false;
}
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
propertyFilter->resultDefinition()->setEclipseCase(activeView->eclipseCase());
propertyFilter->resultDefinition()->setTofAndSelectTracer(wellAllocationPlot->wellName());
propertyFilter->resultDefinition()->updateResultNameHasChanged();
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
activeView->scheduleCreateDisplayModelAndRedraw();
}
}

View File

@ -250,6 +250,43 @@ void RimEclipseResultDefinition::updateAnyFieldHasChanged()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::setTofAndSelectTracer(const QString& tracerName)
{
setResultType(RimDefines::FLOW_DIAGNOSTICS);
setResultVariable("TOF");
m_flowTracerSelectionMode = FLOW_TR_BY_SELECTION;
std::vector<QString> tracers;
tracers.push_back(tracerName);
setSelectedTracers(tracers);
if (m_flowSolution() == nullptr)
{
assignFlowSolutionFromCase();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::assignFlowSolutionFromCase()
{
RimEclipseResultCase* eclCase = nullptr;
this->firstAncestorOrThisOfType(eclCase);
if (eclCase)
{
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
if (flowSols.size() > 0)
{
this->setFlowSolution(flowSols[0]);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -891,13 +928,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
if ( m_flowSolution() == nullptr )
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
if ( eclCase )
{
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
if (flowSols.size()){ this->setFlowSolution(flowSols[0]); }
}
assignFlowSolutionFromCase();
}
}
uiOrdering.add(&m_resultVariableUiField);

View File

@ -87,6 +87,8 @@ public:
void updateResultNameHasChanged();
void updateAnyFieldHasChanged();
void setTofAndSelectTracer(const QString& tracerName);
protected:
virtual void updateLegendCategorySettings() {};
@ -123,6 +125,7 @@ protected:
private:
void setFlowSolution(RimFlowDiagSolution* flowSol);
void setSelectedTracers(const std::vector<QString>& selectedTracers);
void assignFlowSolutionFromCase();
bool hasDualPorFractureResult();