mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Show time annotation in all sub plots (#11906)
* Prepare for more customization of annotation objects * Move files * Add configuration of readout lines in sub plots. The location along the time axis is based on the current mouse cursor position. The location is distributed to all sub plots. Optional support for readout of values at the current time.
This commit is contained in:
@@ -13,6 +13,10 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationGroupCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylineTarget.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTimeAxisAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEquilibriumAxisAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotRectAnnotation.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -30,6 +34,10 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationGroupCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylineTarget.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTimeAxisAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEquilibriumAxisAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotRectAnnotation.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -66,7 +66,7 @@ RimAnnotationLineAppearance::RimAnnotationLineAppearance()
|
||||
CAF_PDM_InitObject( "AnnotationLineAppearance", ":/WellCollection.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_lineFieldsHidden, "LineFieldsHidden", false, "Line Fields Hidden" );
|
||||
CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3f::BLACK ), "Line Color" );
|
||||
CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3f::DARK_GRAY ), "Line Color" );
|
||||
CAF_PDM_InitField( &m_thickness, "Thickness", 2, "Line Thickness" );
|
||||
|
||||
// Stippling not yet supported. Needs new stuff in VizFwk
|
||||
@@ -85,6 +85,20 @@ void RimAnnotationLineAppearance::setLineFieldsHidden( bool hidden )
|
||||
m_lineFieldsHidden = hidden;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationLineAppearance::configureForSummaryAnnotations()
|
||||
{
|
||||
m_style.uiCapability()->setUiHidden( false );
|
||||
m_style.xmlCapability()->setIOReadable( true );
|
||||
m_style.xmlCapability()->setIOWritable( true );
|
||||
|
||||
m_thickness.uiCapability()->setUiHidden( true );
|
||||
|
||||
m_style = STYLE_DASH;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
RimAnnotationLineAppearance();
|
||||
|
||||
void setLineFieldsHidden( bool hidden );
|
||||
void configureForSummaryAnnotations();
|
||||
|
||||
void setColor( const cvf::Color3f& newColor );
|
||||
cvf::Color3f color() const;
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
#include "RimTools.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPlotAxisAnnotation, "RimPlotAxisAnnotation" );
|
||||
@@ -49,16 +53,12 @@ RimPlotAxisAnnotation::RimPlotAxisAnnotation()
|
||||
|
||||
caf::AppEnum<Qt::PenStyle> defaultStyle = Qt::PenStyle::SolidLine;
|
||||
CAF_PDM_InitField( &m_penStyle, "PenStyle", defaultStyle, "Pen Style" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotAxisAnnotation* RimPlotAxisAnnotation::createLineAnnotation()
|
||||
{
|
||||
auto annotation = new RimPlotAxisAnnotation();
|
||||
annotation->setAnnotationType( RimPlotAxisAnnotation::AnnotationType::LINE );
|
||||
return annotation;
|
||||
CAF_PDM_InitFieldNoDefault( &m_textAlignment, "TextAlignment", "Text Alignment" );
|
||||
m_textAlignment = RiaDefines::TextAlignment::RIGHT;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_color, "Color", "Color" );
|
||||
m_color = cvf::Color3f( cvf::Color3f::BLACK );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -125,6 +125,14 @@ QColor RimPlotAxisAnnotation::color() const
|
||||
return QColor( 0, 0, 100 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisAnnotation::setAlignment( RiaDefines::TextAlignment alignment )
|
||||
{
|
||||
m_textAlignment = alignment;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -141,6 +149,22 @@ Qt::PenStyle RimPlotAxisAnnotation::penStyle() const
|
||||
return m_penStyle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisAnnotation::setColor( const cvf::Color3f& color )
|
||||
{
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::TextAlignment RimPlotAxisAnnotation::textAlignment() const
|
||||
{
|
||||
return m_textAlignment();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -18,10 +18,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaPlotDefines.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
@@ -40,21 +44,27 @@ public:
|
||||
};
|
||||
RimPlotAxisAnnotation();
|
||||
|
||||
static RimPlotAxisAnnotation* createLineAnnotation();
|
||||
void setName( const QString& name );
|
||||
QString name() const;
|
||||
|
||||
void setName( const QString& name );
|
||||
void setValue( double value );
|
||||
void setValue( double value );
|
||||
virtual double value() const;
|
||||
|
||||
AnnotationType annotationType() const;
|
||||
virtual QString name() const;
|
||||
virtual double value() const;
|
||||
virtual double rangeStart() const;
|
||||
virtual double rangeEnd() const;
|
||||
virtual QColor color() const;
|
||||
AnnotationType annotationType() const;
|
||||
void setAnnotationType( AnnotationType annotationType );
|
||||
|
||||
void setPenStyle( Qt::PenStyle penStyle );
|
||||
Qt::PenStyle penStyle() const;
|
||||
|
||||
void setColor( const cvf::Color3f& color );
|
||||
virtual QColor color() const;
|
||||
|
||||
void setAlignment( RiaDefines::TextAlignment alignment );
|
||||
RiaDefines::TextAlignment textAlignment() const;
|
||||
|
||||
double rangeStart() const;
|
||||
double rangeEnd() const;
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
@@ -64,16 +74,14 @@ protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<double> m_value;
|
||||
caf::PdmField<double> m_rangeStart;
|
||||
caf::PdmField<double> m_rangeEnd;
|
||||
caf::PdmField<caf::AppEnum<Qt::PenStyle>> m_penStyle;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<double> m_value;
|
||||
caf::PdmField<double> m_rangeStart;
|
||||
caf::PdmField<double> m_rangeEnd;
|
||||
caf::PdmField<caf::AppEnum<Qt::PenStyle>> m_penStyle;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::TextAlignment>> m_textAlignment;
|
||||
caf::PdmField<cvf::Color3f> m_color;
|
||||
|
||||
protected:
|
||||
void setAnnotationType( AnnotationType annotationType );
|
||||
|
||||
private:
|
||||
AnnotationType m_annotationType;
|
||||
};
|
||||
@@ -42,26 +42,29 @@ RimTimeAxisAnnotation::RimTimeAxisAnnotation()
|
||||
CAF_PDM_InitObject( "Time Axis Annotation", ":/LeftAxis16x16.png" );
|
||||
|
||||
m_value.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::fromQColorTo3f( defaultColor( AnnotationType::LINE ) ), "Color" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTimeAxisAnnotation::setTime( time_t time )
|
||||
void RimTimeAxisAnnotation::setTime( time_t time, const QString& dateTimeFormatString )
|
||||
{
|
||||
m_value = RiaTimeTTools::toDouble( time );
|
||||
|
||||
QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(),
|
||||
RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY );
|
||||
QString formatString = dateTimeFormatString;
|
||||
|
||||
QString timeFormatString = RiaQDateTimeTools::timeFormatString( RiaPreferences::current()->timeFormat(),
|
||||
RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE );
|
||||
if ( formatString.isEmpty() )
|
||||
{
|
||||
QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(),
|
||||
RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY );
|
||||
|
||||
QString dateTimeFormatString = QString( "%1 %2" ).arg( dateFormatString ).arg( timeFormatString );
|
||||
QString timeFormatString = RiaQDateTimeTools::timeFormatString( RiaPreferences::current()->timeFormat(),
|
||||
RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE );
|
||||
|
||||
m_name = RiaQDateTimeTools::toStringUsingApplicationLocale( RiaQDateTimeTools::fromTime_t( time ), dateTimeFormatString );
|
||||
QString dateTimeFormatString = QString( "%1 %2" ).arg( dateFormatString ).arg( timeFormatString );
|
||||
}
|
||||
|
||||
m_name = RiaQDateTimeTools::toStringUsingApplicationLocale( RiaQDateTimeTools::fromTime_t( time ), formatString );
|
||||
|
||||
setAnnotationType( AnnotationType::LINE );
|
||||
}
|
||||
@@ -110,23 +113,7 @@ QColor RimTimeAxisAnnotation::defaultColor( AnnotationType annotationType )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTimeAxisAnnotation::setDefaultColor()
|
||||
{
|
||||
m_color = RiaColorTools::fromQColorTo3f( defaultColor( annotationType() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTimeAxisAnnotation::setColor( const cvf::Color3f& color )
|
||||
{
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QColor RimTimeAxisAnnotation::color() const
|
||||
{
|
||||
return RiaColorTools::toQColor( m_color );
|
||||
setColor( RiaColorTools::fromQColorTo3f( defaultColor( annotationType() ) ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -38,18 +38,15 @@ class RimTimeAxisAnnotation : public RimPlotAxisAnnotation
|
||||
public:
|
||||
RimTimeAxisAnnotation();
|
||||
|
||||
void setTime( time_t time );
|
||||
void setTimeRange( time_t startTime, time_t endTime );
|
||||
QColor color() const override;
|
||||
void setTime( time_t time, const QString& dateTimeFormatString );
|
||||
void setTimeRange( time_t startTime, time_t endTime );
|
||||
|
||||
void setColor( const cvf::Color3f& color );
|
||||
void setDefaultColor();
|
||||
void setDateTimeFormatString( const QString& formatString );
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
static QColor defaultColor( AnnotationType annotationType );
|
||||
|
||||
caf::PdmField<cvf::Color3f> m_color;
|
||||
};
|
||||
@@ -88,7 +88,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisPropertiesInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisLogRangeCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.h
|
||||
@@ -105,8 +104,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCustomObjectiveFunctionCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCustomObjectiveFunction.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCustomObjectiveFunctionWeight.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEquilibriumAxisAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTimeAxisAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesDataInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveSetInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/cafTreeNode.h
|
||||
@@ -122,7 +119,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultDefinitionTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimResultSelectionUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotRectAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEmCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseEnsemble.h
|
||||
@@ -220,7 +216,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisPropertiesInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisLogRangeCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.cpp
|
||||
@@ -235,8 +230,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCustomObjectiveFunctionCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCustomObjectiveFunction.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCustomObjectiveFunctionWeight.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEquilibriumAxisAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTimeAxisAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/cafTreeNode.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultipleLocations.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionBand.cpp
|
||||
@@ -250,7 +243,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultDefinitionTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimResultSelectionUi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotRectAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEmCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinePickerInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseViewCollection.cpp
|
||||
|
||||
@@ -473,7 +473,8 @@ void RimDepthTrackPlot::setDepthMarkerPosition( double depth )
|
||||
|
||||
if ( firstAnnotation == nullptr )
|
||||
{
|
||||
firstAnnotation = RimPlotAxisAnnotation::createLineAnnotation();
|
||||
firstAnnotation = new RimPlotAxisAnnotation();
|
||||
firstAnnotation->setAnnotationType( RimPlotAxisAnnotation::AnnotationType::LINE );
|
||||
firstAnnotation->setPenStyle( Qt::DashLine );
|
||||
m_depthAnnotations.push_back( firstAnnotation );
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressSelector.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCrossPlotStatisticsCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryEnsembleTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotReadOut.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -112,6 +113,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressSelector.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCrossPlotStatisticsCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryEnsembleTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotReadOut.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaNumericalTools.h"
|
||||
#include "RiaPlotDefines.h"
|
||||
#include "RiaTimeTTools.h"
|
||||
#include "Summary/RiaSummaryAddressAnalyzer.h"
|
||||
#include "Summary/RiaSummaryAddressModifier.h"
|
||||
#include "Summary/RiaSummaryStringTools.h"
|
||||
@@ -30,12 +31,11 @@
|
||||
#include "PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.h"
|
||||
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
|
||||
|
||||
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
|
||||
|
||||
#include "RifEclEclipseSummary.h"
|
||||
#include "RifEclipseRftAddress.h"
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMultiPlotCollection.h"
|
||||
@@ -67,6 +67,9 @@
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
#include "RimSummaryPlotReadOut.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace caf
|
||||
@@ -146,6 +149,9 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
CAF_PDM_InitField( &m_allow3DSelectionLink, "Allow3DSelectionLink", true, "Allow Well Selection from 3D View" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_allow3DSelectionLink );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_readOutSettings, "ReadOutSettings", "Read Out Settings" );
|
||||
m_readOutSettings = new RimSummaryPlotReadOut;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Y Axis Range" );
|
||||
|
||||
CAF_PDM_InitField( &m_hidePlotsWithValuesBelow, "HidePlotsWithValuesBelow", false, "" );
|
||||
@@ -389,6 +395,9 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
axesGroup->add( &m_linkTimeAxis );
|
||||
axesGroup->add( &m_autoAdjustAppearance );
|
||||
|
||||
auto readOutGroup = uiOrdering.addNewGroup( "Mouse Cursor Readout" );
|
||||
m_readOutSettings->uiOrdering( uiConfigName, *readOutGroup );
|
||||
|
||||
auto plotVisibilityFilterGroup = uiOrdering.addNewGroup( "Plot Visibility Filter" );
|
||||
plotVisibilityFilterGroup->add( &m_plotFilterYAxisThreshold );
|
||||
plotVisibilityFilterGroup->add( &m_hidePlotsWithValuesBelow );
|
||||
@@ -498,6 +507,17 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField )
|
||||
{
|
||||
if ( changedChildField == &m_readOutSettings )
|
||||
{
|
||||
updateReadOutSettings();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -832,9 +852,9 @@ void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension()
|
||||
|
||||
m_sourceStepping->setStepDimension( stepDimension );
|
||||
|
||||
// Previously, when the stepping dimension was set to 'well' for range aggregation, it was based on all wells. If one of the wells had
|
||||
// extreme values and was not visible, it would set the y-range to match the extreme value, making some curves invisible. We have now
|
||||
// changed the default setting to use visible subplots to determine the y-range aggregation.
|
||||
// Previously, when the stepping dimension was set to 'well' for range aggregation, it was based on all wells. If one of the wells
|
||||
// had extreme values and was not visible, it would set the y-range to match the extreme value, making some curves invisible. We
|
||||
// have now changed the default setting to use visible subplots to determine the y-range aggregation.
|
||||
// https://github.com/OPM/ResInsight/issues/10543
|
||||
|
||||
m_axisRangeAggregation = AxisRangeAggregation::SUB_PLOTS;
|
||||
@@ -1455,6 +1475,29 @@ void RimSummaryMultiPlot::updateReadOnlyState()
|
||||
m_axisRangeAggregation.uiCapability()->setUiReadOnly( m_linkSubPlotAxes() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::updateReadOutSettings()
|
||||
{
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
if ( !m_readOutSettings->enableVerticalLine() ) plot->removeAllTimeAnnotations();
|
||||
|
||||
if ( !m_readOutSettings->enableHorizontalLine() )
|
||||
{
|
||||
if ( auto axis = plot->axisPropertiesForPlotAxis( RiuPlotAxis::defaultLeft() ) )
|
||||
{
|
||||
axis->removeAllAnnotations();
|
||||
}
|
||||
}
|
||||
|
||||
plot->enableCurvePointTracking( m_readOutSettings->enableCurvePointTracking() );
|
||||
|
||||
plot->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1494,6 +1537,8 @@ QWidget* RimSummaryMultiPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
}
|
||||
recreatePlotWidgets();
|
||||
|
||||
updateReadOutSettings();
|
||||
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
@@ -1672,3 +1717,72 @@ void RimSummaryMultiPlot::selectWell( QString wellName )
|
||||
if ( m_sourceStepping->stepDimension() != SourceSteppingDimension::WELL ) return;
|
||||
m_sourceStepping->setStep( wellName );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::updateReadOutLines( double qwtTimeValue, double yValue )
|
||||
{
|
||||
if ( !m_readOutSettings->enableVerticalLine() && !m_readOutSettings->enableHorizontalLine() ) return;
|
||||
|
||||
const auto timeTValue = RiaTimeTTools::fromDouble( qwtTimeValue );
|
||||
const QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(),
|
||||
RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY );
|
||||
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
if ( m_readOutSettings->enableVerticalLine() && plot->timeAxisProperties() )
|
||||
{
|
||||
plot->timeAxisProperties()->removeAllAnnotations();
|
||||
|
||||
auto anno = new RimTimeAxisAnnotation;
|
||||
|
||||
anno->setTime( timeTValue, dateFormatString );
|
||||
|
||||
auto lineAppearance = m_readOutSettings->lineAppearance();
|
||||
|
||||
Qt::PenStyle style = lineAppearance->isDashed() ? Qt::PenStyle::DashLine : Qt::PenStyle::SolidLine;
|
||||
anno->setPenStyle( style );
|
||||
anno->setColor( lineAppearance->color() );
|
||||
anno->setAlignment( m_readOutSettings->verticalLineLabelAlignment() );
|
||||
|
||||
plot->timeAxisProperties()->appendAnnotation( anno );
|
||||
}
|
||||
|
||||
if ( m_readOutSettings->enableHorizontalLine() )
|
||||
{
|
||||
if ( auto leftAxisProperties = dynamic_cast<RimPlotAxisProperties*>( plot->axisPropertiesForPlotAxis( RiuPlotAxis::defaultLeft() ) ) )
|
||||
{
|
||||
leftAxisProperties->removeAllAnnotations();
|
||||
|
||||
auto summaryCurves = plot->summaryCurves();
|
||||
if ( !summaryCurves.empty() )
|
||||
{
|
||||
auto firstCurve = summaryCurves.front();
|
||||
yValue = firstCurve->yValueAtTimeT( timeTValue );
|
||||
}
|
||||
|
||||
auto anno = new RimPlotAxisAnnotation();
|
||||
anno->setAnnotationType( RimPlotAxisAnnotation::AnnotationType::LINE );
|
||||
|
||||
anno->setValue( yValue );
|
||||
|
||||
auto scaledValue = yValue / leftAxisProperties->scaleFactor();
|
||||
auto valueText = RiaNumberFormat::valueToText( scaledValue, RiaNumberFormat::NumberFormatType::FIXED, 2 );
|
||||
|
||||
anno->setName( valueText );
|
||||
|
||||
auto lineAppearance = m_readOutSettings->lineAppearance();
|
||||
|
||||
Qt::PenStyle style = lineAppearance->isDashed() ? Qt::PenStyle::DashLine : Qt::PenStyle::SolidLine;
|
||||
anno->setPenStyle( style );
|
||||
anno->setColor( lineAppearance->color() );
|
||||
anno->setAlignment( m_readOutSettings->horizontalLineLabelAlignment() );
|
||||
|
||||
leftAxisProperties->appendAnnotation( anno );
|
||||
}
|
||||
}
|
||||
|
||||
plot->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ class RimSummaryPlotSourceStepping;
|
||||
class RimSummaryPlotNameHelper;
|
||||
class RimSummaryNameHelper;
|
||||
class RimPlotAxisProperties;
|
||||
class RimSummaryPlotReadOut;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -113,6 +114,8 @@ public:
|
||||
|
||||
void selectWell( QString wellName );
|
||||
|
||||
void updateReadOutLines( double qwtTimeValue, double yValue );
|
||||
|
||||
protected:
|
||||
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
|
||||
bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override;
|
||||
@@ -127,6 +130,8 @@ private:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
||||
|
||||
void populateNameHelper( RimSummaryPlotNameHelper* nameHelper );
|
||||
|
||||
void computeAggregatedAxisRange();
|
||||
@@ -151,6 +156,8 @@ private:
|
||||
|
||||
void updateReadOnlyState();
|
||||
|
||||
void updateReadOutSettings();
|
||||
|
||||
std::pair<double, double> adjustedMinMax( const RimPlotAxisProperties* axis, double min, double max ) const;
|
||||
|
||||
private:
|
||||
@@ -163,6 +170,8 @@ private:
|
||||
caf::PdmField<bool> m_autoAdjustAppearance;
|
||||
caf::PdmField<bool> m_allow3DSelectionLink;
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotReadOut*> m_readOutSettings;
|
||||
|
||||
caf::PdmField<bool> m_hidePlotsWithValuesBelow;
|
||||
caf::PdmField<double> m_plotFilterYAxisThreshold;
|
||||
|
||||
|
||||
@@ -1117,6 +1117,14 @@ bool RimSummaryPlot::isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis )
|
||||
return ( waterCutCurveCount == curves.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::enableCurvePointTracking( bool enable )
|
||||
{
|
||||
m_summaryPlot->enableCurvePointTracking( enable );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1336,8 +1344,9 @@ RimTimeAxisAnnotation* RimSummaryPlot::addTimeAnnotation( time_t time )
|
||||
RimSummaryTimeAxisProperties* axisProps = timeAxisProperties();
|
||||
CAF_ASSERT( axisProps );
|
||||
|
||||
auto* annotation = new RimTimeAxisAnnotation;
|
||||
annotation->setTime( time );
|
||||
auto* annotation = new RimTimeAxisAnnotation;
|
||||
const QString formatString;
|
||||
annotation->setTime( time, formatString );
|
||||
annotation->setDefaultColor();
|
||||
|
||||
axisProps->appendAnnotation( annotation );
|
||||
|
||||
@@ -209,6 +209,8 @@ public:
|
||||
RimSummaryPlotSourceStepping* sourceStepper();
|
||||
void scheduleReplotIfVisible();
|
||||
|
||||
void enableCurvePointTracking( bool enable );
|
||||
|
||||
public:
|
||||
// RimViewWindow overrides
|
||||
void deleteViewWidget() override;
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimSummaryPlotReadOut.h"
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSummaryPlotReadOut, "RimSummaryPlotReadOut" );
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimSummaryPlotReadOut::ReadOutType>::setUp()
|
||||
{
|
||||
addItem( RimSummaryPlotReadOut::ReadOutType::NONE, "NONE", "None" );
|
||||
addItem( RimSummaryPlotReadOut::ReadOutType::SNAP_TO_POINT, "SNAP_TO_POINT", "Snap to Closest Curve Point" );
|
||||
addItem( RimSummaryPlotReadOut::ReadOutType::TIME_TRACKING, "TIME_TRACKING", "Time Tracking" );
|
||||
addItem( RimSummaryPlotReadOut::ReadOutType::TIME_VALUE_TRACKING, "TIME_VALUE_TRACKING", "Time and Value Tracking" );
|
||||
|
||||
setDefault( RimSummaryPlotReadOut::ReadOutType::SNAP_TO_POINT );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotReadOut::RimSummaryPlotReadOut()
|
||||
{
|
||||
CAF_PDM_InitObject( "Summary Plot Read Out", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_readOutType, "ReadOutType", "Readout Mode" );
|
||||
m_readOutType = ReadOutType::SNAP_TO_POINT;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_lineAppearance, "LineAppearance", "" );
|
||||
m_lineAppearance = new RimAnnotationLineAppearance;
|
||||
m_lineAppearance->configureForSummaryAnnotations();
|
||||
m_lineAppearance.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_verticalLineLabelAlignment, "VerticalLineLabelAlignment", "Vertical Label Alignment" );
|
||||
m_verticalLineLabelAlignment = RiaDefines::TextAlignment::LEFT;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_horizontalLineLabelAlignment, "HorizontalLineLabelAlignment", "Horizontal Label Alignment" );
|
||||
m_horizontalLineLabelAlignment = RiaDefines::TextAlignment::LEFT;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotReadOut::enableCurvePointTracking() const
|
||||
{
|
||||
return m_readOutType() == ReadOutType::SNAP_TO_POINT;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotReadOut::enableHorizontalLine() const
|
||||
{
|
||||
return m_readOutType() == ReadOutType::TIME_VALUE_TRACKING;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotReadOut::enableVerticalLine() const
|
||||
{
|
||||
return ( ( m_readOutType() == ReadOutType::TIME_TRACKING ) || ( m_readOutType() == ReadOutType::TIME_VALUE_TRACKING ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationLineAppearance* RimSummaryPlotReadOut::lineAppearance() const
|
||||
{
|
||||
return m_lineAppearance();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::TextAlignment RimSummaryPlotReadOut::verticalLineLabelAlignment() const
|
||||
{
|
||||
return m_verticalLineLabelAlignment();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::TextAlignment RimSummaryPlotReadOut::horizontalLineLabelAlignment() const
|
||||
{
|
||||
return m_horizontalLineLabelAlignment();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotReadOut::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_readOutType );
|
||||
|
||||
if ( enableVerticalLine() ) uiOrdering.add( &m_verticalLineLabelAlignment );
|
||||
if ( enableHorizontalLine() ) uiOrdering.add( &m_horizontalLineLabelAlignment );
|
||||
|
||||
if ( enableVerticalLine() || enableHorizontalLine() )
|
||||
{
|
||||
m_lineAppearance->uiOrdering( uiConfigName, uiOrdering );
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025 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 "RiaPlotDefines.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
|
||||
class RimAnnotationLineAppearance;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryPlotReadOut : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum class ReadOutType
|
||||
{
|
||||
NONE,
|
||||
SNAP_TO_POINT,
|
||||
TIME_TRACKING,
|
||||
TIME_VALUE_TRACKING
|
||||
};
|
||||
|
||||
public:
|
||||
RimSummaryPlotReadOut();
|
||||
|
||||
bool enableCurvePointTracking() const;
|
||||
bool enableHorizontalLine() const;
|
||||
bool enableVerticalLine() const;
|
||||
RimAnnotationLineAppearance* lineAppearance() const;
|
||||
RiaDefines::TextAlignment verticalLineLabelAlignment() const;
|
||||
RiaDefines::TextAlignment horizontalLineLabelAlignment() const;
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<ReadOutType>> m_readOutType;
|
||||
|
||||
caf::PdmChildField<RimAnnotationLineAppearance*> m_lineAppearance;
|
||||
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::TextAlignment>> m_verticalLineLabelAlignment;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::TextAlignment>> m_horizontalLineLabelAlignment;
|
||||
};
|
||||
Reference in New Issue
Block a user