#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

@@ -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;
};