diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index da3db582c2..5f5df09ce9 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -1640,7 +1640,9 @@ RicMswExportInfo RicWellPathExportCompletionDataFeatureImpl::generateFishbonesMs exportInfo.setLinerDiameter(wellPath->fishbonesCollection()->mswParameters()->linerDiameter(unitSystem)); exportInfo.setRoughnessFactor(wellPath->fishbonesCollection()->mswParameters()->roughnessFactor(unitSystem)); - double maxSegmentLength = enableSegmentSplitting ? 500 : std::numeric_limits::max(); // Fetch value from fishbones collection + double maxSegmentLength = enableSegmentSplitting + ? wellPath->fishbonesCollection()->mswParameters()->maxSegmentLength() + : std::numeric_limits::infinity(); bool foundSubGridIntersections = false; double subStartMD = wellPath->fishbonesCollection()->startMD(); for (RimFishbonesMultipleSubs* subs : fishbonesSubs) @@ -1732,7 +1734,7 @@ RicMswExportInfo std::vector intersections = RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(caseToApply->eclipseCaseData(), coords, mds); - double maxSegmentLength = 500; // Fetch value from fractures collection + double maxSegmentLength = wellPath->fractureCollection()->mswParameters()->maxSegmentLength(); std::vector subSegIntersections = spiltIntersectionSegmentsToMaxLength(wellPathGeometry, intersections, maxSegmentLength); double initialMD = 0.0; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp b/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp index 7ef70312a7..b579f3c571 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp @@ -19,6 +19,9 @@ #include "RimWellPath.h" +#include "cafPdmUiObjectEditorHandle.h" + +#include namespace caf { template<> @@ -52,6 +55,10 @@ RimMswCompletionParameters::RimMswCompletionParameters() CAF_PDM_InitFieldNoDefault(&m_pressureDrop, "PressureDrop", "Pressure Drop", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_lengthAndDepth, "LengthAndDepth", "Length and Depth", "", "", ""); + + CAF_PDM_InitField(&m_enforceMaxSegmentLength, "EnforceMaxSegmentLength", false, "Enforce Max Segment Length", "", "", ""); + CAF_PDM_InitField(&m_maxSegmentLength, "MaxSegmentLength", 10.0, "Max Segment Length", "", "", ""); + m_maxSegmentLength.uiCapability()->setUiHidden(true); } //-------------------------------------------------------------------------------------------------- @@ -144,6 +151,14 @@ RimMswCompletionParameters::LengthAndDepthEnum RimMswCompletionParameters::lengt return m_lengthAndDepth(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimMswCompletionParameters::maxSegmentLength() const +{ + return m_enforceMaxSegmentLength ? m_maxSegmentLength : std::numeric_limits::infinity(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -176,6 +191,18 @@ void RimMswCompletionParameters::setLengthAndDepth(LengthAndDepthType lengthAndD m_lengthAndDepth = lengthAndDepthType; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMswCompletionParameters::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +{ + if (changedField == &m_enforceMaxSegmentLength) + { + m_maxSegmentLength.uiCapability()->setUiHidden(!m_enforceMaxSegmentLength()); + caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -203,6 +230,10 @@ void RimMswCompletionParameters::defineUiOrdering(QString uiConfigName, caf::Pdm uiOrdering.add(&m_roughnessFactor); uiOrdering.add(&m_pressureDrop); uiOrdering.add(&m_lengthAndDepth); + uiOrdering.add(&m_enforceMaxSegmentLength); + uiOrdering.add(&m_maxSegmentLength); + + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.h b/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.h index 093b3f7dfc..09931048ad 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.h @@ -51,6 +51,7 @@ public: static double defaultRoughnessFactor(RiaEclipseUnitTools::UnitSystem unitSystem); PressureDropEnum pressureDrop() const; LengthAndDepthEnum lengthAndDepth() const; + double maxSegmentLength() const; void setLinerDiameter(double diameter); void setRoughnessFactor(double roughnessFactor); void setPressureDrop(PressureDropType pressureDropType); @@ -60,6 +61,9 @@ public: void setUnitSystemSpecificDefaults(); protected: + virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue); void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual void initAfterRead() override; @@ -69,4 +73,7 @@ private: caf::PdmField m_pressureDrop; caf::PdmField m_lengthAndDepth; + + caf::PdmField m_enforceMaxSegmentLength; + caf::PdmField m_maxSegmentLength; };