#3466 Minor improvements to plotting of completions

This commit is contained in:
Gaute Lindkvist 2018-10-09 15:27:46 +02:00
parent 751bcc5f28
commit 09f3e0e772
4 changed files with 176 additions and 153 deletions

View File

@ -187,11 +187,12 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitField(&m_showformationFluids, "ShowFormationFluids", false, "Show Fluids", "", "", "");
CAF_PDM_InitField(&m_showWellPathAttributes, "ShowWellPathAttributes", false, "Show Well Attributes", "", "", "");
CAF_PDM_InitField(&m_showWellPathAttributesFromCompletions, "ShowWellPathAttributesCompletions", true, "Show Well Completions", "", "", "");
CAF_PDM_InitField(&m_showWellPathAttributeBothSides, "ShowWellPathAttrBothSides", true, "Show Both Sides", "", "", "");
CAF_PDM_InitField(&m_showWellPathAttributeLabels, "ShowWellPathAttrLabels", false, "Show Labels", "", "", "");
CAF_PDM_InitField(&m_wellPathAttributesInLegend, "WellPathAttributesInLegend", false, "Contribute to Legend", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPathAttributeSource, "AttributesWellPathSource", "Well Path", "", "", "");
CAF_PDM_InitField(&m_wellPathAttributesInLegend, "WellPathAttributesInLegend", false, "Attributes in Legend", "", "", "");
CAF_PDM_InitField(&m_showWellPathCompletions, "ShowWellPathCompletions", true, "Show Well Completions", "", "", "");
CAF_PDM_InitField(&m_wellPathCompletionsInLegend, "WellPathCompletionsInLegend", false, "Completions in Legend", "", "", "");
CAF_PDM_InitField(&m_showWellPathComponentsBothSides, "ShowWellPathAttrBothSides", true, "Show Both Sides", "", "", "");
CAF_PDM_InitField(&m_showWellPathComponentLabels, "ShowWellPathAttrLabels", false, "Show Labels", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPathComponentSource, "AttributesWellPathSource", "Well Path", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPathAttributeCollection, "AttributesCollection", "Well Attributes", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_widthScaleFactor, "Width", "Track Width", "", "Set width of track. ", "");
@ -427,16 +428,17 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
loadDataAndUpdate();
}
else if (changedField == &m_showWellPathAttributes ||
changedField == &m_showWellPathAttributesFromCompletions ||
changedField == &m_showWellPathAttributeBothSides ||
changedField == &m_showWellPathAttributeLabels ||
changedField == &m_wellPathAttributesInLegend)
changedField == &m_showWellPathCompletions ||
changedField == &m_showWellPathComponentsBothSides ||
changedField == &m_showWellPathComponentLabels ||
changedField == &m_wellPathAttributesInLegend ||
changedField == &m_wellPathCompletionsInLegend)
{
updateWellPathAttributesOnPlot();
updateParentPlotLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if (changedField == &m_wellPathAttributeSource)
else if (changedField == &m_wellPathComponentSource)
{
updateWellPathAttributesCollection();
updateWellPathAttributesOnPlot();
@ -605,7 +607,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogTrack::calculateValueOptions(const caf::
}
}
}
else if (fieldNeedingOptions == &m_wellPathAttributeSource)
else if (fieldNeedingOptions == &m_wellPathComponentSource)
{
RimTools::wellPathOptionItems(&options);
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
@ -712,7 +714,7 @@ void RimWellLogTrack::availableDepthRange(double* minimumDepth, double* maximumD
}
}
if (m_showWellPathAttributes)
if (m_showWellPathAttributes || m_showWellPathCompletions)
{
for (const std::unique_ptr<RiuWellPathComponentPlotItem>& plotObject : m_wellPathAttributePlotObjects)
{
@ -1026,16 +1028,16 @@ void RimWellLogTrack::applyXZoomFromVisibleRange()
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
// Attribute range. Fixed range where well attributes are positioned [-1, 1].
// Attribute range. Fixed range where well components are positioned [-1, 1].
// Set an extended range here to allow for some label space.
double attributeRangeMax = 1.5 * (10.0 / (m_widthScaleFactor()));
double attributeRangeMin = -0.25;
if (m_showWellPathAttributeBothSides)
double componentRangeMax = 1.5 * (10.0 / (m_widthScaleFactor()));
double componentRangeMin = -0.25;
if (m_showWellPathComponentsBothSides)
{
attributeRangeMin = -1.0;
componentRangeMin = -1.0;
}
m_wellLogTrackPlotWidget->setXRange(attributeRangeMin, attributeRangeMax, QwtPlot::xBottom);
m_wellLogTrackPlotWidget->setXRange(componentRangeMin, componentRangeMax, QwtPlot::xBottom);
m_wellLogTrackPlotWidget->replot();
}
@ -1206,7 +1208,7 @@ bool RimWellLogTrack::showWellPathAttributes() const
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::showWellPathAttributesBothSides() const
{
return m_showWellPathAttributeBothSides;
return m_showWellPathComponentsBothSides;
}
//--------------------------------------------------------------------------------------------------
@ -1222,7 +1224,7 @@ void RimWellLogTrack::setShowWellPathAttributes(bool on)
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setWellPathAttributesSource(RimWellPath* wellPath)
{
m_wellPathAttributeSource = wellPath;
m_wellPathComponentSource = wellPath;
updateWellPathAttributesCollection();
}
@ -1231,7 +1233,7 @@ void RimWellLogTrack::setWellPathAttributesSource(RimWellPath* wellPath)
//--------------------------------------------------------------------------------------------------
RimWellPath* RimWellLogTrack::wellPathAttributeSource() const
{
return m_wellPathAttributeSource;
return m_wellPathComponentSource;
}
//--------------------------------------------------------------------------------------------------
@ -1304,13 +1306,15 @@ void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
}
}
caf::PdmUiGroup* attributeGroup = uiOrdering.addNewGroup("Well Attributes");
attributeGroup->add(&m_showWellPathAttributes);
attributeGroup->add(&m_showWellPathAttributesFromCompletions);
attributeGroup->add(&m_showWellPathAttributeBothSides);
attributeGroup->add(&m_showWellPathAttributeLabels);
attributeGroup->add(&m_wellPathAttributesInLegend);
attributeGroup->add(&m_wellPathAttributeSource);
caf::PdmUiGroup* componentGroup = uiOrdering.addNewGroup("Well Path Components");
componentGroup->add(&m_showWellPathAttributes);
componentGroup->add(&m_showWellPathCompletions);
componentGroup->add(&m_wellPathAttributesInLegend);
componentGroup->add(&m_wellPathCompletionsInLegend);
componentGroup->add(&m_showWellPathComponentsBothSides);
componentGroup->add(&m_showWellPathComponentLabels);
componentGroup->add(&m_wellPathComponentSource);
uiOrderingForXAxisSettings(uiOrdering);
@ -1387,10 +1391,10 @@ std::pair<double, double> RimWellLogTrack::adjustXRange(double minValue, double
void RimWellLogTrack::updateWellPathAttributesCollection()
{
m_wellPathAttributeCollection = nullptr;
if (m_wellPathAttributeSource)
if (m_wellPathComponentSource)
{
std::vector<RimWellPathAttributeCollection*> attributeCollection;
m_wellPathAttributeSource->descendantsIncludingThisOfType(attributeCollection);
m_wellPathComponentSource->descendantsIncludingThisOfType(attributeCollection);
if (!attributeCollection.empty())
{
m_wellPathAttributeCollection = attributeCollection.front();
@ -1813,30 +1817,52 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
{
m_wellPathAttributePlotObjects.clear();
if (m_showWellPathAttributes && wellPathAttributeSource())
{
m_wellPathAttributePlotObjects.push_back(std::unique_ptr<RiuWellPathComponentPlotItem>(new RiuWellPathComponentPlotItem(wellPathAttributeSource())));
if (m_wellPathAttributeCollection)
if (wellPathAttributeSource())
{
if (m_showWellPathAttributes || m_showWellPathCompletions)
{
std::vector<RimWellPathAttribute*> attributes = m_wellPathAttributeCollection->attributes();
std::sort(attributes.begin(), attributes.end(), [](const RimWellPathAttribute* lhs, const RimWellPathAttribute* rhs)
{
return *lhs < *rhs;
});
m_wellPathAttributePlotObjects.push_back(std::unique_ptr<RiuWellPathComponentPlotItem>(new RiuWellPathComponentPlotItem(wellPathAttributeSource())));
}
for (RimWellPathAttribute* attribute : attributes)
if (m_showWellPathAttributes)
{
if (m_wellPathAttributeCollection)
{
m_wellPathAttributePlotObjects.push_back(std::unique_ptr<RiuWellPathComponentPlotItem>(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), attribute)));
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)
{
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);
}
}
}
if (m_showWellPathAttributesFromCompletions())
if (m_showWellPathCompletions)
{
const RimWellPathCompletions* completionsCollection = wellPathAttributeSource()->completions();
std::vector<const RimWellPathComponentInterface*> allCompletions = completionsCollection->allCompletions();
std::set<QString> completionsAssignedToLegend;
for (const RimWellPathComponentInterface* completion : allCompletions)
{
m_wellPathAttributePlotObjects.push_back(std::unique_ptr<RiuWellPathComponentPlotItem>(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), completion)));
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);
}
}
@ -1844,26 +1870,12 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
this->firstAncestorOrThisOfTypeAsserted(wellLogPlot);
RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType();
int index = 0;
std::set<QString> attributesAssignedToLegend;
for (auto& attributePlotObject : m_wellPathAttributePlotObjects)
{
cvf::Color3f attributeColor = cvf::Color3::LIGHT_GRAY;
if (attributePlotObject->completionType() != RiaDefines::WELL_PATH)
{
attributeColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(++index);
}
attributePlotObject->setBaseColor(attributeColor);
attributePlotObject->setDepthType(depthType);
attributePlotObject->setShowLabel(m_showWellPathAttributeLabels());
QString legendTitle = attributePlotObject->legendTitle();
bool contributeToLegend = m_wellPathAttributesInLegend() &&
!attributesAssignedToLegend.count(legendTitle);
attributePlotObject->setContributeToLegend(contributeToLegend);
attributePlotObject->setShowLabel(m_showWellPathComponentLabels());
attributePlotObject->loadDataAndUpdate(false);
attributePlotObject->setParentQwtPlotNoReplot(m_wellLogTrackPlotWidget);
attributesAssignedToLegend.insert(legendTitle);
attributePlotObject->setParentQwtPlotNoReplot(m_wellLogTrackPlotWidget);
}
}
applyXZoomFromVisibleRange();

View File

@ -213,11 +213,12 @@ private:
caf::PdmField<caf::AppEnum<WidthScaleFactor>> m_widthScaleFactor;
caf::PdmField<bool> m_formationBranchDetection;
caf::PdmField<bool> m_showWellPathAttributes;
caf::PdmField<bool> m_showWellPathAttributesFromCompletions;
caf::PdmField<bool> m_showWellPathAttributeBothSides;
caf::PdmField<bool> m_showWellPathAttributeLabels;
caf::PdmField<bool> m_showWellPathCompletions;
caf::PdmField<bool> m_showWellPathComponentsBothSides;
caf::PdmField<bool> m_showWellPathComponentLabels;
caf::PdmField<bool> m_wellPathAttributesInLegend;
caf::PdmPtrField<RimWellPath*> m_wellPathAttributeSource;
caf::PdmField<bool> m_wellPathCompletionsInLegend;
caf::PdmPtrField<RimWellPath*> m_wellPathComponentSource;
caf::PdmPtrField<RimWellPathAttributeCollection*> m_wellPathAttributeCollection;
std::vector<std::unique_ptr<RiuWellPathComponentPlotItem>> m_wellPathAttributePlotObjects;

View File

@ -44,27 +44,30 @@
//--------------------------------------------------------------------------------------------------
RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem(const RimWellPath* wellPath)
: m_wellPath(wellPath)
, m_completionType(RiaDefines::WELL_PATH)
, m_componentType(RiaDefines::WELL_PATH)
, m_depthType(RimWellLogPlot::MEASURED_DEPTH)
, m_baseColor(cvf::Color4f(cvf::Color3::BLACK))
, m_showLabel(false)
{
CVF_ASSERT(wellPath);
double wellStart = wellPath->wellPathGeometry()->measureDepths().front();
double wellEnd = wellPath->wellPathGeometry()->measureDepths().back();
m_startMD = wellStart;
m_endMD = wellEnd;
m_label = wellPath->name();
m_startMD = wellStart;
m_endMD = wellEnd;
m_label = wellPath->name();
m_legendTitle = "Well Tube";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem(const RimWellPath* wellPath, const RimWellPathComponentInterface* completion)
: m_wellPath(wellPath)
, m_depthType(RimWellLogPlot::MEASURED_DEPTH)
, m_showLabel(false)
{
CVF_ASSERT(wellPath && completion);
m_completionType = completion->componentType();
m_componentType = completion->componentType();
m_startMD = completion->startMD();
m_endMD = completion->endMD();
m_label = completion->componentLabel();
@ -105,7 +108,7 @@ void RiuWellPathComponentPlotItem::loadDataAndUpdate(bool updateParentPlot)
//--------------------------------------------------------------------------------------------------
RiaDefines::WellPathComponentType RiuWellPathComponentPlotItem::completionType() const
{
return m_completionType;
return m_componentType;
}
//--------------------------------------------------------------------------------------------------
@ -117,76 +120,75 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate(bool updateParentPlot)
std::tie(startDepth, endDepth) = depthsOfDepthType();
double midDepth = 0.5 * (startDepth + endDepth);
float columnAlpha = 0.9f;
float completionAlpha = 0.9f;
cvf::Color4f transparentBaseColor = m_baseColor;
transparentBaseColor.a() = 0.0;
if (m_completionType == RiaDefines::WELL_PATH)
if (m_componentType == RiaDefines::WELL_PATH)
{
addColumnFeature(-0.25, 0.25, startDepth, endDepth, m_baseColor);
addColumnFeature(-0.25, 0.25, startDepth, endDepth, componentColor());
}
else if (m_completionType == RiaDefines::CASING)
else if (m_componentType == RiaDefines::CASING)
{
addColumnFeature(-0.75, -0.5, startDepth, endDepth, m_baseColor);
addColumnFeature(0.5, 0.75, startDepth, endDepth, m_baseColor);
addMarker(-0.75, endDepth,10, RiuQwtSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, m_baseColor);
addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, m_baseColor, label());
addColumnFeature(-0.75, -0.5, startDepth, endDepth, componentColor());
addColumnFeature(0.5, 0.75, startDepth, endDepth, componentColor());
addMarker(-0.75, endDepth,10, RiuQwtSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, componentColor());
addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor(), label());
}
else if (m_completionType == RiaDefines::LINER)
else if (m_componentType == RiaDefines::LINER)
{
addColumnFeature(-0.5, -0.25, startDepth, endDepth, m_baseColor);
addColumnFeature(0.25, 0.5, startDepth, endDepth, m_baseColor);
addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, transparentBaseColor, label());
addColumnFeature(-0.5, -0.25, startDepth, endDepth, componentColor());
addColumnFeature(0.25, 0.5, startDepth, endDepth, componentColor());
addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor(0.0), label());
}
else if (m_completionType == RiaDefines::PERFORATION_INTERVAL)
else if (m_componentType == RiaDefines::PERFORATION_INTERVAL)
{
addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::Dense6Pattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::Dense6Pattern);
addColumnFeature(-0.75, -0.25, startDepth, endDepth, componentColor(completionAlpha), Qt::Dense6Pattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, componentColor(completionAlpha), Qt::Dense6Pattern);
// Empirically a spacing of around 30 in depth between symbols looks good in the most relevant zoom levels.
const double markerSpacing = 30;
const int markerSize = 6;
double markerDepth = startDepth;
while (markerDepth <= endDepth)
while (markerDepth < endDepth - 5)
{
addMarker(-0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 1.0f));
addMarker(0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 1.0f));
addMarker(-0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, symbolColor());
addMarker(0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, symbolColor());
markerDepth += markerSpacing;
}
addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 0.0), label());
addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, symbolColor(0.0), label());
QwtPlotItem* legendItem1 = createMarker(16.0, 0.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 1.0f));
QwtPlotItem* legendItem1 = createMarker(16.0, 0.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, symbolColor());
legendItem1->setLegendIconSize(QSize(4, 8));
QwtPlotItem* legendItem2 = createMarker(16.0, 8.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 1.0f));
QwtPlotItem* legendItem2 = createMarker(16.0, 8.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, symbolColor());
legendItem2->setLegendIconSize(QSize(4, 8));
m_combinedAttributeGroup.addLegendItem(legendItem1);
m_combinedAttributeGroup.addLegendItem(legendItem2);
m_combinedComponentGroup.addLegendItem(legendItem1);
m_combinedComponentGroup.addLegendItem(legendItem2);
}
else if (m_completionType == RiaDefines::FISHBONES)
else if (m_componentType == RiaDefines::FISHBONES)
{
addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::BDiagPattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::WHITE, columnAlpha), Qt::FDiagPattern);
addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, cvf::Color4f(cvf::Color3::BLACK, 0.0f), label());
addColumnFeature(-0.75, -0.25, startDepth, endDepth, componentColor(completionAlpha), Qt::BDiagPattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, componentColor(completionAlpha), Qt::FDiagPattern);
addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor(0.0), label());
}
else if (m_completionType == RiaDefines::FRACTURE)
else if (m_componentType == RiaDefines::FRACTURE)
{
addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::ORANGE_RED, columnAlpha), Qt::SolidPattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::ORANGE_RED, columnAlpha), Qt::SolidPattern);
addMarker(0.75, startDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::ORANGE_RED, 1.0f), "", Qt::AlignTop | Qt::AlignRight, Qt::Horizontal, true);
addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::ORANGE_RED, 1.0f), "", Qt::AlignTop | Qt::AlignRight, Qt::Horizontal, true);
addColumnFeature(-0.75, -0.25, startDepth, endDepth, componentColor(completionAlpha), Qt::SolidPattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, componentColor(completionAlpha), Qt::SolidPattern);
addMarker(0.75, startDepth, 10, RiuQwtSymbol::SYMBOL_NONE, componentColor(completionAlpha), "", Qt::AlignTop | Qt::AlignRight, Qt::Horizontal, true);
addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, componentColor(completionAlpha), "", Qt::AlignTop | Qt::AlignRight, Qt::Horizontal, true);
addMarker(0.75, startDepth, 1, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, cvf::Color4f(cvf::Color3::ORANGE_RED, 0.0f), label(), Qt::AlignTop | Qt::AlignRight);
}
else if (m_completionType == RiaDefines::ICD)
else if (m_componentType == RiaDefines::ICD)
{
addMarker(0.0, startDepth, 30, RiuQwtSymbol::SYMBOL_ELLIPSE, m_baseColor, label(), Qt::AlignCenter, Qt::Horizontal);
addMarker(0.0, startDepth, 30, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), label(), Qt::AlignCenter, Qt::Horizontal);
}
else if (m_completionType == RiaDefines::PACKER)
else if (m_componentType == RiaDefines::PACKER)
{
addColumnFeature(-1.0, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::GRAY, 1.0f), Qt::DiagCrossPattern);
addColumnFeature(0.25, 1.0, startDepth, endDepth, cvf::Color4f(cvf::Color3::GRAY, 1.0f), Qt::DiagCrossPattern);
addColumnFeature(-0.75, -0.25, startDepth, endDepth, componentColor(), Qt::DiagCrossPattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, componentColor(), Qt::DiagCrossPattern);
addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor(0.0), label());
}
m_combinedAttributeGroup.setTitle(legendTitle());
m_combinedAttributeGroup.setLegendIconSize(QSize(20, 16));
m_combinedComponentGroup.setTitle(legendTitle());
m_combinedComponentGroup.setLegendIconSize(QSize(20, 16));
}
//--------------------------------------------------------------------------------------------------
@ -222,7 +224,7 @@ void RiuWellPathComponentPlotItem::addMarker(double posX,
bool contrastTextColor /*= true*/)
{
QwtPlotItem* marker = createMarker(posX, depth, size, symbolType, baseColor, label, labelAlignment, labelOrientation, drawLine, contrastTextColor);
m_combinedAttributeGroup.addPlotItem(marker);
m_combinedComponentGroup.addPlotItem(marker);
}
//--------------------------------------------------------------------------------------------------
@ -269,28 +271,28 @@ QwtPlotItem* RiuWellPathComponentPlotItem::createMarker(double posX, double dept
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::addColumnFeature(double startX,
double endX,
double startDepth,
double endDepth,
cvf::Color4f baseColor,
Qt::BrushStyle brushStyle /*= Qt::SolidPattern*/)
double endX,
double startDepth,
double endDepth,
cvf::Color4f baseColor,
Qt::BrushStyle brushStyle /*= Qt::SolidPattern*/)
{
QwtPlotItem* backgroundShape = createColumnShape(startX, endX, startDepth, endDepth, baseColor, Qt::SolidPattern);
m_combinedAttributeGroup.addPlotItem(backgroundShape);
if (startX >= 0.0)
m_combinedComponentGroup.addPlotItem(backgroundShape);
if (endX >= 0.0)
{
QwtPlotItem* legendShape = createColumnShape(0.0, 16.0, 0.0, 16.0, baseColor, Qt::SolidPattern);
m_combinedAttributeGroup.addLegendItem(legendShape);
m_combinedComponentGroup.addLegendItem(legendShape);
}
if (brushStyle != Qt::SolidPattern)
{
// If we're doing a special pattern, draw the pattern in black over the existing pattern
QwtPlotItem* patternShape = createColumnShape(startX, endX, startDepth, endDepth, cvf::Color4f(cvf::Color3::BLACK), brushStyle);
m_combinedAttributeGroup.addPlotItem(patternShape);
if (startX >= 0.0)
m_combinedComponentGroup.addPlotItem(patternShape);
if (endX >= 0.0)
{
QwtPlotItem* legendShape = createColumnShape(0.0, 16.0, 0.0, 16.0, cvf::Color4f(cvf::Color3::BLACK), brushStyle);
m_combinedAttributeGroup.addLegendItem(legendShape);
m_combinedComponentGroup.addLegendItem(legendShape);
}
}
}
@ -322,6 +324,35 @@ QwtPlotItem* RiuWellPathComponentPlotItem::createColumnShape(double star
return columnShape;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color4f RiuWellPathComponentPlotItem::componentColor(float alpha /*= 1.0*/) const
{
const std::map<RiaDefines::WellPathComponentType, cvf::Color3::ColorIdent> colors
= {
{RiaDefines::WELL_PATH, cvf::Color3::LIGHT_GRAY},
{RiaDefines::CASING, cvf::Color3::SEA_GREEN},
{RiaDefines::LINER, cvf::Color3::OLIVE},
{RiaDefines::PACKER, cvf::Color3::GRAY},
{RiaDefines::PERFORATION_INTERVAL, cvf::Color3::WHITE},
{RiaDefines::FISHBONES, cvf::Color3::WHITE},
{RiaDefines::FRACTURE, cvf::Color3::ORANGE_RED},
{RiaDefines::ICD, cvf::Color3::GREEN},
{RiaDefines::AICD, cvf::Color3::BLUE},
{RiaDefines::ICV, cvf::Color3::YELLOW}
};
return cvf::Color4f(cvf::Color3f(colors.at(m_componentType)), alpha);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color4f RiuWellPathComponentPlotItem::symbolColor(float alpha) const
{
return cvf::Color4f(cvf::Color3f(cvf::Color3::BLACK), alpha);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -364,32 +395,12 @@ void RiuWellPathComponentPlotItem::setDepthType(RimWellLogPlot::DepthTypeEnum de
m_depthType = depthType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::setBaseColor(const cvf::Color3f& baseColor)
{
m_baseColor = cvf::Color4f(baseColor);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::setBaseColor(const cvf::Color4f& baseColor)
{
m_baseColor = baseColor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::setContributeToLegend(bool contributeToLegend)
{
bool actuallyContributeToLegend = contributeToLegend && (m_completionType == RiaDefines::FISHBONES ||
m_completionType == RiaDefines::FRACTURE ||
m_completionType == RiaDefines::PERFORATION_INTERVAL ||
m_completionType == RiaDefines::PACKER);
m_combinedAttributeGroup.setItemAttribute(QwtPlotItem::Legend, actuallyContributeToLegend);
m_combinedComponentGroup.setItemAttribute(QwtPlotItem::Legend, contributeToLegend);
}
//--------------------------------------------------------------------------------------------------
@ -420,7 +431,7 @@ void RiuWellPathComponentPlotItem::attachToQwt()
{
if (m_parentQwtPlot)
{
m_combinedAttributeGroup.attach(m_parentQwtPlot);
m_combinedComponentGroup.attach(m_parentQwtPlot);
}
}
@ -429,7 +440,7 @@ void RiuWellPathComponentPlotItem::attachToQwt()
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::detachFromQwt()
{
m_combinedAttributeGroup.detach();
m_combinedComponentGroup.detach();
}
//--------------------------------------------------------------------------------------------------

View File

@ -53,7 +53,7 @@ public:
RiuWellPathComponentPlotItem(const RimWellPath* wellPath);
RiuWellPathComponentPlotItem(const RimWellPath* wellPath,
const RimWellPathComponentInterface* completion);
const RimWellPathComponentInterface* completion);
~RiuWellPathComponentPlotItem();
@ -69,8 +69,6 @@ public:
void setShowLabel(bool showLabel);
void setDepthType(RimWellLogPlot::DepthTypeEnum depthType);
void setBaseColor(const cvf::Color3f& baseColor);
void setBaseColor(const cvf::Color4f& baseColor);
void setContributeToLegend(bool contributeToLegend);
void setParentQwtPlotAndReplot(QwtPlot* plot);
@ -118,10 +116,12 @@ private:
cvf::Color4f baseColor,
Qt::BrushStyle brushStyle = Qt::SolidPattern);
cvf::Color4f componentColor(float alpha = 1.0) const;
cvf::Color4f symbolColor(float alpha = 1.0) const;
private:
const RimWellPath* m_wellPath;
RiaDefines::WellPathComponentType m_completionType;
RiaDefines::WellPathComponentType m_componentType;
double m_startMD;
double m_endMD;
QString m_label;
@ -129,8 +129,7 @@ private:
RimWellLogPlot::DepthTypeEnum m_depthType;
QPointer<QwtPlot> m_parentQwtPlot;
RiuQwtPlotItemGroup m_combinedAttributeGroup;
cvf::Color4f m_baseColor;
RiuQwtPlotItemGroup m_combinedComponentGroup;
bool m_showLabel;
};