#3443 MSW: Visualise perforations, fishbones, packers and fractures in well log plots

This commit is contained in:
Gaute Lindkvist 2018-10-03 15:57:09 +02:00
parent 71a1bd98ab
commit fbc49e2b02
19 changed files with 862 additions and 350 deletions

View File

@ -88,3 +88,21 @@ cvf::Color3f RiaColorTools::constrastColor(cvf::Color3f backgroundColor)
return brightContrastColor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QColor RiaColorTools::toQColor(cvf::Color3f color, float alpha)
{
QColor qcolor(color.rByte(), color.gByte(), color.bByte());
qcolor.setAlphaF(alpha);
return qcolor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QColor RiaColorTools::toQColor(cvf::Color4f color)
{
return toQColor(color.toColor3f(), color.a());
}

View File

@ -21,6 +21,7 @@
#include "cvfBase.h"
#include "cvfArray.h"
#include <QColor>
//==================================================================================================
///
@ -35,4 +36,6 @@ public:
static cvf::Color3f darkContrastColor();
static cvf::Color3f brightContrastColor();
static cvf::Color3f constrastColor(cvf::Color3f backgroundColor);
static QColor toQColor(cvf::Color3f color, float alpha = 1.0f);
static QColor toQColor(cvf::Color4f color);
};

View File

@ -29,7 +29,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDef.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathTarget.h
${CMAKE_CURRENT_LIST_DIR}/RimScriptCollection.h
@ -151,7 +150,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDef.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathTarget.cpp
${CMAKE_CURRENT_LIST_DIR}/RimScriptCollection.cpp

View File

@ -210,3 +210,17 @@ void RimMainPlotCollection::updatePlotsWithFormations()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMainPlotCollection::updatePlotsWithCompletions()
{
if (m_wellLogPlotCollection)
{
for (RimWellLogPlot* wellLogPlot : m_wellLogPlotCollection->wellLogPlots())
{
wellLogPlot->loadDataAndUpdate();
}
}
}

View File

@ -59,7 +59,7 @@ public:
void deleteAllContainedObjects();
void updateCurrentTimeStepInPlots();
void updatePlotsWithFormations();
void updatePlotsWithCompletions();
private:
// Overridden PDM methods

View File

@ -848,6 +848,8 @@ void RimProject::reloadCompletionTypeResultsInAllViews()
{
scheduleCreateDisplayModelAndRedrawAllViews();
RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews();
this->mainPlotCollection()->updatePlotsWithCompletions();
}
//--------------------------------------------------------------------------------------------------

View File

@ -116,7 +116,7 @@ public:
void allVisibleGridViews(std::vector<RimGridView*>& views);
void allNotLinkedViews(std::vector<RimGridView*>& views);
void scheduleCreateDisplayModelAndRedrawAllViews();
void scheduleCreateDisplayModelAndRedrawAllViews();
void computeUtmAreaOfInterest();

View File

@ -44,21 +44,28 @@
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimMainPlotCollection.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellPathAttribute.h"
#include "RimWellPathAttributeCurve.h"
#include "RimWellPathAttributeCollection.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
#include "RimWellFlowRateCurve.h"
#include "RimWellLogCurve.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCompletions.h"
#include "RimWellPltPlot.h"
#include "RimWellRftPlot.h"
#include "RiuMainWindow.h"
#include "RiuPlotAnnotationTool.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuWellPathAttributePlotObject.h"
#include "RiuWellLogPlot.h"
#include "RiuWellLogTrack.h"
@ -180,13 +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_InitFieldNoDefault(&m_wellPathAttributeCollection, "AttributesCollection", "Well Attributes", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPathAttributeCurves, "AttributeCurves", "", "", "", "");
m_wellPathAttributeCurves.uiCapability()->setUiHidden(true);
m_wellPathAttributeCurves.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_widthScaleFactor, "Width", "Track Width", "", "Set width of track. ", "");
@ -419,8 +425,10 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{
loadDataAndUpdate();
}
else if (changedField == &m_showWellPathAttributes ||
else if (changedField == &m_showWellPathAttributes ||
changedField == &m_showWellPathAttributesFromCompletions ||
changedField == &m_showWellPathAttributeBothSides ||
changedField == &m_showWellPathAttributeLabels ||
changedField == &m_wellPathAttributesInLegend)
{
updateWellPathAttributesOnPlot();
@ -684,12 +692,7 @@ void RimWellLogTrack::availableDepthRange(double* minimumDepth, double* maximumD
double minDepth = HUGE_VAL;
double maxDepth = -HUGE_VAL;
std::vector<RimPlotCurve*> allCurves;
allCurves.insert(allCurves.end(), curves.begin(), curves.end());
allCurves.insert(allCurves.end(), m_wellPathAttributeCurves.begin(), m_wellPathAttributeCurves.end());
for (RimPlotCurve* curve : allCurves)
for (RimPlotCurve* curve : curves)
{
double minCurveDepth = HUGE_VAL;
double maxCurveDepth = -HUGE_VAL;
@ -708,6 +711,27 @@ void RimWellLogTrack::availableDepthRange(double* minimumDepth, double* maximumD
}
}
if (m_showWellPathAttributes)
{
for (RiuWellPathAttributePlotObject& plotObject : m_wellPathAttributePlotObjects)
{
double minObjectDepth = HUGE_VAL;
double maxObjectDepth = -HUGE_VAL;
if (plotObject.yValueRange(&minObjectDepth, &maxObjectDepth))
{
if (minObjectDepth < minDepth)
{
minDepth = minObjectDepth;
}
if (maxObjectDepth > maxDepth)
{
maxDepth = maxObjectDepth;
}
}
}
}
*minimumDepth = minDepth;
*maximumDepth = maxDepth;
}
@ -946,9 +970,9 @@ void RimWellLogTrack::detachAllCurves()
{
curve->detachQwtCurve();
}
for (RimPlotCurve* curve : m_wellPathAttributeCurves)
for (RiuWellPathAttributePlotObject& plotObjects : m_wellPathAttributePlotObjects)
{
curve->detachQwtCurve();
plotObjects.detachFromQwt();
}
}
@ -961,9 +985,9 @@ void RimWellLogTrack::reattachAllCurves()
{
curve->reattachQwtCurve();
}
for (RimPlotCurve* curve : m_wellPathAttributeCurves)
for (RiuWellPathAttributePlotObject& plotObjects : m_wellPathAttributePlotObjects)
{
curve->reattachQwtCurve();
plotObjects.reattachToQwt();
}
}
@ -1002,21 +1026,13 @@ void RimWellLogTrack::applyXZoomFromVisibleRange()
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
// Attribute range. Double the width of the radius (thus same as diameter) to allow for labels and casing shoe.
double attributeRangeMax = RimWellPathAttribute::MAX_DIAMETER_IN_INCHES;
double attributeRangeMin = 0.0;
double attributeRangeMax = 1.0;
double attributeRangeMin = -0.25;
if (m_showWellPathAttributeBothSides)
{
attributeRangeMin = -attributeRangeMax;
}
else if (m_wellPathAttributeCollection)
{
attributeRangeMax = 0.75 * RimWellPathAttribute::MAX_DIAMETER_IN_INCHES;
attributeRangeMin = 0.5 * RimWellPathAttribute::MAX_DIAMETER_IN_INCHES;
for (const RimWellPathAttribute* attribute : m_wellPathAttributeCollection->attributes())
{
attributeRangeMin = std::min(attributeRangeMin, attribute->diameterInInches() * 0.5);
}
}
m_wellLogTrackPlotWidget->setXRange(attributeRangeMin, attributeRangeMax, QwtPlot::xBottom);
m_wellLogTrackPlotWidget->replot();
@ -1178,17 +1194,25 @@ void RimWellLogTrack::setShowFormationLabels(bool on)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setShowWellPathAttributes(bool on)
bool RimWellLogTrack::showWellPathAttributes() const
{
m_showWellPathAttributes = on;
return m_showWellPathAttributes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::showWellPathAttributes() const
bool RimWellLogTrack::showWellPathAttributesBothSides() const
{
return m_showWellPathAttributes;
return m_showWellPathAttributeBothSides;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setShowWellPathAttributes(bool on)
{
m_showWellPathAttributes = on;
}
//--------------------------------------------------------------------------------------------------
@ -1280,7 +1304,9 @@ 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);
@ -1782,59 +1808,73 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateWellPathAttributesOnPlot()
{
for (RimWellPathAttributeCurve* curve : m_wellPathAttributeCurves)
{
curve->detachQwtCurve();
}
m_wellPathAttributeCurves.deleteAllChildObjects();
{
m_wellPathAttributePlotObjects.clear();
if (m_showWellPathAttributes)
{
if (m_showWellPathAttributes && wellPathAttributeSource())
{
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource()));
if (m_wellPathAttributeCollection)
{
int index = 0;
for (RimWellPathAttribute* attribute : m_wellPathAttributeCollection->attributes())
{
cvf::Color3f curveColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(index++);
{
RimWellPathAttributeCurve* positiveCurve = new RimWellPathAttributeCurve(
attribute, RimWellPathAttributeCurve::PositiveSide, RimWellPathAttributeCurve::LineCurve);
RimWellPathAttributeCurve* negativeCurve = new RimWellPathAttributeCurve(
attribute, RimWellPathAttributeCurve::NegativeSide, RimWellPathAttributeCurve::LineCurve);
positiveCurve->setColor(curveColor);
negativeCurve->setColor(curveColor);
positiveCurve->showLegend(m_wellPathAttributesInLegend());
negativeCurve->showLegend(false);
m_wellPathAttributeCurves.push_back(positiveCurve);
m_wellPathAttributeCurves.push_back(negativeCurve);
}
if (attribute->type() == RimWellPathAttribute::AttributeCasing)
std::vector<RimWellPathAttribute*> attributes = m_wellPathAttributeCollection->attributes();
std::sort(attributes.begin(), attributes.end(), [](const RimWellPathAttribute* lhs, const RimWellPathAttribute* rhs)
{
return *lhs < *rhs;
});
for (RimWellPathAttribute* attribute : attributes)
{
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource(), attribute));
}
}
if (m_showWellPathAttributesFromCompletions())
{
const RimWellPathCompletions* completions = wellPathAttributeSource()->completions();
{
RimPerforationCollection* perforationsCollection = completions->perforationCollection();
for (const RimPerforationInterval* perforationInterval : perforationsCollection->perforations())
{
RimWellPathAttributeCurve* positiveSymbol = new RimWellPathAttributeCurve(
attribute, RimWellPathAttributeCurve::PositiveSide, RimWellPathAttributeCurve::MarkerSymbol);
RimWellPathAttributeCurve* negativeSymbol = new RimWellPathAttributeCurve(
attribute, RimWellPathAttributeCurve::NegativeSide, RimWellPathAttributeCurve::MarkerSymbol);
positiveSymbol->setColor(curveColor);
negativeSymbol->setColor(curveColor);
positiveSymbol->showLegend(false);
negativeSymbol->showLegend(false);
m_wellPathAttributeCurves.push_back(positiveSymbol);
m_wellPathAttributeCurves.push_back(negativeSymbol);
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource(), perforationInterval));
}
}
{
RimFishbonesCollection* fishbonesCollection = completions->fishbonesCollection();
for (const RimFishbonesMultipleSubs* fishbones : fishbonesCollection->activeFishbonesSubs())
{
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource(), fishbones));
}
}
{
RimWellPathFractureCollection* fractureCollection = completions->fractureCollection();
for (const RimFracture* fracture : fractureCollection->activeFractures())
{
m_wellPathAttributePlotObjects.push_back(RiuWellPathAttributePlotObject(wellPathAttributeSource(), fracture));
}
}
}
for (RimWellPathAttributeCurve* curve : m_wellPathAttributeCurves)
RimWellLogPlot* wellLogPlot;
this->firstAncestorOrThisOfTypeAsserted(wellLogPlot);
RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType();
int index = 0;
for (RiuWellPathAttributePlotObject& attributePlotObject : m_wellPathAttributePlotObjects)
{
curve->loadDataAndUpdate(false);
if (m_wellLogTrackPlotWidget)
cvf::Color3f attributeColor = cvf::Color3::LIGHT_GRAY;
if (attributePlotObject.attributeType() != RimWellPathAttribute::AttributeWellTube)
{
curve->setParentQwtPlotNoReplot(m_wellLogTrackPlotWidget);
attributeColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(++index);
}
}
applyXZoomFromVisibleRange();
attributePlotObject.setBaseColor(attributeColor);
attributePlotObject.setDepthType(depthType);
attributePlotObject.setShowLabel(m_showWellPathAttributeLabels());
attributePlotObject.loadDataAndUpdate(false);
attributePlotObject.setParentQwtPlotNoReplot(m_wellLogTrackPlotWidget);
}
}
applyXZoomFromVisibleRange();
}
//--------------------------------------------------------------------------------------------------

View File

@ -36,12 +36,12 @@
class RigWellPath;
class RimCase;
class RimWellPathAttributeCurve;
class RimWellPathAttributeCollection;
class RimWellFlowRateCurve;
class RimWellLogCurve;
class RimWellPath;
class RiuPlotAnnotationTool;
class RiuWellPathAttributePlotObject;
class RiuWellLogTrack;
class RigEclipseWellLogExtractor;
class RimWellLogPlotCollection;
@ -120,8 +120,10 @@ public:
void setShowFormations(bool on);
bool showFormations() const;
void setShowFormationLabels(bool on);
void setShowWellPathAttributes(bool on);
bool showWellPathAttributes() const;
bool showWellPathAttributesBothSides() const;
void setShowWellPathAttributes(bool on);
void setWellPathAttributesSource(RimWellPath* wellPath);
RimWellPath* wellPathAttributeSource() const;
@ -211,11 +213,14 @@ 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_wellPathAttributesInLegend;
caf::PdmPtrField<RimWellPath*> m_wellPathAttributeSource;
caf::PdmPtrField<RimWellPathAttributeCollection*> m_wellPathAttributeCollection;
caf::PdmChildArrayField<RimWellPathAttributeCurve*> m_wellPathAttributeCurves;
std::vector<RiuWellPathAttributePlotObject> m_wellPathAttributePlotObjects;
bool m_formationsForCaseWithSimWellOnly;

View File

@ -17,7 +17,6 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathAttribute.h"
#include "RimWellPathAttributeCurve.h"
#include "RimWellPathAttributeCollection.h"
#include "RimWellPath.h"
@ -34,6 +33,7 @@ void caf::AppEnum<RimWellPathAttribute::AttributeType>::setUp()
{
addItem(RimWellPathAttribute::AttributeCasing, "CASING", "Casing");
addItem(RimWellPathAttribute::AttributeLiner, "LINER", "Liner");
addItem(RimWellPathAttribute::AttributePacker, "PACKER", "Packer");
setDefault(RimWellPathAttribute::AttributeCasing);
}
}
@ -103,10 +103,14 @@ QString RimWellPathAttribute::label() const
{
return QString("Casing %1").arg(diameterLabel());
}
else
else if (m_type == AttributeLiner)
{
return QString("Liner %1").arg(diameterLabel());
}
else
{
return m_type().uiText();
}
}
//--------------------------------------------------------------------------------------------------
@ -114,7 +118,19 @@ QString RimWellPathAttribute::label() const
//--------------------------------------------------------------------------------------------------
QString RimWellPathAttribute::diameterLabel() const
{
return generateInchesLabel(m_diameterInInches());
return generateInchesLabel(m_diameterInInches());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathAttribute::operator<(const RimWellPathAttribute& rhs) const
{
if (type() != rhs.type())
{
return type() < rhs.type();
}
return depthEnd() > rhs.depthEnd();
}
//--------------------------------------------------------------------------------------------------
@ -123,18 +139,20 @@ QString RimWellPathAttribute::diameterLabel() const
QList<caf::PdmOptionItemInfo> RimWellPathAttribute::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_type)
if (fieldNeedingOptions == &m_diameterInInches)
{
options.push_back(caf::PdmOptionItemInfo(AttributeTypeEnum::uiText(AttributeCasing), AttributeCasing));
options.push_back(caf::PdmOptionItemInfo(AttributeTypeEnum::uiText(AttributeLiner), AttributeLiner));
}
else if (fieldNeedingOptions == &m_diameterInInches)
{
std::vector<double> values = { MAX_DIAMETER_IN_INCHES, 22.0, 20.0, 18.0 + 5.0 / 8.0, 16.0, 14.0, 13.0 + 3.0 / 8.0, 10.0 + 3.0 / 4.0, 9.0 + 7.0 / 8.0, 9.0 + 5.0 / 8.0, MIN_DIAMETER_IN_INCHES };
for (double value : values)
if (m_type() == AttributeCasing || m_type() == AttributeLiner)
{
options.push_back(caf::PdmOptionItemInfo(generateInchesLabel(value), value));
std::vector<double> values = { MAX_DIAMETER_IN_INCHES, 22.0, 20.0, 18.0 + 5.0 / 8.0, 16.0, 14.0, 13.0 + 3.0 / 8.0, 10.0 + 3.0 / 4.0, 9.0 + 7.0 / 8.0, 9.0 + 5.0 / 8.0, MIN_DIAMETER_IN_INCHES };
for (double value : values)
{
options.push_back(caf::PdmOptionItemInfo(generateInchesLabel(value), value));
}
}
else
{
options.push_back(caf::PdmOptionItemInfo("N/A", MAX_DIAMETER_IN_INCHES));
}
}
return options;
@ -184,5 +202,11 @@ void RimWellPathAttribute::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
//--------------------------------------------------------------------------------------------------
void RimWellPathAttribute::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
m_depthStart.uiCapability()->setUiReadOnly(m_type() == AttributeCasing);
bool startDepthAvailable = m_type() != AttributeCasing;
bool endDepthAvailable = true;
bool diameterAvailable = m_type() == AttributeCasing || m_type() == AttributeLiner;
m_depthStart.uiCapability()->setUiReadOnly(!startDepthAvailable);
m_depthEnd.uiCapability()->setUiReadOnly(!endDepthAvailable);
m_diameterInInches.uiCapability()->setUiReadOnly(!diameterAvailable);
}

View File

@ -34,8 +34,18 @@ public:
enum AttributeType
{
// Visible and selectable attributes
AttributeCasing,
AttributeLiner
AttributeLiner,
AttributePacker,
// Attribute types generated from well path and completions
AttributeWellTube,
AttributeFracture,
AttributePerforationInterval,
AttributeFishbonesInterval,
AttributeAICD,
AttributeICD,
AttributeICV,
};
typedef caf::AppEnum<AttributeType> AttributeTypeEnum;
@ -48,6 +58,7 @@ public:
double diameterInInches() const;
QString label() const;
QString diameterLabel() const;
bool operator<(const RimWellPathAttribute& rhs) const;
private:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
@ -62,3 +73,4 @@ private:
caf::PdmField<double> m_diameterInInches;
};

View File

@ -85,6 +85,8 @@ void RimWellPathAttributeCollection::insertAttribute(RimWellPathAttribute* inser
m_attributes.insert(index, attribute);
else
m_attributes.push_back(attribute);
this->updateAllReferringTracks();
}
//--------------------------------------------------------------------------------------------------
@ -94,6 +96,8 @@ void RimWellPathAttributeCollection::deleteAttribute(RimWellPathAttribute* attri
{
m_attributes.removeChildObject(attributeToDelete);
delete attributeToDelete;
this->updateAllReferringTracks();
}
//--------------------------------------------------------------------------------------------------
@ -123,6 +127,7 @@ void RimWellPathAttributeCollection::defineEditorAttribute(const caf::PdmFieldHa
if (tvAttribute)
{
tvAttribute->autoResizeColumnsToFillContainer = true;
tvAttribute->minimumHeight = 300;
}
}
}

View File

@ -1,190 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathAttributeCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellPathAttribute.h"
#include "RimWellPath.h"
#include "RigWellPath.h"
#include "RiuQwtPlotCurve.h"
#include "qwt_plot.h"
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellPathAttributeCurve, "RimWellPathAttributeCurve");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathAttributeCurve::RimWellPathAttributeCurve(RimWellPathAttribute* wellPathAttribute,
CurvePlotPosition plotPosition,
CurvePlotItem curvePlotItem)
: m_curvePlotPosition(plotPosition)
, m_curvePlotItem(curvePlotItem)
{
CAF_PDM_InitObject("Well Attribute Curve", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPathAttribute, "WellPathAttribute", "Well Attribute", "", "", "");
m_wellPathAttribute.xmlCapability()->disableIO();
m_wellPathAttribute = wellPathAttribute;
m_symbolLabelPosition = RiuQwtSymbol::LabelRightOfSymbol;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathAttributeCurve::~RimWellPathAttributeCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathAttributeCurve::updateZoomInParentPlot()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathAttributeCurve::createCurveAutoName()
{
CVF_ASSERT(m_wellPathAttribute);
return m_wellPathAttribute->label();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathAttributeCurve::onLoadDataAndUpdate(bool updateParentPlot)
{
m_qwtPlotCurve->setXAxis(QwtPlot::xBottom);
std::vector<double> xValues;
std::vector<double> yValues;
RimWellLogPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
RimWellLogPlot::DepthTypeEnum depthType = plot->depthType();
if (m_wellPathAttribute)
{
RimWellPath* wellPath = nullptr;
m_wellPathAttribute->firstAncestorOrThisOfTypeAsserted(wellPath);
cvf::Vec3d startPoint = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_wellPathAttribute->depthStart());
cvf::Vec3d endPoint = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_wellPathAttribute->depthEnd());
double startTVD = -startPoint.z();
double endTVD = -endPoint.z();
double startDepth = depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? startTVD : m_wellPathAttribute->depthStart();
double endDepth = depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? endTVD : m_wellPathAttribute->depthEnd();
setCustomName(m_wellPathAttribute->label());
double sign = m_curvePlotPosition == PositiveSide ? 1.0 : -1.0;
double radius = 0.5 * sign * m_wellPathAttribute->diameterInInches();
if (m_wellPathAttribute->type() == RimWellPathAttribute::AttributeCasing)
{
if (m_curvePlotItem == LineCurve)
{
setLineStyle(RiuQwtPlotCurve::STYLE_SOLID);
setLineThickness(4);
setSymbol(RiuQwtSymbol::SYMBOL_NONE);
xValues = { radius, radius };
yValues = { startDepth, endDepth };
}
else if (m_curvePlotItem == MarkerSymbol)
{
setLineStyle(RiuQwtPlotCurve::STYLE_NONE);
setLineThickness(4);
setSymbolSize(10);
if (m_curvePlotPosition == PositiveSide)
{
setSymbol(RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE);
setSymbolLabel(m_wellPathAttribute->diameterLabel());
}
else
{
setSymbol(RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE);
}
xValues = { radius };
yValues = { endDepth };
}
}
else if (m_wellPathAttribute->type() == RimWellPathAttribute::AttributeLiner)
{
setLineStyle(RiuQwtPlotCurve::STYLE_DASH);
setLineThickness(2);
xValues = { radius, radius};
yValues = { startDepth, endDepth };
}
}
if (!xValues.empty())
{
CVF_ASSERT(xValues.size() == yValues.size());
m_qwtPlotCurve->setSamples(&xValues[0], &yValues[0], static_cast<int>(xValues.size()));
RimPlotCurve::updateCurvePresentation(updateParentPlot);
}
if (updateParentPlot)
{
m_parentQwtPlot->replot();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathAttributeCurve::yValueRange(double* minimumValue, double* maximumValue) const
{
if (m_wellPathAttribute)
{
RimWellLogPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
RimWellLogPlot::DepthTypeEnum depthType = plot->depthType();
RimWellPath* wellPath = nullptr;
m_wellPathAttribute->firstAncestorOrThisOfTypeAsserted(wellPath);
cvf::Vec3d startPoint = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_wellPathAttribute->depthStart());
cvf::Vec3d endPoint = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_wellPathAttribute->depthEnd());
double startTVD = -startPoint.z();
double endTVD = -endPoint.z();
double startDepth = depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? startTVD : m_wellPathAttribute->depthStart();
double endDepth = depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? endTVD : m_wellPathAttribute->depthEnd();
*minimumValue = startDepth;
*maximumValue = endDepth;
return true;
}
return false;
}

View File

@ -1,62 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimPlotCurve.h"
#include "cafPdmBase.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
class RigWellLogCurveData;
class RimWellPathAttribute;
//==================================================================================================
///
///
//==================================================================================================
class RimWellPathAttributeCurve : public RimPlotCurve
{
CAF_PDM_HEADER_INIT;
enum CurvePlotPosition
{
NegativeSide,
PositiveSide
};
enum CurvePlotItem
{
LineCurve,
MarkerSymbol
};
public:
RimWellPathAttributeCurve(RimWellPathAttribute* wellPathAttribute = nullptr, CurvePlotPosition plotPosition = PositiveSide, CurvePlotItem curvePlotItem = LineCurve);
~RimWellPathAttributeCurve();
void updateZoomInParentPlot();
QString createCurveAutoName();
void onLoadDataAndUpdate(bool updateParentPlot);
virtual bool yValueRange(double* minimumValue, double* maximumValue) const override;
private:
caf::PdmPtrField<RimWellPathAttribute*> m_wellPathAttribute;
CurvePlotPosition m_curvePlotPosition;
CurvePlotItem m_curvePlotItem;
};

View File

@ -74,6 +74,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuMohrsCirclePlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindowTools.h
${CMAKE_CURRENT_LIST_DIR}/Riu3DMainWindowTools.h
${CMAKE_CURRENT_LIST_DIR}/RiuDockWidgetTools.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellPathAttributePlotObject.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -148,6 +149,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuMohrsCirclePlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindowTools.cpp
${CMAKE_CURRENT_LIST_DIR}/Riu3DMainWindowTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuDockWidgetTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellPathAttributePlotObject.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -53,6 +53,30 @@ RiuQwtSymbol::RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, Label
style = QwtSymbol::DTriangle;
break;
case SYMBOL_LEFT_TRIANGLE:
style = QwtSymbol::Path;
{
QPainterPath path;
path.moveTo(0, -10);
path.lineTo(-10, 0);
path.lineTo(0, 10);
path.lineTo(0, -10);
setPath(path);
setPinPoint(QPointF(0, 0));
}
break;
case SYMBOL_RIGHT_TRIANGLE:
style = QwtSymbol::Path;
{
QPainterPath path;
path.moveTo(0, -10);
path.lineTo(10, 0);
path.lineTo(0, 10);
path.lineTo(0, -10);
setPath(path);
setPinPoint(QPointF(0, 0));
}
break;
case SYMBOL_LEFT_ANGLED_TRIANGLE:
style = QwtSymbol::Path;
{
QPainterPath path;
@ -64,7 +88,7 @@ RiuQwtSymbol::RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, Label
setPinPoint(QPointF(0, 0));
}
break;
case SYMBOL_RIGHT_TRIANGLE:
case SYMBOL_RIGHT_ANGLED_TRIANGLE:
style = QwtSymbol::Path;
{
QPainterPath path;
@ -104,12 +128,16 @@ void RiuQwtSymbol::renderSymbols(QPainter *painter, const QPointF *points, int n
//--------------------------------------------------------------------------------------------------
void RiuQwtSymbol::renderSymbolLabel(QPainter *painter, const QPointF& position) const
{
int symbolWidth = this->size().width();
int labelWidth = painter->fontMetrics().width(m_label);
int symbolWidth = this->size().width();
int labelWidth = painter->fontMetrics().width(m_label);
if (m_labelPosition == LabelAboveSymbol)
{
painter->drawText(position.x() - labelWidth / 2, position.y() - 5, m_label);
}
else if (m_labelPosition == LabelLeftOfSymbol)
{
painter->drawText(position.x() - labelWidth - symbolWidth, position.y(), m_label);
}
else if (m_labelPosition == LabelRightOfSymbol)
{
painter->drawText(position.x() + symbolWidth + 3, position.y(), m_label);
@ -124,4 +152,3 @@ void RiuQwtSymbol::setLabelPosition(LabelPosition labelPosition)
m_labelPosition = labelPosition;
}

View File

@ -34,6 +34,7 @@ public:
enum LabelPosition
{
LabelAboveSymbol,
LabelLeftOfSymbol,
LabelRightOfSymbol
};
enum PointSymbolEnum
@ -47,7 +48,9 @@ public:
SYMBOL_XCROSS,
SYMBOL_DOWN_TRIANGLE,
SYMBOL_LEFT_TRIANGLE,
SYMBOL_RIGHT_TRIANGLE
SYMBOL_RIGHT_TRIANGLE,
SYMBOL_LEFT_ANGLED_TRIANGLE,
SYMBOL_RIGHT_ANGLED_TRIANGLE
};
RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, LabelPosition labelPosition = LabelAboveSymbol);

View File

@ -0,0 +1,484 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuWellPathAttributePlotObject.h"
#include "RiaColorTools.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFracture.h"
#include "RimFractureTemplate.h"
#include "RimPerforationInterval.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPathAttribute.h"
#include "RimWellPath.h"
#include "RigWellPath.h"
#include "RiuQwtPlotCurve.h"
#include "qwt_plot.h"
#include "qwt_plot_marker.h"
#include "qwt_plot_shapeitem.h"
#include <QBrush>
#include <Qt>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(const RimWellPath* wellPath)
: m_wellPath(wellPath)
, m_attributeType(RimWellPathAttribute::AttributeWellTube)
, 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();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(const RimWellPath* wellPath,
const RimWellPathAttribute* wellPathAttribute)
: m_wellPath(wellPath)
, m_attributeType(RimWellPathAttribute::AttributeCasing)
, m_startMD(0.0)
, m_endMD(0.0)
, m_depthType(RimWellLogPlot::MEASURED_DEPTH)
, m_baseColor(cvf::Color4f(cvf::Color3::BLACK))
, m_showLabel(false)
{
CVF_ASSERT(wellPathAttribute);
if (wellPathAttribute)
{
m_attributeType = wellPathAttribute->type();
m_startMD = wellPathAttribute->depthStart();
m_endMD = wellPathAttribute->depthEnd();
m_label = wellPathAttribute->label();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(
const RimWellPath* wellPath,
const RimPerforationInterval* perforationInterval)
: m_wellPath(wellPath)
, m_attributeType(RimWellPathAttribute::AttributePerforationInterval)
, m_depthType(RimWellLogPlot::MEASURED_DEPTH)
, m_baseColor(cvf::Color4f(cvf::Color3::BLACK))
, m_showLabel(false)
{
CVF_ASSERT(wellPath && perforationInterval);
m_startMD = perforationInterval->startMD();
m_endMD = perforationInterval->endMD();
m_label = QString("Perforations: %1").arg(perforationInterval->name());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(
const RimWellPath* wellPath,
const RimFishbonesMultipleSubs* fishbones)
: m_wellPath(wellPath)
, m_attributeType(RimWellPathAttribute::AttributeFishbonesInterval)
, m_depthType(RimWellLogPlot::MEASURED_DEPTH)
, m_baseColor(cvf::Color4f(cvf::Color3::BLACK))
, m_showLabel(false)
{
CVF_ASSERT(wellPath && fishbones);
m_startMD = fishbones->startOfSubMD();
m_endMD = fishbones->endOfSubMD();
m_label = fishbones->generatedName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathAttributePlotObject::RiuWellPathAttributePlotObject(
const RimWellPath* wellPath,
const RimFracture* fracture)
: m_wellPath(wellPath)
, m_attributeType(RimWellPathAttribute::AttributeFracture)
, m_depthType(RimWellLogPlot::MEASURED_DEPTH)
, m_baseColor(cvf::Color4f(cvf::Color3::BLACK))
, m_showLabel(false)
{
CVF_ASSERT(wellPath && fracture);
if (fracture->fractureTemplate()->orientationType() == RimFractureTemplate::ALONG_WELL_PATH)
{
m_startMD = fracture->fractureMD() + 0.5*fracture->perforationLength();
m_endMD = m_startMD + fracture->perforationLength();
}
else
{
m_startMD = fracture->fractureMD();
m_endMD = m_startMD + fracture->fractureTemplate()->computeFractureWidth(fracture);
}
m_label = fracture->name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathAttributePlotObject::~RiuWellPathAttributePlotObject()
{
detachFromQwt();
for (QwtPlotItem* plotFeature : m_plotFeatures)
{
delete plotFeature;
}
if (m_parentQwtPlot)
{
m_parentQwtPlot->replot();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuWellPathAttributePlotObject::label()
{
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::loadDataAndUpdate(bool updateParentPlot)
{
onLoadDataAndUpdate(updateParentPlot);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathAttribute::AttributeType RiuWellPathAttributePlotObject::attributeType() const
{
return m_attributeType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::onLoadDataAndUpdate(bool updateParentPlot)
{
double startDepth, endDepth;
std::tie(startDepth, endDepth) = depthsOfDepthType();
float columnAlpha = 0.9f;
cvf::Color4f transparentBaseColor = m_baseColor;
transparentBaseColor.a() = 0.0;
if (m_attributeType == RimWellPathAttribute::AttributeWellTube)
{
addColumnFeature(-0.25, 0.25, startDepth, endDepth, m_baseColor);
}
else if (m_attributeType == RimWellPathAttribute::AttributeCasing)
{
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);
addMarker(0.625, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, m_baseColor, label());
}
else if (m_attributeType == RimWellPathAttribute::AttributeLiner)
{
addColumnFeature(-0.5, -0.25, startDepth, endDepth, m_baseColor);
addColumnFeature(0.25, 0.5, startDepth, endDepth, m_baseColor);
addMarker(0.375, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, transparentBaseColor, label(), Qt::AlignTop);
}
else if (m_attributeType == RimWellPathAttribute::AttributePerforationInterval)
{
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);
addMarker(0.626, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::WHITE, 0.0), label(), Qt::AlignTop);
// 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 + 0.5 * markerSpacing;
while (markerDepth <= endDepth)
{
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));
markerDepth += markerSpacing;
}
}
else if (m_attributeType == RimWellPathAttribute::AttributeFishbonesInterval)
{
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.625, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::WHITE, 0.0f), label(), Qt::AlignTop);
}
else if (m_attributeType == RimWellPathAttribute::AttributeFracture)
{
if (std::abs(m_endMD - m_startMD) < 20)
{
addMarker(0.625, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::ORANGE_RED, 1.0f), label(), Qt::AlignTop, Qt::Horizontal, true, false);
}
else
{
addColumnFeature(-0.75, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::ORANGE_RED, columnAlpha), Qt::HorPattern);
addColumnFeature(0.25, 0.75, startDepth, endDepth, cvf::Color4f(cvf::Color3::ORANGE_RED, columnAlpha), Qt::HorPattern);
addMarker(0.625, endDepth, 10, RiuQwtSymbol::SYMBOL_NONE, cvf::Color4f(cvf::Color3::ORANGE_RED, 0.0f), label(), Qt::AlignTop);
}
}
else if (m_attributeType == RimWellPathAttribute::AttributeICD)
{
addMarker(0.0, startDepth, 30, RiuQwtSymbol::SYMBOL_ELLIPSE, m_baseColor, label(), Qt::AlignCenter, Qt::Horizontal);
}
else if (m_attributeType == RimWellPathAttribute::AttributePacker)
{
addColumnFeature(-1.0, -0.25, startDepth, endDepth, cvf::Color4f(cvf::Color3::GRAY, 1.0f), Qt::SolidPattern);
addColumnFeature(0.25, 1.0, startDepth, endDepth, cvf::Color4f(cvf::Color3::GRAY, 1.0f), Qt::SolidPattern);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<double, double> RiuWellPathAttributePlotObject::depthsOfDepthType() const
{
double startDepth = m_startMD;
double endDepth = m_endMD;
if (m_depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
{
cvf::Vec3d startPoint = m_wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_startMD);
cvf::Vec3d endPoint = m_wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_endMD);
startDepth = -startPoint.z();
endDepth = -endPoint.z();
}
return std::make_pair(startDepth, endDepth);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::addMarker(double posX,
double depth,
int size,
RiuQwtSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor,
QString label /*= QString("")*/,
Qt::Alignment labelAlignment /*= Qt::AlignTop*/,
Qt::Orientation labelOrientation /*= Qt::Vertical*/,
bool drawLine /*= false*/,
bool contrastTextColor /*= true*/)
{
QColor bgColor = RiaColorTools::toQColor(baseColor);
QColor textColor = bgColor;
if (contrastTextColor)
{
textColor = RiaColorTools::toQColor(RiaColorTools::constrastColor(baseColor.toColor3f()));
}
QwtPlotMarker* marker = new QwtPlotMarker(label);
RiuQwtSymbol* symbol = new RiuQwtSymbol(symbolType, "", RiuQwtSymbol::LabelRightOfSymbol);
symbol->setSize(size);
symbol->setColor(bgColor);
marker->setSymbol(symbol);
marker->setSpacing(2);
marker->setXValue(posX);
marker->setYValue(depth);
if (m_showLabel)
{
QwtText labelText(label);
labelText.setColor(textColor);
QFont font;
font.setPointSize(8);
labelText.setFont(font);
marker->setLabel(labelText);
marker->setLabelAlignment(labelAlignment);
marker->setLabelOrientation(labelOrientation);
}
if (drawLine)
{
marker->setLineStyle(QwtPlotMarker::HLine);
marker->setLinePen(bgColor, 5.0, Qt::DashLine);
}
m_plotFeatures.push_back(marker);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::addColumnFeature(double startX, double endX, double startDepth, double endDepth, cvf::Color4f baseColor, Qt::BrushStyle brushStyle)
{
drawColumnFeature(startX, endX, startDepth, endDepth, baseColor, Qt::SolidPattern);
if (brushStyle != Qt::SolidPattern)
{
// If we're doing a special pattern, draw the pattern in black over the existing pattern
drawColumnFeature(startX, endX, startDepth, endDepth, cvf::Color4f(cvf::Color3::BLACK), brushStyle);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::drawColumnFeature(double startX,
double endX,
double startDepth,
double endDepth,
cvf::Color4f baseColor,
Qt::BrushStyle brushStyle)
{
QwtPlotShapeItem* rightSide = new QwtPlotShapeItem(label());
QPolygonF polygon;
QColor color = RiaColorTools::toQColor(baseColor);
polygon.push_back(QPointF(startX, startDepth));
polygon.push_back(QPointF(endX, startDepth));
polygon.push_back(QPointF(endX, endDepth));
polygon.push_back(QPointF(startX, endDepth));
polygon.push_back(QPointF(startX, startDepth));
rightSide->setPolygon(polygon);
rightSide->setXAxis(QwtPlot::xBottom);
rightSide->setBrush(QBrush(color, brushStyle));
m_plotFeatures.push_back(rightSide);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellPathAttributePlotObject::xValueRange(double* minimumValue, double* maximumValue) const
{
CVF_ASSERT(minimumValue && maximumValue);
*maximumValue = 1.0;
*minimumValue = -1.0;
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellPathAttributePlotObject::yValueRange(double* minimumValue, double* maximumValue) const
{
CVF_ASSERT(minimumValue && maximumValue);
if (minimumValue && maximumValue)
{
std::tie(*minimumValue, *maximumValue) = depthsOfDepthType();
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::setShowLabel(bool showLabel)
{
m_showLabel = showLabel;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::setDepthType(RimWellLogPlot::DepthTypeEnum depthType)
{
m_depthType = depthType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::setBaseColor(const cvf::Color3f& baseColor)
{
m_baseColor = cvf::Color4f(baseColor);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::setBaseColor(const cvf::Color4f& baseColor)
{
m_baseColor = baseColor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::setParentQwtPlotAndReplot(QwtPlot* plot)
{
setParentQwtPlotNoReplot(plot);
if (m_parentQwtPlot)
{
m_parentQwtPlot->replot();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::setParentQwtPlotNoReplot(QwtPlot* plot)
{
m_parentQwtPlot = plot;
attachToQwt();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::attachToQwt()
{
if (m_parentQwtPlot)
{
for (QwtPlotItem* plotFeature : m_plotFeatures)
{
plotFeature->attach(m_parentQwtPlot);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::detachFromQwt()
{
for (QwtPlotItem* plotFeature : m_plotFeatures)
{
plotFeature->detach();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathAttributePlotObject::reattachToQwt()
{
detachFromQwt();
attachToQwt();
}

View File

@ -0,0 +1,127 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimPlotCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellPathAttribute.h"
#include "cafPdmBase.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cvfColor4.h"
#include <QBrush>
#include <QString>
class RigWellLogCurveData;
class RimFishbonesMultipleSubs;
class RimFracture;
class RimPerforationInterval;
class RimWellPath;
class QwtPlotItem;
//==================================================================================================
///
///
//==================================================================================================
class RiuWellPathAttributePlotObject
{
public:
RiuWellPathAttributePlotObject(const RimWellPath* wellPath);
RiuWellPathAttributePlotObject(const RimWellPath* wellPath,
const RimWellPathAttribute* wellPathAttribute);
RiuWellPathAttributePlotObject(const RimWellPath* wellPath,
const RimPerforationInterval* perforationInterval);
RiuWellPathAttributePlotObject(const RimWellPath* wellPath,
const RimFishbonesMultipleSubs* fishbones);
RiuWellPathAttributePlotObject(const RimWellPath* wellPath,
const RimFracture* fracture);
~RiuWellPathAttributePlotObject();
QString label();
void loadDataAndUpdate(bool updateParentPlot);
RimWellPathAttribute::AttributeType attributeType() const;
bool xValueRange(double* minimumValue, double* maximumValue) const;
bool yValueRange(double* minimumValue, double* maximumValue) const;
void setShowLabel(bool showLabel);
void setDepthType(RimWellLogPlot::DepthTypeEnum depthType);
void setBaseColor(const cvf::Color3f& baseColor);
void setBaseColor(const cvf::Color4f& baseColor);
void setParentQwtPlotAndReplot(QwtPlot* plot);
void setParentQwtPlotNoReplot(QwtPlot* plot);
void attachToQwt();
void detachFromQwt();
void reattachToQwt();
private:
void onLoadDataAndUpdate(bool updateParentPlot);
std::pair<double, double> depthsOfDepthType() const;
void addMarker(double posX,
double depth,
int size,
RiuQwtSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor,
QString label = QString(""),
Qt::Alignment labelAlignment = Qt::AlignTop,
Qt::Orientation labelOrientation = Qt::Vertical,
bool drawLine = false,
bool contrastTextColor = true);
void addColumnFeature(double startX,
double endX,
double startDepth,
double endDepth,
cvf::Color4f baseColor,
Qt::BrushStyle brushStyle = Qt::SolidPattern);
void drawColumnFeature(double startX,
double endX,
double startDepth,
double endDepth,
cvf::Color4f baseColor,
Qt::BrushStyle brushStyle = Qt::SolidPattern);
private:
const RimWellPath* m_wellPath;
RimWellPathAttribute::AttributeType m_attributeType;
double m_startMD;
double m_endMD;
QString m_label;
RimWellLogPlot::DepthTypeEnum m_depthType;
QPointer<QwtPlot> m_parentQwtPlot;
std::vector<QwtPlotItem*> m_plotFeatures;
cvf::Color4f m_baseColor;
bool m_showLabel;
};