mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
Add fixed, min and max segment length per segment interval (fixed is exclusive with min/max, min and max can be combined), connect COMPSEGS rows to the nearest segment node, and add collection options for a single segment before the first and after the last perforation.
132 lines
4.9 KiB
C++
132 lines
4.9 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2026- 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 "RiaDefines.h"
|
|
#include "RimWellPathComponentInterface.h"
|
|
|
|
#include "cafPdmField.h"
|
|
#include "cafPdmObject.h"
|
|
|
|
#include <QDate>
|
|
#include <QDateTime>
|
|
#include <QString>
|
|
|
|
#include <optional>
|
|
|
|
class RimWellPath;
|
|
|
|
namespace caf
|
|
{
|
|
class CmdFeatureMenuBuilder;
|
|
class PdmUiTreeOrdering;
|
|
} // namespace caf
|
|
|
|
//==================================================================================================
|
|
///
|
|
/// Represents a segment interval for a specific measured depth range
|
|
///
|
|
//==================================================================================================
|
|
class RimSegmentInterval : public caf::PdmObject, public RimWellPathComponentInterface
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
RimSegmentInterval();
|
|
~RimSegmentInterval() override;
|
|
|
|
// Getters
|
|
double startMD() const override;
|
|
double endMD() const override;
|
|
double diameter() const;
|
|
double diameter( RiaDefines::EclipseUnitSystem unitSystem ) const;
|
|
double roughnessFactor() const;
|
|
double roughnessFactor( RiaDefines::EclipseUnitSystem unitSystem ) const;
|
|
|
|
// Setters
|
|
void setStartMD( double startMD );
|
|
void setEndMD( double endMD );
|
|
void setDiameter( double diameter );
|
|
void setRoughnessFactor( double roughness );
|
|
|
|
// Segmentation. Fixed length cannot be combined with min/max length, min and max length can be combined.
|
|
std::optional<double> fixedSegmentLength() const;
|
|
std::optional<double> minSegmentLength() const;
|
|
std::optional<double> maxSegmentLength() const;
|
|
void setFixedSegmentLength( std::optional<double> length );
|
|
void setMinSegmentLength( std::optional<double> length );
|
|
void setMaxSegmentLength( std::optional<double> length );
|
|
|
|
// Date tracking
|
|
void enableCustomStartDate( bool enable );
|
|
void setCustomStartDate( const QDate& date );
|
|
void setCustomStartDate( const QDateTime& date );
|
|
bool isActiveOnDate( const QDateTime& date ) const;
|
|
|
|
// Validation
|
|
bool isValidInterval() const;
|
|
bool overlaps( const RimSegmentInterval* other ) const;
|
|
bool containsMD( double md ) const;
|
|
|
|
// Display
|
|
QString diameterLabel() const;
|
|
QString roughnessLabel() const;
|
|
|
|
// Comparison for sorting
|
|
bool operator<( const RimSegmentInterval& rhs ) const;
|
|
|
|
// Overrides from RimWellPathComponentInterface
|
|
bool isEnabled() const override;
|
|
RiaDefines::WellPathComponentType componentType() const override;
|
|
QString componentLabel() const override;
|
|
QString componentTypeLabel() const override;
|
|
cvf::Color3f defaultComponentColor() const override;
|
|
void applyOffset( double offsetMD ) override;
|
|
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
|
|
|
// Public static methods for default values
|
|
static double defaultDiameter( RiaDefines::EclipseUnitSystem unitSystem );
|
|
static double defaultRoughness( RiaDefines::EclipseUnitSystem unitSystem );
|
|
|
|
// Visual feedback for overlapping intervals
|
|
void updateOverlapVisualFeedback( bool hasOverlap );
|
|
|
|
protected:
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
|
|
|
private:
|
|
void updateConnectedEditors();
|
|
void updateUiName();
|
|
QString generateDisplayLabel() const;
|
|
void enforceSegmentationRules( const caf::PdmFieldHandle* activeField );
|
|
|
|
private:
|
|
caf::PdmField<double> m_startMD;
|
|
caf::PdmField<double> m_endMD;
|
|
caf::PdmField<double> m_diameter;
|
|
caf::PdmField<double> m_roughnessFactor;
|
|
|
|
caf::PdmField<std::pair<bool, double>> m_fixedSegmentLength;
|
|
caf::PdmField<std::pair<bool, double>> m_minSegmentLength;
|
|
caf::PdmField<std::pair<bool, double>> m_maxSegmentLength;
|
|
|
|
caf::PdmField<bool> m_useCustomStartDate;
|
|
caf::PdmField<QDateTime> m_startDate;
|
|
}; |