mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
This commit is contained in:
parent
6fad753c4d
commit
6bd8a4d51a
@ -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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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", "", "", "", "");
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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; }
|
||||
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -32,7 +32,7 @@ class RimWellAllocationPlot;
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuWellAllocationPlot : public QwtPlot
|
||||
class RiuWellAllocationPlot : public QFrame
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user