mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
3D Well Log Curves (#2672): Max and min value control for each curve.
This commit is contained in:
parent
5d89ad3a6d
commit
bf5d95d873
@ -48,6 +48,8 @@ cvf::ref<cvf::DrawableGeo>
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double minResultValue,
|
||||
double maxResultValue,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth) const
|
||||
@ -57,6 +59,8 @@ cvf::ref<cvf::DrawableGeo>
|
||||
|
||||
createCurveVerticesAndIndices(resultValues,
|
||||
resultMds,
|
||||
minResultValue,
|
||||
maxResultValue,
|
||||
planeAngle,
|
||||
planeOffsetFromWellPathCenter,
|
||||
planeWidth,
|
||||
@ -89,6 +93,8 @@ cvf::ref<cvf::DrawableGeo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double minResultValue,
|
||||
double maxResultValue,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth,
|
||||
@ -104,6 +110,11 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std
|
||||
if (resultValues.empty()) return;
|
||||
CVF_ASSERT(resultValues.size() == resultMds.size());
|
||||
|
||||
if (maxResultValue - minResultValue < 1.0e-6)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
m_wellPath->firstAncestorOrThisOfTypeAsserted(wellPathCollection);
|
||||
|
||||
@ -145,20 +156,27 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std
|
||||
std::vector<double> resultValuesForInterpolatedPoints(resultValues.end() - interpolatedWellPathPoints.size(),
|
||||
resultValues.end());
|
||||
|
||||
double maxResult = -HUGE_VAL;
|
||||
double minResult = HUGE_VAL;
|
||||
double maxClampedResult = -HUGE_VAL;
|
||||
double minClampedResult = HUGE_VAL;
|
||||
|
||||
for (double result : resultValuesForInterpolatedPoints)
|
||||
for (double& result : resultValuesForInterpolatedPoints)
|
||||
{
|
||||
if (!RigCurveDataTools::isValidValue(result, false)) continue;
|
||||
|
||||
maxResult = std::max(result, maxResult);
|
||||
minResult = std::min(result, minResult);
|
||||
result = cvf::Math::clamp(result, minResultValue, maxResultValue);
|
||||
|
||||
maxClampedResult = std::max(result, maxClampedResult);
|
||||
minClampedResult = std::min(result, minClampedResult);
|
||||
}
|
||||
|
||||
if (minClampedResult >= maxClampedResult)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
vertices->resize(interpolatedWellPathPoints.size());
|
||||
|
||||
double plotRangeToResultRangeFactor = planeWidth / (maxResult - minResult);
|
||||
double plotRangeToResultRangeFactor = planeWidth / (maxClampedResult - minClampedResult);
|
||||
|
||||
for (size_t i = 0; i < interpolatedCurveNormals.size(); i++)
|
||||
{
|
||||
@ -167,7 +185,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std
|
||||
if (RigCurveDataTools::isValidValue(resultValuesForInterpolatedPoints[i], false))
|
||||
{
|
||||
scaledResult =
|
||||
planeOffsetFromWellPathCenter + (resultValuesForInterpolatedPoints[i] - minResult) * plotRangeToResultRangeFactor;
|
||||
planeOffsetFromWellPathCenter + (resultValuesForInterpolatedPoints[i] - minClampedResult) * plotRangeToResultRangeFactor;
|
||||
}
|
||||
|
||||
(*vertices)[i] = cvf::Vec3f(interpolatedWellPathPoints[i] + scaledResult * interpolatedCurveNormals[i]);
|
||||
|
@ -51,10 +51,14 @@ public:
|
||||
const std::vector<double>& resultMds,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth) const;
|
||||
double planeWidth,
|
||||
double minResultValue,
|
||||
double maxResultValue) const;
|
||||
private:
|
||||
void createCurveVerticesAndIndices(const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double minResultValue,
|
||||
double maxResultValue,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth,
|
||||
|
@ -107,6 +107,8 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
|
||||
wellPathClipBoundingBox,
|
||||
resultValues,
|
||||
resultMds,
|
||||
rim3dWellLogCurve->minCurveValue(),
|
||||
rim3dWellLogCurve->maxCurveValue(),
|
||||
planeAngle(curveCollection, rim3dWellLogCurve),
|
||||
wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve),
|
||||
planeWidth());
|
||||
|
@ -18,9 +18,16 @@
|
||||
|
||||
#include "Rim3dWellLogCurve.h"
|
||||
|
||||
#include "RigCurveDataTools.h"
|
||||
|
||||
#include "Rim3dWellLogCurveCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -45,11 +52,17 @@ namespace caf
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dWellLogCurve::Rim3dWellLogCurve()
|
||||
: m_minCurveDataValue(-HUGE_VAL)
|
||||
, m_maxCurveDataValue(HUGE_VAL)
|
||||
{
|
||||
CAF_PDM_InitObject("3d Well Log Curve", ":/WellLogCurve16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_showCurve, "Show3dWellLogCurve", true, "Show 3d Well Log Curve", "", "", "");
|
||||
m_showCurve.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField(&m_minCurveValue, "MinCurveValue", -HUGE_VAL, "Minimum Curve Value", "", "Clip curve values below this.", "");
|
||||
CAF_PDM_InitField(&m_maxCurveValue, "MaxCurveValue", HUGE_VAL, "Maximum Curve Value", "", "Clip curve values above this.", "");
|
||||
m_minCurveValue.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
m_maxCurveValue.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_drawPlane, "DrawPlane", DrawPlaneEnum(VERTICAL_ABOVE), "Draw Plane", "", "", "");
|
||||
CAF_PDM_InitField(&m_color, "CurveColor", cvf::Color3f(0.0f, 0.0f, 0.0f), "Curve Color", "", "", "");
|
||||
@ -106,6 +119,22 @@ void Rim3dWellLogCurve::setColor(const cvf::Color3f& color)
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double Rim3dWellLogCurve::minCurveValue() const
|
||||
{
|
||||
return m_minCurveValue();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double Rim3dWellLogCurve::maxCurveValue() const
|
||||
{
|
||||
return m_maxCurveValue();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -147,6 +176,8 @@ void Rim3dWellLogCurve::configurationUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
||||
caf::PdmUiGroup* configurationGroup = uiOrdering.addNewGroup("Curve Configuration");
|
||||
configurationGroup->add(&m_drawPlane);
|
||||
configurationGroup->add(&m_color);
|
||||
configurationGroup->add(&m_minCurveValue);
|
||||
configurationGroup->add(&m_maxCurveValue);
|
||||
}
|
||||
|
||||
QList<caf::PdmOptionItemInfo> Rim3dWellLogCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
@ -177,3 +208,66 @@ QList<caf::PdmOptionItemInfo> Rim3dWellLogCurve::calculateValueOptions(const caf
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogCurve::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
caf::PdmUiDoubleSliderEditorAttribute* sliderAttribute = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||
if (sliderAttribute)
|
||||
{
|
||||
if (m_minCurveDataValue == -HUGE_VAL &&
|
||||
m_maxCurveDataValue == HUGE_VAL)
|
||||
{
|
||||
this->resetMinMaxValues();
|
||||
}
|
||||
if (field == &m_minCurveValue)
|
||||
{
|
||||
sliderAttribute->m_minimum = m_minCurveDataValue;
|
||||
sliderAttribute->m_maximum = m_maxCurveDataValue;
|
||||
}
|
||||
else if (field == &m_maxCurveValue)
|
||||
{
|
||||
sliderAttribute->m_minimum = m_minCurveDataValue;
|
||||
sliderAttribute->m_maximum = m_maxCurveDataValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogCurve::resetMinMaxValuesAndUpdateUI()
|
||||
{
|
||||
this->resetMinMaxValues();
|
||||
this->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogCurve::resetMinMaxValues()
|
||||
{
|
||||
std::vector<double> values;
|
||||
std::vector<double> measuredDepths;
|
||||
this->curveValuesAndMds(&values, &measuredDepths);
|
||||
double foundMinValue = HUGE_VAL;
|
||||
double foundMaxValue = -HUGE_VAL;
|
||||
for (double value : values)
|
||||
{
|
||||
if (RigCurveDataTools::isValidValue(value, false))
|
||||
{
|
||||
foundMinValue = std::min(foundMinValue, value);
|
||||
foundMaxValue = std::max(foundMaxValue, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Update data boundaries
|
||||
m_minCurveDataValue = foundMinValue;
|
||||
m_maxCurveDataValue = foundMaxValue;
|
||||
|
||||
// Update selected GUI boundaries
|
||||
m_minCurveValue = m_minCurveDataValue;
|
||||
m_maxCurveValue = m_maxCurveDataValue;
|
||||
}
|
||||
|
@ -54,19 +54,29 @@ public:
|
||||
virtual void curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const = 0;
|
||||
|
||||
void setColor(const cvf::Color3f& color);
|
||||
|
||||
double minCurveValue() const;
|
||||
double maxCurveValue() const;
|
||||
void resetMinMaxValuesAndUpdateUI();
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
void configurationUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
private:
|
||||
void resetMinMaxValues();
|
||||
protected:
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<caf::AppEnum<DrawPlane>> m_drawPlane;
|
||||
caf::PdmField<cvf::Color3f> m_color;
|
||||
|
||||
caf::PdmField<double> m_minCurveValue;
|
||||
caf::PdmField<double> m_maxCurveValue;
|
||||
double m_minCurveDataValue;
|
||||
double m_maxCurveDataValue;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showCurve;
|
||||
|
||||
};
|
||||
|
@ -96,6 +96,19 @@ void Rim3dWellLogFileCurve::curveValuesAndMds(std::vector<double>* values, std::
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_wellLogFile || changedField == &m_wellLogChannnelName)
|
||||
{
|
||||
this->resetMinMaxValuesAndUpdateUI();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -41,6 +41,11 @@ public:
|
||||
void setDefaultFileCurveDataInfo();
|
||||
virtual void curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const override;
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly) override;
|
||||
|
@ -76,6 +76,19 @@ void Rim3dWellLogRftCurve::curveValuesAndMds(std::vector<double>* values, std::v
|
||||
*measuredDepthValues = curveData->measuredDepths();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogRftCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_wellLogChannelName)
|
||||
{
|
||||
this->resetMinMaxValuesAndUpdateUI();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -44,6 +44,11 @@ public:
|
||||
|
||||
virtual void curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const override;
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly) override;
|
||||
|
@ -342,6 +342,7 @@ void RimEclipseResultDefinition::updateAnyFieldHasChanged()
|
||||
this->firstAncestorOrThisOfType(rim3dWellLogCurve);
|
||||
if (rim3dWellLogCurve)
|
||||
{
|
||||
rim3dWellLogCurve->resetMinMaxValuesAndUpdateUI();
|
||||
rim3dWellLogCurve->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user