#4990 Column and row span

This commit is contained in:
Gaute Lindkvist
2019-11-05 14:17:24 +01:00
parent 6d1d7bde23
commit c1dfe193d7
12 changed files with 254 additions and 119 deletions

View File

@@ -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
///

View File

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

View File

@@ -296,7 +296,7 @@ int RimGridPlotWindow::columnCount() const
{
if ( m_columnCountEnum() == COLUMNS_UNLIMITED )
{
return static_cast<int>( visiblePlots().size() );
std::numeric_limits<int>::max();
}
return static_cast<int>( m_columnCountEnum() );
}

View File

@@ -19,6 +19,17 @@ void RimPlotInterface::WidthScaleFactorEnum::setUp()
addItem( RimPlotInterface::EXTRA_WIDE, "EXTRA_WIDE_TRACK", "Extra wide" );
setDefault( RimPlotInterface::NORMAL );
}
template <>
void RimPlotInterface::RowOrColSpanEnum::setUp()
{
addItem( RimPlotInterface::ONE, "ONE", "1" );
addItem( RimPlotInterface::TWO, "TWO", "2" );
addItem( RimPlotInterface::THREE, "THREE", "3" );
addItem( RimPlotInterface::FOUR, "FOUR", "4" );
setDefault( RimPlotInterface::ONE );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
@@ -45,3 +56,19 @@ QString RimPlotInterface::asciiDataForPlotExport() const
{
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotInterface::updatePlotWindowLayout()
{
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
CAF_ASSERT( thisPdm );
RimGridPlotWindow* plotWindow;
thisPdm->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
}

View File

@@ -41,9 +41,17 @@ public:
WIDE = 7,
EXTRA_WIDE = 10
};
typedef caf::AppEnum<WidthScaleFactor> WidthScaleFactorEnum;
enum RowOrColSpan
{
ONE = 1,
TWO = 2,
THREE = 3,
FOUR = 4
};
typedef caf::AppEnum<RowOrColSpan> RowOrColSpanEnum;
public:
RimPlotInterface() = default;
virtual ~RimPlotInterface() = default;
@@ -99,6 +107,6 @@ public:
virtual void updateAfterInsertingIntoGridPlotWindow() {}
protected:
virtual void updatePlotWindowLayout() {}
void updatePlotWindowLayout();
virtual void onWidthScaleFactorChange() {}
};

View File

@@ -882,19 +882,6 @@ void RimWellLogTrack::updateZoomFromQwt()
m_visibleYRangeMax = depthInterval.maxValue();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updatePlotWindowLayout()
{
RimGridPlotWindow* plotWindow;
this->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -2253,7 +2240,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
std::vector<QString> sourceNames =
{"", "PP=Grid", "PP=Las-File", "PP=Element Property Table", "", "PP=Hydrostatic"};
{ "", "PP=Grid", "PP=Las-File", "PP=Element Property Table", "", "PP=Hydrostatic" };
curveData.data = ppValues;
std::vector<QString> sourceNamesToPlot;
@@ -2277,12 +2264,12 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
std::vector<QString> sourceNames =
{"",
"",
"Poisson=Las-File",
"Poisson=Element Property Table",
QString( "Poisson=%1" ).arg( wellBoreStabilityPlot->userDefinedPoissonRatio() ),
""};
{ "",
"",
"Poisson=Las-File",
"Poisson=Element Property Table",
QString( "Poisson=%1" ).arg( wellBoreStabilityPlot->userDefinedPoissonRatio() ),
"" };
curveData.data = poissonValues;
std::vector<QString> sourceNamesToPlot;
@@ -2305,12 +2292,12 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
{
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
std::vector<QString> sourceNames = {"",
"",
"UCS=Las-File",
"UCS=Element Property Table",
QString( "UCS=%1" ).arg( wellBoreStabilityPlot->userDefinedUcs() ),
""};
std::vector<QString> sourceNames = { "",
"",
"UCS=Las-File",
"UCS=Element Property Table",
QString( "UCS=%1" ).arg( wellBoreStabilityPlot->userDefinedUcs() ),
"" };
curveData.data = ucsValues;
@@ -2380,16 +2367,16 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
}
}
const std::map<RiaDefines::WellPathComponentType, int> sortIndices = {{RiaDefines::WELL_PATH, 0},
{RiaDefines::CASING, 1},
{RiaDefines::LINER, 2},
{RiaDefines::PERFORATION_INTERVAL, 3},
{RiaDefines::FISHBONES, 4},
{RiaDefines::FRACTURE, 5},
{RiaDefines::PACKER, 6},
{RiaDefines::ICD, 7},
{RiaDefines::AICD, 8},
{RiaDefines::ICV, 9}};
const std::map<RiaDefines::WellPathComponentType, int> sortIndices = { { RiaDefines::WELL_PATH, 0 },
{ RiaDefines::CASING, 1 },
{ RiaDefines::LINER, 2 },
{ RiaDefines::PERFORATION_INTERVAL, 3 },
{ RiaDefines::FISHBONES, 4 },
{ RiaDefines::FRACTURE, 5 },
{ RiaDefines::PACKER, 6 },
{ RiaDefines::ICD, 7 },
{ RiaDefines::AICD, 8 },
{ RiaDefines::ICV, 9 } };
std::stable_sort( allWellPathComponents.begin(),
allWellPathComponents.end(),

View File

@@ -198,8 +198,6 @@ public:
int fontSize,
bool forceChange = false ) override;
void updatePlotWindowLayout() override;
void onAxisSelected( int axis, bool toggle ) override;
void updateAxes() override;

View File

@@ -156,6 +156,9 @@ RimSummaryPlot::RimSummaryPlot()
CAF_PDM_InitField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_curveFilters_OBSOLETE, "SummaryCurveFilters", "", "", "", "" );
m_curveFilters_OBSOLETE.uiCapability()->setUiTreeHidden( true );
@@ -331,7 +334,7 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( DateTimePeriod resampling
populateTimeHistoryCurvesData( m_gridTimeHistoryCurves.childObjects(), &timeHistoryCurvesData );
// Export observed data
appendToExportData( out, {summaryCurvesObsData}, showTimeAsLongString );
appendToExportData( out, { summaryCurvesObsData }, showTimeAsLongString );
std::vector<CurvesData> exportData( 2 );
@@ -353,7 +356,7 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( DateTimePeriod resampling
CurvesData asciiCurvesData;
populateAsciiDataCurvesData( m_asciiDataCurves.childObjects(), &asciiCurvesData );
appendToExportData( out, {asciiCurvesData}, showTimeAsLongString );
appendToExportData( out, { asciiCurvesData }, showTimeAsLongString );
}
return out;
@@ -1176,7 +1179,7 @@ void RimSummaryPlot::addCurveNoUpdate( RimSummaryCurve* curve )
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::deleteCurve( RimSummaryCurve* curve )
{
deleteCurves( {curve} );
deleteCurves( { curve } );
}
//--------------------------------------------------------------------------------------------------
@@ -1343,6 +1346,11 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
}
if ( changedField == &m_rowSpan || changedField == &m_colSpan )
{
updatePlotWindowLayout();
}
if ( changedField == &m_normalizeCurveYValues )
{
this->loadDataAndUpdate();
@@ -1497,7 +1505,7 @@ void RimSummaryPlot::updateZoomFromQwt()
//--------------------------------------------------------------------------------------------------
std::set<RimPlotAxisPropertiesInterface*> RimSummaryPlot::allPlotAxes() const
{
return {m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties};
return { m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties };
}
//--------------------------------------------------------------------------------------------------
@@ -1555,6 +1563,22 @@ void RimSummaryPlot::updateAfterInsertingIntoGridPlotWindow()
updateAxes();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimSummaryPlot::rowSpan() const
{
return static_cast<int>( m_rowSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimSummaryPlot::colSpan() const
{
return static_cast<int>( m_colSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1654,6 +1678,8 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
{
mainOptions->add( &m_useAutoPlotTitle );
mainOptions->add( &m_description );
mainOptions->add( &m_rowSpan );
mainOptions->add( &m_colSpan );
}
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle );
@@ -2095,13 +2121,13 @@ void populateTimeHistoryCurvesData( std::vector<RimGridTimeHistoryCurve*> curves
if ( curveCaseName == curvesData->caseNames[i] ) casePosInList = i;
}
CurveData curveData = {curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues()};
CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() };
if ( casePosInList == cvf::UNDEFINED_SIZE_T )
{
curvesData->caseNames.push_back( curveCaseName );
curvesData->timeSteps.push_back( curve->timeStepValues() );
curvesData->allCurveData.push_back( std::vector<CurveData>( {curveData} ) );
curvesData->allCurveData.push_back( std::vector<CurveData>( { curveData } ) );
}
else
{
@@ -2127,13 +2153,13 @@ void populateAsciiDataCurvesData( std::vector<RimAsciiDataCurve*> curves, Curves
size_t casePosInList = cvf::UNDEFINED_SIZE_T;
CurveData curveData = {curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues()};
CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() };
if ( casePosInList == cvf::UNDEFINED_SIZE_T )
{
curvesData->caseNames.push_back( "" );
curvesData->timeSteps.push_back( curve->timeSteps() );
curvesData->allCurveData.push_back( std::vector<CurveData>( {curveData} ) );
curvesData->allCurveData.push_back( std::vector<CurveData>( { curveData } ) );
}
else
{
@@ -2169,7 +2195,7 @@ void populateSummaryCurvesData( std::vector<RimSummaryCurve*> curves, SummaryCur
if ( curveCaseName == curvesData->caseNames[i] ) casePosInList = i;
}
CurveData curveData = {curve->curveExportDescription(), curve->summaryAddressY(), curve->valuesY()};
CurveData curveData = { curve->curveExportDescription(), curve->summaryAddressY(), curve->valuesY() };
CurveData errorCurveData;
// Error data
@@ -2185,7 +2211,7 @@ void populateSummaryCurvesData( std::vector<RimSummaryCurve*> curves, SummaryCur
if ( casePosInList == cvf::UNDEFINED_SIZE_T )
{
auto curveDataList = std::vector<CurveData>( {curveData} );
auto curveDataList = std::vector<CurveData>( { curveData } );
if ( hasErrorData ) curveDataList.push_back( errorCurveData );
curvesData->caseNames.push_back( curveCaseName );

View File

@@ -179,6 +179,9 @@ public:
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoGridPlotWindow() override;
int rowSpan() const override;
int colSpan() const override;
public:
// RimViewWindow overrides
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
@@ -226,6 +229,9 @@ private:
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_rowSpan;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
caf::PdmChildField<RimEnsembleCurveSetCollection*> m_ensembleCurveSetCollection;