#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 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 { enum WellPathComponentType {
// Production Tube // Production Tube
WELL_PATH, WELL_PATH,

View File

@ -1794,9 +1794,12 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
if (wellPathAttributeSource()) if (wellPathAttributeSource())
{ {
std::vector<const RimWellPathComponentInterface*> allWellPathComponents;
if (m_showWellPathAttributes || m_showWellPathCompletions) 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) if (m_showWellPathAttributes)
@ -1804,23 +1807,11 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
if (m_wellPathAttributeCollection) if (m_wellPathAttributeCollection)
{ {
std::vector<RimWellPathAttribute*> attributes = m_wellPathAttributeCollection->attributes(); std::vector<RimWellPathAttribute*> attributes = m_wellPathAttributeCollection->attributes();
std::sort(attributes.begin(), attributes.end(), [](const RimWellPathAttribute* lhs, const RimWellPathAttribute* rhs) for (const RimWellPathAttribute* attribute : attributes)
{
return *lhs < *rhs;
});
std::set<QString> attributesAssignedToLegend;
for (RimWellPathAttribute* attribute : attributes)
{ {
if (attribute->isEnabled()) if (attribute->isEnabled())
{ {
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), attribute)); allWellPathComponents.push_back(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);
} }
} }
} }
@ -1830,21 +1821,43 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
const RimWellPathCompletions* completionsCollection = wellPathAttributeSource()->completions(); const RimWellPathCompletions* completionsCollection = wellPathAttributeSource()->completions();
std::vector<const RimWellPathComponentInterface*> allCompletions = completionsCollection->allCompletions(); std::vector<const RimWellPathComponentInterface*> allCompletions = completionsCollection->allCompletions();
std::set<QString> completionsAssignedToLegend;
for (const RimWellPathComponentInterface* completion : allCompletions) for (const RimWellPathComponentInterface* completion : allCompletions)
{ {
if (completion->isEnabled()) if (completion->isEnabled())
{ {
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), completion)); 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(); QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathCompletionsInLegend() && bool contributeToLegend = m_wellPathCompletionsInLegend() && !completionsAssignedToLegend.count(legendTitle);
!completionsAssignedToLegend.count(legendTitle);
plotItem->setContributeToLegend(contributeToLegend); plotItem->setContributeToLegend(contributeToLegend);
m_wellPathAttributePlotObjects.push_back(std::move(plotItem)); m_wellPathAttributePlotObjects.push_back(std::move(plotItem));
completionsAssignedToLegend.insert(legendTitle); completionsAssignedToLegend.insert(legendTitle);
} }
}
}
RimWellLogPlot* wellLogPlot; RimWellLogPlot* wellLogPlot;
this->firstAncestorOrThisOfTypeAsserted(wellLogPlot); this->firstAncestorOrThisOfTypeAsserted(wellLogPlot);