mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
#4862 Lock scale Z in comparison view to follow the main view.
#4858 Make timestep independent in comparison view. Make Linked Views timestep linking work
This commit is contained in:
parent
eee8467e02
commit
016f26725a
@ -332,6 +332,7 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr
|
||||
|
||||
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Grid Appearance" );
|
||||
gridGroup->add( &scaleZ );
|
||||
scaleZ.uiCapability()->setUiReadOnly( !this->isScaleZEditable() );
|
||||
gridGroup->add( &meshMode );
|
||||
gridGroup->add( &surfaceMode );
|
||||
|
||||
@ -410,6 +411,15 @@ std::set<Rim3dView*> Rim3dView::viewsUsingThisAsComparisonView()
|
||||
return containingViews;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dView::isScaleZEditable()
|
||||
{
|
||||
return ( this->viewsUsingThisAsComparisonView().empty() ||
|
||||
( this->viewController() && this->viewController()->isCameraLinked() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1005,6 +1015,11 @@ void Rim3dView::updateScaling()
|
||||
viewer()->setPointOfInterest( poi );
|
||||
}
|
||||
|
||||
if (activeComparisonView())
|
||||
{
|
||||
activeComparisonView()->setScaleZAndUpdate(scaleZ);
|
||||
}
|
||||
|
||||
updateScaleTransform();
|
||||
updateGridBoxData();
|
||||
updateZScaleLabel();
|
||||
@ -1422,12 +1437,11 @@ Rim3dView* Rim3dView::prepareComparisonView()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_comparisonViewOrgTimestep = depView->currentTimeStep();
|
||||
depView->m_currentTimeStep = currentTimeStep();
|
||||
depView->clampCurrentTimestep();
|
||||
|
||||
m_comparisonViewOrgZScale = depView->scaleZ();
|
||||
depView->scaleZ = scaleZ();
|
||||
if ( depView->scaleZ() != scaleZ() )
|
||||
{
|
||||
depView->setScaleZAndUpdate( scaleZ() );
|
||||
}
|
||||
|
||||
viewer()->setComparisonViewEyePointOffset( RimViewManipulator::calculateEquivalentCamPosOffset( this, depView ) );
|
||||
|
||||
@ -1445,6 +1459,6 @@ void Rim3dView::restoreComparisonView()
|
||||
CVF_ASSERT( depView );
|
||||
|
||||
depView->setOverrideViewer( nullptr );
|
||||
depView->m_currentTimeStep = m_comparisonViewOrgTimestep;
|
||||
depView->scaleZ = m_comparisonViewOrgZScale;
|
||||
viewer()->setCurrentComparisonFrame(depView->currentTimeStep());
|
||||
|
||||
}
|
||||
|
@ -165,6 +165,9 @@ public:
|
||||
|
||||
bool isMasterView() const;
|
||||
Rim3dView* activeComparisonView() const;
|
||||
bool isScaleZEditable();
|
||||
|
||||
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const override;
|
||||
|
||||
@ -297,8 +300,7 @@ private:
|
||||
|
||||
// Pure private methods : Override viewer and comparison view
|
||||
|
||||
void setOverrideViewer( RiuViewer* overrideViewer );
|
||||
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
|
||||
void setOverrideViewer( RiuViewer* overrideViewer );
|
||||
|
||||
Rim3dView* prepareComparisonView();
|
||||
void restoreComparisonView();
|
||||
|
@ -1790,7 +1790,7 @@ void RiuMainWindow::updateScaleValue()
|
||||
{
|
||||
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
|
||||
bool isRegularReservoirView = view && dynamic_cast<RimEclipseContourMapView*>( view ) == nullptr;
|
||||
if ( isRegularReservoirView )
|
||||
if ( isRegularReservoirView && view->isScaleZEditable() )
|
||||
{
|
||||
m_scaleFactor->setEnabled( true );
|
||||
|
||||
|
@ -182,6 +182,7 @@ RiuViewer::RiuViewer( const QGLFormat& format, QWidget* parent )
|
||||
m_scaleLegend->setOrientation( caf::OverlayScaleLegend::HORIZONTAL );
|
||||
|
||||
m_comparisonWindowMover = new RiuComparisonViewMover( this );
|
||||
this->setComparisonViewToFollowAnimation(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -309,6 +310,18 @@ void RiuViewer::slotSetCurrentFrame( int frameIndex )
|
||||
{
|
||||
viewLinker->updateTimeStep( dynamic_cast<RimGridView*>( m_rimView.p() ), frameIndex );
|
||||
}
|
||||
|
||||
// Update views using this as comparison
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>( m_rimView.p() );
|
||||
if (view)
|
||||
{
|
||||
std::set<Rim3dView*> containingViews = view->viewsUsingThisAsComparisonView();
|
||||
|
||||
for ( auto view : containingViews )
|
||||
{
|
||||
view->updateCurrentTimeStepAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,8 @@ caf::Viewer::Viewer(const QGLFormat& format, QWidget* parent)
|
||||
m_offscreenViewportHeight(0),
|
||||
m_parallelProjectionLightDirection(0, 0, -1), // Light directly from behind
|
||||
m_comparisonViewOffset(0, 0, 0),
|
||||
m_comparisonWindowNormalizedRect(0.5f, 0.0f, 0.5f, 1.0f)
|
||||
m_comparisonWindowNormalizedRect(0.5f, 0.0f, 0.5f, 1.0f),
|
||||
m_isComparisonFollowingAnimation(true)
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
m_layoutWidget = new QWidget(parent);
|
||||
@ -965,6 +966,40 @@ bool caf::Viewer::isAnimationActive()
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::Viewer::setCurrentComparisonFrame(int frameIndex)
|
||||
{
|
||||
if (m_frameScenes.size() == 0) return;
|
||||
|
||||
int clampedFrameIndex = clampFrameIndex(frameIndex);
|
||||
|
||||
if (m_releaseOGLResourcesEachFrame)
|
||||
{
|
||||
releaseOGlResourcesForCurrentFrame();
|
||||
}
|
||||
|
||||
if ( m_comparisonFrameScenes.size() > clampedFrameIndex && m_comparisonFrameScenes.at(clampedFrameIndex) != nullptr )
|
||||
{
|
||||
m_comparisonMainRendering->setScene(m_comparisonFrameScenes.at(clampedFrameIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_comparisonMainRendering->setScene(nullptr);
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::Viewer::setComparisonViewToFollowAnimation(bool isToFollow)
|
||||
{
|
||||
m_isComparisonFollowingAnimation = isToFollow;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -989,14 +1024,19 @@ void caf::Viewer::slotSetCurrentFrame(int frameIndex)
|
||||
{
|
||||
m_mainRendering->setScene(nullptr);
|
||||
}
|
||||
if (m_comparisonFrameScenes.size() > clampedFrameIndex && m_comparisonFrameScenes.at(clampedFrameIndex) != nullptr )
|
||||
|
||||
if ( m_isComparisonFollowingAnimation )
|
||||
{
|
||||
m_comparisonMainRendering->setScene(m_comparisonFrameScenes.at(clampedFrameIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_comparisonMainRendering->setScene(nullptr);
|
||||
if ( m_comparisonFrameScenes.size() > clampedFrameIndex && m_comparisonFrameScenes.at(clampedFrameIndex) != nullptr )
|
||||
{
|
||||
m_comparisonMainRendering->setScene(m_comparisonFrameScenes.at(clampedFrameIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_comparisonMainRendering->setScene(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -174,6 +174,9 @@ public:
|
||||
|
||||
static void copyCameraView(cvf::Camera* srcCamera, cvf::Camera* dstCamera);
|
||||
|
||||
void setCurrentComparisonFrame(int frameIndex);
|
||||
void setComparisonViewToFollowAnimation(bool isToFollow);
|
||||
|
||||
public slots:
|
||||
virtual void slotSetCurrentFrame(int frameIndex);
|
||||
virtual void slotEndAnimation();
|
||||
@ -257,6 +260,7 @@ private:
|
||||
cvf::ref<cvf::Scene> m_comparisonMainScene;
|
||||
cvf::Collection<cvf::Scene> m_comparisonFrameScenes;
|
||||
cvf::Collection<cvf::Model> m_comparisonStaticModels;
|
||||
bool m_isComparisonFollowingAnimation;
|
||||
|
||||
cvf::Vec3d m_comparisonViewOffset;
|
||||
cvf::ref<cvf::RenderingScissor> m_comparisonRenderingScissor;
|
||||
|
Loading…
Reference in New Issue
Block a user