From 646a102eff33d6f1d2261800814724cfb92911d1 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 7 Feb 2020 10:15:16 +0100 Subject: [PATCH] #5477 Add independent scaling factor field to well measurements --- .../ModelVisualization/RivWellPathPartMgr.cpp | 23 +++++++++++--- .../ModelVisualization/RivWellPathPartMgr.h | 4 +++ .../RimWellMeasurementInView.cpp | 31 ++++++++++++++++--- .../RimWellMeasurementInView.h | 2 ++ 4 files changed, 52 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index eaef4a101f..f270fa119c 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -304,6 +304,10 @@ void RivWellPathPartMgr::appendWellMeasurementsToModel( cvf::ModelBasicList* double startMD = wellMeasurement->MD() - wellPathRadius * 0.5; double endMD = wellMeasurement->MD() + wellPathRadius * 0.5; + double wellMeasurementRadius = this->wellMeasurementRadius( characteristicCellSize, + this->wellPathCollection(), + wellMeasurementInView ); + std::vector displayCoords; displayCoords.push_back( displayCoordTransform->transformToDisplayCoord( m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( startMD ) ) ); @@ -315,10 +319,10 @@ void RivWellPathPartMgr::appendWellMeasurementsToModel( cvf::ModelBasicList* m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( endMD ) ) ); std::vector radii; - radii.push_back( wellPathRadius ); - radii.push_back( wellPathRadius * 2.5 ); - radii.push_back( wellPathRadius * 2.5 ); - radii.push_back( wellPathRadius ); + radii.push_back( std::min( wellPathRadius, wellMeasurementRadius ) ); + radii.push_back( wellMeasurementRadius ); + radii.push_back( wellMeasurementRadius ); + radii.push_back( std::min( wellPathRadius, wellMeasurementRadius ) ); cvf::ref objectSourceInfo = new RivObjectSourceInfo( wellMeasurement ); @@ -935,3 +939,14 @@ double RivWellPathPartMgr::wellPathRadius( double characteristicCellSize, RimWel return wellPathCollection->wellPathRadiusScaleFactor() * m_rimWellPath->wellPathRadiusScaleFactor() * characteristicCellSize; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RivWellPathPartMgr::wellMeasurementRadius( double characteristicCellSize, + const RimWellPathCollection* wellPathCollection, + const RimWellMeasurementInView* wellMeasurementInView ) +{ + return wellPathCollection->wellPathRadiusScaleFactor() * wellMeasurementInView->radiusScaleFactor() * + characteristicCellSize; +} diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index d77f207b20..a52b1c23e5 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -48,6 +48,7 @@ class RimWellPathCollection; class Rim3dView; class Riv3dWellLogPlanePartMgr; class RivWellConnectionFactorPartMgr; +class RimWellMeasurementInView; class QDateTime; @@ -126,6 +127,9 @@ private: void clearAllBranchData(); inline RimWellPathCollection* wellPathCollection() const; inline double wellPathRadius( double characteristicCellSize, RimWellPathCollection* wellPathCollection ); + double wellMeasurementRadius( double characteristicCellSize, + const RimWellPathCollection* wellPathCollection, + const RimWellMeasurementInView* wellMeasurementInView ); bool isWellPathWithinBoundingBox( const cvf::BoundingBox& wellPathClipBoundingBox ) const; diff --git a/ApplicationCode/ProjectDataModel/RimWellMeasurementInView.cpp b/ApplicationCode/ProjectDataModel/RimWellMeasurementInView.cpp index 391ce8336b..a192f0d0d1 100644 --- a/ApplicationCode/ProjectDataModel/RimWellMeasurementInView.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellMeasurementInView.cpp @@ -33,6 +33,7 @@ #include "cafCmdFeatureMenuBuilder.h" #include "cafPdmUiDoubleSliderEditor.h" +#include "cafPdmUiDoubleValueEditor.h" #include "cafPdmUiTableViewEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeSelectionEditor.h" @@ -85,6 +86,9 @@ RimWellMeasurementInView::RimWellMeasurementInView() m_qualityFilter.uiCapability()->setAutoAddingOptionFromValue( false ); m_qualityFilter.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); + CAF_PDM_InitField( &m_radiusScaleFactor, "RadiusScaleFactor", 2.5, "Radius Scale", "", "", "" ); + m_radiusScaleFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); + this->setName( "Well Measurement" ); m_minimumResultValue = cvf::UNDEFINED_DOUBLE; @@ -126,6 +130,8 @@ void RimWellMeasurementInView::defineUiOrdering( QString uiConfigName, caf::PdmU uiOrdering.add( &m_qualityFilter ); + uiOrdering.add( &m_radiusScaleFactor ); + uiOrdering.skipRemainingFields(); } @@ -144,13 +150,22 @@ void RimWellMeasurementInView::defineEditorAttribute( const caf::PdmFieldHandle* if ( field == &m_lowerBound || field == &m_upperBound ) { caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast( attribute ); - if ( !myAttr ) + if ( myAttr ) { - return; + myAttr->m_minimum = m_minimumResultValue; + myAttr->m_maximum = m_maximumResultValue; } + } - myAttr->m_minimum = m_minimumResultValue; - myAttr->m_maximum = m_maximumResultValue; + if ( field == &m_radiusScaleFactor ) + { + caf::PdmUiDoubleValueEditorAttribute* uiDoubleValueEditorAttr = + dynamic_cast( attribute ); + if ( uiDoubleValueEditorAttr ) + { + uiDoubleValueEditorAttr->m_decimals = 2; + uiDoubleValueEditorAttr->m_validator = new QDoubleValidator( 0.001, 100.0, 2 ); + } } } @@ -503,3 +518,11 @@ std::set RimWellMeasurementInView::getAvailableWells() const std::set s( v.begin(), v.end() ); return s; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimWellMeasurementInView::radiusScaleFactor() const +{ + return m_radiusScaleFactor; +} diff --git a/ApplicationCode/ProjectDataModel/RimWellMeasurementInView.h b/ApplicationCode/ProjectDataModel/RimWellMeasurementInView.h index 046b10d09f..f82fe13487 100644 --- a/ApplicationCode/ProjectDataModel/RimWellMeasurementInView.h +++ b/ApplicationCode/ProjectDataModel/RimWellMeasurementInView.h @@ -54,6 +54,7 @@ public: void rangeValues( double* lowerBound, double* upperBound ) const; std::vector qualityFilter() const; + double radiusScaleFactor() const; protected: void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; @@ -88,6 +89,7 @@ private: caf::PdmField> m_qualityFilter; caf::PdmField m_wellsSerialized; caf::PdmField m_availableWellsSerialized; + caf::PdmField m_radiusScaleFactor; void selectNewWells( const std::set& wells ); void setAvailableWells( const std::set& wells );