mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor WellLogPlot, RftPlot, PlotPlot and WellAllocationPlot
This commit is contained in:
@@ -100,18 +100,18 @@ const char RimWellPltPlot::PLOT_NAME_QFORMAT_STRING[] = "PLT: %1";
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPltPlot::RimWellPltPlot()
|
||||
: RimWellLogPlot()
|
||||
{
|
||||
CAF_PDM_InitObject("Well Allocation Plot", ":/WellFlowPlot16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("PLT Plot"), "Name", "", "", "");
|
||||
m_userName.uiCapability()->setUiReadOnly(true);
|
||||
CAF_PDM_InitField(&m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "");
|
||||
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellLogPlot, "WellLog", "WellLog", "", "", "");
|
||||
m_wellLogPlot.uiCapability()->setUiHidden(true);
|
||||
m_wellLogPlot = new RimWellLogPlot();
|
||||
m_wellLogPlot->setDepthType(RimWellLogPlot::MEASURED_DEPTH);
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", "");
|
||||
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden(true);
|
||||
m_wellLogPlot_OBSOLETE = new RimWellLogPlot();
|
||||
m_wellLogPlot_OBSOLETE->setDepthType(RimWellLogPlot::MEASURED_DEPTH);
|
||||
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellPathName, "WellName", "Well Name", "", "", "");
|
||||
|
||||
@@ -152,18 +152,6 @@ RimWellPltPlot::~RimWellPltPlot()
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::deleteViewWidget()
|
||||
{
|
||||
if (m_wellLogPlotWidget)
|
||||
{
|
||||
m_wellLogPlotWidget->deleteLater();
|
||||
m_wellLogPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -238,12 +226,12 @@ void RimWellPltPlot::setPlotXAxisTitles(RimWellLogTrack* plotTrack)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::updateFormationsOnPlot() const
|
||||
{
|
||||
if (m_wellLogPlot->trackCount() > 0)
|
||||
if (trackCount() > 0)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimWellPath* wellPath = proj->wellPathByName(m_wellPathName);
|
||||
|
||||
RimCase* formationNamesCase = m_wellLogPlot->trackByIndex(0)->formationNamesCase();
|
||||
RimCase* formationNamesCase = trackByIndex(0)->formationNamesCase();
|
||||
|
||||
if (!formationNamesCase)
|
||||
{
|
||||
@@ -257,28 +245,16 @@ void RimWellPltPlot::updateFormationsOnPlot() const
|
||||
}
|
||||
}
|
||||
|
||||
m_wellLogPlot->trackByIndex(0)->setAndUpdateWellPathFormationNamesData(formationNamesCase, wellPath);
|
||||
trackByIndex(0)->setAndUpdateWellPathFormationNamesData(formationNamesCase, wellPath);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::updateWidgetTitleWindowTitle()
|
||||
std::set<RimWellLogPlot::DepthTypeEnum> RimWellPltPlot::availableDepthTypes() const
|
||||
{
|
||||
updateMdiWindowTitle();
|
||||
|
||||
if (m_wellLogPlotWidget)
|
||||
{
|
||||
if (m_showPlotTitle)
|
||||
{
|
||||
m_wellLogPlotWidget->showTitle(m_userName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wellLogPlotWidget->hideTitle();
|
||||
}
|
||||
}
|
||||
return {RimWellLogPlot::MEASURED_DEPTH};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -506,7 +482,7 @@ public:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
{
|
||||
RimWellLogTrack* plotTrack = m_wellLogPlot->trackByIndex(0);
|
||||
RimWellLogTrack* plotTrack = trackByIndex(0);
|
||||
const std::set<RiaRftPltCurveDefinition>& curveDefs = selectedCurveDefs();
|
||||
|
||||
setPlotXAxisTitles(plotTrack);
|
||||
@@ -715,8 +691,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
curveGroupId++;
|
||||
}
|
||||
|
||||
updateWidgetTitleWindowTitle();
|
||||
m_wellLogPlot->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
plotTrack->calculateXZoomRange();
|
||||
}
|
||||
|
||||
@@ -773,30 +748,6 @@ std::vector<RifDataSourceForRftPlt> RimWellPltPlot::selectedSourcesExpanded() co
|
||||
return sources;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellPltPlot::viewWidget()
|
||||
{
|
||||
return m_wellLogPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::zoomAll()
|
||||
{
|
||||
m_wellLogPlot()->zoomAll();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot* RimWellPltPlot::wellLogPlot() const
|
||||
{
|
||||
return m_wellLogPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -917,7 +868,7 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
|
||||
if (changedField == &m_wellPathName)
|
||||
{
|
||||
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
|
||||
RimWellLogTrack* const plotTrack = trackByIndex(0);
|
||||
plotTrack->deleteAllCurves();
|
||||
m_selectedSources.v().clear();
|
||||
m_selectedTimeSteps.v().clear();
|
||||
@@ -953,9 +904,9 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
updateFormationsOnPlot();
|
||||
syncSourcesIoFieldFromGuiField();
|
||||
syncCurvesFromUiSelection();
|
||||
m_wellLogPlot->updateDepthZoom();
|
||||
updateDepthZoom();
|
||||
|
||||
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
|
||||
RimWellLogTrack* const plotTrack = trackByIndex(0);
|
||||
plotTrack->calculateXZoomRangeAndUpdateQwt();
|
||||
}
|
||||
|
||||
@@ -963,9 +914,9 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
changedField == &m_phases)
|
||||
{
|
||||
syncCurvesFromUiSelection();
|
||||
m_wellLogPlot->updateDepthZoom();
|
||||
updateDepthZoom();
|
||||
|
||||
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0);
|
||||
RimWellLogTrack* const plotTrack = trackByIndex(0);
|
||||
plotTrack->calculateXZoomRangeAndUpdateQwt();
|
||||
}
|
||||
}
|
||||
@@ -978,22 +929,6 @@ void RimWellPltPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellPltPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if (m_wellLogPlotWidget)
|
||||
{
|
||||
QPixmap pix = QPixmap::grabWidget(m_wellLogPlotWidget);
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1001,7 +936,6 @@ void RimWellPltPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
{
|
||||
const QString simWellName = RimWellPlotTools::simWellName(m_wellPathName);
|
||||
|
||||
uiOrdering.add(&m_userName);
|
||||
uiOrdering.add(&m_wellPathName);
|
||||
|
||||
caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword("Sources", "Sources");
|
||||
@@ -1016,20 +950,20 @@ void RimWellPltPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
|
||||
flowGroup->add(&m_phases);
|
||||
|
||||
if (m_wellLogPlot && m_wellLogPlot->trackCount() > 0)
|
||||
if (trackCount() > 0)
|
||||
{
|
||||
RimWellLogTrack* track = m_wellLogPlot->trackByIndex(0);
|
||||
RimWellLogTrack* track = trackByIndex(0);
|
||||
|
||||
track->uiOrderingForRftPltFormations(uiOrdering);
|
||||
|
||||
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup("Legend and Axis");
|
||||
legendAndAxisGroup->setCollapsedByDefault(true);
|
||||
|
||||
m_wellLogPlot->uiOrderingForPlotSettings(*legendAndAxisGroup);
|
||||
uiOrderingForPlotSettings(*legendAndAxisGroup);
|
||||
|
||||
track->uiOrderingForXAxisSettings(*legendAndAxisGroup);
|
||||
|
||||
m_wellLogPlot->uiOrderingForDepthAxis(*legendAndAxisGroup);
|
||||
uiOrderingForDepthAxis(*legendAndAxisGroup);
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
@@ -1057,6 +991,20 @@ void RimWellPltPlot::initAfterRead()
|
||||
{
|
||||
RimViewWindow::initAfterRead();
|
||||
|
||||
if (m_wellLogPlot_OBSOLETE)
|
||||
{
|
||||
RimWellLogPlot& wellLogPlot = dynamic_cast<RimWellLogPlot&>(*this);
|
||||
wellLogPlot = std::move(*m_wellLogPlot_OBSOLETE.value());
|
||||
m_wellLogPlot_OBSOLETE = nullptr;
|
||||
}
|
||||
|
||||
if (m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot())
|
||||
{
|
||||
m_showTitleInPlot = m_showPlotTitle_OBSOLETE();
|
||||
}
|
||||
|
||||
RimWellLogPlot::initAfterRead();
|
||||
|
||||
// Postpone init until data has been loaded
|
||||
m_doInitAfterLoad = true;
|
||||
}
|
||||
@@ -1117,24 +1065,6 @@ void RimWellPltPlot::calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>
|
||||
options.push_back(caf::PdmOptionItemInfo("None", ""));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::setDescription(const QString& description)
|
||||
{
|
||||
m_userName = description;
|
||||
|
||||
updateWidgetTitleWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPltPlot::description() const
|
||||
{
|
||||
return m_userName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1148,9 +1078,9 @@ void RimWellPltPlot::onLoadDataAndUpdate()
|
||||
|
||||
if (m_isOnLoad)
|
||||
{
|
||||
if (m_wellLogPlot->trackCount() > 0)
|
||||
if (trackCount() > 0)
|
||||
{
|
||||
m_wellLogPlot->trackByIndex(0)->setShowFormations(true);
|
||||
trackByIndex(0)->setShowFormations(true);
|
||||
}
|
||||
m_isOnLoad = false;
|
||||
}
|
||||
@@ -1158,7 +1088,7 @@ void RimWellPltPlot::onLoadDataAndUpdate()
|
||||
updateMdiWindowVisibility();
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
m_wellLogPlot->loadDataAndUpdate();
|
||||
RimWellLogPlot::loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1166,6 +1096,6 @@ void RimWellPltPlot::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellPltPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
m_wellLogPlotWidget = new RiuWellPltPlot(this, mainWindowParent);
|
||||
return m_wellLogPlotWidget;
|
||||
m_viewer = new RiuWellPltPlot(this, mainWindowParent);
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user