diff --git a/ApplicationCode/ProjectDataModel/RimWellMeasurementCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellMeasurementCurve.cpp index c753bc3d9e..c1e0c7598a 100644 --- a/ApplicationCode/ProjectDataModel/RimWellMeasurementCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellMeasurementCurve.cpp @@ -59,7 +59,6 @@ RimWellMeasurementCurve::RimWellMeasurementCurve() CAF_PDM_InitFieldNoDefault( &m_measurementKind, "CurveMeasurementKind", "Measurement Kind", "", "", "" ); m_measurementKind.uiCapability()->setUiTreeChildrenHidden( true ); - m_measurementKind.uiCapability()->setUiHidden( true ); m_wellPath = nullptr; } @@ -76,108 +75,105 @@ RimWellMeasurementCurve::~RimWellMeasurementCurve() //-------------------------------------------------------------------------------------------------- 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 measurementKinds; + measurementKinds.push_back( measurementKind() ); + + std::vector measurements = + RimWellMeasurementFilter::filterMeasurements( measurementCollection->measurements(), + *wellPathCollection, + *m_wellPath, + measurementKinds ); + + // Extract the values for this measurement kind + std::vector values; + std::vector 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 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( this->curveData()->xPlotValues().size() ) ); + m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); + } + this->RimPlotCurve::updateCurvePresentation( updateParentPlot ); - if ( isCurveVisible() ) + if ( updateParentPlot ) { - RimWellLogPlot* wellLogPlot; - firstAncestorOrThisOfType( wellLogPlot ); - CVF_ASSERT( wellLogPlot ); + updateZoomInParentPlot(); + } - RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection(); - if ( m_wellPath && !m_measurementKind().isEmpty() && wellPathCollection ) - { - const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection(); - - std::vector measurementKinds; - measurementKinds.push_back( measurementKind() ); - - std::vector measurements = - RimWellMeasurementFilter::filterMeasurements( measurementCollection->measurements(), - *wellPathCollection, - *m_wellPath, - measurementKinds ); - - // Extract the values for this measurement kind - std::vector values; - std::vector 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 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( this->curveData()->xPlotValues().size() ) ); - m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); - } - - if ( updateParentPlot ) - { - updateZoomInParentPlot(); - } - - if ( m_parentQwtPlot ) - { - m_parentQwtPlot->replot(); - } + if ( m_parentQwtPlot ) + { + m_parentQwtPlot->replot(); } } @@ -210,6 +206,7 @@ void RimWellMeasurementCurve::fieldChangedByUi( const caf::PdmFieldHandle* chang { this->loadDataAndUpdate( true ); } + if ( m_parentQwtPlot ) m_parentQwtPlot->replot(); } @@ -222,6 +219,7 @@ void RimWellMeasurementCurve::defineUiOrdering( QString uiConfigName, caf::PdmUi caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" ); curveDataGroup->add( &m_wellPath ); + curveDataGroup->add( &m_measurementKind ); caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" ); RimPlotCurve::appearanceUiOrdering( *appearanceGroup ); @@ -254,6 +252,33 @@ QList { RimTools::wellPathOptionItems( &options ); } + else if ( fieldNeedingOptions == &m_measurementKind ) + { + RimWellPathCollection* wellPathCollection = nullptr; + if ( m_wellPath ) + { + m_wellPath->firstAncestorOrThisOfTypeAsserted( wellPathCollection ); + } + + std::set 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; }