mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Implement pdf rendering (#5250)
* First PDF creation support * Reimplement info box * Set title and make overlay frame margins more unified * Remove a style sheet that was never meant to be applied to Project Tree * Update RiuDraggableOverlayFrame when changing content * Default page layout in Preferences * undo removal of elision * Remove friend class assignment in cafCategoryMapper * the required methods have been made public * Fix up after review * Remove spurious const on by-value return * Fix compile errors on Linux * Fix size adjustment of legends with plot resizing
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
#include "RimWellPltPlot.h"
|
||||
|
||||
#include "RiuCvfOverlayItemWidget.h"
|
||||
#include "RiuDraggableOverlayFrame.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
@@ -1268,10 +1269,12 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
||||
{
|
||||
if ( !m_ensembleLegendFrames[curveSet] )
|
||||
{
|
||||
m_ensembleLegendFrames[curveSet] = new RiuCvfOverlayItemWidget( track->viewer(),
|
||||
track->viewer()->canvas() );
|
||||
m_ensembleLegendFrames[curveSet] =
|
||||
new RiuCvfOverlayItemWidget( curveSet->legendConfig()->titledOverlayFrame(),
|
||||
track->viewer()->canvas(),
|
||||
track->viewer()->overlayMargins() );
|
||||
}
|
||||
m_ensembleLegendFrames[curveSet]->updateFromOverlayItem( curveSet->legendConfig()->titledOverlayFrame() );
|
||||
|
||||
track->viewer()->addOverlayFrame( m_ensembleLegendFrames[curveSet] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class RigEclipseCaseData;
|
||||
class RiaRftPltCurveDefinition;
|
||||
class RifDataSourceForRftPlt;
|
||||
class RifEclipseRftAddress;
|
||||
class RiuCvfOverlayItemWidget;
|
||||
class RiuDraggableOverlayFrame;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@@ -156,8 +156,8 @@ private:
|
||||
|
||||
caf::PdmPtrField<RimWellPathCollection*> m_wellPathCollection;
|
||||
|
||||
caf::PdmChildArrayField<RimWellRftEnsembleCurveSet*> m_ensembleCurveSets;
|
||||
std::map<RimWellRftEnsembleCurveSet*, QPointer<RiuCvfOverlayItemWidget>> m_ensembleLegendFrames;
|
||||
caf::PdmChildArrayField<RimWellRftEnsembleCurveSet*> m_ensembleCurveSets;
|
||||
std::map<RimWellRftEnsembleCurveSet*, QPointer<RiuDraggableOverlayFrame>> m_ensembleLegendFrames;
|
||||
|
||||
std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors;
|
||||
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifTextDataTableFormatter.h"
|
||||
#include "RiuDraggableOverlayFrame.h"
|
||||
#include "RiuGridCrossQwtPlot.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
@@ -276,6 +277,37 @@ bool RimGridCrossPlot::showInfoBox() const
|
||||
return m_showInfoBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateInfoBox()
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
if ( m_showInfoBox )
|
||||
{
|
||||
if ( !m_infoBox )
|
||||
{
|
||||
m_infoBox = new RiuDraggableOverlayFrame( m_plotWidget->canvas(), m_plotWidget->overlayMargins() );
|
||||
m_infoBox->setAnchorCorner( RiuDraggableOverlayFrame::AnchorCorner::TopRight );
|
||||
RiuTextOverlayContentFrame* textFrame = new RiuTextOverlayContentFrame( m_infoBox );
|
||||
textFrame->setText( generateInfoBoxText() );
|
||||
m_infoBox->setContentFrame( textFrame );
|
||||
}
|
||||
m_plotWidget->addOverlayFrame( m_infoBox );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_plotWidget && m_infoBox )
|
||||
{
|
||||
m_plotWidget->removeOverlayFrame( m_infoBox );
|
||||
delete m_infoBox;
|
||||
m_infoBox = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -355,28 +387,6 @@ void RimGridCrossPlot::onAxisSelected( int axis, bool toggle )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet )
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->addOrUpdateDataSetLegend( dataSet );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSet )
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->removeDataSetLegend( dataSet );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -391,6 +401,38 @@ void RimGridCrossPlot::doRemoveFromCollection()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridCrossPlot::generateInfoBoxText() const
|
||||
{
|
||||
QStringList curveInfoTexts;
|
||||
for ( auto dataSet : dataSets() )
|
||||
{
|
||||
QString curveInfoText = dataSet->infoText();
|
||||
if ( dataSet->isChecked() && !curveInfoText.isEmpty() )
|
||||
{
|
||||
curveInfoTexts += curveInfoText;
|
||||
}
|
||||
}
|
||||
QStringList infoText;
|
||||
infoText << QString( "<b>View ID:</b> %1<br/>" ).arg( id() );
|
||||
if ( curveInfoTexts.size() > 1 )
|
||||
{
|
||||
infoText += QString( "<ol style=\"margin-top: 0px; margin-left: 15px; -qt-list-indent:0;\">" );
|
||||
for ( QString curveInfoText : curveInfoTexts )
|
||||
{
|
||||
infoText += QString( "<li>%1</li>" ).arg( curveInfoText );
|
||||
}
|
||||
infoText += QString( "</ol>" );
|
||||
}
|
||||
else if ( curveInfoTexts.size() > 0 )
|
||||
{
|
||||
infoText += curveInfoTexts.front();
|
||||
}
|
||||
return infoText.join( "\n" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -404,9 +446,9 @@ QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
|
||||
}
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
|
||||
m_plotWidget->scheduleReplot();
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
@@ -433,6 +475,7 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
|
||||
|
||||
updateCurveNamesAndPlotTitle();
|
||||
updatePlot();
|
||||
updateInfoBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -724,6 +767,7 @@ bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingTyp
|
||||
if ( forceChange || legendFontSize() == oldFontSize )
|
||||
{
|
||||
setLegendFontSize( fontSize );
|
||||
|
||||
anyChange = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
class RimPlotAxisPropertiesInterface;
|
||||
class RimPlotAxisProperties;
|
||||
class RimGridCrossPlotDataSet;
|
||||
class RiuDraggableOverlayFrame;
|
||||
class RiuGridCrossQwtPlot;
|
||||
|
||||
class RimGridCrossPlotNameConfig : public RimNameConfig
|
||||
@@ -76,6 +77,7 @@ public:
|
||||
QString createAutoName() const override;
|
||||
|
||||
bool showInfoBox() const;
|
||||
void updateInfoBox();
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
void detachAllCurves() override;
|
||||
@@ -109,9 +111,6 @@ public:
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
void addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet );
|
||||
void removeDataSetLegend( RimGridCrossPlotDataSet* dataSet );
|
||||
|
||||
protected:
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
void deleteViewWidget() override;
|
||||
@@ -146,7 +145,8 @@ private:
|
||||
void doUpdateLayout() override;
|
||||
void cleanupBeforeClose();
|
||||
|
||||
void doRemoveFromCollection() override;
|
||||
void doRemoveFromCollection() override;
|
||||
QString generateInfoBoxText() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showInfoBox;
|
||||
@@ -158,5 +158,6 @@ private:
|
||||
|
||||
caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets;
|
||||
|
||||
QPointer<RiuGridCrossQwtPlot> m_plotWidget;
|
||||
QPointer<RiuGridCrossQwtPlot> m_plotWidget;
|
||||
QPointer<RiuDraggableOverlayFrame> m_infoBox;
|
||||
};
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
#include "RigFormationNames.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RiuCvfOverlayItemWidget.h"
|
||||
#include "RiuGridCrossQwtPlot.h"
|
||||
#include "RiuScalarMapperLegendFrame.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseCase.h"
|
||||
@@ -57,6 +59,7 @@
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cafTitledOverlayFrame.h"
|
||||
#include "cvfScalarMapper.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
@@ -133,6 +136,18 @@ RimGridCrossPlotDataSet::RimGridCrossPlotDataSet()
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridCrossPlotDataSet::~RimGridCrossPlotDataSet()
|
||||
{
|
||||
if ( m_legendOverlayFrame )
|
||||
{
|
||||
m_legendOverlayFrame->setParent( nullptr );
|
||||
delete m_legendOverlayFrame;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1020,11 +1035,20 @@ void RimGridCrossPlotDataSet::updateLegendRange()
|
||||
m_groupingProperty->updateRangesForEmbeddedLegends( m_timeStep() );
|
||||
}
|
||||
}
|
||||
parent->addOrUpdateDataSetLegend( this );
|
||||
if ( !m_legendOverlayFrame )
|
||||
{
|
||||
m_legendOverlayFrame = new RiuDraggableOverlayFrame( parent->viewer()->canvas(),
|
||||
parent->viewer()->overlayMargins() );
|
||||
}
|
||||
m_legendOverlayFrame->setContentFrame( legendConfig()->makeLegendFrame() );
|
||||
parent->viewer()->addOverlayFrame( m_legendOverlayFrame );
|
||||
}
|
||||
else
|
||||
{
|
||||
parent->removeDataSetLegend( this );
|
||||
if ( m_legendOverlayFrame )
|
||||
{
|
||||
parent->viewer()->removeOverlayFrame( m_legendOverlayFrame );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <cvfArray.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
#include <map>
|
||||
|
||||
class RifTextDataTableFormatter;
|
||||
@@ -47,11 +48,12 @@ class RimEclipseResultCase;
|
||||
class RimEclipseCellColors;
|
||||
class RimEclipseResultDefinition;
|
||||
class RimRegularLegendConfig;
|
||||
class RimPlotCellFilterCollection;
|
||||
class RimPlotCellFilter;
|
||||
class RiuDraggableOverlayFrame;
|
||||
class QwtPlot;
|
||||
class QwtPlotCurve;
|
||||
class QString;
|
||||
class RimPlotCellFilterCollection;
|
||||
class RimPlotCellFilter;
|
||||
|
||||
class RimGridCrossPlotDataSetNameConfig : public RimNameConfig
|
||||
{
|
||||
@@ -93,7 +95,7 @@ public:
|
||||
|
||||
public:
|
||||
RimGridCrossPlotDataSet();
|
||||
~RimGridCrossPlotDataSet() = default;
|
||||
~RimGridCrossPlotDataSet();
|
||||
|
||||
void setCellFilterView( RimGridView* cellFilterView );
|
||||
void loadDataAndUpdate( bool updateParentPlot );
|
||||
@@ -188,5 +190,6 @@ private:
|
||||
caf::PdmField<bool> m_useCustomColor;
|
||||
caf::PdmField<cvf::Color3f> m_customColor;
|
||||
caf::PdmChildField<RimPlotCellFilterCollection*> m_plotCellFilterCollection;
|
||||
;
|
||||
|
||||
QPointer<RiuDraggableOverlayFrame> m_legendOverlayFrame;
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <cvfAssert.h>
|
||||
@@ -299,6 +300,17 @@ void RimMultiPlotWindow::doSetAutoScaleYEnabled( bool enabled )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::doRenderWindowContent( QPainter* painter )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->renderTo( painter );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -426,10 +438,10 @@ QImage RimMultiPlotWindow::snapshotWindowContent()
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setSelectionsVisible( false );
|
||||
QPixmap pix = m_viewer->grab();
|
||||
image = pix.toImage();
|
||||
m_viewer->setSelectionsVisible( true );
|
||||
QPixmap pix( m_viewer->size() );
|
||||
QPainter painter( &pix );
|
||||
m_viewer->renderTo( &painter );
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
|
||||
@@ -129,6 +129,7 @@ private:
|
||||
virtual void updateSubPlotNames();
|
||||
virtual void updatePlotWindowTitle();
|
||||
virtual void doSetAutoScaleYEnabled( bool enabled );
|
||||
void doRenderWindowContent( QPainter* painter ) override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_showPlotWindowTitle;
|
||||
|
||||
@@ -123,3 +123,14 @@ void RimPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const Q
|
||||
updateParentLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::doRenderWindowContent( QPainter* painter )
|
||||
{
|
||||
if ( viewer() )
|
||||
{
|
||||
viewer()->renderTo( painter, viewer()->frameGeometry() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void doRemoveFromCollection() = 0;
|
||||
virtual void doRenderWindowContent( QPainter* painter );
|
||||
|
||||
protected:
|
||||
caf::PdmField<RowOrColSpanEnum> m_rowSpan;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPlotWindowRedrawScheduler.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
@@ -26,6 +27,8 @@
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -153,6 +156,28 @@ void RimPlotWindow::updateParentLayout()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotWindow::renderWindowContent( QPainter* painter )
|
||||
{
|
||||
doRenderWindowContent( painter );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QPageLayout RimPlotWindow::pageLayout() const
|
||||
{
|
||||
QPageLayout defaultPageLayout = RiaApplication::instance()->preferences()->defaultPageLayout();
|
||||
QPageLayout customPageLayout;
|
||||
if ( hasCustomPageLayout( &customPageLayout ) )
|
||||
{
|
||||
return customPageLayout;
|
||||
}
|
||||
return defaultPageLayout;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -218,6 +243,14 @@ void RimPlotWindow::uiOrderingForLegendSettings( QString uiConfigName, caf::PdmU
|
||||
uiOrdering.add( &m_legendFontSize );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Re-implement this in sub classes to provide a custom page layout for printing/PDF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotWindow::hasCustomPageLayout( QPageLayout* customPageLayout ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "cafPdmFieldHandle.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QPageLayout>
|
||||
|
||||
class RimProject;
|
||||
|
||||
class QwtPlotCurve;
|
||||
@@ -57,6 +59,9 @@ public:
|
||||
void updateLayout();
|
||||
void updateParentLayout();
|
||||
|
||||
void renderWindowContent( QPainter* painter );
|
||||
QPageLayout pageLayout() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
@@ -69,6 +74,8 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void doUpdateLayout() {}
|
||||
virtual bool hasCustomPageLayout( QPageLayout* customPageLayout ) const;
|
||||
virtual void doRenderWindowContent( QPainter* painter ) = 0;
|
||||
|
||||
private:
|
||||
friend class RimProject;
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "RimWellMeasurementInView.h"
|
||||
#include "RimWellRftEnsembleCurveSet.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
#include "RiuCategoryLegendFrame.h"
|
||||
#include "RiuScalarMapperLegendFrame.h"
|
||||
|
||||
#include "cafCategoryLegend.h"
|
||||
#include "cafCategoryMapper.h"
|
||||
@@ -148,6 +150,7 @@ RimRegularLegendConfig::RimRegularLegendConfig()
|
||||
"",
|
||||
"The number of significant digits displayed in the legend numbers",
|
||||
"" );
|
||||
m_significantDigitsInData = m_precision;
|
||||
CAF_PDM_InitField( &m_tickNumberFormat,
|
||||
"TickNumberFormat",
|
||||
caf::AppEnum<RimRegularLegendConfig::NumberFormatType>( FIXED ),
|
||||
@@ -312,6 +315,8 @@ void RimRegularLegendConfig::fieldChangedByUi( const caf::PdmFieldHandle* change
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRegularLegendConfig::updateLegend()
|
||||
{
|
||||
m_significantDigitsInData = m_precision;
|
||||
|
||||
double adjustedMin = cvf::UNDEFINED_DOUBLE;
|
||||
double adjustedMax = cvf::UNDEFINED_DOUBLE;
|
||||
|
||||
@@ -461,7 +466,9 @@ void RimRegularLegendConfig::updateLegend()
|
||||
{
|
||||
numDecimalDigits -= static_cast<int>( decadesInRange );
|
||||
}
|
||||
m_scalarMapperLegend->setTickPrecision( cvf::Math::clamp( numDecimalDigits, 0, 20 ) );
|
||||
numDecimalDigits = cvf::Math::clamp( numDecimalDigits, 0, 20 );
|
||||
m_significantDigitsInData = numDecimalDigits;
|
||||
m_scalarMapperLegend->setTickPrecision( numDecimalDigits );
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaPreferences* preferences = app->preferences();
|
||||
@@ -762,7 +769,9 @@ double RimRegularLegendConfig::categoryValueFromCategoryName( const QString& cat
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRegularLegendConfig::setTitle( const QString& title )
|
||||
{
|
||||
auto cvfTitle = cvfqt::Utils::toString( title );
|
||||
m_title = title;
|
||||
|
||||
auto cvfTitle = cvfqt::Utils::toString( m_title );
|
||||
m_scalarMapperLegend->setTitle( cvfTitle );
|
||||
m_categoryLegend->setTitle( cvfTitle );
|
||||
}
|
||||
@@ -805,6 +814,24 @@ const caf::TitledOverlayFrame* RimRegularLegendConfig::titledOverlayFrame() cons
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuAbstractLegendFrame* RimRegularLegendConfig::makeLegendFrame()
|
||||
{
|
||||
if ( m_currentScalarMapper == m_categoryMapper )
|
||||
{
|
||||
return new RiuCategoryLegendFrame( nullptr, m_title, m_categoryMapper.p() );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto legend = new RiuScalarMapperLegendFrame( nullptr, m_title, m_currentScalarMapper.p() );
|
||||
legend->setTickFormat( m_tickNumberFormat() );
|
||||
legend->setTickPrecision( m_significantDigitsInData );
|
||||
return legend;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -48,6 +48,7 @@ class OverlayScalarMapperLegend;
|
||||
|
||||
class Rim3dView;
|
||||
class RimEnsembleCurveSet;
|
||||
class RiuAbstractLegendFrame;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -148,6 +149,7 @@ public:
|
||||
|
||||
const caf::TitledOverlayFrame* titledOverlayFrame() const override;
|
||||
caf::TitledOverlayFrame* titledOverlayFrame() override;
|
||||
RiuAbstractLegendFrame* makeLegendFrame();
|
||||
|
||||
RangeModeType rangeMode() const;
|
||||
static cvf::Color3ubArray colorArrayFromColorType( ColorRangesType colorType );
|
||||
@@ -170,9 +172,6 @@ private:
|
||||
|
||||
friend class RimViewLinker;
|
||||
|
||||
caf::OverlayScalarMapperLegend* getOrCreateScalarMapperLegend();
|
||||
caf::CategoryLegend* getOrCreateCategoryLegend();
|
||||
|
||||
private:
|
||||
cvf::ref<cvf::ScalarMapperDiscreteLinear> m_linDiscreteScalarMapper;
|
||||
cvf::ref<cvf::ScalarMapperDiscreteLog> m_logDiscreteScalarMapper;
|
||||
@@ -211,4 +210,7 @@ private:
|
||||
caf::PdmField<double> m_userDefinedMinValue;
|
||||
caf::PdmField<caf::AppEnum<ColorRangesType>> m_colorRangeMode;
|
||||
caf::PdmField<caf::AppEnum<MappingType>> m_mappingMode;
|
||||
|
||||
QString m_title;
|
||||
int m_significantDigitsInData;
|
||||
};
|
||||
|
||||
@@ -693,26 +693,6 @@ void RimWellLogPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellLogPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
RiuWellLogPlot* wellLogViewer = dynamic_cast<RiuWellLogPlot*>( m_viewer.data() );
|
||||
CAF_ASSERT( wellLogViewer );
|
||||
bool isScrollbarVisible = wellLogViewer->isScrollbarVisible();
|
||||
wellLogViewer->setScrollbarVisible( false );
|
||||
image = RimMultiPlotWindow::snapshotWindowContent();
|
||||
wellLogViewer->setScrollbarVisible( isScrollbarVisible );
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -122,8 +122,6 @@ protected:
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
private:
|
||||
void updateSubPlotNames() override;
|
||||
void updatePlotWindowTitle() override;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaStatisticsTools.h"
|
||||
#include "RiuAbstractLegendFrame.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicSummaryCurveCreator.h"
|
||||
|
||||
@@ -47,6 +48,7 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuCvfOverlayItemWidget.h"
|
||||
#include "RiuDraggableOverlayFrame.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuSummaryCurveDefSelectionDialog.h"
|
||||
@@ -383,7 +385,7 @@ RimRegularLegendConfig* RimEnsembleCurveSet::legendConfig()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QFrame* RimEnsembleCurveSet::legendFrame() const
|
||||
RiuDraggableOverlayFrame* RimEnsembleCurveSet::legendFrame() const
|
||||
{
|
||||
return m_legendOverlayFrame;
|
||||
}
|
||||
@@ -888,10 +890,10 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
{
|
||||
if ( !m_legendOverlayFrame )
|
||||
{
|
||||
m_legendOverlayFrame = new RiuCvfOverlayItemWidget( plot->viewer(), plot->viewer()->canvas() );
|
||||
m_legendOverlayFrame = new RiuDraggableOverlayFrame( plot->viewer()->canvas(),
|
||||
plot->viewer()->overlayMargins() );
|
||||
}
|
||||
m_legendOverlayFrame->updateFromOverlayItem( m_legendConfig()->titledOverlayFrame() );
|
||||
plot->viewer()->addOverlayFrame( m_legendOverlayFrame );
|
||||
m_legendOverlayFrame->setContentFrame( m_legendConfig->makeLegendFrame() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ class RimSummaryCurveAutoName;
|
||||
class RimEnsembleCurveFilterCollection;
|
||||
class RimEnsembleStatistics;
|
||||
class RimEnsembleStatisticsCase;
|
||||
class RiuCvfOverlayItemWidget;
|
||||
class RiuDraggableOverlayFrame;
|
||||
|
||||
class QwtPlot;
|
||||
class QwtPlotCurve;
|
||||
@@ -108,8 +108,8 @@ public:
|
||||
|
||||
RimRegularLegendConfig* legendConfig();
|
||||
|
||||
void updateEnsembleLegendItem();
|
||||
QFrame* legendFrame() const;
|
||||
void updateEnsembleLegendItem();
|
||||
RiuDraggableOverlayFrame* legendFrame() const;
|
||||
|
||||
void updateAllCurves();
|
||||
void updateStatisticsCurves();
|
||||
@@ -190,8 +190,8 @@ private:
|
||||
caf::PdmProxyValueField<QString> m_autoGeneratedName;
|
||||
caf::PdmChildField<RimSummaryCurveAutoName*> m_summaryAddressNameTools;
|
||||
|
||||
QwtPlotCurve* m_qwtPlotCurveForLegendText;
|
||||
QPointer<RiuCvfOverlayItemWidget> m_legendOverlayFrame;
|
||||
QwtPlotCurve* m_qwtPlotCurveForLegendText;
|
||||
QPointer<RiuDraggableOverlayFrame> m_legendOverlayFrame;
|
||||
|
||||
std::unique_ptr<RimEnsembleStatisticsCase> m_ensembleStatCase;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user