#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;

View File

@ -512,8 +512,11 @@ void RimWellLogTrack::updateXZoomAndParentPlotDepthZoom()
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateXZoom()
{
std::vector<RimWellFlowRateCurve*> stackCurves = visibleStackedCurves();
for (RimWellFlowRateCurve* stCurve: stackCurves) stCurve->updateStackedPlotData();
std::map<int, std::vector<RimWellFlowRateCurve*>> stackCurveGroups = visibleStackedCurves();
for (const std::pair<int, std::vector<RimWellFlowRateCurve*>>& curveGroup : stackCurveGroups)
{
for (RimWellFlowRateCurve* stCurve : curveGroup.second) stCurve->updateStackedPlotData();
}
if (!m_isAutoScaleXEnabled())
{
@ -734,15 +737,22 @@ void RimWellLogTrack::setLogarithmicScale(bool enable)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellFlowRateCurve*> RimWellLogTrack::visibleStackedCurves()
std::map<int, std::vector<RimWellFlowRateCurve*>> RimWellLogTrack::visibleStackedCurves()
{
std::vector<RimWellFlowRateCurve*> stackedCurves;
std::map<int, std::vector<RimWellFlowRateCurve*>> stackedCurves;
for (RimWellLogCurve* curve: curves)
{
if (curve && curve->isCurveVisible() )
{
RimWellFlowRateCurve* wfrCurve = dynamic_cast<RimWellFlowRateCurve*>(curve);
if (wfrCurve) stackedCurves.push_back(wfrCurve);
if (wfrCurve != nullptr)
{
if (stackedCurves.count(wfrCurve->groupId()) == 0)
{
stackedCurves.insert(std::make_pair(wfrCurve->groupId(), std::vector<RimWellFlowRateCurve*>()));
}
stackedCurves[wfrCurve->groupId()].push_back(wfrCurve);
}
}
}

View File

@ -31,6 +31,7 @@
#include <memory>
#include <vector>
#include <map>
class RigWellPath;
class RimCase;
@ -92,7 +93,7 @@ public:
void setLogarithmicScale(bool enable);
std::vector<RimWellFlowRateCurve*> visibleStackedCurves();
std::map<int, std::vector<RimWellFlowRateCurve*>> visibleStackedCurves();
QString description();
std::vector<RimWellLogCurve* > curvesVector();