#4990 Column and row span

This commit is contained in:
Gaute Lindkvist
2019-11-05 15:34:36 +01:00
parent 6d1d7bde23
commit c1dfe193d7
12 changed files with 254 additions and 119 deletions
@@ -57,6 +57,9 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" );
CAF_PDM_InitField( &m_showLegend_OBSOLETE, "ShowLegend", false, "Show Legend", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
m_nameConfig.uiCapability()->setUiTreeHidden( true );
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
@@ -387,6 +390,73 @@ 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 );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::removeFromMdiAreaAndCollection()
{
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
this->firstAncestorOrThisOfType( crossPlotCollection );
if ( crossPlotCollection )
{
crossPlotCollection->removeGridCrossPlot( this );
this->revokeMdiWindowStatus();
crossPlotCollection->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAfterInsertingIntoGridPlotWindow()
{
if ( m_plotWidget )
{
m_plotWidget->setTitle( "" );
m_plotWidget->setInternalQwtLegendVisible( false );
}
updateAxes();
updateLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::rowSpan() const
{
return static_cast<int>( m_rowSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::colSpan() const
{
return static_cast<int>( m_colSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -463,6 +533,11 @@ void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
uiOrdering.add( &m_legendFontSize );
}
}
else
{
uiOrdering.add( &m_rowSpan );
uiOrdering.add( &m_colSpan );
}
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Name Configuration" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
@@ -497,7 +572,14 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
{
updateLegend();
}
onLoadDataAndUpdate();
else if ( changedField == &m_colSpan || changedField == &m_rowSpan )
{
updatePlotWindowLayout();
}
else
{
onLoadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
@@ -1021,7 +1103,7 @@ void RimGridCrossPlot::setShowInfoBox( bool enable )
//--------------------------------------------------------------------------------------------------
std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const
{
return {m_xAxisProperties, m_yAxisProperties};
return { m_xAxisProperties, m_yAxisProperties };
}
//--------------------------------------------------------------------------------------------------
@@ -1032,57 +1114,6 @@ void RimGridCrossPlot::updatePlotTitle()
updateCurveNamesAndPlotTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet )
{
if ( m_plotWidget )
{
m_plotWidget->addOrUpdateDataSetLegend( dataSet );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSet )
{
if ( m_plotWidget )
{
m_plotWidget->removeDataSetLegend( dataSet );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::removeFromMdiAreaAndCollection()
{
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
this->firstAncestorOrThisOfType( crossPlotCollection );
if ( crossPlotCollection )
{
crossPlotCollection->removeGridCrossPlot( this );
this->revokeMdiWindowStatus();
crossPlotCollection->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAfterInsertingIntoGridPlotWindow()
{
if ( m_plotWidget )
{
m_plotWidget->setTitle( "" );
m_plotWidget->setInternalQwtLegendVisible( false );
}
updateAxes();
updateLayout();
}
//--------------------------------------------------------------------------------------------------
/// Name Configuration
///
@@ -117,6 +117,9 @@ public:
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoGridPlotWindow() override;
int rowSpan() const override;
int colSpan() const override;
protected:
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
@@ -155,6 +158,9 @@ private:
caf::PdmField<bool> m_showLegend_OBSOLETE;
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_rowSpan;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;