#1106, #1107, #1009, #1113 Started using WellLog plot for the Accumulated Well Flow plot

This commit is contained in:
Jacob Støren 2017-01-19 17:39:43 +01:00
parent 6fad753c4d
commit 6bd8a4d51a
7 changed files with 91 additions and 7 deletions

View File

@ -26,6 +26,9 @@
#include "RiuMainPlotWindow.h"
#include "RiuWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RigSingleWellResultsData.h"
CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot");
@ -44,9 +47,12 @@ RimWellAllocationPlot::RimWellAllocationPlot()
m_userName.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_accumulatedWellFlowPlot, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", "");
m_accumulatedWellFlowPlot.uiCapability()->setUiHidden(true);
m_accumulatedWellFlowPlot = new RimWellLogPlot;
this->setAsPlotMDI();
}
@ -56,6 +62,8 @@ RimWellAllocationPlot::RimWellAllocationPlot()
RimWellAllocationPlot::~RimWellAllocationPlot()
{
removeWidgetFromMDI();
delete m_accumulatedWellFlowPlot();
deleteViewWidget();
}
@ -88,14 +96,42 @@ void RimWellAllocationPlot::deleteViewWidget()
void RimWellAllocationPlot::updateFromWell()
{
QString simName = "None";
size_t branchCount = 0;
const RigWellResultFrame* wellResultFrame = nullptr;
if (m_simulationWell)
if (m_simulationWell && m_simulationWell->wellResults() )// && Timestep Ok )
{
simName = m_simulationWell->name();
wellResultFrame = &(m_simulationWell->wellResults()->wellResultFrame(1));
branchCount = wellResultFrame->m_wellResultBranches.size();
}
setDescription(simName);
updateViewerWidgetBasic();
size_t existingTrackCount = accumulatedWellFlowPlot()->trackCount();
accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + simName + ")");
int neededExtraTrackCount = branchCount - existingTrackCount;
for (int etc = 0; etc < neededExtraTrackCount; ++etc)
{
RimWellLogTrack* plotTrack = new RimWellLogTrack();
accumulatedWellFlowPlot()->addTrack(plotTrack);
}
for (int etc = branchCount; etc < existingTrackCount; ++etc)
{
accumulatedWellFlowPlot()->removeTrackByIndex(accumulatedWellFlowPlot()->trackCount()- 1);
}
for (size_t brIdx = 0; brIdx < branchCount; ++brIdx)
{
RimWellLogTrack* plotTrack = accumulatedWellFlowPlot()->trackByIndex(brIdx);
plotTrack->setDescription(QString("Branch %1").arg(wellResultFrame->m_wellResultBranches[brIdx].m_ertBranchId));
}
setDescription("Well Allocation (" + simName + ")");
accumulatedWellFlowPlot()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
@ -113,6 +149,14 @@ void RimWellAllocationPlot::zoomAll()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RimWellAllocationPlot::accumulatedWellFlowPlot()
{
return m_accumulatedWellFlowPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -188,6 +232,7 @@ QImage RimWellAllocationPlot::snapshotWindowContent()
void RimWellAllocationPlot::setDescription(const QString& description)
{
m_userName = description;
this->updateViewerWidgetWindowTitle();
}
//--------------------------------------------------------------------------------------------------

View File

@ -29,6 +29,7 @@
class RiuWellAllocationPlot;
class RimEclipseWell;
class RimWellLogPlot;
namespace caf {
class PdmOptionItemInfo;
@ -57,6 +58,7 @@ public:
virtual QWidget* viewWidget() override;
virtual void zoomAll() override;
RimWellLogPlot* accumulatedWellFlowPlot();
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
@ -83,8 +85,11 @@ private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
//caf::PdmField<bool> m_showAccWellFlowPlot;
caf::PdmPtrField<RimEclipseWell*> m_simulationWell;
QPointer<RiuWellAllocationPlot> m_wellAllocationPlotWidget;
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
};

View File

@ -30,7 +30,7 @@ RimViewWindow::RimViewWindow(void)
{
CAF_PDM_InitFieldNoDefault(&m_windowController, "WindowController", "", "", "", "");
m_windowController.uiCapability()->setUiHidden(true);
m_windowController.uiCapability()->setUiTreeChildrenHidden(true);
// Obsolete field
CAF_PDM_InitFieldNoDefault(&m_windowGeometry, "WindowGeometry", "", "", "", "");

View File

@ -199,6 +199,17 @@ void RimWellLogPlot::removeTrack(RimWellLogTrack* track)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::removeTrackByIndex(size_t index)
{
CVF_ASSERT(index < m_tracks.size());
RimWellLogTrack* track = m_tracks[index];
this->removeTrack(track);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -228,6 +239,14 @@ void RimWellLogPlot::moveTracks(RimWellLogTrack* insertAfterTrack, const std::ve
updateTrackNames();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RimWellLogPlot::trackByIndex(size_t index)
{
return m_tracks[index];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -66,10 +66,14 @@ public:
void addTrack(RimWellLogTrack* track);
void insertTrack(RimWellLogTrack* track, size_t index);
size_t trackCount() { return m_tracks.size();}
void removeTrackByIndex(size_t index);
void removeTrack(RimWellLogTrack* track);
size_t trackIndex(RimWellLogTrack* track);
void moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector<RimWellLogTrack*>& tracksToMove);
RimWellLogTrack* trackByIndex(size_t index);
void loadDataAndUpdate();
void updateTracks();
void updateTrackNames();
@ -104,6 +108,7 @@ private:
void recreateTrackPlots();
void detachAllCurves();
public: // Needed by RiuWellAllocation Plot
// RimViewWindow overrides
virtual caf::PdmField<bool>* getShowWindowField() override { return &m_showWindow; }

View File

@ -22,6 +22,9 @@
#include "RiaApplication.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "QBoxLayout"
@ -30,10 +33,17 @@
///
//--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
: QwtPlot(parent)
: QFrame(parent)
{
Q_ASSERT(plotDefinition);
this->setLayout(new QVBoxLayout());
this->layout()->setMargin(0);
m_plotDefinition = plotDefinition;
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this);
this->layout()->addWidget(wellFlowWidget);
}
//--------------------------------------------------------------------------------------------------

View File

@ -32,7 +32,7 @@ class RimWellAllocationPlot;
//
//
//==================================================================================================
class RiuWellAllocationPlot : public QwtPlot
class RiuWellAllocationPlot : public QFrame
{
Q_OBJECT;
public: