Allow linking of contour map views

* Place copy of contour map in correct collection
* Allow linking of contour maps
* Improve handling of contour views and 3D views
* Guard nullptr
* Guard assert seen on Linux
* Zoom all on contour map when unlinked to reset zoom
If a contour map is linked to a 3D view, the view can get distorted. Call ZoomAll to reset to sensible defaults.

* Remove default rainbow legend
This commit is contained in:
Magne Sjaastad
2022-11-04 15:48:25 +01:00
committed by GitHub
parent f77b3673b0
commit d4086ee371
20 changed files with 157 additions and 159 deletions

View File

@@ -35,6 +35,7 @@
#include "RimGridCollection.h"
#include "RimRegularLegendConfig.h"
#include "RimSimWellInViewCollection.h"
#include "RimViewLinker.h"
#include "RimViewNameConfig.h"
#include "cafPdmUiTreeOrdering.h"
@@ -72,7 +73,7 @@ RimEclipseContourMapView::RimEclipseContourMapView()
m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr( contourMapProjection(), this );
( (RiuViewerToViewInterface*)this )->setCameraPosition( sm_defaultViewMatrix );
setCameraPosition( sm_defaultViewMatrix );
cellResult()->setTernaryEnabled( false );
cellResult()->legendConfigChanged.connect( this, &RimEclipseContourMapView::onLegendConfigChanged );
@@ -410,7 +411,22 @@ void RimEclipseContourMapView::onUpdateLegends()
}
}
nativeOrOverrideViewer()->showScaleLegend( m_showScaleLegend() );
// Hide the scale widget if any 3D views are present, as the display of the scale widget is only working for
// default rotation. The update is triggered in RimViewLinker::updateScaleWidgetVisibility()
bool any3DViewsLinked = false;
if ( auto viewLinker = assosiatedViewLinker() )
{
auto views = viewLinker->allViews();
for ( auto v : views )
{
if ( dynamic_cast<RimEclipseContourMapView*>( v ) ) continue;
any3DViewsLinked = true;
}
}
nativeOrOverrideViewer()->showScaleLegend( any3DViewsLinked ? false : m_showScaleLegend() );
}
}
@@ -569,3 +585,18 @@ RimSurfaceInViewCollection* RimEclipseContourMapView::surfaceInViewCollection()
// Surfaces should not be shown in contour map.
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseContourMapView::zoomAll()
{
setCameraPosition( sm_defaultViewMatrix );
isPerspectiveView = false;
// If a 3D view has been used as the primary linked view, a contour map can be rotated in 3D. Use the following
// function to make sure view is reset to original state, with correct rotation and grid box configuration.
updateViewWidgetAfterCreation();
RimEclipseView::zoomAll();
}