mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9369 Curve Probing: Show data from other curves in tooltip text
Optionally show data from other curves in tooltip text when hoovering over a curve point
This commit is contained in:
parent
7c2941aedd
commit
760bfaeec2
@ -206,3 +206,27 @@ double RiaDefines::scalingFactor( QPaintDevice* paintDevice )
|
||||
|
||||
return scaling;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::curveNameGroupName()
|
||||
{
|
||||
return "Curve Name";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::appearanceGroupName()
|
||||
{
|
||||
return "Appearance";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::additionalDataSourcesGroupName()
|
||||
{
|
||||
return "Additional Data Sources";
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ enum class ObjectNamingMethod
|
||||
TEMPLATE
|
||||
};
|
||||
|
||||
// Defines relate to curve and plot template names
|
||||
QString namingVariableCase();
|
||||
QString namingVariableWell();
|
||||
QString namingVariableWellBranch();
|
||||
@ -93,4 +94,9 @@ PlotAxis opposite( PlotAxis axis );
|
||||
|
||||
double scalingFactor( QPaintDevice* paintDevice );
|
||||
|
||||
// Project editor group names
|
||||
QString curveNameGroupName();
|
||||
QString appearanceGroupName();
|
||||
QString additionalDataSourcesGroupName();
|
||||
|
||||
}; // namespace RiaDefines
|
||||
|
@ -122,6 +122,45 @@ void RicNewRftSegmentWellLogPlotFeature::appendTrackAndCurveForBranchType( RimWe
|
||||
RiuPlotMainWindowTools::setExpanded( curve );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotCurve*> RicNewRftSegmentWellLogPlotFeature::appendAdditionalDataSourceTrack( RimWellLogPlot* plot,
|
||||
const QString& wellName,
|
||||
RimSummaryCase* summaryCase )
|
||||
{
|
||||
auto additionalDataSourceTrack = new RimWellLogTrack();
|
||||
additionalDataSourceTrack->setDescription( "Additional Data Source Curves" );
|
||||
|
||||
plot->addPlot( additionalDataSourceTrack );
|
||||
additionalDataSourceTrack->setShowWindow( false );
|
||||
|
||||
QString resultName = RiaDefines::segmentNumberResultName();
|
||||
QString templateText = RiaDefines::namingVariableResultName() + ", " + RiaDefines::namingVariableResultType();
|
||||
|
||||
std::vector<RimPlotCurve*> curves;
|
||||
|
||||
for ( auto branchType : { RiaDefines::RftBranchType::RFT_TUBING,
|
||||
RiaDefines::RftBranchType::RFT_DEVICE,
|
||||
RiaDefines::RftBranchType::RFT_ANNULUS } )
|
||||
{
|
||||
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( additionalDataSourceTrack,
|
||||
resultName,
|
||||
wellName,
|
||||
branchType,
|
||||
summaryCase );
|
||||
curve->setFillStyle( Qt::NoBrush );
|
||||
curve->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
||||
curve->setCurveNameTemplateText( templateText );
|
||||
|
||||
curves.push_back( curve );
|
||||
}
|
||||
|
||||
additionalDataSourceTrack->updateAllRequiredEditors();
|
||||
|
||||
return curves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -145,22 +184,22 @@ void RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( RimWellLogPlot* pl
|
||||
|
||||
plot->addPlot( track );
|
||||
|
||||
std::vector<RiaDefines::RftBranchType> branchTypes{ RiaDefines::RftBranchType::RFT_TUBING,
|
||||
RiaDefines::RftBranchType::RFT_DEVICE,
|
||||
RiaDefines::RftBranchType::RFT_ANNULUS };
|
||||
std::vector<RimPlotCurve*> additionalDataSourceCurves = appendAdditionalDataSourceTrack( plot, wellName, summaryCase );
|
||||
|
||||
for ( auto branchType : branchTypes )
|
||||
for ( auto branchType : { RiaDefines::RftBranchType::RFT_TUBING,
|
||||
RiaDefines::RftBranchType::RFT_DEVICE,
|
||||
RiaDefines::RftBranchType::RFT_ANNULUS } )
|
||||
{
|
||||
auto curve = RimRftTopologyCurve::createTopologyCurve( summaryCase, dateTime, wellName, branchIndex, branchType );
|
||||
curve->setAdditionalDataSources( additionalDataSourceCurves );
|
||||
curve->applyDefaultAppearance();
|
||||
track->addCurve( curve );
|
||||
}
|
||||
|
||||
{
|
||||
auto curve = RimRftTopologyCurve::createPackerCurve( summaryCase, dateTime, wellName, branchIndex );
|
||||
curve->applyDefaultAppearance();
|
||||
track->addCurve( curve );
|
||||
}
|
||||
auto packerCurve = RimRftTopologyCurve::createPackerCurve( summaryCase, dateTime, wellName, branchIndex );
|
||||
packerCurve->setAdditionalDataSources( additionalDataSourceCurves );
|
||||
packerCurve->applyDefaultAppearance();
|
||||
track->addCurve( packerCurve );
|
||||
|
||||
track->updateAllRequiredEditors();
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
class RimWellLogPlot;
|
||||
class RimSummaryCase;
|
||||
class RimPlotCurve;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -46,4 +47,7 @@ private:
|
||||
const QString& wellName,
|
||||
RiaDefines::RftBranchType branchType,
|
||||
RimSummaryCase* summaryCase );
|
||||
|
||||
static std::vector<RimPlotCurve*>
|
||||
appendAdditionalDataSourceTrack( RimWellLogPlot* plot, const QString& wellName, RimSummaryCase* summaryCase );
|
||||
};
|
||||
|
@ -526,7 +526,8 @@ void RifReaderOpmRft::buildSegmentData()
|
||||
for ( const auto& rftResultMetaData : arraysAtWellDate )
|
||||
{
|
||||
auto [name, arrayType, size] = rftResultMetaData;
|
||||
if ( size == m_segmentResultItemCount || size == m_connectionResultItemCount )
|
||||
if ( size == static_cast<int64_t>( m_segmentResultItemCount ) ||
|
||||
size == static_cast<int64_t>( m_connectionResultItemCount ) )
|
||||
{
|
||||
segment.addResultNameAndSize( rftResultMetaData );
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "cafAssert.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
#include <QPen>
|
||||
|
||||
@ -126,6 +127,10 @@ RimPlotCurve::RimPlotCurve()
|
||||
m_curveAppearance->appearanceChanged.connect( this, &RimPlotCurve::onCurveAppearanceChanged );
|
||||
m_curveAppearance->fillColorChanged.connect( this, &RimPlotCurve::onFillColorChanged );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_additionalDataSources, "AdditionalDataSources", "Additional Data Sources" );
|
||||
m_additionalDataSources.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
m_additionalDataSources.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
m_plotCurve = nullptr;
|
||||
m_parentPlot = nullptr;
|
||||
}
|
||||
@ -309,6 +314,27 @@ QList<caf::PdmOptionItemInfo> RimPlotCurve::calculateValueOptions( const caf::Pd
|
||||
RiaDefines::ObjectNamingMethod::TEMPLATE ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_additionalDataSources )
|
||||
{
|
||||
std::vector<RimPlotWindow*> parentPlots;
|
||||
|
||||
// Find all plot windows above this object upwards in the object hierarchy. Use the top most plot window as the
|
||||
// root to find all plot curves.
|
||||
this->allAncestorsOfType( parentPlots );
|
||||
|
||||
if ( !parentPlots.empty() )
|
||||
{
|
||||
std::vector<RimPlotCurve*> plotCurves;
|
||||
parentPlots.back()->descendantsOfType( plotCurves );
|
||||
|
||||
for ( auto p : plotCurves )
|
||||
{
|
||||
caf::PdmOptionItemInfo optionInfo( p->curveName(), p );
|
||||
|
||||
options.push_back( optionInfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@ -455,6 +481,16 @@ void RimPlotCurve::curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
uiOrdering.add( &m_curveName );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::additionalDataSourcesUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
auto group = uiOrdering.addNewGroup( RiaDefines::additionalDataSourcesGroupName() );
|
||||
group->add( &m_additionalDataSources );
|
||||
group->setCollapsedByDefault();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1069,6 +1105,22 @@ std::pair<double, double> RimPlotCurve::sample( int index ) const
|
||||
return m_plotCurve->sample( index );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimPlotCurve::closestYValueForX( double xValue ) const
|
||||
{
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotCurve*> RimPlotCurve::additionalDataSources() const
|
||||
{
|
||||
return m_additionalDataSources.ptrReferencedObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <Qt>
|
||||
@ -89,6 +90,7 @@ public:
|
||||
void setNamingMethod( RiaDefines::ObjectNamingMethod namingMethod );
|
||||
QString curveName() const;
|
||||
virtual QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const;
|
||||
virtual QString createCurveNameFromTemplate( const QString& templateText );
|
||||
|
||||
void setCustomName( const QString& customName );
|
||||
void setLegendEntryText( const QString& legendEntryText );
|
||||
@ -117,8 +119,10 @@ public:
|
||||
|
||||
virtual void setTitle( const QString& title );
|
||||
|
||||
int dataSize() const;
|
||||
std::pair<double, double> sample( int index ) const;
|
||||
int dataSize() const;
|
||||
std::pair<double, double> sample( int index ) const;
|
||||
virtual double closestYValueForX( double xValue ) const;
|
||||
std::vector<RimPlotCurve*> additionalDataSources() const;
|
||||
|
||||
void setParentPlotNoReplot( RiuPlotWidget* );
|
||||
void setParentPlotAndReplot( RiuPlotWidget* );
|
||||
@ -132,8 +136,6 @@ public:
|
||||
protected:
|
||||
virtual QString createCurveAutoName() = 0;
|
||||
|
||||
// Override these two methods to show and use curve name template when assigning a name to the curve
|
||||
virtual QString createCurveNameFromTemplate( const QString& templateText );
|
||||
virtual QStringList supportedCurveNameVariables() const;
|
||||
|
||||
virtual void updateZoomInParentPlot() = 0;
|
||||
@ -172,6 +174,7 @@ protected:
|
||||
|
||||
void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
void additionalDataSourcesUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
void onCurveAppearanceChanged( const caf::SignalEmitter* emitter );
|
||||
virtual void onFillColorChanged( const caf::SignalEmitter* emitter );
|
||||
@ -200,6 +203,8 @@ protected:
|
||||
|
||||
caf::PdmChildField<RimPlotCurveAppearance*> m_curveAppearance;
|
||||
|
||||
caf::PdmPtrArrayField<RimPlotCurve*> m_additionalDataSources;
|
||||
|
||||
QPointer<RiuPlotWidget> m_parentPlot;
|
||||
RiuPlotCurve* m_plotCurve;
|
||||
|
||||
|
@ -157,3 +157,22 @@ void RimStackablePlotCurve::stackingUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
uiOrdering.add( &m_isStacked );
|
||||
if ( m_isStacked() ) uiOrdering.add( &m_isStackedWithPhaseColors );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStackablePlotCurve::defaultUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimPlotCurve::additionalDataSourcesUiOrdering( uiOrdering );
|
||||
|
||||
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
|
||||
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( RiaDefines::appearanceGroupName() );
|
||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( RiaDefines::curveNameGroupName() );
|
||||
nameGroup->setCollapsedByDefault();
|
||||
nameGroup->add( &m_showLegend );
|
||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||
}
|
||||
|
@ -37,7 +37,9 @@ public:
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
void stackingUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
void defaultUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
void onFillColorChanged( const caf::SignalEmitter* emitter ) override;
|
||||
|
||||
|
@ -142,8 +142,6 @@ QString RimRftTopologyCurve::createCurveAutoName()
|
||||
if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_TUBING ) text += "Tubing";
|
||||
}
|
||||
|
||||
text += QString( " (%1)" ).arg( m_segmentBranchIndex() );
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
@ -166,16 +164,7 @@ void RimRftTopologyCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
curveDataGroup->add( &m_segmentBranchType );
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
|
||||
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
||||
nameGroup->setCollapsedByDefault();
|
||||
nameGroup->add( &m_showLegend );
|
||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||
RimStackablePlotCurve::defaultUiOrdering( uiOrdering );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
@ -187,7 +176,7 @@ QList<caf::PdmOptionItemInfo> RimRftTopologyCurve::calculateValueOptions( const
|
||||
{
|
||||
if ( !m_summaryCase ) return {};
|
||||
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
QList<caf::PdmOptionItemInfo> options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions );
|
||||
|
||||
auto reader = m_summaryCase->rftReader();
|
||||
|
||||
@ -323,6 +312,14 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRftTopologyCurve::setAdditionalDataSources( const std::vector<RimPlotCurve*>& additionalDataSources )
|
||||
{
|
||||
m_additionalDataSources.setValue( additionalDataSources );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -74,4 +74,7 @@ private:
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::RftBranchType>> m_segmentBranchType;
|
||||
|
||||
caf::PdmField<bool> m_isPackerCurve;
|
||||
|
||||
public:
|
||||
void setAdditionalDataSources( const std::vector<RimPlotCurve*>& additionalDataSources );
|
||||
};
|
||||
|
@ -295,6 +295,31 @@ void RimWellLogCurve::setOverrideCurveData( const std::vector<double>&
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimWellLogCurve::closestYValueForX( double xValue ) const
|
||||
{
|
||||
if ( m_curveData.isNull() ) return std::numeric_limits<double>::infinity();
|
||||
|
||||
auto depths = m_curveData->depths( RiaDefines::DepthTypeEnum::MEASURED_DEPTH );
|
||||
auto values = m_curveData->propertyValues();
|
||||
|
||||
if ( depths.empty() || values.empty() ) return std::numeric_limits<double>::infinity();
|
||||
|
||||
auto it = std::upper_bound( depths.begin(), depths.end(), xValue );
|
||||
if ( it == depths.begin() ) return values.front();
|
||||
if ( it == depths.end() ) return values.back();
|
||||
|
||||
auto index = std::distance( depths.begin(), it - 1 );
|
||||
|
||||
double firstDistance = std::abs( xValue - depths[index] );
|
||||
double secondDistance = std::abs( xValue - depths[index + 1] );
|
||||
|
||||
if ( firstDistance < secondDistance ) return values[index];
|
||||
return values[index + 1];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
const std::vector<double>& depthValues,
|
||||
const RiaCurveDataTools::CurveIntervals& curveIntervals );
|
||||
|
||||
double closestYValueForX( double xValue ) const override;
|
||||
|
||||
protected:
|
||||
void updateZoomInParentPlot() override;
|
||||
void updateLegendsInPlot() override;
|
||||
|
@ -787,19 +787,11 @@ void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::Pdm
|
||||
curveDataGroup->add( &m_timeStep );
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
|
||||
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
||||
nameGroup->setCollapsedByDefault();
|
||||
nameGroup->add( &m_showLegend );
|
||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||
RimStackablePlotCurve::defaultUiOrdering( uiOrdering );
|
||||
|
||||
if ( m_namingMethod == RiaDefines::ObjectNamingMethod::AUTO )
|
||||
{
|
||||
auto nameGroup = uiOrdering.findGroup( RiaDefines::curveNameGroupName() );
|
||||
nameGroup->add( &m_addWellNameToCurveName );
|
||||
nameGroup->add( &m_addCaseNameToCurveName );
|
||||
nameGroup->add( &m_addPropertyToCurveName );
|
||||
|
@ -337,15 +337,7 @@ void RimWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
curveDataGroup->add( &m_wellLogFile );
|
||||
curveDataGroup->add( &m_wellLogChannelName );
|
||||
|
||||
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
|
||||
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
||||
nameGroup->add( &m_showLegend );
|
||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||
RimStackablePlotCurve::defaultUiOrdering( uiOrdering );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -806,15 +806,7 @@ void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
|
||||
curveDataGroup->add( &m_curveColorByPhase );
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
|
||||
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
||||
nameGroup->add( &m_showLegend );
|
||||
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
||||
RimStackablePlotCurve::defaultUiOrdering( uiOrdering );
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
@ -30,4 +30,5 @@ class RiuPlotCurveInfoTextProvider
|
||||
{
|
||||
public:
|
||||
virtual QString curveInfoText( RiuPlotCurve* curve ) const = 0;
|
||||
virtual QString additionalText( RiuPlotCurve* curve, int sampleIndex ) const { return {}; };
|
||||
};
|
||||
|
@ -219,6 +219,15 @@ QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPosition
|
||||
{
|
||||
*valueAxisValueString = valueAxisScaleDraw->label( valueAxisSampleVal ).text();
|
||||
}
|
||||
|
||||
auto additionalText = m_curveInfoTextProvider->additionalText( dynamic_cast<RiuPlotCurve*>( closestCurve ),
|
||||
closestPointSampleIndex );
|
||||
|
||||
if ( !additionalText.isEmpty() )
|
||||
{
|
||||
*valueAxisValueString += "\n";
|
||||
*valueAxisValueString += additionalText;
|
||||
}
|
||||
}
|
||||
|
||||
return samplePoint;
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
#include "RiuGuiTheme.h"
|
||||
#include "RiuPlotCurve.h"
|
||||
#include "RiuPlotCurveInfoTextProvider.h"
|
||||
@ -114,10 +116,9 @@ public:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString curveInfoText( RiuPlotCurve* riuCurve ) const override
|
||||
{
|
||||
RimWellLogCurve* wlCurve = nullptr;
|
||||
if ( riuCurve )
|
||||
{
|
||||
wlCurve = dynamic_cast<RimWellLogCurve*>( riuCurve->ownerRimCurve() );
|
||||
RimWellLogCurve* wlCurve = dynamic_cast<RimWellLogCurve*>( riuCurve->ownerRimCurve() );
|
||||
if ( wlCurve )
|
||||
{
|
||||
return QString( "%1" ).arg( wlCurve->curveName() );
|
||||
@ -126,6 +127,51 @@ public:
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString additionalText( RiuPlotCurve* curve, int sampleIndex ) const override
|
||||
{
|
||||
if ( !curve ) return {};
|
||||
|
||||
std::vector<std::pair<QString, double>> propertyNameValues;
|
||||
|
||||
auto* sourceCurve = curve->ownerRimCurve();
|
||||
if ( !sourceCurve ) return {};
|
||||
|
||||
auto annotationCurves = sourceCurve->additionalDataSources();
|
||||
for ( auto annotationCurve : annotationCurves )
|
||||
{
|
||||
RimDepthTrackPlot* depthTrackPlot = nullptr;
|
||||
annotationCurve->firstAncestorOfType( depthTrackPlot );
|
||||
if ( depthTrackPlot )
|
||||
{
|
||||
auto [xValue, yValue] = curve->sample( sampleIndex );
|
||||
|
||||
auto depth = depthTrackPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ? yValue
|
||||
: xValue;
|
||||
|
||||
auto propertyValue = annotationCurve->closestYValueForX( depth );
|
||||
|
||||
// Use template to get as short label as possible. The default curve name will often
|
||||
// contain too much and redundant information.
|
||||
QString templateText = RiaDefines::namingVariableResultName() + ", " +
|
||||
RiaDefines::namingVariableResultType();
|
||||
auto resultName = annotationCurve->createCurveNameFromTemplate( templateText );
|
||||
|
||||
propertyNameValues.push_back( std::make_pair( resultName, propertyValue ) );
|
||||
}
|
||||
}
|
||||
|
||||
QString txt;
|
||||
for ( const auto& [name, value] : propertyNameValues )
|
||||
{
|
||||
txt += QString( "%1 : %2\n" ).arg( name ).arg( value );
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
};
|
||||
static WellLogCurveInfoTextProvider wellLogCurveInfoTextProvider;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user