mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4994 Make ComparisonView mode for InfoBox and animation progress
This commit is contained in:
parent
c27c19ce96
commit
e78b0d4204
@ -19,6 +19,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimGridView.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
@ -50,6 +51,7 @@ void RicCompareTo3dViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
activeView->setComparisonView( view );
|
||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
activeView->overlayInfoConfig()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,9 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimGridView.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
@ -48,6 +50,9 @@ public:
|
||||
{
|
||||
m_activeView->setComparisonView( nullptr );
|
||||
m_activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
auto gridView = dynamic_cast<RimGridView*>( m_activeView );
|
||||
if ( gridView ) gridView->overlayInfoConfig()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -425,11 +425,11 @@ bool Rim2dIntersectionView::hasResults()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int Rim2dIntersectionView::timeStepCount()
|
||||
size_t Rim2dIntersectionView::onTimeStepCountRequested()
|
||||
{
|
||||
if ( isTimeStepDependentDataVisible() )
|
||||
{
|
||||
return static_cast<int>( this->ownerCase()->timeStepStrings().size() );
|
||||
return this->ownerCase()->timeStepStrings().size();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -484,9 +484,9 @@ void Rim2dIntersectionView::onCreateDisplayModel()
|
||||
|
||||
nativeOrOverrideViewer()->removeAllFrames( isUsingOverrideViewer() );
|
||||
|
||||
int tsCount = this->timeStepCount();
|
||||
size_t tsCount = this->timeStepCount();
|
||||
|
||||
for ( int i = 0; i < tsCount; ++i )
|
||||
for ( size_t i = 0; i < tsCount; ++i )
|
||||
{
|
||||
nativeOrOverrideViewer()->addFrame( new cvf::Scene(), isUsingOverrideViewer() );
|
||||
}
|
||||
|
@ -106,7 +106,8 @@ protected:
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
bool hasResults();
|
||||
int timeStepCount();
|
||||
|
||||
virtual size_t onTimeStepCountRequested() override;
|
||||
|
||||
private:
|
||||
QString createAutoName() const override;
|
||||
|
@ -926,7 +926,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
return;
|
||||
}
|
||||
|
||||
m_viewDef->viewer()->showInfoText( m_showCaseInfo() || m_showResultInfo() );
|
||||
m_viewDef->viewer()->showInfoText( m_showCaseInfo() || ( m_showResultInfo() && !m_viewDef->activeComparisonView() ) );
|
||||
m_viewDef->viewer()->showHistogram( false );
|
||||
m_viewDef->viewer()->showAnimationProgress( m_showAnimProgress() );
|
||||
m_viewDef->viewer()->showVersionInfo( m_showVersionInfo() );
|
||||
@ -1024,6 +1024,12 @@ void Rim3dOverlayInfoConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiO
|
||||
}
|
||||
statGroup->add( &m_statisticsCellRange );
|
||||
}
|
||||
|
||||
bool isUsingComparisonView = m_viewDef->activeComparisonView();
|
||||
m_showResultInfo.uiCapability()->setUiReadOnly( isUsingComparisonView );
|
||||
m_showVolumeWeightedMean.uiCapability()->setUiReadOnly( isUsingComparisonView );
|
||||
m_showHistogram.uiCapability()->setUiReadOnly( isUsingComparisonView );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
|
@ -453,6 +453,14 @@ bool Rim3dView::isTimeStepDependentDataVisibleInThisOrComparisonView() const
|
||||
return ( isTimeStepDependentDataVisible() || ( otherView && otherView->isTimeStepDependentDataVisible() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t Rim3dView::timeStepCount()
|
||||
{
|
||||
return this->onTimeStepCountRequested();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -146,6 +146,8 @@ public:
|
||||
void setCurrentTimeStep( int frameIdx );
|
||||
void setCurrentTimeStepAndUpdate( int frameIdx ) override;
|
||||
bool isTimeStepDependentDataVisibleInThisOrComparisonView() const;
|
||||
size_t timeStepCount();
|
||||
QString timeStepName( int frameIdx ) const override;
|
||||
|
||||
// Updating
|
||||
void scheduleCreateDisplayModelAndRedraw();
|
||||
@ -204,6 +206,8 @@ protected:
|
||||
virtual void onUpdateDisplayModelForCurrentTimeStep() = 0;
|
||||
virtual void onUpdateDisplayModelVisibility(){};
|
||||
virtual void onClampCurrentTimestep() = 0;
|
||||
virtual size_t onTimeStepCountRequested() = 0;
|
||||
|
||||
virtual void onClearReservoirCellVisibilitiesIfNeccessary(){};
|
||||
virtual bool isTimeStepDependentDataVisible() const = 0;
|
||||
virtual void defineAxisLabels( cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel ) = 0;
|
||||
@ -258,7 +262,6 @@ private:
|
||||
void setCameraPosition( const cvf::Mat4d& cameraPosition ) override;
|
||||
void setCameraPointOfInterest( const cvf::Vec3d& cameraPointOfInterest ) override;
|
||||
|
||||
QString timeStepName( int frameIdx ) const override;
|
||||
void endAnimation() override;
|
||||
|
||||
caf::PdmObjectHandle* implementingPdmObject() override;
|
||||
|
@ -268,6 +268,19 @@ void RimEclipseView::onClampCurrentTimestep()
|
||||
if ( m_currentTimeStep < 0 ) m_currentTimeStep = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseView::onTimeStepCountRequested()
|
||||
{
|
||||
if ( this->currentGridCellResults() )
|
||||
{
|
||||
return this->currentGridCellResults()->maxTimeStepCount();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -187,6 +187,8 @@ private:
|
||||
void syncronizeWellsWithResults();
|
||||
|
||||
void onClampCurrentTimestep() override;
|
||||
size_t onTimeStepCountRequested() override;
|
||||
|
||||
void setVisibleGridParts( const std::vector<RivCellSetEnum>& cellSets );
|
||||
void setVisibleGridPartsWatertight();
|
||||
|
||||
|
@ -725,6 +725,19 @@ void RimGeoMechView::onClampCurrentTimestep()
|
||||
if ( m_currentTimeStep < 0 ) m_currentTimeStep = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimGeoMechView::onTimeStepCountRequested()
|
||||
{
|
||||
if ( m_geomechCase )
|
||||
{
|
||||
return m_geomechCase->geoMechData()->femPartResults()->frameCount();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -122,6 +122,7 @@ private:
|
||||
void onUpdateScaleTransform() override;
|
||||
|
||||
void onClampCurrentTimestep() override;
|
||||
size_t onTimeStepCountRequested() override;
|
||||
|
||||
void onUpdateDisplayModelForCurrentTimeStep() override;
|
||||
void onUpdateStaticCellColors() override;
|
||||
|
@ -118,6 +118,20 @@ RiuViewer::RiuViewer( const QGLFormat& format, QWidget* parent )
|
||||
m_infoLabel->setFont( font );
|
||||
m_showInfoText = true;
|
||||
|
||||
m_shortInfoLabel = new QLabel();
|
||||
m_shortInfoLabel->setObjectName( "ShortInfoLabel" );
|
||||
m_shortInfoLabel->setFrameShape( QFrame::Box );
|
||||
m_shortInfoLabel->setFrameShadow( QFrame::Plain );
|
||||
m_shortInfoLabel->setMinimumWidth( 100 );
|
||||
m_shortInfoLabel->setFont( font );
|
||||
|
||||
m_shortInfoLabelCompView = new QLabel();
|
||||
m_shortInfoLabelCompView->setObjectName( "ShortInfoLabelCompView" );
|
||||
m_shortInfoLabelCompView->setFrameShape( QFrame::Box );
|
||||
m_shortInfoLabelCompView->setFrameShadow( QFrame::Plain );
|
||||
m_shortInfoLabelCompView->setMinimumWidth( 100 );
|
||||
m_shortInfoLabelCompView->setFont( font );
|
||||
|
||||
// Version info label
|
||||
m_versionInfoLabel = new QLabel();
|
||||
m_versionInfoLabel->setFrameShape( QFrame::NoFrame );
|
||||
@ -144,6 +158,13 @@ RiuViewer::RiuViewer( const QGLFormat& format, QWidget* parent )
|
||||
m_animationProgress->setObjectName( "AnimationProgress" );
|
||||
m_animationProgress->setFont( font );
|
||||
|
||||
m_animationProgressCompView = new caf::QStyledProgressBar( "AnimationProgress" );
|
||||
m_animationProgressCompView->setFormat( "Time Step: %v/%m" );
|
||||
m_animationProgressCompView->setTextVisible( true );
|
||||
m_animationProgressCompView->setAlignment( Qt::AlignCenter );
|
||||
m_animationProgressCompView->setObjectName( "AnimationProgress" );
|
||||
m_animationProgressCompView->setFont( font );
|
||||
|
||||
m_showAnimProgress = false;
|
||||
|
||||
// Histogram
|
||||
@ -158,6 +179,8 @@ RiuViewer::RiuViewer( const QGLFormat& format, QWidget* parent )
|
||||
regTestFont.setPixelSize( 11 );
|
||||
|
||||
m_infoLabel->setFont( regTestFont );
|
||||
m_shortInfoLabel->setFont( regTestFont );
|
||||
m_shortInfoLabelCompView->setFont( regTestFont );
|
||||
m_versionInfoLabel->setFont( regTestFont );
|
||||
m_animationProgress->setFont( regTestFont );
|
||||
m_histogramWidget->setFont( regTestFont );
|
||||
@ -198,7 +221,10 @@ RiuViewer::~RiuViewer()
|
||||
}
|
||||
|
||||
delete m_infoLabel;
|
||||
delete m_shortInfoLabel;
|
||||
delete m_shortInfoLabelCompView;
|
||||
delete m_animationProgress;
|
||||
delete m_animationProgressCompView;
|
||||
delete m_histogramWidget;
|
||||
delete m_gridBoxGenerator;
|
||||
delete m_comparisonGridBoxGenerator;
|
||||
@ -255,9 +281,9 @@ void RiuViewer::mouseReleaseEvent( QMouseEvent* event )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !m_infoLabelOverlayArea.isNull() )
|
||||
if ( !m_infoPickArea.isNull() )
|
||||
{
|
||||
if ( m_infoLabelOverlayArea.contains( event->x(), event->y() ) )
|
||||
if ( m_infoPickArea.contains( event->x(), event->y() ) )
|
||||
{
|
||||
m_rimView->selectOverlayInfoConfig();
|
||||
|
||||
@ -265,6 +291,18 @@ void RiuViewer::mouseReleaseEvent( QMouseEvent* event )
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_infoPickAreaCompView.isNull() )
|
||||
{
|
||||
if ( m_infoPickAreaCompView.contains( event->x(), event->y() ) )
|
||||
{
|
||||
Rim3dView* compView = dynamic_cast<Rim3dView*>( m_rimView.p() )->activeComparisonView();
|
||||
|
||||
if ( compView ) compView->selectOverlayInfoConfig();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_viewerCommands->handlePickAction( event->x(), event->y(), event->modifiers() );
|
||||
|
||||
return;
|
||||
@ -367,7 +405,8 @@ void RiuViewer::paintOverlayItems( QPainter* painter )
|
||||
int edgeAxisFrameBorderHeight = m_showWindowEdgeAxes ? m_windowEdgeAxisOverlay->frameBorderHeight() : 0;
|
||||
|
||||
int margin = 5;
|
||||
int yPos = margin + edgeAxisFrameBorderHeight;
|
||||
int startYPos = margin + edgeAxisFrameBorderHeight;
|
||||
int yPos = startYPos;
|
||||
|
||||
bool showAnimBar = false;
|
||||
if ( isAnimationActive() && frameCount() > 1 ) showAnimBar = true;
|
||||
@ -376,37 +415,101 @@ void RiuViewer::paintOverlayItems( QPainter* painter )
|
||||
|
||||
int columnPos = this->width() - columnWidth - margin - edgeAxisFrameBorderWidth;
|
||||
|
||||
if ( this->isComparisonViewActive() )
|
||||
{
|
||||
Rim3dView* compView = dynamic_cast<Rim3dView*>( m_rimView.p() )->activeComparisonView();
|
||||
columnWidth = 200;
|
||||
|
||||
// int sliderPos = this->width() * this->comparisonViewVisibleNormalizedRect().min().x();
|
||||
int sliderPos = 0.5 * this->width();
|
||||
int compViewItemsXPos = sliderPos + 0.5 * ( this->width() - sliderPos ) - 0.5 * columnWidth;
|
||||
columnPos = 0.5 * sliderPos - 0.5 * columnWidth;
|
||||
|
||||
if ( m_showInfoText )
|
||||
{
|
||||
{
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>( m_rimView.p() );
|
||||
m_shortInfoLabel->setText( "<center>" + view->ownerCase()->caseUserDescription() + "</center>" );
|
||||
|
||||
QPoint topLeft = QPoint( columnPos, yPos );
|
||||
m_shortInfoLabel->resize( columnWidth, m_shortInfoLabel->sizeHint().height() );
|
||||
m_shortInfoLabel->render( painter, topLeft );
|
||||
}
|
||||
|
||||
{
|
||||
m_shortInfoLabelCompView->setText( "<center>" + compView->ownerCase()->caseUserDescription() +
|
||||
"</center>" );
|
||||
QPoint topLeft = QPoint( compViewItemsXPos, yPos );
|
||||
m_shortInfoLabelCompView->resize( columnWidth, m_shortInfoLabelCompView->sizeHint().height() );
|
||||
m_shortInfoLabelCompView->render( painter, topLeft );
|
||||
}
|
||||
|
||||
yPos += m_shortInfoLabel->height();
|
||||
}
|
||||
|
||||
int pickAreaHeight = yPos - startYPos;
|
||||
if ( m_showAnimProgress && isAnimationActive( true ) && compView->timeStepCount() > 1 )
|
||||
{
|
||||
QString stepName = compView->timeStepName( compView->currentTimeStep() );
|
||||
|
||||
m_animationProgressCompView->setFormat( "Time Step: %v/%m " + stepName );
|
||||
m_animationProgressCompView->setMinimum( 0 );
|
||||
m_animationProgressCompView->setMaximum( static_cast<int>( compView->timeStepCount() ) - 1 );
|
||||
m_animationProgressCompView->setValue( compView->currentTimeStep() );
|
||||
|
||||
m_animationProgressCompView->resize( columnWidth, m_animationProgressCompView->sizeHint().height() );
|
||||
|
||||
m_animationProgressCompView->render( painter, QPoint( compViewItemsXPos, yPos ) );
|
||||
|
||||
pickAreaHeight += m_animationProgressCompView->height();
|
||||
}
|
||||
|
||||
m_infoPickArea.setLeft( columnPos );
|
||||
m_infoPickArea.setWidth( columnWidth );
|
||||
m_infoPickArea.setHeight( pickAreaHeight );
|
||||
m_infoPickArea.setTop( startYPos );
|
||||
|
||||
m_infoPickAreaCompView.setLeft( compViewItemsXPos );
|
||||
m_infoPickAreaCompView.setWidth( columnWidth );
|
||||
m_infoPickAreaCompView.setHeight( pickAreaHeight );
|
||||
m_infoPickAreaCompView.setTop( startYPos );
|
||||
}
|
||||
|
||||
if ( showAnimBar && m_showAnimProgress )
|
||||
{
|
||||
QString stepName = m_rimView->timeStepName( currentFrameIndex() );
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>( m_rimView.p() );
|
||||
|
||||
QString stepName = view->timeStepName( view->currentTimeStep() );
|
||||
|
||||
m_animationProgress->setFormat( "Time Step: %v/%m " + stepName );
|
||||
m_animationProgress->setMinimum( 0 );
|
||||
m_animationProgress->setMaximum( static_cast<int>( frameCount() ) - 1 );
|
||||
m_animationProgress->setValue( currentFrameIndex() );
|
||||
m_animationProgress->resize( columnWidth, m_animationProgress->sizeHint().height() );
|
||||
m_animationProgress->setMaximum( static_cast<int>( view->timeStepCount() ) - 1 );
|
||||
m_animationProgress->setValue( view->currentTimeStep() );
|
||||
|
||||
m_animationProgress->resize( columnWidth, m_animationProgress->sizeHint().height() );
|
||||
m_animationProgress->render( painter, QPoint( columnPos, yPos ) );
|
||||
|
||||
yPos += m_animationProgress->height() + margin;
|
||||
}
|
||||
|
||||
if ( m_showInfoText )
|
||||
if ( m_showInfoText && !this->isComparisonViewActive() )
|
||||
{
|
||||
QPoint topLeft = QPoint( columnPos, yPos );
|
||||
m_infoLabel->resize( columnWidth, m_infoLabel->sizeHint().height() );
|
||||
m_infoLabel->render( painter, topLeft );
|
||||
|
||||
m_infoLabelOverlayArea.setTopLeft( topLeft );
|
||||
m_infoLabelOverlayArea.setBottom( yPos + m_infoLabel->height() );
|
||||
m_infoLabelOverlayArea.setRight( columnPos + columnWidth );
|
||||
m_infoPickArea.setTopLeft( topLeft );
|
||||
m_infoPickArea.setBottom( yPos + m_infoLabel->height() );
|
||||
m_infoPickArea.setRight( columnPos + columnWidth );
|
||||
|
||||
yPos += m_infoLabel->height() + margin;
|
||||
}
|
||||
else
|
||||
else if ( !this->isComparisonViewActive() )
|
||||
{
|
||||
m_infoLabelOverlayArea = QRect();
|
||||
m_infoPickArea = QRect();
|
||||
}
|
||||
|
||||
if ( m_showHistogram )
|
||||
if ( m_showHistogram && !this->isComparisonViewActive() )
|
||||
{
|
||||
m_histogramWidget->resize( columnWidth, 40 );
|
||||
m_histogramWidget->render( painter, QPoint( columnPos, yPos ) );
|
||||
@ -1233,7 +1336,10 @@ void RiuViewer::updateFonts()
|
||||
|
||||
m_zScaleLabel->setFont( font );
|
||||
m_infoLabel->setFont( font );
|
||||
m_shortInfoLabel->setFont( font );
|
||||
m_shortInfoLabelCompView->setFont( font );
|
||||
m_animationProgress->setFont( font );
|
||||
m_animationProgressCompView->setFont( font );
|
||||
m_versionInfoLabel->setFont( font );
|
||||
}
|
||||
|
||||
@ -1337,6 +1443,16 @@ void RiuViewer::updateOverlayItemsStyle()
|
||||
contrastColor,
|
||||
backgroundColor,
|
||||
backgroundFrameColor ) );
|
||||
m_shortInfoLabel->setStyleSheet( caf::StyleSheetTools::createFrameStyleSheet( "QLabel",
|
||||
"ShortInfoLabel",
|
||||
contrastColor,
|
||||
backgroundColor,
|
||||
backgroundFrameColor ) );
|
||||
m_shortInfoLabelCompView->setStyleSheet( caf::StyleSheetTools::createFrameStyleSheet( "QLabel",
|
||||
"ShortInfoLabelCompView",
|
||||
contrastColor,
|
||||
backgroundColor,
|
||||
backgroundFrameColor ) );
|
||||
m_histogramWidget->setStyleSheet( caf::StyleSheetTools::createFrameStyleSheet( "",
|
||||
"HistogramWidget",
|
||||
contrastColor,
|
||||
@ -1354,6 +1470,10 @@ void RiuViewer::updateOverlayItemsStyle()
|
||||
backgroundColor,
|
||||
backgroundFrameColor,
|
||||
progressColor );
|
||||
m_animationProgressCompView->setTextBackgroundAndProgressColor( contrastColor,
|
||||
backgroundColor,
|
||||
backgroundFrameColor,
|
||||
progressColor );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -166,7 +166,11 @@ private:
|
||||
|
||||
private:
|
||||
QLabel* m_infoLabel;
|
||||
QRect m_infoLabelOverlayArea;
|
||||
QRect m_infoPickArea;
|
||||
QRect m_infoPickAreaCompView;
|
||||
|
||||
QLabel* m_shortInfoLabel; // Used when in comparison view mode
|
||||
QLabel* m_shortInfoLabelCompView;
|
||||
|
||||
QLabel* m_versionInfoLabel;
|
||||
bool m_showInfoText;
|
||||
@ -178,6 +182,7 @@ private:
|
||||
double m_zScale;
|
||||
|
||||
caf::QStyledProgressBar* m_animationProgress;
|
||||
caf::QStyledProgressBar* m_animationProgressCompView;
|
||||
bool m_showAnimProgress;
|
||||
RiuSimpleHistogramWidget* m_histogramWidget;
|
||||
bool m_showHistogram;
|
||||
|
Loading…
Reference in New Issue
Block a user