diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 759b5c8bf5..4ebe1d092d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -218,6 +218,7 @@ RimWellLogTrack::RimWellLogTrack() m_colorShadingTransparency.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_showRegionLabels, "ShowFormationLabels", true, "Show Labels", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_regionLabelFontSize, "RegionLabelFontSize", "Font Size", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_formationSource, "FormationSource", "Source", "", "", "" ); @@ -617,7 +618,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, updateConnectedEditors(); RiuPlotMainWindowTools::refreshToolbars(); } - else if ( changedField == &m_showRegionLabels ) + else if ( changedField == &m_showRegionLabels || changedField == &m_regionLabelFontSize ) { loadDataAndUpdate(); } @@ -1742,6 +1743,8 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering annotationGroup->add( &m_regionAnnotationType ); annotationGroup->add( &m_regionAnnotationDisplay ); annotationGroup->add( &m_showRegionLabels ); + if ( m_regionAnnotationType() == RiuPlotAnnotationTool::RegionAnnotationType::RESULT_PROPERTY_ANNOTATIONS ) + annotationGroup->add( &m_regionLabelFontSize ); if ( m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING || m_regionAnnotationDisplay() & RiuPlotAnnotationTool::COLORED_LINES ) @@ -2760,6 +2763,10 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot() } caf::ColorTable colorTable( colors ); + + int fontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), + m_regionLabelFontSize() ); + m_annotationTool->attachNamedRegions( m_plotWidget, namesToPlot, xRange, @@ -2767,7 +2774,10 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot() m_regionAnnotationDisplay(), colorTable, ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100, - m_showRegionLabels() ); + m_showRegionLabels(), + RiuPlotAnnotationTool::TrackSpan::FULL_WIDTH, + {}, + fontSize ); } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 8aa893f779..fb2a611a91 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -329,6 +329,7 @@ private: caf::PdmPtrField m_colorShadingLegend; caf::PdmField m_colorShadingTransparency; caf::PdmField m_showRegionLabels; + caf::PdmField m_regionLabelFontSize; caf::PdmField> m_formationSource; caf::PdmPtrField m_formationCase; caf::PdmField> m_formationTrajectoryType; diff --git a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp index 9c11683875..0aedbfb7b7 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp @@ -50,7 +50,8 @@ void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot* int shadingAlphaByte, bool showNames /*= true */, TrackSpan trackSpan /*= FULL_WIDTH*/, - const std::vector& brushStyles /* = {}*/ ) + const std::vector& brushStyles /* = {}*/, + int fontSize ) { if ( names.size() != yPositions.size() ) return; m_plot = plot; @@ -120,14 +121,26 @@ void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot* textColor = lineColor; } Qt::Alignment horizontalAlignment = trackTextAlignment( trackSpan ); - RiuPlotAnnotationTool::horizontalDashedLine( line, name, yPositions[i].first, lineColor, textColor, horizontalAlignment ); + RiuPlotAnnotationTool::horizontalDashedLine( line, + name, + yPositions[i].first, + lineColor, + textColor, + horizontalAlignment, + fontSize ); line->attach( m_plot ); m_horizontalMarkers.push_back( std::move( line ) ); if ( ( i != names.size() - 1 ) && cvf::Math::abs( yPositions[i].second - yPositions[i + 1].first ) > delta ) { QwtPlotMarker* bottomLine( new QwtPlotMarker() ); - RiuPlotAnnotationTool::horizontalDashedLine( bottomLine, QString(), yPositions[i].second, lineColor, textColor ); + RiuPlotAnnotationTool::horizontalDashedLine( bottomLine, + QString(), + yPositions[i].second, + lineColor, + textColor, + Qt::AlignRight, + fontSize ); bottomLine->attach( m_plot ); m_horizontalMarkers.push_back( std::move( bottomLine ) ); @@ -283,7 +296,8 @@ void RiuPlotAnnotationTool::horizontalDashedLine( QwtPlotMarker* line, double yValue, const QColor& color /*= QColor(0, 0, 100) */, const QColor& textColor /*= QColor(0, 0, 100) */, - Qt::Alignment horizontalAlignment /*= Qt::AlignRight */ ) + Qt::Alignment horizontalAlignment /*= Qt::AlignRight */, + int fontSize ) { QPen curvePen; curvePen.setStyle( Qt::DashLine ); @@ -295,6 +309,7 @@ void RiuPlotAnnotationTool::horizontalDashedLine( QwtPlotMarker* line, line->setYValue( yValue ); QwtText label( name ); label.setColor( textColor ); + if ( fontSize > 0 ) label.setFont( QFont( label.font().key(), fontSize ) ); line->setLabel( label ); line->setLabelAlignment( horizontalAlignment | Qt::AlignBottom ); } diff --git a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.h b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.h index 7f6bd47a81..c6477db97e 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.h +++ b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.h @@ -74,7 +74,8 @@ public: int shadingAlphaByte, bool showNames = true, TrackSpan trackSpan = TrackSpan::FULL_WIDTH, - const std::vector& brushStyles = {} ); + const std::vector& brushStyles = {}, + int fontSize = 0 ); void attachWellPicks( QwtPlot* plot, const std::vector& names, const std::vector& yPositions ); void attachAnnotationLine( QwtPlot* plot, @@ -112,7 +113,8 @@ private: double yValue, const QColor& color = QColor( 0, 0, 100 ), const QColor& textColor = QColor( 0, 0, 100 ), - Qt::Alignment horizontalAlignment = Qt::AlignRight ); + Qt::Alignment horizontalAlignment = Qt::AlignRight, + int fontSize = 0 ); void verticalLine( QwtPlotMarker* line, const QString& name,