#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"; 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< std::pair<size_t, size_t> > polyLineStartStopIndices = m_curveData->polylineStartStopIndices();
std::vector<double> stackedValues(depthValues.size(), 0.0); 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; double zPos = -0.1;
for ( RimWellFlowRateCurve * stCurve: stackedCurves ) for ( RimWellFlowRateCurve * stCurve: stackedCurves )
{ {

View File

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

View File

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

View File

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

View File

@ -512,8 +512,11 @@ void RimWellLogTrack::updateXZoomAndParentPlotDepthZoom()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateXZoom() void RimWellLogTrack::updateXZoom()
{ {
std::vector<RimWellFlowRateCurve*> stackCurves = visibleStackedCurves(); std::map<int, std::vector<RimWellFlowRateCurve*>> stackCurveGroups = visibleStackedCurves();
for (RimWellFlowRateCurve* stCurve: stackCurves) stCurve->updateStackedPlotData(); for (const std::pair<int, std::vector<RimWellFlowRateCurve*>>& curveGroup : stackCurveGroups)
{
for (RimWellFlowRateCurve* stCurve : curveGroup.second) stCurve->updateStackedPlotData();
}
if (!m_isAutoScaleXEnabled()) 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) for (RimWellLogCurve* curve: curves)
{ {
if (curve && curve->isCurveVisible() ) if (curve && curve->isCurveVisible() )
{ {
RimWellFlowRateCurve* wfrCurve = dynamic_cast<RimWellFlowRateCurve*>(curve); 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 <memory>
#include <vector> #include <vector>
#include <map>
class RigWellPath; class RigWellPath;
class RimCase; class RimCase;
@ -92,7 +93,7 @@ public:
void setLogarithmicScale(bool enable); void setLogarithmicScale(bool enable);
std::vector<RimWellFlowRateCurve*> visibleStackedCurves(); std::map<int, std::vector<RimWellFlowRateCurve*>> visibleStackedCurves();
QString description(); QString description();
std::vector<RimWellLogCurve* > curvesVector(); std::vector<RimWellLogCurve* > curvesVector();