mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 16:06:04 -06:00
Merge pull request #5017 from OPM/feature-adjust-comparison-overlay-items
Feature adjust comparison overlay items
This commit is contained in:
commit
19fe1fcd1b
@ -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:
|
||||
|
@ -188,7 +188,8 @@ void RivGridBoxGenerator::setGridBoxDomainCoordBoundingBox( const cvf::BoundingB
|
||||
expandedBB.add( min );
|
||||
expandedBB.add( max );
|
||||
|
||||
if ( m_domainCoordsBoundingBox.min() != expandedBB.min() || m_domainCoordsBoundingBox.max() != expandedBB.max() )
|
||||
if ( !m_domainCoordsBoundingBox.isValid() || m_domainCoordsBoundingBox.min() != expandedBB.min() ||
|
||||
m_domainCoordsBoundingBox.max() != expandedBB.max() )
|
||||
{
|
||||
m_needsRegeneration = true;
|
||||
}
|
||||
|
@ -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() );
|
||||
}
|
||||
@ -679,7 +679,7 @@ void Rim2dIntersectionView::onUpdateLegends()
|
||||
|
||||
if ( legend )
|
||||
{
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( legend );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( legend, 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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -142,10 +142,12 @@ public:
|
||||
void forceShowWindowOn();
|
||||
|
||||
// Animation
|
||||
int currentTimeStep() const;
|
||||
void setCurrentTimeStep( int frameIdx );
|
||||
void setCurrentTimeStepAndUpdate( int frameIdx ) override;
|
||||
bool isTimeStepDependentDataVisibleInThisOrComparisonView() const;
|
||||
int currentTimeStep() const;
|
||||
void setCurrentTimeStep( int frameIdx );
|
||||
void setCurrentTimeStepAndUpdate( int frameIdx ) override;
|
||||
bool isTimeStepDependentDataVisibleInThisOrComparisonView() const;
|
||||
size_t timeStepCount();
|
||||
QString timeStepName( int frameIdx ) const override;
|
||||
|
||||
// Updating
|
||||
void scheduleCreateDisplayModelAndRedraw();
|
||||
@ -200,10 +202,12 @@ protected:
|
||||
|
||||
// Abstract methods to implement in subclasses
|
||||
|
||||
virtual void onCreateDisplayModel() = 0;
|
||||
virtual void onUpdateDisplayModelForCurrentTimeStep() = 0;
|
||||
virtual void onUpdateDisplayModelVisibility(){};
|
||||
virtual void onClampCurrentTimestep() = 0;
|
||||
virtual void onCreateDisplayModel() = 0;
|
||||
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,8 +262,7 @@ private:
|
||||
void setCameraPosition( const cvf::Mat4d& cameraPosition ) override;
|
||||
void setCameraPointOfInterest( const cvf::Vec3d& cameraPointOfInterest ) override;
|
||||
|
||||
QString timeStepName( int frameIdx ) const override;
|
||||
void endAnimation() override;
|
||||
void endAnimation() override;
|
||||
|
||||
caf::PdmObjectHandle* implementingPdmObject() override;
|
||||
|
||||
|
@ -387,7 +387,8 @@ void RimEclipseContourMapView::onUpdateLegends()
|
||||
m_contourMapProjection->updateLegend();
|
||||
if ( projectionLegend->showLegend() )
|
||||
{
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( projectionLegend->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( projectionLegend->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1232,8 +1245,9 @@ void RimEclipseView::onUpdateLegends()
|
||||
|
||||
this->cellEdgeResult()->legendConfig()->setTitle( QString( "Edge Results: \n" ) +
|
||||
this->cellEdgeResult()->resultVariableUiShortName() );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner(
|
||||
this->cellEdgeResult()->legendConfig()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()
|
||||
->addColorLegendToBottomLeftCorner( this->cellEdgeResult()->legendConfig()->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1266,7 +1280,8 @@ void RimEclipseView::onUpdateLegends()
|
||||
|
||||
if ( fractureColors()->isChecked() && stimPlanLegend->titledOverlayFrame() )
|
||||
{
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( stimPlanLegend->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( stimPlanLegend->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1277,7 +1292,8 @@ void RimEclipseView::onUpdateLegends()
|
||||
updateVirtualConnectionLegendRanges();
|
||||
|
||||
RimRegularLegendConfig* virtLegend = m_virtualPerforationResult->legendConfig();
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( virtLegend->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( virtLegend->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1307,7 +1323,8 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView( QString
|
||||
}
|
||||
|
||||
resultColors->legendConfig()->setTitle( title );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( resultColors->legendConfig()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( resultColors->legendConfig()->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
|
||||
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
|
||||
@ -1317,8 +1334,9 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView( QString
|
||||
resultColors->ternaryLegendConfig()->titledOverlayFrame() )
|
||||
{
|
||||
resultColors->ternaryLegendConfig()->setTitle( legendLabel );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner(
|
||||
resultColors->ternaryLegendConfig()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()
|
||||
->addColorLegendToBottomLeftCorner( resultColors->ternaryLegendConfig()->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,9 @@ private:
|
||||
|
||||
void syncronizeWellsWithResults();
|
||||
|
||||
void onClampCurrentTimestep() override;
|
||||
void onClampCurrentTimestep() override;
|
||||
size_t onTimeStepCountRequested() override;
|
||||
|
||||
void setVisibleGridParts( const std::vector<RivCellSetEnum>& cellSets );
|
||||
void setVisibleGridPartsWatertight();
|
||||
|
||||
|
@ -380,7 +380,8 @@ void RimGeoMechContourMapView::onUpdateLegends()
|
||||
m_contourMapProjection->updateLegend();
|
||||
if ( projectionLegend->showLegend() )
|
||||
{
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( projectionLegend->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( projectionLegend->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -451,7 +451,8 @@ void RimGeoMechView::onUpdateLegends()
|
||||
|
||||
if ( cellResult()->hasResult() && cellResult()->legendConfig()->showLegend() )
|
||||
{
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( cellResult()->legendConfig->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( cellResult()->legendConfig->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
|
||||
if ( tensorResults()->showTensors() )
|
||||
@ -461,8 +462,9 @@ void RimGeoMechView::onUpdateLegends()
|
||||
if ( tensorResults()->vectorColors() == RimTensorResults::RESULT_COLORS &&
|
||||
tensorResults()->arrowColorLegendConfig()->showLegend() )
|
||||
{
|
||||
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner(
|
||||
m_tensorResults->arrowColorLegendConfig->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()
|
||||
->addColorLegendToBottomLeftCorner( m_tensorResults->arrowColorLegendConfig->titledOverlayFrame(),
|
||||
isUsingOverrideViewer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -723,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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -121,7 +121,8 @@ private:
|
||||
|
||||
void onUpdateScaleTransform() override;
|
||||
|
||||
void onClampCurrentTimestep() override;
|
||||
void onClampCurrentTimestep() override;
|
||||
size_t onTimeStepCountRequested() override;
|
||||
|
||||
void onUpdateDisplayModelForCurrentTimeStep() override;
|
||||
void onUpdateStaticCellColors() override;
|
||||
|
@ -65,11 +65,15 @@ bool RiuComparisonViewMover::eventFilter( QObject* watched, QEvent* event )
|
||||
QPointF normMousePos = {mousePos.x() / m_viewer->width(), mousePos.y() / m_viewer->height()};
|
||||
cvf::Rectf orgCompViewWindow = m_viewer->comparisonViewVisibleNormalizedRect();
|
||||
|
||||
m_viewer->setComparisonViewVisibleNormalizedRect(
|
||||
cvf::Rectf( normMousePos.x(),
|
||||
orgCompViewWindow.min().y(),
|
||||
( orgCompViewWindow.min().x() + orgCompViewWindow.width() ) - normMousePos.x(),
|
||||
orgCompViewWindow.height() ) );
|
||||
float minx = normMousePos.x();
|
||||
minx = minx > 1.0 ? 1.0 : minx;
|
||||
minx = minx < 0.0 ? 0.0 : minx;
|
||||
float miny = orgCompViewWindow.min().y();
|
||||
float width = ( orgCompViewWindow.min().x() + orgCompViewWindow.width() ) - normMousePos.x();
|
||||
width = width < 0.0f ? 0.0 : width;
|
||||
float height = orgCompViewWindow.height();
|
||||
|
||||
m_viewer->setComparisonViewVisibleNormalizedRect( cvf::Rectf( minx, miny, width, height ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -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;
|
||||
@ -366,8 +404,9 @@ void RiuViewer::paintOverlayItems( QPainter* painter )
|
||||
int edgeAxisFrameBorderWidth = m_showWindowEdgeAxes ? m_windowEdgeAxisOverlay->frameBorderWidth() : 0;
|
||||
int edgeAxisFrameBorderHeight = m_showWindowEdgeAxes ? m_windowEdgeAxisOverlay->frameBorderHeight() : 0;
|
||||
|
||||
int margin = 5;
|
||||
int yPos = margin + edgeAxisFrameBorderHeight;
|
||||
int margin = 5;
|
||||
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 ) );
|
||||
@ -582,40 +685,49 @@ void RiuViewer::removeAllColorLegends()
|
||||
{
|
||||
overlayItemsRendering()->removeOverlayItem( m_visibleLegends[i].p() );
|
||||
}
|
||||
for ( auto legend : m_visibleComparisonLegends )
|
||||
{
|
||||
overlayItemsRendering()->removeOverlayItem( legend.p() );
|
||||
}
|
||||
|
||||
m_visibleLegends.clear();
|
||||
m_visibleComparisonLegends.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::addColorLegendToBottomLeftCorner( caf::TitledOverlayFrame* addedLegend )
|
||||
void RiuViewer::addColorLegendToBottomLeftCorner( caf::TitledOverlayFrame* addedLegend, bool isForComparisonView )
|
||||
{
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
CVF_ASSERT( app );
|
||||
RiaPreferences* preferences = app->preferences();
|
||||
cvf::Rendering* overlayRendering = overlayItemsRendering();
|
||||
CVF_ASSERT( preferences );
|
||||
if ( !addedLegend || m_visibleLegends.contains( addedLegend ) ) return;
|
||||
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
RiaPreferences* preferences = app->preferences();
|
||||
cvf::Rendering* overlayRendering = overlayItemsRendering();
|
||||
CVF_ASSERT( overlayRendering );
|
||||
|
||||
if ( addedLegend )
|
||||
cvf::Color4f backgroundColor = mainCamera()->viewport()->clearColor();
|
||||
backgroundColor.a() = 0.8f;
|
||||
|
||||
cvf::Color3f backgroundColor3f( backgroundColor.r(), backgroundColor.g(), backgroundColor.b() );
|
||||
cvf::Color4f frameColor = cvf::Color4f( RiaColorTools::computeOffsetColor( backgroundColor3f, 0.3f ), 0.9f );
|
||||
|
||||
updateLegendTextAndTickMarkColor( addedLegend );
|
||||
|
||||
addedLegend->enableBackground( preferences->showLegendBackground() );
|
||||
addedLegend->setBackgroundColor( backgroundColor );
|
||||
addedLegend->setBackgroundFrameColor( frameColor );
|
||||
addedLegend->setFont( app->defaultSceneFont() );
|
||||
|
||||
overlayRendering->addOverlayItem( addedLegend );
|
||||
|
||||
if ( isForComparisonView )
|
||||
{
|
||||
cvf::Color4f backgroundColor = mainCamera()->viewport()->clearColor();
|
||||
backgroundColor.a() = 0.8f;
|
||||
cvf::Color3f frameColor( backgroundColor.r(), backgroundColor.g(), backgroundColor.b() );
|
||||
updateLegendTextAndTickMarkColor( addedLegend );
|
||||
|
||||
overlayRendering->addOverlayItem( addedLegend );
|
||||
addedLegend->enableBackground( preferences->showLegendBackground() );
|
||||
addedLegend->setBackgroundColor( backgroundColor );
|
||||
addedLegend->setBackgroundFrameColor(
|
||||
cvf::Color4f( RiaColorTools::computeOffsetColor( frameColor, 0.3f ), 0.9f ) );
|
||||
addedLegend->setFont( app->defaultSceneFont() );
|
||||
|
||||
if ( !m_visibleLegends.contains( addedLegend ) )
|
||||
{
|
||||
m_visibleLegends.push_back( addedLegend );
|
||||
}
|
||||
m_visibleComparisonLegends.push_back( addedLegend );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_visibleLegends.push_back( addedLegend );
|
||||
}
|
||||
}
|
||||
|
||||
@ -626,6 +738,7 @@ void RiuViewer::removeColorLegend( caf::TitledOverlayFrame* legend )
|
||||
{
|
||||
overlayItemsRendering()->removeOverlayItem( legend );
|
||||
m_visibleLegends.erase( legend );
|
||||
m_visibleComparisonLegends.erase( legend );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -640,6 +753,7 @@ void RiuViewer::updateLegendLayout()
|
||||
int edgeAxisBorderWidth = m_showWindowEdgeAxes ? m_windowEdgeAxisOverlay->frameBorderWidth() : 0;
|
||||
int edgeAxisBorderHeight = m_showWindowEdgeAxes ? m_windowEdgeAxisOverlay->frameBorderHeight() : 0;
|
||||
|
||||
// Place the main view legends from left to right
|
||||
{
|
||||
int xPos = border + edgeAxisBorderWidth;
|
||||
int yPos = border + edgeAxisBorderHeight;
|
||||
@ -705,6 +819,90 @@ void RiuViewer::updateLegendLayout()
|
||||
}
|
||||
}
|
||||
|
||||
// Place the comparison view legends from right to left
|
||||
{
|
||||
int viewPortWidth = static_cast<int>( m_mainCamera->viewport()->width() );
|
||||
|
||||
int xPos = viewPortWidth - border + edgeAxisBorderWidth;
|
||||
int yPosStart = border + edgeAxisBorderHeight + m_versionInfoLabel->sizeHint().height() + 5;
|
||||
int yPos = yPosStart;
|
||||
|
||||
std::vector<caf::TitledOverlayFrame*> standardHeightLegends;
|
||||
|
||||
// Place the legends needing the full height, and sort out the standard height legends
|
||||
|
||||
for ( cvf::ref<caf::TitledOverlayFrame> legend : m_visibleComparisonLegends )
|
||||
{
|
||||
cvf::Vec2ui prefSize = legend->preferredSize();
|
||||
if ( prefSize.y() > maxFreeLegendHeight )
|
||||
{
|
||||
int legendWidth = prefSize.x();
|
||||
legend->setLayoutFixedPosition( cvf::Vec2i( xPos - legendWidth, yPos ) );
|
||||
legend->setRenderSize(
|
||||
cvf::Vec2ui( legendWidth, viewPortHeight - yPosStart - border - edgeAxisBorderHeight ) );
|
||||
xPos -= legendWidth + border;
|
||||
}
|
||||
else
|
||||
{
|
||||
standardHeightLegends.push_back( legend.p() );
|
||||
}
|
||||
}
|
||||
|
||||
// Place the rest of the legends in columns that fits within the screen height
|
||||
|
||||
std::vector<caf::TitledOverlayFrame*> columnLegends;
|
||||
|
||||
int maxColumnWidht = 0;
|
||||
|
||||
for ( caf::TitledOverlayFrame* legend : standardHeightLegends )
|
||||
{
|
||||
cvf::Vec2ui prefSize = legend->preferredSize();
|
||||
|
||||
// Check if we need a new column
|
||||
if ( ( yPos + (int)prefSize.y() + border ) > viewPortHeight )
|
||||
{
|
||||
// Finish the previous column setting same width to all legends and correcting the xposition accordingly
|
||||
for ( caf::TitledOverlayFrame* columnLegend : columnLegends )
|
||||
{
|
||||
columnLegend->setRenderSize( cvf::Vec2ui( maxColumnWidht, columnLegend->renderSize().y() ) );
|
||||
columnLegend->setLayoutFixedPosition(
|
||||
cvf::Vec2i( xPos - maxColumnWidht, columnLegend->fixedPosition().y() ) );
|
||||
}
|
||||
|
||||
// Increment to make ready for a new column
|
||||
xPos -= border + maxColumnWidht;
|
||||
yPos = yPosStart;
|
||||
|
||||
maxColumnWidht = 0;
|
||||
columnLegends.clear();
|
||||
}
|
||||
|
||||
legend->setLayoutFixedPosition( cvf::Vec2i( xPos - prefSize.x(), yPos ) );
|
||||
legend->setRenderSize( cvf::Vec2ui( prefSize.x(), prefSize.y() ) );
|
||||
columnLegends.push_back( legend );
|
||||
|
||||
yPos += legend->renderSize().y() + border;
|
||||
maxColumnWidht = std::max( maxColumnWidht, (int)prefSize.x() );
|
||||
}
|
||||
|
||||
// Finish the last column setting same width to all legends and correcting the xposition accordingly
|
||||
|
||||
for ( caf::TitledOverlayFrame* columnLegend : columnLegends )
|
||||
{
|
||||
columnLegend->setRenderSize( cvf::Vec2ui( maxColumnWidht, columnLegend->renderSize().y() ) );
|
||||
columnLegend->setLayoutFixedPosition( cvf::Vec2i( xPos - maxColumnWidht, columnLegend->fixedPosition().y() ) );
|
||||
}
|
||||
|
||||
xPos -= maxColumnWidht;
|
||||
|
||||
// Set axis cross position at the bottom besides the last column
|
||||
{
|
||||
m_axisCross->setLayoutFixedPosition(
|
||||
cvf::Vec2i( xPos + border - m_axisCross->sizeHint().x(), edgeAxisBorderHeight ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Set the position of the scale bar used in contour map views
|
||||
{
|
||||
int margin = 5;
|
||||
auto scaleLegendSize = m_scaleLegend->renderSize();
|
||||
@ -1020,6 +1218,18 @@ cvf::OverlayItem* RiuViewer::pickFixedPositionedLegend( int winPosX, int winPosY
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto overlayItem : m_visibleComparisonLegends )
|
||||
{
|
||||
if ( overlayItem->layoutScheme() == cvf::OverlayItem::FIXED_POSITION &&
|
||||
overlayItem->pick( translatedMousePosX,
|
||||
translatedMousePosY,
|
||||
overlayItem->fixedPosition(),
|
||||
overlayItem->renderSize() ) )
|
||||
{
|
||||
return overlayItem.p();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1126,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 );
|
||||
}
|
||||
|
||||
@ -1170,6 +1383,11 @@ void RiuViewer::updateTextAndTickMarkColorForOverlayItems()
|
||||
updateLegendTextAndTickMarkColor( m_visibleLegends.at( i ) );
|
||||
}
|
||||
|
||||
for ( auto legend : m_visibleComparisonLegends )
|
||||
{
|
||||
updateLegendTextAndTickMarkColor( legend.p() );
|
||||
}
|
||||
|
||||
updateAxisCrossTextColor();
|
||||
|
||||
updateOverlayItemsStyle();
|
||||
@ -1225,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,
|
||||
@ -1242,6 +1470,10 @@ void RiuViewer::updateOverlayItemsStyle()
|
||||
backgroundColor,
|
||||
backgroundFrameColor,
|
||||
progressColor );
|
||||
m_animationProgressCompView->setTextBackgroundAndProgressColor( contrastColor,
|
||||
backgroundColor,
|
||||
backgroundFrameColor,
|
||||
progressColor );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
void showAnimationProgress( bool enable );
|
||||
|
||||
void removeAllColorLegends();
|
||||
void addColorLegendToBottomLeftCorner( caf::TitledOverlayFrame* legend );
|
||||
void addColorLegendToBottomLeftCorner( caf::TitledOverlayFrame* legend, bool isForComparisonView );
|
||||
void removeColorLegend( caf::TitledOverlayFrame* legend );
|
||||
|
||||
void enableNavigationRotation( bool disable );
|
||||
@ -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;
|
||||
@ -185,6 +190,7 @@ private:
|
||||
cvf::ref<cvf::OverlayAxisCross> m_axisCross;
|
||||
bool m_showAxisCross;
|
||||
cvf::Collection<caf::TitledOverlayFrame> m_visibleLegends;
|
||||
cvf::Collection<caf::TitledOverlayFrame> m_visibleComparisonLegends;
|
||||
|
||||
caf::PdmInterfacePointer<RiuViewerToViewInterface> m_rimView;
|
||||
QPoint m_lastMousePressPosition;
|
||||
|
@ -980,21 +980,40 @@ void caf::Viewer::removeAllFrames(bool isForComparisonView)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool caf::Viewer::isAnimationActive()
|
||||
bool caf::Viewer::isAnimationActive(bool isForComparisonView)
|
||||
{
|
||||
cvf::Scene* currentScene = m_mainRendering->scene();
|
||||
|
||||
if (!currentScene)
|
||||
if ( !isForComparisonView )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
cvf::Scene* currentScene = m_mainRendering->scene();
|
||||
|
||||
if (m_mainScene.notNull() && m_mainScene.p() == currentScene)
|
||||
if ( !currentScene )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_mainScene.notNull() && m_mainScene.p() == currentScene )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
cvf::Scene* currentScene = m_comparisonMainRendering->scene();
|
||||
|
||||
return true;
|
||||
if ( !currentScene )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_comparisonMainScene.notNull() && m_comparisonMainScene.p() == currentScene )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
// As of yet: Only updates bounding boxes. Other things might be added later.
|
||||
void updateCachedValuesInScene();
|
||||
|
||||
bool isAnimationActive();
|
||||
bool isAnimationActive(bool isForComparisonView = false);
|
||||
caf::FrameAnimationControl*
|
||||
animationControl() { return m_animationControl;}
|
||||
void setReleaseOGLResourcesEachFrame(bool releaseOGLResourcesEachFrame) { m_releaseOGLResourcesEachFrame = releaseOGLResourcesEachFrame; }
|
||||
|
Loading…
Reference in New Issue
Block a user