#1948 PLT plot. Support for stacked curve grouping

This commit is contained in:
Bjørn Erik Jensen
2017-10-27 15:17:24 +02:00
parent 7dd42d2da4
commit 0c6fd31e07
6 changed files with 59 additions and 17 deletions

View File

@@ -87,6 +87,22 @@ QString RimWellFlowRateCurve::wellLogChannelName() const
return "AccumulatedFlowRate";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setGroupId(int groupId)
{
m_groupId = groupId;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellFlowRateCurve::groupId() const
{
return m_groupId;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -181,7 +197,13 @@ void RimWellFlowRateCurve::updateStackedPlotData()
std::vector< std::pair<size_t, size_t> > polyLineStartStopIndices = m_curveData->polylineStartStopIndices();
std::vector<double> stackedValues(depthValues.size(), 0.0);
std::vector<RimWellFlowRateCurve*> stackedCurves = wellLogTrack->visibleStackedCurves();
std::map<int, std::vector<RimWellFlowRateCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves();
std::vector<RimWellFlowRateCurve*> stackedCurves;
if (stackedCurveGroups.count(groupId()) > 0)
{
stackedCurves = stackedCurveGroups[groupId()];
}
double zPos = -0.1;
for ( RimWellFlowRateCurve * stCurve: stackedCurves )
{

View File

@@ -44,6 +44,9 @@ public:
virtual QString wellName() const override;
virtual QString wellLogChannelName() const override;
void setGroupId(int groupId);
int groupId() const;
protected:
virtual QString createCurveAutoName() override;
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
@@ -56,5 +59,7 @@ private:
RimWellAllocationPlot* wellAllocationPlot() const;
QString m_tracerName;
int m_groupId;
};

View File

@@ -816,9 +816,15 @@ void RimWellPltPlot::updateCurvesInPlot(const std::set<std::pair<RifWellRftAddre
plotTrack->removeCurve(curve);
}
int curveGroupId = 0;
// Add curves
for (const std::pair<RifWellRftAddress, QDateTime>& curveDefToAdd : curveDefs)
{
std::set<FlowPhase> selectedPhases = m_phaseSelectionMode == FLOW_TYPE_PHASE_SPLIT ?
std::set<FlowPhase>(m_phases().begin(), m_phases().end()) :
std::set<FlowPhase>({ PHASE_TOTAL });
//if (curveDefToAdd.first.sourceType() == RftSourceType::RFT)
//{
// auto curve = new RimWellLogRftCurve();
@@ -874,10 +880,6 @@ void RimWellPltPlot::updateCurvesInPlot(const std::set<std::pair<RifWellRftAddre
RimWellPath* const wellPath = wellPathFromWellLogFile(wellLogFile);
if(wellLogFile!= nullptr)
{
std::set<FlowPhase> selectedPhases = m_phaseSelectionMode == FLOW_TYPE_PHASE_SPLIT ?
std::set<FlowPhase>(m_phases().begin(), m_phases().end()) :
std::set<FlowPhase>({ PHASE_TOTAL });
RigWellLogFile* rigWellLogFile = wellLogFile->wellLogFile();
if (rigWellLogFile != nullptr)
@@ -887,13 +889,13 @@ void RimWellPltPlot::updateCurvesInPlot(const std::set<std::pair<RifWellRftAddre
const auto& channelName = channel->name();
if (selectedPhases.count(flowPhaseFromChannelName(channelName)) > 0)
{
addStackedCurve(channelName, rigWellLogFile->depthValues(), rigWellLogFile->values(channelName), plotTrack);
addStackedCurve(channelName, rigWellLogFile->depthValues(), rigWellLogFile->values(channelName), plotTrack, curveGroupId);
}
}
}
}
}
curveGroupId++;
}
}
@@ -903,7 +905,8 @@ void RimWellPltPlot::updateCurvesInPlot(const std::set<std::pair<RifWellRftAddre
void RimWellPltPlot::addStackedCurve(const QString& channelName,
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack)
RimWellLogTrack* plotTrack,
int curveGroupId)
{
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValuesPrDepthValue(channelName, depthValues, accFlow);
@@ -912,8 +915,8 @@ void RimWellPltPlot::addStackedCurve(const QString& channelName,
channelName == GAS_CHANNEL_NAME ? cvf::Color3f::DARK_RED :
channelName == WATER_CHANNEL_NAME ? cvf::Color3f::BLUE :
cvf::Color3f::DARK_GRAY;
curve->setColor(color);
curve->setColor(color);
curve->setGroupId(curveGroupId);
plotTrack->addCurve(curve);
curve->loadDataAndUpdate(true);

View File

@@ -153,7 +153,8 @@ private:
void addStackedCurve(const QString& tracerName,
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack);
RimWellLogTrack* plotTrack,
int curveGroupId);
bool isOnlyGridSourcesSelected() const;
bool isAnySourceAddressSelected(const std::set<RifWellRftAddress>& addresses) const;