#14602 Contour map: Keep interactive panning when reloading a project

Viewer::setView() moves the camera to look straight at the point of interest. Panning does not move the point of interest, so this discarded the camera position restored from the project file.

Only reset the view direction if the camera is not already oriented top-down, which is the case when a contour map has been rotated by a linked 3D view.
This commit is contained in:
Magne Sjaastad committed 2026-08-27 10:16:06 +02:00
1 parent cf3dadacf7
commit 61117162da
4 files changed
+36 -4

No files matched your search

@@ -1653,6 +1653,19 @@ cvf::Vec3d Rim3dView::cameraPointOfInterest() const
return m_cameraPointOfInterest();
}
//--------------------------------------------------------------------------------------------------
/// Returns true if the camera is already oriented along the given view direction and up direction
//--------------------------------------------------------------------------------------------------
bool Rim3dView::isCameraOriented( const cvf::Vec3d& viewDirection, const cvf::Vec3d& upDirection ) const
{
auto viewer = nativeOrOverrideViewer();
if ( !viewer || !viewer->mainCamera() ) return false;
const double tolerance = 1.0e-6;
return ( viewer->mainCamera()->direction() - viewDirection ).length() < tolerance &&
( viewer->mainCamera()->up() - upDirection ).length() < tolerance;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------