mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2901 RFT Plot : Whitespace cleanup
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
#include "RigSimWellData.h"
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "RimWellPlotTools.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
@@ -47,6 +46,7 @@
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
|
||||
#include "RiuWellRftPlot.h"
|
||||
@@ -84,8 +84,13 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellPathNameOrSimWellName, "WellName", "Well Name", "", "", "");
|
||||
CAF_PDM_InitField(&m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", "");
|
||||
CAF_PDM_InitField(&m_branchDetection, "BranchDetection", true, "Branch Detection", "",
|
||||
"Compute branches based on how simulation well cells are organized", "");
|
||||
CAF_PDM_InitField(&m_branchDetection,
|
||||
"BranchDetection",
|
||||
true,
|
||||
"Branch Detection",
|
||||
"",
|
||||
"Compute branches based on how simulation well cells are organized",
|
||||
"");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedSources, "Sources", "Sources", "", "", "");
|
||||
m_selectedSources.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
||||
@@ -136,15 +141,12 @@ void RimWellRftPlot::applyCurveAppearance(RimWellLogCurve* newCurve)
|
||||
std::vector<cvf::Color3f> colorTable;
|
||||
RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector(&colorTable);
|
||||
|
||||
std::vector<RimPlotCurve::PointSymbolEnum> symbolTable =
|
||||
{
|
||||
RimPlotCurve::SYMBOL_ELLIPSE,
|
||||
std::vector<RimPlotCurve::PointSymbolEnum> symbolTable = {RimPlotCurve::SYMBOL_ELLIPSE,
|
||||
RimPlotCurve::SYMBOL_RECT,
|
||||
RimPlotCurve::SYMBOL_DIAMOND,
|
||||
RimPlotCurve::SYMBOL_TRIANGLE,
|
||||
RimPlotCurve::SYMBOL_CROSS,
|
||||
RimPlotCurve::SYMBOL_XCROSS
|
||||
};
|
||||
RimPlotCurve::SYMBOL_XCROSS};
|
||||
|
||||
// State variables
|
||||
static size_t defaultColorTableIndex = 0;
|
||||
@@ -194,9 +196,7 @@ void RimWellRftPlot::applyCurveAppearance(RimWellLogCurve* newCurve)
|
||||
if (!isCurrentColorSet)
|
||||
{
|
||||
currentColor = colorTable[defaultColorTableIndex];
|
||||
if (++defaultColorTableIndex == colorTable.size())
|
||||
defaultColorTableIndex = 0;
|
||||
|
||||
if (++defaultColorTableIndex == colorTable.size()) defaultColorTableIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,21 +215,19 @@ void RimWellRftPlot::applyCurveAppearance(RimWellLogCurve* newCurve)
|
||||
if (!isCurrentSymbolSet)
|
||||
{
|
||||
currentSymbol = symbolTable[defaultSymbolTableIndex];
|
||||
if (++defaultSymbolTableIndex == symbolTable.size())
|
||||
defaultSymbolTableIndex = 0;
|
||||
if (++defaultSymbolTableIndex == symbolTable.size()) defaultSymbolTableIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Observed data
|
||||
currentLineStyle = newCurveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED
|
||||
? RimPlotCurve::STYLE_NONE : RimPlotCurve::STYLE_SOLID;
|
||||
currentLineStyle = newCurveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED ? RimPlotCurve::STYLE_NONE
|
||||
: RimPlotCurve::STYLE_SOLID;
|
||||
|
||||
newCurve->setColor(currentColor);
|
||||
newCurve->setSymbol(currentSymbol);
|
||||
newCurve->setLineStyle(currentLineStyle);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -260,7 +258,8 @@ void RimWellRftPlot::updateFormationsOnPlot() const
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wellLogPlot->trackByIndex(0)->setAndUpdateSimWellFormationNamesAndBranchData(formationNamesCase, associatedSimWellName(), m_branchIndex, m_branchDetection);
|
||||
m_wellLogPlot->trackByIndex(0)->setAndUpdateSimWellFormationNamesAndBranchData(
|
||||
formationNamesCase, associatedSimWellName(), m_branchIndex, m_branchDetection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,8 +316,7 @@ void RimWellRftPlot::applyInitialSelections()
|
||||
{
|
||||
timeStepsToSelect.insert(timeStep);
|
||||
}
|
||||
if (gridTimeSteps.size() > 0)
|
||||
timeStepsToSelect.insert(*gridTimeSteps.begin());
|
||||
if (gridTimeSteps.size() > 0) timeStepsToSelect.insert(*gridTimeSteps.begin());
|
||||
|
||||
m_selectedTimeSteps = std::vector<QDateTime>(timeStepsToSelect.begin(), timeStepsToSelect.end());
|
||||
|
||||
@@ -341,17 +339,14 @@ void RimWellRftPlot::updateEditorsFromCurves()
|
||||
else
|
||||
selectedSources.insert(curveDef.address());
|
||||
|
||||
auto newTimeStepMap = std::map<QDateTime, std::set<RifDataSourceForRftPlt>>
|
||||
{
|
||||
{ curveDef.timeStep(), std::set<RifDataSourceForRftPlt> { curveDef.address()} }
|
||||
};
|
||||
auto newTimeStepMap = std::map<QDateTime, std::set<RifDataSourceForRftPlt>>{
|
||||
{curveDef.timeStep(), std::set<RifDataSourceForRftPlt>{curveDef.address()}}};
|
||||
RimWellPlotTools::addTimeStepsToMap(selectedTimeStepsMap, newTimeStepMap);
|
||||
selectedTimeSteps.insert(curveDef.timeStep());
|
||||
}
|
||||
|
||||
m_selectedSources = std::vector<RifDataSourceForRftPlt>(selectedSources.begin(), selectedSources.end());
|
||||
m_selectedTimeSteps = std::vector<QDateTime>(selectedTimeSteps.begin(), selectedTimeSteps.end());
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -392,8 +387,10 @@ void RimWellRftPlot::syncCurvesFromUiSelection()
|
||||
// Determine which curves to delete from plot
|
||||
std::set<RiaRftPltCurveDefinition> deleteCurveDefs;
|
||||
|
||||
std::set_difference(curveDefsInPlot.begin(), curveDefsInPlot.end(),
|
||||
allCurveDefs.begin(), allCurveDefs.end(),
|
||||
std::set_difference(curveDefsInPlot.begin(),
|
||||
curveDefsInPlot.end(),
|
||||
allCurveDefs.begin(),
|
||||
allCurveDefs.end(),
|
||||
std::inserter(deleteCurveDefs, deleteCurveDefs.end()));
|
||||
|
||||
for (RimWellLogCurve* const curve : plotTrack->curvesVector())
|
||||
@@ -408,8 +405,10 @@ void RimWellRftPlot::syncCurvesFromUiSelection()
|
||||
else
|
||||
{
|
||||
// Determine which curves are new since last time
|
||||
std::set_difference(allCurveDefs.begin(), allCurveDefs.end(),
|
||||
curveDefsInPlot.begin(), curveDefsInPlot.end(),
|
||||
std::set_difference(allCurveDefs.begin(),
|
||||
allCurveDefs.end(),
|
||||
curveDefsInPlot.begin(),
|
||||
curveDefsInPlot.end(),
|
||||
std::inserter(newCurveDefs, newCurveDefs.end()));
|
||||
}
|
||||
|
||||
@@ -421,10 +420,8 @@ void RimWellRftPlot::syncCurvesFromUiSelection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RiaRftPltCurveDefinition> RimWellRftPlot::selectedCurveDefs() const
|
||||
{
|
||||
return RimWellPlotTools::curveDefsFromTimesteps(associatedSimWellName(),
|
||||
m_selectedTimeSteps.v(),
|
||||
true,
|
||||
selectedSourcesExpanded());
|
||||
return RimWellPlotTools::curveDefsFromTimesteps(
|
||||
associatedSimWellName(), m_selectedTimeSteps.v(), true, selectedSourcesExpanded());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -492,11 +489,16 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
|
||||
|
||||
// Time step
|
||||
|
||||
std::vector<QDateTime> timeSteps = gridCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates();
|
||||
std::vector<QDateTime> timeSteps =
|
||||
gridCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates();
|
||||
int currentTimeStepIndex = -1;
|
||||
for (size_t tsIdx = 0; tsIdx < timeSteps.size(); ++tsIdx)
|
||||
{
|
||||
if (timeSteps[tsIdx] == curveDefToAdd.timeStep()){ currentTimeStepIndex = static_cast<int>(tsIdx); break;}
|
||||
if (timeSteps[tsIdx] == curveDefToAdd.timeStep())
|
||||
{
|
||||
currentTimeStepIndex = static_cast<int>(tsIdx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
curve->setCurrentTimeStep(currentTimeStepIndex);
|
||||
@@ -513,6 +515,7 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
|
||||
{
|
||||
RimWellLogFileChannel* pressureChannel = RimWellPlotTools::getPressureChannelFromWellFile(wellLogFile);
|
||||
auto curve = new RimWellLogFileCurve();
|
||||
|
||||
plotTrack->addCurve(curve);
|
||||
curve->setWellPath(wellPath);
|
||||
curve->setWellLogFile(wellLogFile);
|
||||
@@ -531,7 +534,6 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -542,7 +544,8 @@ std::vector<RifDataSourceForRftPlt> RimWellRftPlot::selectedSourcesExpanded() co
|
||||
{
|
||||
if (addr.sourceType() == RifDataSourceForRftPlt::OBSERVED)
|
||||
{
|
||||
for (RimWellLogFile* const wellLogFile : RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName))
|
||||
for (RimWellLogFile* const wellLogFile :
|
||||
RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName))
|
||||
{
|
||||
sources.push_back(RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED, wellLogFile));
|
||||
}
|
||||
@@ -616,7 +619,8 @@ const char* RimWellRftPlot::plotNameFormatString()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
@@ -631,7 +635,8 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::P
|
||||
const std::vector<RimEclipseResultCase*> rftCases = RimWellPlotTools::rftCasesForWell(simWellName);
|
||||
if (rftCases.size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::RFT), true));
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(
|
||||
RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::RFT), true));
|
||||
}
|
||||
for (const auto& rftCase : rftCases)
|
||||
{
|
||||
@@ -644,7 +649,8 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::P
|
||||
const std::vector<RimEclipseResultCase*> gridCases = RimWellPlotTools::gridCasesForWell(simWellName);
|
||||
if (gridCases.size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::GRID), true));
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(
|
||||
RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::GRID), true));
|
||||
}
|
||||
for (const auto& gridCase : gridCases)
|
||||
{
|
||||
@@ -656,7 +662,8 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::P
|
||||
|
||||
if (RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName).size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::OBSERVED), true));
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(
|
||||
RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::OBSERVED), true));
|
||||
|
||||
auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED);
|
||||
auto item = caf::PdmOptionItemInfo("Observed Data", QVariant::fromValue(addr));
|
||||
@@ -666,10 +673,8 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::P
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_selectedTimeSteps)
|
||||
{
|
||||
RimWellPlotTools::calculateValueOptionsForTimeSteps( associatedSimWellName(),
|
||||
selectedSourcesExpanded(),
|
||||
{ RifEclipseRftAddress::PRESSURE },
|
||||
options);
|
||||
RimWellPlotTools::calculateValueOptionsForTimeSteps(
|
||||
associatedSimWellName(), selectedSourcesExpanded(), {RifEclipseRftAddress::PRESSURE}, options);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_branchIndex)
|
||||
{
|
||||
@@ -706,18 +711,15 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
updateEditorsFromCurves();
|
||||
updateFormationsOnPlot();
|
||||
}
|
||||
else if (changedField == &m_branchIndex ||
|
||||
changedField == &m_branchDetection)
|
||||
else if (changedField == &m_branchIndex || changedField == &m_branchDetection)
|
||||
{
|
||||
const QString simWellName = associatedSimWellName();
|
||||
m_branchIndex = RiaSimWellBranchTools::clampBranchIndex(simWellName, m_branchIndex, m_branchDetection);
|
||||
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
|
||||
}
|
||||
else if (changedField == &m_selectedSources ||
|
||||
changedField == &m_selectedTimeSteps)
|
||||
else if (changedField == &m_selectedSources || changedField == &m_selectedTimeSteps)
|
||||
{
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
@@ -767,10 +769,8 @@ void RimWellRftPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
uiOrdering.add(&m_userName);
|
||||
uiOrdering.add(&m_wellPathNameOrSimWellName);
|
||||
|
||||
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName(&uiOrdering,
|
||||
m_wellPathNameOrSimWellName,
|
||||
m_branchDetection,
|
||||
m_branchIndex);
|
||||
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName(
|
||||
&uiOrdering, m_wellPathNameOrSimWellName, m_branchDetection, m_branchIndex);
|
||||
|
||||
caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword("Sources", "Sources");
|
||||
sourcesGroup->add(&m_selectedSources);
|
||||
@@ -871,9 +871,12 @@ void RimWellRftPlot::onLoadDataAndUpdate()
|
||||
|
||||
m_isOnLoad = false;
|
||||
}
|
||||
|
||||
updateMdiWindowVisibility();
|
||||
updateFormationsOnPlot();
|
||||
|
||||
m_wellLogPlot->loadDataAndUpdate();
|
||||
|
||||
updateEditorsFromCurves();
|
||||
updateWidgetTitleWindowTitle();
|
||||
}
|
||||
@@ -884,6 +887,6 @@ void RimWellRftPlot::onLoadDataAndUpdate()
|
||||
QWidget* RimWellRftPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
m_wellLogPlotWidget = new RiuWellRftPlot(this, mainWindowParent);
|
||||
|
||||
return m_wellLogPlotWidget;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ protected:
|
||||
// Overridden PDM methods
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override { return &m_userName; }
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
|
||||
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
@@ -141,10 +141,10 @@ private:
|
||||
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
|
||||
QPointer<RiuWellRftPlot> m_wellLogPlotWidget;
|
||||
|
||||
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot;
|
||||
|
||||
QPointer<RiuWellRftPlot> m_wellLogPlotWidget;
|
||||
|
||||
bool m_selectedSourcesOrTimeStepsFieldsChanged;
|
||||
bool m_isOnLoad;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user