#3615 Fix z-order so packers are added after other components

*  Valves are added last of all
* This way packers are displayed on top of perforation intervals and fishbones.
This commit is contained in:
Gaute Lindkvist 2018-12-05 09:11:24 +01:00
parent c1c897d7a4
commit 4591d9f20e
2 changed files with 38 additions and 23 deletions

View File

@ -40,6 +40,8 @@ namespace RiaDefines
UNDEFINED = 999
};
// WARNING: DO NOT CHANGE THE ORDER WITHOUT KNOWING WHAT YOU ARE DOING!
// You may well change the behaviour of property filters.
enum WellPathComponentType {
// Production Tube
WELL_PATH,

View File

@ -1794,9 +1794,12 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
if (wellPathAttributeSource())
{
std::vector<const RimWellPathComponentInterface*> allWellPathComponents;
if (m_showWellPathAttributes || m_showWellPathCompletions)
{
m_wellPathAttributePlotObjects.push_back(std::unique_ptr<RiuWellPathComponentPlotItem>(new RiuWellPathComponentPlotItem(wellPathAttributeSource())));
m_wellPathAttributePlotObjects.push_back(
std::unique_ptr<RiuWellPathComponentPlotItem>(new RiuWellPathComponentPlotItem(wellPathAttributeSource())));
}
if (m_showWellPathAttributes)
@ -1804,23 +1807,11 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
if (m_wellPathAttributeCollection)
{
std::vector<RimWellPathAttribute*> attributes = m_wellPathAttributeCollection->attributes();
std::sort(attributes.begin(), attributes.end(), [](const RimWellPathAttribute* lhs, const RimWellPathAttribute* rhs)
{
return *lhs < *rhs;
});
std::set<QString> attributesAssignedToLegend;
for (RimWellPathAttribute* attribute : attributes)
for (const RimWellPathAttribute* attribute : attributes)
{
if (attribute->isEnabled())
{
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), attribute));
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathAttributesInLegend() &&
!attributesAssignedToLegend.count(legendTitle);
plotItem->setContributeToLegend(contributeToLegend);
m_wellPathAttributePlotObjects.push_back(std::move(plotItem));
attributesAssignedToLegend.insert(legendTitle);
allWellPathComponents.push_back(attribute);
}
}
}
@ -1830,22 +1821,44 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
const RimWellPathCompletions* completionsCollection = wellPathAttributeSource()->completions();
std::vector<const RimWellPathComponentInterface*> allCompletions = completionsCollection->allCompletions();
std::set<QString> completionsAssignedToLegend;
for (const RimWellPathComponentInterface* completion : allCompletions)
{
if (completion->isEnabled())
{
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), completion));
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathCompletionsInLegend() &&
!completionsAssignedToLegend.count(legendTitle);
plotItem->setContributeToLegend(contributeToLegend);
m_wellPathAttributePlotObjects.push_back(std::move(plotItem));
completionsAssignedToLegend.insert(legendTitle);
allWellPathComponents.push_back(completion);
}
}
}
const std::map<RiaDefines::WellPathComponentType, int> sortIndices = {{RiaDefines::WELL_PATH, 0},
{RiaDefines::CASING, 1},
{RiaDefines::LINER, 2},
{RiaDefines::PERFORATION_INTERVAL, 3},
{RiaDefines::FISHBONES, 4},
{RiaDefines::FRACTURE, 5},
{RiaDefines::PACKER, 6},
{RiaDefines::ICD, 7},
{RiaDefines::AICD, 8},
{RiaDefines::ICV, 9}};
std::stable_sort(allWellPathComponents.begin(), allWellPathComponents.end(),
[&sortIndices](const RimWellPathComponentInterface* lhs, const RimWellPathComponentInterface* rhs)
{
return sortIndices.at(lhs->componentType()) < sortIndices.at(rhs->componentType());
});
std::set<QString> completionsAssignedToLegend;
for (const RimWellPathComponentInterface* component : allWellPathComponents)
{
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(
new RiuWellPathComponentPlotItem(wellPathAttributeSource(), component));
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathCompletionsInLegend() && !completionsAssignedToLegend.count(legendTitle);
plotItem->setContributeToLegend(contributeToLegend);
m_wellPathAttributePlotObjects.push_back(std::move(plotItem));
completionsAssignedToLegend.insert(legendTitle);
}
RimWellLogPlot* wellLogPlot;
this->firstAncestorOrThisOfTypeAsserted(wellLogPlot);
RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType();