mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
* 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
137 lines
4.5 KiB
C++
137 lines
4.5 KiB
C++
#include "RimPlot.h"
|
|
|
|
#include "RimMultiPlotWindow.h"
|
|
#include "RimPlotWindow.h"
|
|
|
|
#include "RiuQwtPlotWidget.h"
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
namespace caf
|
|
{
|
|
template <>
|
|
void RimPlot::RowOrColSpanEnum::setUp()
|
|
{
|
|
addItem( RimPlot::UNLIMITED, "UNLIMITED", "Unlimited" );
|
|
addItem( RimPlot::ONE, "ONE", "1" );
|
|
addItem( RimPlot::TWO, "TWO", "2" );
|
|
addItem( RimPlot::THREE, "THREE", "3" );
|
|
addItem( RimPlot::FOUR, "FOUR", "4" );
|
|
addItem( RimPlot::FIVE, "FIVE", "5" );
|
|
setDefault( RimPlot::ONE );
|
|
}
|
|
} // namespace caf
|
|
|
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlot, "RimPlot" ); // Do not use. Abstract class
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimPlot::RimPlot()
|
|
{
|
|
CAF_PDM_InitObject( "Plot", "", "", "" );
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
|
|
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimPlot::~RimPlot() {}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlot::createPlotWidget()
|
|
{
|
|
createViewWidget( nullptr );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimPlot::RowOrColSpan RimPlot::rowSpan() const
|
|
{
|
|
return m_rowSpan();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimPlot::RowOrColSpan RimPlot::colSpan() const
|
|
{
|
|
return m_colSpan();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlot::setRowSpan( RowOrColSpan rowSpan )
|
|
{
|
|
m_rowSpan = rowSpan;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlot::setColSpan( RowOrColSpan colSpan )
|
|
{
|
|
m_colSpan = colSpan;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlot::removeFromMdiAreaAndCollection()
|
|
{
|
|
if ( isMdiWindow() )
|
|
{
|
|
revokeMdiWindowStatus();
|
|
}
|
|
doRemoveFromCollection();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlot::updateAfterInsertingIntoMultiPlot()
|
|
{
|
|
updateLegend();
|
|
updateAxes();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
|
{
|
|
if ( !isMdiWindow() )
|
|
{
|
|
uiOrdering.add( &m_rowSpan );
|
|
uiOrdering.add( &m_colSpan );
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
|
{
|
|
if ( changedField == &m_colSpan || changedField == &m_rowSpan )
|
|
{
|
|
updateParentLayout();
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlot::doRenderWindowContent( QPainter* painter )
|
|
{
|
|
if ( viewer() )
|
|
{
|
|
viewer()->renderTo( painter, viewer()->frameGeometry() );
|
|
}
|
|
}
|