#3492 Tidy up color code for well path components/completions and select colors that work better.

This commit is contained in:
Gaute Lindkvist 2018-10-11 16:03:49 +02:00
parent 8464d19696
commit 2035df2739
18 changed files with 139 additions and 114 deletions

View File

@ -76,23 +76,6 @@ namespace caf
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RiaDefines::WellPathComponentType> RiaDefines::wellPathCompletionTypes()
{
return { PERFORATION_INTERVAL, FISHBONES, FRACTURE, ICD, AICD, ICV };
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RiaDefines::WellPathComponentType> RiaDefines::wellPathAttributeTypes()
{
return { CASING, LINER, PACKER };
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -55,8 +55,6 @@ namespace RiaDefines
LINER,
PACKER
};
std::vector<WellPathComponentType> wellPathCompletionTypes();
std::vector<WellPathComponentType> wellPathAttributeTypes();
bool isPerCellFaceResult(const QString& resultName);

View File

@ -511,15 +511,20 @@ cvf::Color3f RiaColorTables::undefinedCellColor()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiaColorTables::perforationLengthColor()
RiaColorTables::WellPathComponentColors RiaColorTables::wellPathComponentColors()
{
// based on hwb ( 85, 9%, 67%) dark_olive_green
// added 10 to each component
cvf::Color3ub color(69, 94, 33);
return cvf::Color3f(color);
return {{RiaDefines::WELL_PATH, cvf::Color3::CEETRON},
{RiaDefines::PERFORATION_INTERVAL, cvf::Color3::DARK_MAGENTA},
{RiaDefines::FISHBONES, cvf::Color3::DARK_GREEN},
{RiaDefines::FRACTURE, cvf::Color3::CRIMSON},
{RiaDefines::ICD, cvf::Color3::DARK_ORANGE},
{RiaDefines::AICD, cvf::Color3::INDIGO},
{RiaDefines::ICV, cvf::Color3::ORCHID},
{RiaDefines::CASING, cvf::Color3::SEA_GREEN},
{RiaDefines::LINER, cvf::Color3::OLIVE},
{RiaDefines::PACKER, cvf::Color3::GRAY}};
}
//--------------------------------------------------------------------------------------------------

View File

@ -18,8 +18,9 @@
#pragma once
#include "RiaDefines.h"
#include "cafColorTable.h"
#include <map>
//==================================================================================================
///
@ -28,6 +29,8 @@
class RiaColorTables
{
public:
typedef std::map<RiaDefines::WellPathComponentType, cvf::Color3::ColorIdent> WellPathComponentColors;
static const caf::ColorTable& normalPaletteColors();
static const caf::ColorTable& normalPaletteOppositeOrderingColors();
static const caf::ColorTable& blackWhitePaletteColors();
@ -57,7 +60,8 @@ public:
static const caf::ColorTable& wellPathsPaletteColors();
static cvf::Color3f undefinedCellColor();
static cvf::Color3f perforationLengthColor();
static WellPathComponentColors wellPathComponentColors();
private:
static std::vector<cvf::Color3ub> categoryColors();

View File

@ -18,13 +18,15 @@
#include "Riv3dWellLogCurveGeometryGenerator.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiaCurveDataTools.h"
#include "RigWellPath.h"
#include "RigWellPathGeometryTools.h"
#include "Rim3dWellLogCurve.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "cafLine.h"
#include "cafDisplayCoordTransform.h"
#include "cvfPrimitiveSetIndexedUInt.h"

View File

@ -967,7 +967,7 @@ void RivWellFracturePartMgr::appendFracturePerforationLengthParts(const RimEclip
RivPipeGeometryGenerator geoGenerator;
geoGenerator.cylinderWithCenterLineParts(
&parts, displayCoords, RiaColorTables::perforationLengthColor(), perforationRadius);
&parts, displayCoords, RiaColorTables::wellPathComponentColors()[RiaDefines::PERFORATION_INTERVAL], perforationRadius);
for (auto part : parts)
{

View File

@ -18,6 +18,7 @@
#include "RimFishbonesMultipleSubs.h"
#include "RiaColorTables.h"
#include "RigFishbonesGeometry.h"
#include "RigWellPath.h"
#include "RimProject.h"
@ -71,7 +72,8 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
m_name.uiCapability()->setUiReadOnly(true);
m_name.xmlCapability()->setIOWritable(false);
CAF_PDM_InitField(&fishbonesColor, "Color", cvf::Color3f(0.999f, 0.333f, 0.999f), "Fishbones Color", "", "", "");
cvf::Color3f defaultColor = RiaColorTables::wellPathComponentColors()[RiaDefines::FISHBONES];
CAF_PDM_InitField(&fishbonesColor, "Color", defaultColor, "Fishbones Color", "", "", "");
CAF_PDM_InitField(&m_lateralCountPerSub, "LateralCountPerSub", 3, "Laterals Per Sub", "", "", "");
CAF_PDM_InitField(&m_lateralLength, "LateralLength", QString("11.0"), "Length(s) [m]", "", "Specify multiple length values if the sub lengths differ", "");

View File

@ -19,6 +19,7 @@
#include "RimFracture.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaCompletionTypeCalculationScheduler.h"
#include "RiaEclipseUnitTools.h"
#include "RiaLogging.h"
@ -314,7 +315,7 @@ QString RimFracture::componentTypeLabel() const
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimFracture::defaultComponentColor() const
{
return cvf::Color3f(cvf::Color3::ORANGE_RED);
return RiaColorTables::wellPathComponentColors()[componentType()];
}
//--------------------------------------------------------------------------------------------------

View File

@ -19,6 +19,7 @@
#include "RimPerforationInterval.h"
#include "RiaColorTables.h"
#include "RigWellPath.h"
#include "RigCaseCellResultsData.h"
@ -259,7 +260,7 @@ QString RimPerforationInterval::componentTypeLabel() const
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimPerforationInterval::defaultComponentColor() const
{
return cvf::Color3f(cvf::Color3::GREEN);
return RiaColorTables::wellPathComponentColors()[componentType()];
}
//--------------------------------------------------------------------------------------------------

View File

@ -19,6 +19,7 @@
#include "RimWellPathValve.h"
#include "RiaDefines.h"
#include "RiaColorTables.h"
#include "RiaEclipseUnitTools.h"
#include "RigWellPath.h"
@ -89,19 +90,7 @@ QString RimWellPathValve::componentTypeLabel() const
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimWellPathValve::defaultComponentColor() const
{
switch (m_type())
{
case RiaDefines::ICD:
return cvf::Color3f(cvf::Color3::DARK_BLUE);
case RiaDefines::AICD:
return cvf::Color3f(cvf::Color3::BROWN);
case RiaDefines::ICV:
return cvf::Color3f(cvf::Color3::DARK_VIOLET);
default:
break;
}
CVF_ASSERT(false);
return cvf::Color3f(cvf::Color3::BLACK);
return RiaColorTables::wellPathComponentColors()[componentType()];
}
//--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,7 @@
#include "RiaPreferences.h"
#include "RiaViewRedrawScheduler.h"
#include "Rim3dWellLogCurve.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimMainPlotCollection.h"

View File

@ -20,6 +20,7 @@
#include "RimEclipseCellColors.h"
#include "RiaColorTables.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResults.h"
@ -392,34 +393,22 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
legendConfig->setNamedCategoriesInverse(fnVector);
}
else if ( this->resultType() == RiaDefines::DYNAMIC_NATIVE && this->resultVariable() == RiaDefines::completionTypeResultName() )
{
std::vector< std::tuple<QString, int, cvf::Color3ub> > categories;
caf::AppEnum<RiaDefines::WellPathComponentType> wellPath(RiaDefines::WELL_PATH);
caf::AppEnum<RiaDefines::WellPathComponentType> fishbone(RiaDefines::FISHBONES);
caf::AppEnum<RiaDefines::WellPathComponentType> perforationInterval(RiaDefines::PERFORATION_INTERVAL);
caf::AppEnum<RiaDefines::WellPathComponentType> fracture(RiaDefines::FRACTURE);
{
const std::vector<int>& visibleCategories = cellResultsData->uniqueCellScalarValues(this->scalarResultIndex());
if (std::find(visibleCategories.begin(), visibleCategories.end(), wellPath.index()) != visibleCategories.end())
std::vector<RiaDefines::WellPathComponentType> supportedCompletionTypes =
{ RiaDefines::WELL_PATH, RiaDefines::FISHBONES, RiaDefines::PERFORATION_INTERVAL, RiaDefines::FRACTURE };
RiaColorTables::WellPathComponentColors colors = RiaColorTables::wellPathComponentColors();
std::vector< std::tuple<QString, int, cvf::Color3ub> > categories;
for (auto completionType : supportedCompletionTypes)
{
categories.push_back(std::make_tuple(wellPath.uiText(), static_cast<int>(wellPath.index()), cvf::Color3::RED));
}
if (std::find(visibleCategories.begin(), visibleCategories.end(), fishbone.index()) != visibleCategories.end())
{
categories.push_back(std::make_tuple(fishbone.uiText(), static_cast<int>(fishbone.index()), cvf::Color3::DARK_GREEN));
}
if (std::find(visibleCategories.begin(), visibleCategories.end(), perforationInterval.index()) != visibleCategories.end())
{
categories.push_back(std::make_tuple(perforationInterval.uiText(), static_cast<int>(perforationInterval.index()), cvf::Color3::GREEN));
}
if (std::find(visibleCategories.begin(), visibleCategories.end(), fracture.index()) != visibleCategories.end())
{
categories.push_back(std::make_tuple(fracture.uiText(), static_cast<int>(fracture.index()), cvf::Color3::YELLOW_GREEN));
if (std::find(visibleCategories.begin(), visibleCategories.end(), completionType) != visibleCategories.end())
{
QString categoryText = caf::AppEnum<RiaDefines::WellPathComponentType>::uiText(completionType);
categories.push_back(std::make_tuple(categoryText, completionType, colors[completionType]));
}
}
legendConfig->setCategoryItems(categories);

View File

@ -391,13 +391,17 @@ void RimEclipsePropertyFilter::computeResultValueRange()
}
else if (resultDefinition->resultVariable() == RiaDefines::completionTypeResultName())
{
std::vector<QString> ctNames;
ctNames.push_back(caf::AppEnum<RiaDefines::WellPathComponentType>::uiText(RiaDefines::WELL_PATH));
for (RiaDefines::WellPathComponentType type : RiaDefines::wellPathCompletionTypes())
std::vector<RiaDefines::WellPathComponentType> componentTypes =
{
RiaDefines::WELL_PATH, RiaDefines::PERFORATION_INTERVAL,
RiaDefines::FISHBONES, RiaDefines::FRACTURE
};
std::vector<std::pair<QString, int>> ctNamesAndValues;
for (RiaDefines::WellPathComponentType type : componentTypes)
{
ctNames.push_back(caf::AppEnum<RiaDefines::WellPathComponentType>::uiText(type));
ctNamesAndValues.push_back(std::make_pair(caf::AppEnum<RiaDefines::WellPathComponentType>::uiText(type), type));
}
setCategoryNames(ctNames);
setCategoryNamesAndValues(ctNamesAndValues);
}
else
{

View File

@ -21,6 +21,7 @@
#include "RimWellPath.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaSimWellBranchTools.h"
#include "RiaWellNameComparer.h"
@ -190,6 +191,62 @@ double RimWellPath::wellPathRadiusScaleFactor() const
return m_wellPathRadiusScaleFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::WellPathComponentType RimWellPath::componentType() const
{
return RiaDefines::WELL_PATH;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPath::componentLabel() const
{
return name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPath::componentTypeLabel() const
{
return "Well Path";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimWellPath::defaultComponentColor() const
{
return RiaColorTables::wellPathComponentColors()[componentType()];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPath::startMD() const
{
if (wellPathGeometry())
{
return wellPathGeometry()->measureDepths().front();
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPath::endMD() const
{
if (wellPathGeometry())
{
return wellPathGeometry()->measureDepths().back();
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -22,7 +22,7 @@
#include "RiaEclipseUnitTools.h"
#include "Rim3dWellLogCurve.h"
#include "RimWellPathComponentInterface.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
@ -53,13 +53,14 @@ class RimWellPathCompletions;
class RigWellPathFormations;
class RimWellPathFractureCollection;
class Rim3dWellLogCurve;
class Rim3dWellLogCurveCollection;
//==================================================================================================
///
///
//==================================================================================================
class RimWellPath : public caf::PdmObject
class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface
{
CAF_PDM_HEADER_INIT;
@ -120,6 +121,15 @@ public:
double combinedScaleFactor() const;
double wellPathRadius(double characteristicCellSize) const;
double wellPathRadiusScaleFactor() const;
// RimWellPathComponentInterface overrides
RiaDefines::WellPathComponentType componentType() const override;
QString componentLabel() const override;
QString componentTypeLabel() const override;
cvf::Color3f defaultComponentColor() const override;
double startMD() const override;
double endMD() const override;
protected:

View File

@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathAttribute.h"
#include "RiaColorTables.h"
#include "RigWellPath.h"
#include "RimProject.h"
@ -124,19 +125,7 @@ QString RimWellPathAttribute::componentTypeLabel() const
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimWellPathAttribute::defaultComponentColor() const
{
switch (m_type())
{
case RiaDefines::CASING:
return cvf::Color3::FOREST_GREEN;
case RiaDefines::LINER:
return cvf::Color3::OLIVE;
case RiaDefines::PACKER:
return cvf::Color3::GRAY;
default:
break;
}
CVF_ASSERT(false);
return cvf::Color3f(cvf::Color3::BLACK);
return RiaColorTables::wellPathComponentColors()[componentType()];
}
//--------------------------------------------------------------------------------------------------

View File

@ -18,6 +18,7 @@
#include "RiuWellPathComponentPlotItem.h"
#include "RiaColorTables.h"
#include "RiaColorTools.h"
#include "RimFishbonesMultipleSubs.h"
@ -45,7 +46,6 @@
RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem(const RimWellPath* wellPath)
: m_wellPath(wellPath)
, m_componentType(RiaDefines::WELL_PATH)
, m_baseColor(cvf::Color3f(cvf::Color3::LIGHT_GRAY))
, m_depthType(RimWellLogPlot::MEASURED_DEPTH)
, m_showLabel(false)
{
@ -71,7 +71,6 @@ RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem(const RimWellPath* we
m_componentType = component->componentType();
m_label = component->componentLabel();
m_legendTitle = component->componentTypeLabel();
m_baseColor = component->defaultComponentColor();
m_startMD = component->startMD();
m_endMD = component->endMD();
}
@ -149,16 +148,16 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate(bool updateParentPlot)
double markerDepth = startDepth;
while (markerDepth < endDepth - 5)
{
addMarker(-0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, symbolColor());
addMarker(0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, symbolColor());
addMarker(-0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, componentColor());
addMarker(0.75, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, componentColor());
markerDepth += markerSpacing;
}
addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, symbolColor(0.0), label());
addMarker(0.75, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, componentColor(0.0), label());
QwtPlotItem* legendItem1 = createMarker(16.0, 0.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, symbolColor());
QwtPlotItem* legendItem1 = createMarker(16.0, 0.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, componentColor());
legendItem1->setLegendIconSize(QSize(4, 8));
QwtPlotItem* legendItem2 = createMarker(16.0, 8.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, symbolColor());
QwtPlotItem* legendItem2 = createMarker(16.0, 8.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, componentColor());
legendItem2->setLegendIconSize(QSize(4, 8));
m_combinedComponentGroup.addLegendItem(legendItem1);
m_combinedComponentGroup.addLegendItem(legendItem2);
@ -175,7 +174,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate(bool updateParentPlot)
addColumnFeature(0.25, 0.75, startDepth, endDepth, componentColor(), Qt::SolidPattern);
addMarker(0.75, startDepth, 10, RiuQwtSymbol::SYMBOL_NONE, componentColor(), "", Qt::AlignTop | Qt::AlignRight, Qt::Horizontal, true);
addMarker(0.75, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, componentColor(), "", 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);
addMarker(0.75, startDepth, 1, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor(0.0f), label(), Qt::AlignTop | Qt::AlignRight);
}
else if (m_componentType == RiaDefines::ICD)
{
@ -295,14 +294,14 @@ void RiuWellPathComponentPlotItem::addColumnFeature(double startX,
QwtPlotItem* backgroundShape = createColumnShape(startX, endX, startDepth, endDepth, semiTransparentWhite, Qt::SolidPattern);
m_combinedComponentGroup.addPlotItem(backgroundShape);
QwtPlotItem* patternShape = createColumnShape(startX, endX, startDepth, endDepth, cvf::Color4f(cvf::Color3::BLACK), brushStyle);
QwtPlotItem* patternShape = createColumnShape(startX, endX, startDepth, endDepth, baseColor, brushStyle);
m_combinedComponentGroup.addPlotItem(patternShape);
if (endX >= 0.0)
{
QwtPlotItem* legendBGShape = createColumnShape(0.0, 16.0, 0.0, 16.0, semiTransparentWhite, Qt::SolidPattern);
m_combinedComponentGroup.addLegendItem(legendBGShape);
QwtPlotItem* legendShape = createColumnShape(0.0, 16.0, 0.0, 16.0, cvf::Color4f(cvf::Color3::BLACK), brushStyle);
QwtPlotItem* legendShape = createColumnShape(0.0, 16.0, 0.0, 16.0, baseColor, brushStyle);
m_combinedComponentGroup.addLegendItem(legendShape);
}
}
@ -351,15 +350,7 @@ QwtPlotItem* RiuWellPathComponentPlotItem::createColumnShape(double star
//--------------------------------------------------------------------------------------------------
cvf::Color4f RiuWellPathComponentPlotItem::componentColor(float alpha /*= 1.0*/) const
{
return cvf::Color4f(m_baseColor, alpha);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color4f RiuWellPathComponentPlotItem::symbolColor(float alpha) const
{
return cvf::Color4f(cvf::Color3f(cvf::Color3::BLACK), alpha);
return cvf::Color4f(RiaColorTables::wellPathComponentColors()[m_componentType], alpha);
}
//--------------------------------------------------------------------------------------------------

View File

@ -117,7 +117,7 @@ private:
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;
@ -126,7 +126,6 @@ private:
double m_endMD;
QString m_label;
QString m_legendTitle;
cvf::Color3f m_baseColor;
RimWellLogPlot::DepthTypeEnum m_depthType;
QPointer<QwtPlot> m_parentQwtPlot;