Merge pull request #4907 from OPM/feature-picking-in-comparison-view

Feature fix picking in comparison view step 1
This commit is contained in:
Jacob Støren
2019-10-22 16:07:59 +02:00
committed by GitHub
45 changed files with 513 additions and 360 deletions

View File

@@ -225,7 +225,10 @@ void RimAnnotationCollection::updateViewAnnotationCollections()
for ( const auto* view : views )
{
view->annotationCollection()->onGlobalCollectionChanged( this );
if (view->annotationCollection())
{
view->annotationCollection()->onGlobalCollectionChanged( this );
}
}
}

View File

@@ -131,13 +131,6 @@ Rim3dView::Rim3dView( void )
CAF_PDM_InitField( &m_isComparisonViewEnabled, "EnableComparisonView", false, "Enable", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_comparisonView, "ComparisonView", "Comparison View", "", "", "" );
CAF_PDM_InitField( &m_isComparisonViewLinkingTimestep,
"EnableComparisonViewTimestepLinking",
true,
"Link Timestep",
"",
"",
"" );
m_crossSectionVizModel = new cvf::ModelBasicList;
m_crossSectionVizModel->setName( "CrossSectionModel" );
@@ -332,13 +325,13 @@ 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 );
caf::PdmUiGroup* compViewGroup = uiOrdering.addNewGroup( "Comparison View" );
compViewGroup->add( &m_isComparisonViewEnabled );
compViewGroup->add( &m_comparisonView );
compViewGroup->add( &m_isComparisonViewLinkingTimestep );
uiOrdering.skipRemainingFields( true );
}
@@ -410,6 +403,15 @@ std::set<Rim3dView*> Rim3dView::viewsUsingThisAsComparisonView()
return containingViews;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dView::isScaleZEditable()
{
return ( this->viewsUsingThisAsComparisonView().empty() ||
( this->viewController() && this->viewController()->isCameraLinked() ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -497,7 +499,7 @@ void Rim3dView::updateCurrentTimeStepAndRedraw()
}
std::set<Rim3dView*> containerViews = this->viewsUsingThisAsComparisonView();
if ( !containerViews.empty() && !isUsingOverrideViewer())
if ( !containerViews.empty() && !isUsingOverrideViewer() )
{
for ( auto view : containerViews )
{
@@ -815,13 +817,7 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
createDisplayModelAndRedraw();
}
}
else if ( changedField == &m_isComparisonViewLinkingTimestep )
{
if ( m_isComparisonViewEnabled() && m_comparisonView() )
{
createDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -912,19 +908,6 @@ void Rim3dView::addMeasurementToModel( cvf::ModelBasicList* wellPathModelBasicLi
wellPathModelBasicList->updateBoundingBoxesRecursive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::setScaleZAndUpdate( double scalingFactor )
{
this->scaleZ = scalingFactor;
updateScaleTransform();
this->updateGridBoxData();
this->scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -986,6 +969,16 @@ void Rim3dView::updateAnnotationItems()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::setScaleZAndUpdate( double scalingFactor )
{
this->scaleZ = scalingFactor;
updateScaling();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1006,14 +999,18 @@ void Rim3dView::updateScaling()
viewer()->mainCamera()->setFromLookAt( eye, eye + dir, up );
viewer()->setPointOfInterest( poi );
updateScaleTransform();
createDisplayModelAndRedraw();
viewer()->update();
updateZScaleLabel();
}
if (activeComparisonView())
{
activeComparisonView()->setScaleZAndUpdate(scaleZ);
}
updateScaleTransform();
updateGridBoxData();
updateZScaleLabel();
this->scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------
@@ -1023,7 +1020,8 @@ void Rim3dView::updateZScaleLabel()
{
// Update Z scale label
int scale = static_cast<int>( scaleZ() );
nativeOrOverrideViewer()->setZScale( scale );
if ( viewer() ) viewer()->setZScale( scale );
}
//--------------------------------------------------------------------------------------------------
@@ -1045,6 +1043,12 @@ void Rim3dView::createHighlightAndGridBoxDisplayModelWithRedraw()
{
createHighlightAndGridBoxDisplayModel();
if ( Rim3dView* depView = prepareComparisonView() )
{
depView->createHighlightAndGridBoxDisplayModel();
restoreComparisonView();
}
if ( nativeOrOverrideViewer() )
{
nativeOrOverrideViewer()->update();
@@ -1419,12 +1423,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 ) );
@@ -1442,6 +1445,6 @@ void Rim3dView::restoreComparisonView()
CVF_ASSERT( depView );
depView->setOverrideViewer( nullptr );
depView->m_currentTimeStep = m_comparisonViewOrgTimestep;
depView->scaleZ = m_comparisonViewOrgZScale;
viewer()->setCurrentComparisonFrame(depView->currentTimeStep());
}

View File

@@ -163,7 +163,11 @@ public:
void updateZScaleLabel();
void updateMeasurement();
bool isMasterView() const;
bool isMasterView() const;
Rim3dView* activeComparisonView() const;
bool isScaleZEditable();
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const override;
@@ -296,9 +300,7 @@ private:
// Pure private methods : Override viewer and comparison view
void setOverrideViewer( RiuViewer* overrideViewer );
Rim3dView* activeComparisonView() const;
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
void setOverrideViewer( RiuViewer* overrideViewer );
Rim3dView* prepareComparisonView();
void restoreComparisonView();
@@ -319,5 +321,4 @@ private:
caf::PdmField<bool> m_showZScaleLabel;
caf::PdmField<bool> m_isComparisonViewEnabled;
caf::PdmPtrField<Rim3dView*> m_comparisonView;
caf::PdmField<bool> m_isComparisonViewLinkingTimestep;
};

View File

@@ -294,7 +294,7 @@ void RimEclipseView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
Rim3dView::fieldChangedByUi( changedField, oldValue, newValue );
RimGridView::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_showInvalidCells )
{
@@ -1169,16 +1169,12 @@ void RimEclipseView::updateLegends()
}
else
{
nativeOrOverrideViewer()->removeColorLegend( this->cellEdgeResult()->legendConfig()->titledOverlayFrame() );
nativeOrOverrideViewer()->removeColorLegend( fractureColors()->activeLegend()->titledOverlayFrame() );
nativeOrOverrideViewer()->removeColorLegend(
m_virtualPerforationResult->legendConfig()->titledOverlayFrame() );
nativeOrOverrideViewer()->removeColorLegend( this->cellResult()->legendConfig()->titledOverlayFrame() );
nativeOrOverrideViewer()->removeColorLegend( this->cellResult()->ternaryLegendConfig()->titledOverlayFrame() );
nativeOrOverrideViewer()->removeColorLegend(
this->currentFaultResultColors()->legendConfig()->titledOverlayFrame() );
nativeOrOverrideViewer()->removeColorLegend(
this->currentFaultResultColors()->ternaryLegendConfig()->titledOverlayFrame() );
std::vector<RimLegendConfig*> legendConfs = this->legendConfigs();
for (auto legendConf : legendConfs)
{
nativeOrOverrideViewer()->removeColorLegend(legendConf->titledOverlayFrame());
}
}
}

View File

@@ -440,8 +440,12 @@ void RimGeoMechView::updateLegends()
}
else
{
nativeOrOverrideViewer()->removeColorLegend( cellResult()->legendConfig->titledOverlayFrame() );
nativeOrOverrideViewer()->removeColorLegend( m_tensorResults->arrowColorLegendConfig->titledOverlayFrame() );
std::vector<RimLegendConfig*> legendConfs = this->legendConfigs();
for (auto legendConf : legendConfs)
{
nativeOrOverrideViewer()->removeColorLegend(legendConf->titledOverlayFrame());
}
}
this->updateLegendTextAndRanges( cellResult()->legendConfig(), m_currentTimeStep() );
@@ -752,7 +756,7 @@ void RimGeoMechView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
Rim3dView::fieldChangedByUi( changedField, oldValue, newValue );
RimGridView::fieldChangedByUi( changedField, oldValue, newValue );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -418,14 +418,6 @@ void RimGridView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
viewLinker->updateCamera( this );
}
}
else if ( changedField == &m_currentTimeStep )
{
RimViewLinker* viewLinker = this->assosiatedViewLinker();
if ( viewLinker )
{
viewLinker->updateTimeStep( this, m_currentTimeStep );
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -255,7 +255,7 @@ void RimIntersectionCollection::appendIntersectionBoxAndUpdate( RimIntersectionB
m_intersectionBoxes.push_back( intersectionBox );
updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( intersectionBox );
Riu3DMainWindowTools::selectAsCurrentItem( intersectionBox, false );
Rim3dView* rimView = nullptr;
firstAncestorOrThisOfType( rimView );

View File

@@ -286,12 +286,7 @@ QString RimViewLinker::displayNameForView( RimGridView* view )
if ( view )
{
RimCase* rimCase = nullptr;
view->firstAncestorOrThisOfType( rimCase );
if ( rimCase )
{
displayName = rimCase->caseUserDescription() + ": " + view->name();
}
displayName = view->autoName();
}
return displayName;
@@ -437,29 +432,8 @@ void RimViewLinker::findNameAndIconFromView( QString* name, caf::QIconProvider*
CVF_ASSERT( name && icon );
*name = displayNameForView( view );
*icon = view->uiIconProvider();
if ( view )
{
RimCase* rimCase = nullptr;
view->firstAncestorOrThisOfType( rimCase );
if ( dynamic_cast<RimGeoMechCase*>( rimCase ) )
{
*icon = caf::QIconProvider( ":/GeoMechCase48x48.png" );
}
else if ( dynamic_cast<RimEclipseResultCase*>( rimCase ) )
{
*icon = caf::QIconProvider( ":/Case48x48.png" );
}
else if ( dynamic_cast<RimEclipseInputCase*>( rimCase ) )
{
*icon = caf::QIconProvider( ":/EclipseInput48x48.png" );
}
}
else
{
*icon = caf::QIconProvider();
}
}
//--------------------------------------------------------------------------------------------------