#8053 StimPlan Model Plot: Smaller font size for Facies log

This commit is contained in:
Kristian Bendiksen 2021-10-04 19:43:27 +02:00
parent 750c1832e5
commit 9f86bf15ed
4 changed files with 36 additions and 8 deletions

View File

@ -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 );
}
}

View File

@ -329,6 +329,7 @@ private:
caf::PdmPtrField<RimColorLegend*> m_colorShadingLegend;
caf::PdmField<int> m_colorShadingTransparency;
caf::PdmField<bool> m_showRegionLabels;
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_regionLabelFontSize;
caf::PdmField<caf::AppEnum<FormationSource>> m_formationSource;
caf::PdmPtrField<RimCase*> m_formationCase;
caf::PdmField<caf::AppEnum<TrajectoryType>> m_formationTrajectoryType;

View File

@ -50,7 +50,8 @@ void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot*
int shadingAlphaByte,
bool showNames /*= true */,
TrackSpan trackSpan /*= FULL_WIDTH*/,
const std::vector<Qt::BrushStyle>& brushStyles /* = {}*/ )
const std::vector<Qt::BrushStyle>& 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 );
}

View File

@ -74,7 +74,8 @@ public:
int shadingAlphaByte,
bool showNames = true,
TrackSpan trackSpan = TrackSpan::FULL_WIDTH,
const std::vector<Qt::BrushStyle>& brushStyles = {} );
const std::vector<Qt::BrushStyle>& brushStyles = {},
int fontSize = 0 );
void attachWellPicks( QwtPlot* plot, const std::vector<QString>& names, const std::vector<double>& 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,