#1108, #1110, #1116 Pie chart Well Allocation Factors now working.

This commit is contained in:
Jacob Støren
2017-02-02 11:22:02 +01:00
parent 7abdc38d92
commit eee43ccf0f
4 changed files with 105 additions and 152 deletions

View File

@@ -32,6 +32,7 @@
#include "RiuMainPlotWindow.h"
#include "RiuNightchartsWidget.h"
#include "RiuWellAllocationPlot.h"
#include "cvfColor3.h"
CAF_PDM_SOURCE_INIT(RimTotalWellAllocationPlot, "TotalWellAllocationPlot");
@@ -48,7 +49,6 @@ RimTotalWellAllocationPlot::RimTotalWellAllocationPlot()
m_userName.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
}
@@ -62,15 +62,6 @@ RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
{
m_simulationWell = simWell;
updateFromWell();
}
//--------------------------------------------------------------------------------------------------
///
@@ -84,60 +75,6 @@ void RimTotalWellAllocationPlot::deleteViewWidget()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::updateFromWell()
{
/*
QString simName = "None";
int branchCount = 0;
const RigWellResultFrame* wellResultFrame = nullptr;
if (m_simulationWell && m_simulationWell->wellResults() )// && Timestep Ok )
{
simName = m_simulationWell->name();
wellResultFrame = &(m_simulationWell->wellResults()->wellResultFrame(1));
branchCount = static_cast<int>( wellResultFrame->m_wellResultBranches.size());
// // Todo : Use this instead, and use to calculate accumulated flow
//
// size_t timeStep = 0; // make field
// std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
// std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
// m_simulationWell->calculateWellPipeDynamicCenterLine(timeStep, pipeBranchesCLCoords, pipeBranchesCellIds);
// branchCount = static_cast<int>( pipeBranchesCLCoords.size());
}
int existingTrackCount = static_cast<int>(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(brIdx+1));
}
setDescription("Well Allocation (" + simName + ")");
accumulatedWellFlowPlot()->updateConnectedEditors();
*/
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -153,39 +90,6 @@ void RimTotalWellAllocationPlot::zoomAll()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimTotalWellAllocationPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_simulationWell)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
if (eclView && eclView->wellCollection())
{
RimEclipseWellCollection* coll = eclView->wellCollection();
caf::PdmChildArrayField<RimEclipseWell*>& eclWells = coll->wells;
QIcon simWellIcon(":/Well.png");
for (RimEclipseWell* eclWell : eclWells)
{
options.push_back(caf::PdmOptionItemInfo(eclWell->name(), eclWell, false, simWellIcon));
}
}
if (options.size() == 0)
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
@@ -199,10 +103,7 @@ void RimTotalWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
{
updateMdiWindowTitle();
}
else if (changedField == &m_simulationWell)
{
updateFromWell();
}
}
@@ -235,13 +136,34 @@ QString RimTotalWellAllocationPlot::description() const
return m_userName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::addSlice(const QString& name, const cvf::Color3f& color, float value)
{
QColor sliceColor(color.rByte(), color.gByte(), color.bByte());
m_wellTotalAllocationPlotWidget->addItem(name, sliceColor, value);
m_wellTotalAllocationPlotWidget->update();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::clearSlices()
{
m_wellTotalAllocationPlotWidget->clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTotalWellAllocationPlot::loadDataAndUpdate()
{
updateMdiWindowVisibility();
updateFromWell();
}
//--------------------------------------------------------------------------------------------------
@@ -250,12 +172,6 @@ void RimTotalWellAllocationPlot::loadDataAndUpdate()
QWidget* RimTotalWellAllocationPlot::createViewWidget(QWidget* mainWindowParent)
{
m_wellTotalAllocationPlotWidget = new RiuNightchartsWidget(mainWindowParent);
m_wellTotalAllocationPlotWidget->addItem("Item1", QColor(200, 10, 50), 34);
m_wellTotalAllocationPlotWidget->addItem("Item2", Qt::green, 27);
m_wellTotalAllocationPlotWidget->addItem("Item3", Qt::cyan, 14);
m_wellTotalAllocationPlotWidget->addItem("Item4", Qt::yellow, 7);
m_wellTotalAllocationPlotWidget->addItem("Item5", Qt::blue, 4);
return m_wellTotalAllocationPlotWidget;
}