mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5837 Well Measurements : Allow modification of kind
This commit is contained in:
@@ -59,7 +59,6 @@ RimWellMeasurementCurve::RimWellMeasurementCurve()
|
|||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_measurementKind, "CurveMeasurementKind", "Measurement Kind", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_measurementKind, "CurveMeasurementKind", "Measurement Kind", "", "", "" );
|
||||||
m_measurementKind.uiCapability()->setUiTreeChildrenHidden( true );
|
m_measurementKind.uiCapability()->setUiTreeChildrenHidden( true );
|
||||||
m_measurementKind.uiCapability()->setUiHidden( true );
|
|
||||||
|
|
||||||
m_wellPath = nullptr;
|
m_wellPath = nullptr;
|
||||||
}
|
}
|
||||||
@@ -76,108 +75,105 @@ RimWellMeasurementCurve::~RimWellMeasurementCurve()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||||
{
|
{
|
||||||
|
RimWellLogPlot* wellLogPlot;
|
||||||
|
firstAncestorOrThisOfType( wellLogPlot );
|
||||||
|
CVF_ASSERT( wellLogPlot );
|
||||||
|
|
||||||
|
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||||
|
if ( m_wellPath && !m_measurementKind().isEmpty() && wellPathCollection )
|
||||||
|
{
|
||||||
|
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
|
||||||
|
|
||||||
|
std::vector<QString> measurementKinds;
|
||||||
|
measurementKinds.push_back( measurementKind() );
|
||||||
|
|
||||||
|
std::vector<RimWellMeasurement*> measurements =
|
||||||
|
RimWellMeasurementFilter::filterMeasurements( measurementCollection->measurements(),
|
||||||
|
*wellPathCollection,
|
||||||
|
*m_wellPath,
|
||||||
|
measurementKinds );
|
||||||
|
|
||||||
|
// Extract the values for this measurement kind
|
||||||
|
std::vector<double> values;
|
||||||
|
std::vector<double> measuredDepthValues;
|
||||||
|
for ( auto& measurement : measurements )
|
||||||
|
{
|
||||||
|
if ( measurement->kind() == measurementKind() )
|
||||||
|
{
|
||||||
|
values.push_back( measurement->value() );
|
||||||
|
measuredDepthValues.push_back( measurement->MD() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( values.size() == measuredDepthValues.size() )
|
||||||
|
{
|
||||||
|
RigWellPath* rigWellPath = m_wellPath->wellPathGeometry();
|
||||||
|
if ( rigWellPath )
|
||||||
|
{
|
||||||
|
std::vector<double> trueVerticalDepthValues;
|
||||||
|
|
||||||
|
for ( double measuredDepthValue : measuredDepthValues )
|
||||||
|
{
|
||||||
|
trueVerticalDepthValues.push_back(
|
||||||
|
-rigWellPath->interpolatedPointAlongWellPath( measuredDepthValue ).z() );
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setValuesWithMdAndTVD( values,
|
||||||
|
measuredDepthValues,
|
||||||
|
trueVerticalDepthValues,
|
||||||
|
m_wellPath->wellPathGeometry()->rkbDiff(),
|
||||||
|
RiaDefines::DepthUnitType::UNIT_METER,
|
||||||
|
false );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->setValuesAndDepths( values,
|
||||||
|
measuredDepthValues,
|
||||||
|
RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
|
||||||
|
0.0,
|
||||||
|
RiaDefines::DepthUnitType::UNIT_METER,
|
||||||
|
false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_isUsingAutoName )
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->setTitle( createCurveAutoName() );
|
||||||
|
}
|
||||||
|
|
||||||
|
setSymbol( getSymbolForMeasurementKind( m_measurementKind() ) );
|
||||||
|
setColor( getColorForMeasurementKind( measurementKind() ) );
|
||||||
|
setSymbolEdgeColor( getColorForMeasurementKind( measurementKind() ) );
|
||||||
|
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
|
||||||
|
|
||||||
|
RiaDefines::DepthUnitType displayUnit = RiaDefines::DepthUnitType::UNIT_METER;
|
||||||
|
if ( wellLogPlot )
|
||||||
|
{
|
||||||
|
displayUnit = wellLogPlot->depthUnit();
|
||||||
|
}
|
||||||
|
|
||||||
|
RiaDefines::DepthTypeEnum depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH;
|
||||||
|
if ( wellLogPlot && this->curveData()->availableDepthTypes().count( wellLogPlot->depthType() ) )
|
||||||
|
{
|
||||||
|
depthType = wellLogPlot->depthType();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(),
|
||||||
|
this->curveData()->depthPlotValues( depthType, displayUnit ).data(),
|
||||||
|
static_cast<int>( this->curveData()->xPlotValues().size() ) );
|
||||||
|
m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
|
||||||
|
}
|
||||||
|
|
||||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||||
|
|
||||||
if ( isCurveVisible() )
|
if ( updateParentPlot )
|
||||||
{
|
{
|
||||||
RimWellLogPlot* wellLogPlot;
|
updateZoomInParentPlot();
|
||||||
firstAncestorOrThisOfType( wellLogPlot );
|
}
|
||||||
CVF_ASSERT( wellLogPlot );
|
|
||||||
|
|
||||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
if ( m_parentQwtPlot )
|
||||||
if ( m_wellPath && !m_measurementKind().isEmpty() && wellPathCollection )
|
{
|
||||||
{
|
m_parentQwtPlot->replot();
|
||||||
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
|
|
||||||
|
|
||||||
std::vector<QString> measurementKinds;
|
|
||||||
measurementKinds.push_back( measurementKind() );
|
|
||||||
|
|
||||||
std::vector<RimWellMeasurement*> measurements =
|
|
||||||
RimWellMeasurementFilter::filterMeasurements( measurementCollection->measurements(),
|
|
||||||
*wellPathCollection,
|
|
||||||
*m_wellPath,
|
|
||||||
measurementKinds );
|
|
||||||
|
|
||||||
// Extract the values for this measurement kind
|
|
||||||
std::vector<double> values;
|
|
||||||
std::vector<double> measuredDepthValues;
|
|
||||||
for ( auto& measurement : measurements )
|
|
||||||
{
|
|
||||||
if ( measurement->kind() == measurementKind() )
|
|
||||||
{
|
|
||||||
values.push_back( measurement->value() );
|
|
||||||
measuredDepthValues.push_back( measurement->MD() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( values.size() == measuredDepthValues.size() )
|
|
||||||
{
|
|
||||||
RigWellPath* rigWellPath = m_wellPath->wellPathGeometry();
|
|
||||||
if ( rigWellPath )
|
|
||||||
{
|
|
||||||
std::vector<double> trueVerticalDepthValues;
|
|
||||||
|
|
||||||
for ( double measuredDepthValue : measuredDepthValues )
|
|
||||||
{
|
|
||||||
trueVerticalDepthValues.push_back(
|
|
||||||
-rigWellPath->interpolatedPointAlongWellPath( measuredDepthValue ).z() );
|
|
||||||
}
|
|
||||||
|
|
||||||
this->setValuesWithMdAndTVD( values,
|
|
||||||
measuredDepthValues,
|
|
||||||
trueVerticalDepthValues,
|
|
||||||
m_wellPath->wellPathGeometry()->rkbDiff(),
|
|
||||||
RiaDefines::DepthUnitType::UNIT_METER,
|
|
||||||
false );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->setValuesAndDepths( values,
|
|
||||||
measuredDepthValues,
|
|
||||||
RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
|
|
||||||
0.0,
|
|
||||||
RiaDefines::DepthUnitType::UNIT_METER,
|
|
||||||
false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_isUsingAutoName )
|
|
||||||
{
|
|
||||||
m_qwtPlotCurve->setTitle( createCurveAutoName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
setSymbol( getSymbolForMeasurementKind( m_measurementKind() ) );
|
|
||||||
setColor( getColorForMeasurementKind( measurementKind() ) );
|
|
||||||
setSymbolEdgeColor( getColorForMeasurementKind( measurementKind() ) );
|
|
||||||
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
|
|
||||||
|
|
||||||
RiaDefines::DepthUnitType displayUnit = RiaDefines::DepthUnitType::UNIT_METER;
|
|
||||||
if ( wellLogPlot )
|
|
||||||
{
|
|
||||||
displayUnit = wellLogPlot->depthUnit();
|
|
||||||
}
|
|
||||||
|
|
||||||
RiaDefines::DepthTypeEnum depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH;
|
|
||||||
if ( wellLogPlot && this->curveData()->availableDepthTypes().count( wellLogPlot->depthType() ) )
|
|
||||||
{
|
|
||||||
depthType = wellLogPlot->depthType();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(),
|
|
||||||
this->curveData()->depthPlotValues( depthType, displayUnit ).data(),
|
|
||||||
static_cast<int>( this->curveData()->xPlotValues().size() ) );
|
|
||||||
m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( updateParentPlot )
|
|
||||||
{
|
|
||||||
updateZoomInParentPlot();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_parentQwtPlot )
|
|
||||||
{
|
|
||||||
m_parentQwtPlot->replot();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,6 +206,7 @@ void RimWellMeasurementCurve::fieldChangedByUi( const caf::PdmFieldHandle* chang
|
|||||||
{
|
{
|
||||||
this->loadDataAndUpdate( true );
|
this->loadDataAndUpdate( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
|
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,6 +219,7 @@ void RimWellMeasurementCurve::defineUiOrdering( QString uiConfigName, caf::PdmUi
|
|||||||
|
|
||||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
|
||||||
curveDataGroup->add( &m_wellPath );
|
curveDataGroup->add( &m_wellPath );
|
||||||
|
curveDataGroup->add( &m_measurementKind );
|
||||||
|
|
||||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||||
@@ -254,6 +252,33 @@ QList<caf::PdmOptionItemInfo>
|
|||||||
{
|
{
|
||||||
RimTools::wellPathOptionItems( &options );
|
RimTools::wellPathOptionItems( &options );
|
||||||
}
|
}
|
||||||
|
else if ( fieldNeedingOptions == &m_measurementKind )
|
||||||
|
{
|
||||||
|
RimWellPathCollection* wellPathCollection = nullptr;
|
||||||
|
if ( m_wellPath )
|
||||||
|
{
|
||||||
|
m_wellPath->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::set<QString> names;
|
||||||
|
|
||||||
|
if ( wellPathCollection )
|
||||||
|
{
|
||||||
|
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
|
||||||
|
for ( RimWellMeasurement* measurement : measurementCollection->measurements() )
|
||||||
|
{
|
||||||
|
if ( measurement->wellName() == m_wellPath->name() )
|
||||||
|
{
|
||||||
|
names.insert( measurement->kind() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( const auto& kind : names )
|
||||||
|
{
|
||||||
|
options.push_back( caf::PdmOptionItemInfo( kind, kind ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user