Merge pull request #4947 from OPM/feature-co-visualization-into-linked-views
Improve Linked Views and include Co visualization #4892
@ -269,7 +269,8 @@ RimGridView* RiaApplication::activeMainOrComparisonGridView()
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimGridView* viewOrComparisonView = activeView;
|
||||
|
||||
if ( activeView != nullptr && activeView->viewer()->viewerCommands()->isCurrentPickInComparisonView() )
|
||||
if ( activeView != nullptr && activeView->viewer() &&
|
||||
activeView->viewer()->viewerCommands()->isCurrentPickInComparisonView() )
|
||||
{
|
||||
if ( RimGridView* compView = dynamic_cast<RimGridView*>( activeView->activeComparisonView() ) )
|
||||
{
|
||||
|
@ -8,6 +8,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RicUnLinkViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowLinkOptionsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRemoveComparison3dViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCompareTo3dViewFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -19,6 +21,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RicUnLinkViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowLinkOptionsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRemoveComparison3dViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCompareTo3dViewFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicCompareTo3dViewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimGridView.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCompareTo3dViewFeature, "RicCompareTo3dViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCompareTo3dViewFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCompareTo3dViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
|
||||
QVariant userData = this->userData();
|
||||
auto view = static_cast<Rim3dView*>(userData.value<void*>());
|
||||
|
||||
if (view && activeView)
|
||||
{
|
||||
activeView->setComparisonView( view );
|
||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCompareTo3dViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
QVariant userData = actionToSetup->data();
|
||||
|
||||
auto view = static_cast<Rim3dView*>(userData.value<void*>());
|
||||
if ( view )
|
||||
{
|
||||
actionToSetup->setIcon(view->uiIconProvider().icon() );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/ComparisonView16x16.png"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCompareTo3dViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "RicDeleteAllLinkedViewsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
@ -30,18 +31,10 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteAllLinkedViewsFeature, "RicDeleteAllLinkedViewsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteAllLinkedViewsFeature::isCommandEnabled()
|
||||
class DeleteAllLinkedViewsImpl
|
||||
{
|
||||
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimViewLinkerCollection>() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
||||
public:
|
||||
static void execute()
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
@ -59,12 +52,29 @@ void RicDeleteAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
||||
proj->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteAllLinkedViewsFeature::isCommandEnabled()
|
||||
{
|
||||
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimViewLinkerCollection>() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
DeleteAllLinkedViewsImpl::execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAllLinkedViewsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Delete All Linked Views" );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.png" ) );
|
||||
actionToSetup->setText( "Unlink All Views" );
|
||||
actionToSetup->setIcon( QIcon( ":/UnLinkView16x16.png" ) );
|
||||
}
|
||||
|
@ -25,59 +25,97 @@
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicLinkViewFeature, "RicLinkViewFeature" );
|
||||
|
||||
class RicLinkViewFeatureImpl
|
||||
{
|
||||
public:
|
||||
// 1. Selected views in the tree
|
||||
// 2. Context menu on a viewer
|
||||
|
||||
bool prepareToExecute()
|
||||
{
|
||||
auto contextViewer = dynamic_cast<RiuViewer*>(
|
||||
caf::CmdFeatureManager::instance()->currentContextMenuTargetWidget() );
|
||||
|
||||
if ( contextViewer )
|
||||
{
|
||||
// Link only the active view to an existing view link collection.
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
if ( !activeView ) return false;
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( activeView ) ) return false;
|
||||
if ( dynamic_cast<RimGeoMechContourMapView*>( activeView ) ) return false;
|
||||
|
||||
if ( activeView->assosiatedViewLinker() ) return false;
|
||||
|
||||
m_viewsToLink.push_back( activeView );
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<RimGridView*> selectedGridViews;
|
||||
|
||||
caf::SelectionManager::instance()->objectsByTypeStrict( &selectedGridViews );
|
||||
bool hasAnyUnlinkableViews = false;
|
||||
for ( auto gridView : selectedGridViews )
|
||||
{
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( gridView ) )
|
||||
{
|
||||
hasAnyUnlinkableViews = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( dynamic_cast<RimGeoMechContourMapView*>( gridView ) )
|
||||
{
|
||||
hasAnyUnlinkableViews = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !gridView->assosiatedViewLinker() )
|
||||
{
|
||||
m_viewsToLink.push_back( gridView );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_viewsToLink.empty() && !hasAnyUnlinkableViews )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void execute()
|
||||
{
|
||||
RicLinkVisibleViewsFeature::linkViews( m_viewsToLink );
|
||||
}
|
||||
|
||||
const std::vector<RimGridView*>& viewsToLink() { return m_viewsToLink;}
|
||||
|
||||
private:
|
||||
std::vector<RimGridView*> m_viewsToLink;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicLinkViewFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
||||
std::vector<RimGridView*> selectedGridViews;
|
||||
std::vector<RimEclipseContourMapView*> selectedContourMaps;
|
||||
|
||||
caf::SelectionManager::instance()->selectedItems( allSelectedItems );
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedGridViews );
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedContourMaps );
|
||||
size_t selectedRegularGridViews = selectedGridViews.size() - selectedContourMaps.size();
|
||||
|
||||
if ( selectedGridViews.size() > 1u && selectedRegularGridViews >= 1u &&
|
||||
allSelectedItems.size() == selectedGridViews.size() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Link only the active view to an existing view link collection.
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !activeView ) return false;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker();
|
||||
|
||||
if ( !viewLinker ) return false;
|
||||
|
||||
RimViewController* viewController = activeView->viewController();
|
||||
|
||||
if ( viewController )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ( !activeView->isMasterView() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
RicLinkViewFeatureImpl cmdImpl;
|
||||
return cmdImpl.prepareToExecute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -85,26 +123,10 @@ bool RicLinkViewFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
||||
std::vector<RimGridView*> selectedGridViews;
|
||||
|
||||
caf::SelectionManager::instance()->selectedItems( allSelectedItems );
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedGridViews );
|
||||
|
||||
if ( selectedGridViews.size() > 1u && allSelectedItems.size() == selectedGridViews.size() )
|
||||
RicLinkViewFeatureImpl cmdImpl;
|
||||
if ( cmdImpl.prepareToExecute() )
|
||||
{
|
||||
RicLinkVisibleViewsFeature::linkViews( selectedGridViews );
|
||||
}
|
||||
else
|
||||
{
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
RimGridView* gridView = dynamic_cast<RimGridView*>( activeView );
|
||||
if ( gridView )
|
||||
{
|
||||
std::vector<RimGridView*> views;
|
||||
views.push_back( gridView );
|
||||
RicLinkVisibleViewsFeature::linkViews( views );
|
||||
}
|
||||
cmdImpl.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,15 +135,25 @@ void RicLinkViewFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
std::vector<RimGridView*> selectedGridViews;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedGridViews );
|
||||
if ( selectedGridViews.size() > 1u )
|
||||
RicLinkViewFeatureImpl cmdImpl;
|
||||
cmdImpl.prepareToExecute();
|
||||
|
||||
|
||||
if ( cmdImpl.viewsToLink().size() >= 2u )
|
||||
{
|
||||
actionToSetup->setText( "Link Selected Views" );
|
||||
actionToSetup->setIcon( QIcon( ":/LinkView16x16.png" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setText( "Link View" );
|
||||
if (RiaApplication::instance()->project()->viewLinkerCollection()->viewLinker())
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/ControlledView16x16.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/MasterView16x16.png"));
|
||||
}
|
||||
}
|
||||
actionToSetup->setIcon( QIcon( ":/chain.png" ) );
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QTreeView>
|
||||
@ -65,7 +66,7 @@ bool RicLinkVisibleViewsFeature::isCommandEnabled()
|
||||
if ( visibleGridViews.size() >= 2 && ( linkedviews.size() < visibleGridViews.size() ) )
|
||||
{
|
||||
std::vector<RimGridView*> views;
|
||||
findNotLinkedVisibleViews( views );
|
||||
findLinkableVisibleViews( views );
|
||||
RicLinkVisibleViewsFeatureUi testUi;
|
||||
testUi.setViews( views );
|
||||
return !testUi.masterViewCandidates().empty();
|
||||
@ -79,10 +80,10 @@ bool RicLinkVisibleViewsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimGridView*> views;
|
||||
findNotLinkedVisibleViews( views );
|
||||
std::vector<RimGridView*> linkableViews;
|
||||
findLinkableVisibleViews( linkableViews );
|
||||
|
||||
linkViews( views );
|
||||
linkViews( linkableViews );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -92,7 +93,7 @@ void RicLinkVisibleViewsFeature::onActionTriggered( bool isChecked )
|
||||
void RicLinkVisibleViewsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Link Visible Views" );
|
||||
actionToSetup->setIcon( QIcon( ":/chain.png" ) );
|
||||
actionToSetup->setIcon( QIcon( ":/LinkView24x24.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -110,81 +111,51 @@ void RicLinkVisibleViewsFeature::allLinkedViews( std::vector<RimGridView*>& view
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeature::findNotLinkedVisibleViews( std::vector<RimGridView*>& views )
|
||||
void RicLinkVisibleViewsFeature::findLinkableVisibleViews( std::vector<RimGridView*>& views )
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
std::vector<RimGridView*> alreadyLinkedViews;
|
||||
allLinkedViews( alreadyLinkedViews );
|
||||
|
||||
std::vector<RimGridView*> visibleViews;
|
||||
proj->allVisibleGridViews( visibleViews );
|
||||
std::vector<RimGridView*> visibleGridViews;
|
||||
proj->allVisibleGridViews( visibleGridViews );
|
||||
|
||||
for ( size_t i = 0; i < visibleViews.size(); i++ )
|
||||
for ( auto gridView : visibleGridViews )
|
||||
{
|
||||
bool isLinked = false;
|
||||
for ( size_t j = 0; j < alreadyLinkedViews.size(); j++ )
|
||||
{
|
||||
if ( visibleViews[i] == alreadyLinkedViews[j] )
|
||||
{
|
||||
isLinked = true;
|
||||
}
|
||||
}
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( gridView ) ) continue;
|
||||
if ( dynamic_cast<RimGeoMechContourMapView*>( gridView ) ) continue;
|
||||
if ( gridView->assosiatedViewLinker() ) continue;
|
||||
|
||||
if ( !isLinked )
|
||||
{
|
||||
views.push_back( visibleViews[i] );
|
||||
}
|
||||
views.push_back( gridView );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeature::linkViews( std::vector<RimGridView*>& views )
|
||||
void RicLinkVisibleViewsFeature::linkViews( std::vector<RimGridView*>& linkableViews )
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker();
|
||||
|
||||
std::vector<RimGridView*> masterCandidates;
|
||||
for ( RimGridView* view : views )
|
||||
{
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( view ) == nullptr )
|
||||
{
|
||||
masterCandidates.push_back( view );
|
||||
}
|
||||
}
|
||||
std::vector<RimGridView*> masterCandidates = linkableViews;
|
||||
|
||||
if ( !viewLinker )
|
||||
{
|
||||
// Create a new view linker
|
||||
|
||||
if ( views.size() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
CVF_ASSERT( !masterCandidates.empty() );
|
||||
|
||||
RimGridView* masterView = masterCandidates.front();
|
||||
if ( masterCandidates.size() > 1u )
|
||||
{
|
||||
RicLinkVisibleViewsFeatureUi featureUi;
|
||||
featureUi.setViews( masterCandidates );
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &featureUi, "Select Master View", "" );
|
||||
propertyDialog.setWindowIcon( QIcon( ":/chain.png" ) );
|
||||
if ( propertyDialog.exec() != QDialog::Accepted ) return;
|
||||
|
||||
masterView = featureUi.masterView();
|
||||
}
|
||||
viewLinker = new RimViewLinker;
|
||||
|
||||
proj->viewLinkerCollection()->viewLinker = viewLinker;
|
||||
viewLinker->setMasterView( masterView );
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < views.size(); i++ )
|
||||
for ( size_t i = 0; i < linkableViews.size(); i++ )
|
||||
{
|
||||
RimGridView* rimView = views[i];
|
||||
RimGridView* rimView = linkableViews[i];
|
||||
if ( rimView == viewLinker->masterView() ) continue;
|
||||
|
||||
viewLinker->addDependentView( rimView );
|
||||
|
@ -43,6 +43,6 @@ protected:
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
void findNotLinkedVisibleViews( std::vector<RimGridView*>& views );
|
||||
void findLinkableVisibleViews( std::vector<RimGridView*>& views );
|
||||
void allLinkedViews( std::vector<RimGridView*>& views );
|
||||
};
|
||||
|
@ -34,9 +34,9 @@ CAF_PDM_SOURCE_INIT( RicLinkVisibleViewsFeatureUi, "RicLinkVisibleViewsFeatureUi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicLinkVisibleViewsFeatureUi::RicLinkVisibleViewsFeatureUi( void )
|
||||
{
|
||||
CAF_PDM_InitObject( "Link Visible Views Feature UI", ":/chain.png", "", "" );
|
||||
CAF_PDM_InitObject( "Link Visible Views Feature UI", ":/LinkView16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_masterView, "MasterView", "Master View", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_masterView, "MasterView", "Primary View", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicRemoveComparison3dViewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicRemoveComparison3dViewFeature, "RicRemoveComparison3dViewFeature" );
|
||||
|
||||
class RemoveComparison3dViewImpl
|
||||
{
|
||||
public:
|
||||
bool makeReady()
|
||||
{
|
||||
m_activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if ( m_activeView && m_activeView->viewer()->viewerCommands()->isCurrentPickInComparisonView() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void execute()
|
||||
{
|
||||
m_activeView->setComparisonView( nullptr );
|
||||
m_activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
private:
|
||||
Rim3dView* m_activeView = nullptr;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRemoveComparison3dViewFeature::isCommandEnabled()
|
||||
{
|
||||
RemoveComparison3dViewImpl cmdImpl;
|
||||
|
||||
return cmdImpl.makeReady();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRemoveComparison3dViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RemoveComparison3dViewImpl cmdImpl;
|
||||
|
||||
if ( cmdImpl.makeReady() )
|
||||
{
|
||||
cmdImpl.execute();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRemoveComparison3dViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Remove Comparison" );
|
||||
actionToSetup->setIcon( QIcon( ":/RemoveComparisonView16x16.png" ) );
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRemoveComparison3dViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include <QAction>
|
||||
#include <QTreeView>
|
||||
|
||||
@ -42,23 +43,13 @@ bool RicSetMasterViewFeature::isCommandEnabled()
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !activeView ) return false;
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( activeView ) != nullptr ) return false;
|
||||
if ( dynamic_cast<RimGeoMechContourMapView*>( activeView ) != nullptr ) return false;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
|
||||
if ( viewLinker && viewLinker->masterView() == activeView )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !proj->viewLinkerCollection()->viewLinker() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( activeView ) != nullptr )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( !viewLinker ) return false;
|
||||
if ( viewLinker->masterView() == activeView ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -96,5 +87,6 @@ void RicSetMasterViewFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSetMasterViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Set As Master View" );
|
||||
actionToSetup->setText( "Set As Primary Linked View" );
|
||||
actionToSetup->setIcon( QIcon( ":/MasterView16x16.png" ) );
|
||||
}
|
||||
|
@ -69,5 +69,5 @@ void RicShowLinkOptionsFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowLinkOptionsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Show Link Options" );
|
||||
actionToSetup->setText( "Show Linked View Options" );
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include "RimViewLinkerCollection.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicUnLinkViewFeature, "RicUnLinkViewFeature" );
|
||||
|
||||
@ -43,9 +44,7 @@ bool RicUnLinkViewFeature::isCommandEnabled()
|
||||
;
|
||||
if ( !activeView ) return false;
|
||||
|
||||
RimViewController* viewController = activeView->viewController();
|
||||
|
||||
if ( viewController )
|
||||
if ( activeView->assosiatedViewLinker() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -63,16 +62,39 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
|
||||
if ( !activeView ) return;
|
||||
|
||||
RimViewController* viewController = activeView->viewController();
|
||||
viewController->applyRangeFilterCollectionByUserChoice();
|
||||
RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItem( viewController );
|
||||
caf::CmdFeature* feature = caf::CmdFeatureManager::instance()->getCommandFeature( "RicDeleteItemFeature" );
|
||||
if ( feature )
|
||||
if ( viewController )
|
||||
{
|
||||
feature->action()->trigger();
|
||||
|
||||
return;
|
||||
viewController->applyRangeFilterCollectionByUserChoice();
|
||||
delete viewController;
|
||||
viewLinker->removeViewController( nullptr ); // Remove the slots in the vector that was set to nullptr by the destructor
|
||||
}
|
||||
else if ( viewLinker )
|
||||
{
|
||||
viewLinker->applyRangeFilterCollectionByUserChoice();
|
||||
|
||||
RimGridView* firstControlledView = viewLinker->firstControlledView();
|
||||
|
||||
if ( firstControlledView )
|
||||
{
|
||||
viewLinker->setMasterView(firstControlledView);
|
||||
|
||||
viewLinker->updateDependentViews();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove the view linker object from the view linker collection
|
||||
// viewLinkerCollection->viewLinker is a PdmChildField containing one RimViewLinker child object
|
||||
RiaApplication::instance()->project()->viewLinkerCollection->viewLinker.removeChildObject(viewLinker);
|
||||
|
||||
delete viewLinker;
|
||||
}
|
||||
activeView->updateHolder();
|
||||
}
|
||||
|
||||
RiaApplication::instance()->project()->viewLinkerCollection.uiCapability()->updateConnectedEditors();
|
||||
RiaApplication::instance()->project()->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -81,4 +103,5 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
|
||||
void RicUnLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Unlink View" );
|
||||
actionToSetup->setIcon( QIcon( ":/UnLinkView16x16.png" ) );
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( Rim3dView, "GenericView" ); // Do not use. Abs
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dView::Rim3dView( void )
|
||||
: m_isCallingUpdateTimestepAndRedraw( false )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaPreferences* preferences = app->preferences();
|
||||
@ -129,7 +130,6 @@ Rim3dView::Rim3dView( void )
|
||||
|
||||
CAF_PDM_InitField( &m_showZScaleLabel, "ShowZScale", true, "Show Z Scale Label", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_isComparisonViewEnabled, "EnableComparisonView", false, "Enable", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_comparisonView, "ComparisonView", "Comparison View", "", "", "" );
|
||||
|
||||
m_crossSectionVizModel = new cvf::ModelBasicList;
|
||||
@ -291,7 +291,8 @@ void Rim3dView::updateMdiWindowTitle()
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->layoutWidget()->setWindowTitle( autoName() );
|
||||
m_viewer->layoutWidget()->setWindowTitle(
|
||||
autoName() + ( isMasterView() ? " (Primary)" : viewController() ? " (Controlled)" : "" ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,6 +323,7 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr
|
||||
viewGroup->add( &m_showGridBox );
|
||||
viewGroup->add( &isPerspectiveView );
|
||||
viewGroup->add( &m_disableLighting );
|
||||
viewGroup->add( &m_comparisonView );
|
||||
|
||||
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Grid Appearance" );
|
||||
gridGroup->add( &scaleZ );
|
||||
@ -329,10 +331,6 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr
|
||||
gridGroup->add( &meshMode );
|
||||
gridGroup->add( &surfaceMode );
|
||||
|
||||
caf::PdmUiGroup* compViewGroup = uiOrdering.addNewGroup( "Comparison View" );
|
||||
compViewGroup->add( &m_isComparisonViewEnabled );
|
||||
compViewGroup->add( &m_comparisonView );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
@ -412,6 +410,15 @@ bool Rim3dView::isScaleZEditable()
|
||||
( this->viewController() && this->viewController()->isCameraLinked() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dView::setComparisonView( Rim3dView* compView )
|
||||
{
|
||||
m_comparisonView = compView;
|
||||
m_comparisonView.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -484,6 +491,8 @@ void Rim3dView::setCurrentTimeStep( int frameIndex )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dView::updateCurrentTimeStepAndRedraw()
|
||||
{
|
||||
if ( m_isCallingUpdateTimestepAndRedraw ) return;
|
||||
|
||||
if ( nativeOrOverrideViewer() )
|
||||
{
|
||||
this->updateCurrentTimeStep();
|
||||
@ -498,6 +507,8 @@ void Rim3dView::updateCurrentTimeStepAndRedraw()
|
||||
nativeOrOverrideViewer()->update();
|
||||
}
|
||||
|
||||
m_isCallingUpdateTimestepAndRedraw = true;
|
||||
|
||||
std::set<Rim3dView*> containerViews = this->viewsUsingThisAsComparisonView();
|
||||
if ( !containerViews.empty() && !isUsingOverrideViewer() )
|
||||
{
|
||||
@ -506,6 +517,7 @@ void Rim3dView::updateCurrentTimeStepAndRedraw()
|
||||
view->updateCurrentTimeStepAndRedraw();
|
||||
}
|
||||
}
|
||||
m_isCallingUpdateTimestepAndRedraw = false;
|
||||
|
||||
RimProject* project;
|
||||
firstAncestorOrThisOfTypeAsserted( project );
|
||||
@ -806,20 +818,12 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
m_viewer->showZScaleLabel( m_showZScaleLabel() );
|
||||
m_viewer->update();
|
||||
}
|
||||
else if ( changedField == &m_isComparisonViewEnabled )
|
||||
{
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
else if ( changedField == &m_comparisonView )
|
||||
{
|
||||
if ( m_isComparisonViewEnabled() )
|
||||
{
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -973,11 +977,14 @@ void Rim3dView::updateAnnotationItems()
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dView::setScaleZAndUpdate( double scalingFactor )
|
||||
{
|
||||
if ( this->scaleZ != scalingFactor )
|
||||
{
|
||||
this->scaleZ = scalingFactor;
|
||||
|
||||
updateScaling();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -1402,16 +1409,9 @@ void Rim3dView::appendMeasurementToModel()
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dView* Rim3dView::activeComparisonView() const
|
||||
{
|
||||
if ( m_isComparisonViewEnabled() )
|
||||
{
|
||||
return m_comparisonView();
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -1430,7 +1430,6 @@ Rim3dView* Rim3dView::prepareComparisonView()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
if ( depView->scaleZ() != scaleZ() )
|
||||
{
|
||||
depView->setScaleZAndUpdate( scaleZ() );
|
||||
@ -1453,5 +1452,4 @@ void Rim3dView::restoreComparisonView()
|
||||
|
||||
depView->setOverrideViewer( nullptr );
|
||||
viewer()->setCurrentComparisonFrame( depView->currentTimeStep() );
|
||||
|
||||
}
|
||||
|
@ -166,6 +166,7 @@ public:
|
||||
bool isMasterView() const;
|
||||
Rim3dView* activeComparisonView() const;
|
||||
bool isScaleZEditable();
|
||||
void setComparisonView(Rim3dView* compView);
|
||||
|
||||
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
|
||||
|
||||
@ -310,6 +311,7 @@ private:
|
||||
QPointer<RiuViewer> m_overrideViewer;
|
||||
int m_comparisonViewOrgTimestep;
|
||||
double m_comparisonViewOrgZScale;
|
||||
bool m_isCallingUpdateTimestepAndRedraw; // To avoid infinite recursion if comparison views are pointing to each other.
|
||||
|
||||
caf::PdmField<QString> m_name_OBSOLETE;
|
||||
caf::PdmChildField<RimViewNameConfig*> m_nameConfig;
|
||||
@ -319,6 +321,5 @@ private:
|
||||
caf::PdmField<cvf::Color3f> m_backgroundColor;
|
||||
caf::PdmField<bool> m_showGridBox;
|
||||
caf::PdmField<bool> m_showZScaleLabel;
|
||||
caf::PdmField<bool> m_isComparisonViewEnabled;
|
||||
caf::PdmPtrField<Rim3dView*> m_comparisonView;
|
||||
};
|
||||
|
@ -86,6 +86,9 @@ RimGridView::~RimGridView( void )
|
||||
|
||||
if ( proj && this->isMasterView() )
|
||||
{
|
||||
RimViewLinker* viewLinker = this->assosiatedViewLinker();
|
||||
viewLinker->setMasterView(nullptr);
|
||||
|
||||
delete proj->viewLinkerCollection->viewLinker();
|
||||
proj->viewLinkerCollection->viewLinker = nullptr;
|
||||
|
||||
|
@ -127,7 +127,7 @@ RimProject::RimProject( void )
|
||||
CAF_PDM_InitFieldNoDefault( &viewLinkerCollection,
|
||||
"LinkedViews",
|
||||
"Linked Views (field in RimProject",
|
||||
":/chain.png",
|
||||
":/LinkView16x16.png",
|
||||
"",
|
||||
"" );
|
||||
viewLinkerCollection.uiCapability()->setUiHidden( true );
|
||||
|
@ -95,6 +95,10 @@ RimViewController::RimViewController()
|
||||
RimViewController::~RimViewController()
|
||||
{
|
||||
this->removeOverrides();
|
||||
RimGridView* managedView = m_managedView;
|
||||
m_managedView = nullptr;
|
||||
|
||||
if (managedView) managedView->updateHolder();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -216,6 +220,8 @@ void RimViewController::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
RimGridView* previousManagedView = dynamic_cast<RimGridView*>( prevValue );
|
||||
RimViewController::removeOverrides( previousManagedView );
|
||||
|
||||
ownerViewLinker()->notifyManagedViewChange(previousManagedView, m_managedView());
|
||||
|
||||
setManagedView( m_managedView() );
|
||||
|
||||
m_name.uiCapability()->updateConnectedEditors();
|
||||
@ -469,6 +475,11 @@ RimGridView* RimViewController::managedView() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewController::setManagedView( RimGridView* view )
|
||||
{
|
||||
if (m_managedView != view)
|
||||
{
|
||||
ownerViewLinker()->notifyManagedViewChange(m_managedView(), view);
|
||||
}
|
||||
|
||||
m_managedView = view;
|
||||
|
||||
updateOptionSensitivity();
|
||||
@ -478,6 +489,7 @@ void RimViewController::setManagedView( RimGridView* view )
|
||||
updateCameraLink();
|
||||
updateDisplayNameAndIcon();
|
||||
updateTimeStepLink();
|
||||
m_managedView->updateHolder();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -949,7 +961,7 @@ bool RimViewController::isRangeFiltersControlled() const
|
||||
{
|
||||
if ( !isRangeFilterControlPossible() ) return false;
|
||||
|
||||
if ( ownerViewLinker()->isActive() && this->m_isActive() )
|
||||
if (ownerViewLinker() && ownerViewLinker()->isActive() && this->m_isActive() )
|
||||
{
|
||||
return m_syncRangeFilters;
|
||||
}
|
||||
@ -1125,7 +1137,7 @@ bool RimViewController::askUserToRestoreOriginalRangeFilterCollection( const QSt
|
||||
questionText = QString( "The range filters in the view \"%1\" are about to be unlinked." ).arg( viewName );
|
||||
|
||||
msgBox.setText( questionText );
|
||||
msgBox.setInformativeText( "Do you want to keep the range filters from the master view?" );
|
||||
msgBox.setInformativeText( "Do you want to keep the range filters from the primary view?" );
|
||||
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No );
|
||||
|
||||
int ret = msgBox.exec();
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RiaOptionItemFactory.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafQIconProvider.h"
|
||||
#include "cvfCamera.h"
|
||||
@ -70,6 +71,10 @@ RimViewLinker::RimViewLinker()
|
||||
CAF_PDM_InitFieldNoDefault(&m_viewControllers, "ManagedViews", "Managed Views", "", "", "");
|
||||
m_viewControllers.uiCapability()->setUiHidden(true);
|
||||
m_viewControllers.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_comparisonView, "LinkedComparisonView", "Comparison View", "", "", "");
|
||||
m_comparisonView.xmlCapability()->disableIO();
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
@ -81,6 +86,9 @@ RimViewLinker::~RimViewLinker()
|
||||
removeOverrides();
|
||||
|
||||
m_viewControllers.deleteAllChildObjects();
|
||||
RimGridView* masterView = m_masterView;
|
||||
m_masterView = nullptr;
|
||||
if (masterView) masterView->updateHolder();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -270,6 +278,8 @@ void RimViewLinker::allViewsForCameraSync( const RimGridView* source, std::vecto
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::updateDependentViews()
|
||||
{
|
||||
if (m_viewControllers.empty()) return;
|
||||
|
||||
updateOverrides();
|
||||
updateCellResult();
|
||||
updateScaleZ( m_masterView, m_masterView->scaleZ() );
|
||||
@ -297,7 +307,8 @@ QString RimViewLinker::displayNameForView( RimGridView* view )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::setMasterView( RimGridView* view )
|
||||
{
|
||||
RimViewController* previousViewController = view->viewController();
|
||||
RimViewController* previousViewController = nullptr;
|
||||
if (view) previousViewController = view->viewController();
|
||||
|
||||
// Remove the view as dependent view
|
||||
if ( previousViewController )
|
||||
@ -343,6 +354,10 @@ void RimViewLinker::allViews( std::vector<RimGridView*>& views ) const
|
||||
void RimViewLinker::initAfterRead()
|
||||
{
|
||||
updateUiNameAndIcon();
|
||||
if ( m_masterView() )
|
||||
{
|
||||
m_comparisonView = dynamic_cast<RimGridView*>( m_masterView->activeComparisonView() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -399,6 +414,9 @@ void RimViewLinker::updateUiNameAndIcon()
|
||||
{
|
||||
caf::QIconProvider iconProvider;
|
||||
RimViewLinker::findNameAndIconFromView( &m_name.v(), &iconProvider, m_masterView );
|
||||
|
||||
if (m_masterView) m_masterView->updateHolder();
|
||||
|
||||
setUiIcon( iconProvider );
|
||||
}
|
||||
|
||||
@ -476,6 +494,94 @@ void RimViewLinker::updateCursorPosition( const RimGridView* sourceView, const c
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::notifyManagedViewChange( RimGridView* oldManagedView, RimGridView* newManagedView )
|
||||
{
|
||||
if ( oldManagedView && ( oldManagedView == m_comparisonView ) )
|
||||
{
|
||||
m_comparisonView = newManagedView;
|
||||
m_comparisonView.uiCapability()->updateConnectedEditors();
|
||||
|
||||
if ( masterView() )
|
||||
{
|
||||
masterView()->setComparisonView( m_comparisonView() );
|
||||
masterView()->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimViewLinker::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
RimGridView* actualComparisonView = nullptr;
|
||||
if ( m_masterView() )
|
||||
{
|
||||
actualComparisonView = dynamic_cast<RimGridView*>( m_masterView->activeComparisonView() );
|
||||
}
|
||||
|
||||
bool isActiveCompViewInList = false;
|
||||
for ( const auto& viewController : m_viewControllers )
|
||||
{
|
||||
if ( viewController->managedView() )
|
||||
{
|
||||
RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName( viewController->managedView(), &options );
|
||||
if ( viewController->managedView() == actualComparisonView )
|
||||
{
|
||||
isActiveCompViewInList = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isActiveCompViewInList && actualComparisonView != nullptr )
|
||||
{
|
||||
// Add the actually used comparison view to the option list, even though it is not one of the linked views
|
||||
options.push_front( caf::PdmOptionItemInfo( actualComparisonView->autoName(),
|
||||
actualComparisonView,
|
||||
false,
|
||||
actualComparisonView->uiCapability()->uiIconProvider() ) );
|
||||
}
|
||||
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
// Update the comparison view from the master view
|
||||
if ( m_masterView() )
|
||||
{
|
||||
m_comparisonView = dynamic_cast<RimGridView*>( m_masterView->activeComparisonView() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_comparisonView )
|
||||
{
|
||||
if ( masterView() )
|
||||
{
|
||||
masterView()->setComparisonView( m_comparisonView() );
|
||||
masterView()->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -507,11 +613,14 @@ void RimViewLinker::addDependentView( RimGridView* view )
|
||||
{
|
||||
CVF_ASSERT( view && view != m_masterView );
|
||||
|
||||
if ( !view->viewController() )
|
||||
{
|
||||
RimViewController* viewContr = new RimViewController;
|
||||
this->m_viewControllers.push_back( viewContr );
|
||||
|
||||
viewContr->setManagedView( view );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -535,7 +644,7 @@ void RimViewLinker::addViewControllers( caf::PdmUiTreeOrdering& uiTreeOrdering )
|
||||
{
|
||||
for ( const auto& viewController : m_viewControllers )
|
||||
{
|
||||
uiTreeOrdering.add( viewController );
|
||||
if (viewController) uiTreeOrdering.add( viewController );
|
||||
}
|
||||
}
|
||||
|
||||
@ -568,3 +677,13 @@ void RimViewLinker::removeViewController( RimViewController* viewController )
|
||||
{
|
||||
m_viewControllers.removeChildObject( viewController );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridView* RimViewLinker::firstControlledView()
|
||||
{
|
||||
if (m_viewControllers.empty()) return nullptr;
|
||||
|
||||
return m_viewControllers[0]->managedView();
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ public:
|
||||
bool isFirstViewDependentOnSecondView( const RimGridView* firstView, const RimGridView* secondView ) const;
|
||||
void updateDependentViews();
|
||||
void removeViewController( RimViewController* viewController );
|
||||
RimGridView* firstControlledView();
|
||||
|
||||
void updateOverrides();
|
||||
|
||||
@ -91,12 +92,24 @@ public:
|
||||
|
||||
void updateCursorPosition( const RimGridView* sourceView, const cvf::Vec3d& domainCoord );
|
||||
|
||||
void notifyManagedViewChange(RimGridView* oldManagedView, RimGridView* newManagedView);
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override
|
||||
{
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
void initAfterRead() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
static QString displayNameForView( RimGridView* view );
|
||||
@ -109,4 +122,5 @@ private:
|
||||
caf::PdmChildArrayField<RimViewController*> m_viewControllers;
|
||||
caf::PdmPtrField<RimGridView*> m_masterView;
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmPtrField<RimGridView*> m_comparisonView;
|
||||
};
|
||||
|
@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimViewLinkerCollection, "RimViewLinkerCollection" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewLinkerCollection::RimViewLinkerCollection( void )
|
||||
{
|
||||
CAF_PDM_InitObject( "Linked Views", ":/chain.png", "", "" );
|
||||
CAF_PDM_InitObject( "Linked Views", ":/LinkView16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" );
|
||||
isActive.uiCapability()->setUiHidden( true );
|
||||
|
@ -53,8 +53,13 @@ void RimViewManipulator::applySourceViewCameraOnDestinationViews( RimGridView*
|
||||
}
|
||||
|
||||
// Source bounding box in global coordinates including scaleZ
|
||||
cvf::BoundingBox sourceSceneBB = sourceView->viewer()->currentScene()->boundingBox();
|
||||
cvf::BoundingBox sourceSceneBB;
|
||||
{
|
||||
if ( sourceView->viewer()->currentScene() )
|
||||
{
|
||||
sourceSceneBB = sourceView->viewer()->currentScene()->boundingBox();
|
||||
}
|
||||
|
||||
cvf::Vec3d offset = cvf::Vec3d::ZERO;
|
||||
RimCase* sourceOwnerCase = sourceView->ownerCase();
|
||||
if ( sourceOwnerCase )
|
||||
@ -84,7 +89,12 @@ void RimViewManipulator::applySourceViewCameraOnDestinationViews( RimGridView*
|
||||
destinationViewer->enableParallelProjection( !sourceView->isPerspectiveView );
|
||||
|
||||
// Destination bounding box in global coordinates including scaleZ
|
||||
cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox();
|
||||
cvf::BoundingBox destSceneBB;
|
||||
if ( destinationViewer->currentScene() )
|
||||
{
|
||||
destSceneBB = destinationViewer->currentScene()->boundingBox();
|
||||
}
|
||||
|
||||
cvf::Vec3d destinationCamEye = sourceCamGlobalEye;
|
||||
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint;
|
||||
cvf::Vec3d offset = cvf::Vec3d::ZERO;
|
||||
|
BIN
ApplicationCode/Resources/ComparisonView16x16.png
Normal file
After Width: | Height: | Size: 202 B |
BIN
ApplicationCode/Resources/ControlledView16x16.png
Normal file
After Width: | Height: | Size: 218 B |
BIN
ApplicationCode/Resources/LinkView16x16.png
Normal file
After Width: | Height: | Size: 255 B |
BIN
ApplicationCode/Resources/LinkView24x24.png
Normal file
After Width: | Height: | Size: 187 B |
BIN
ApplicationCode/Resources/MasterView16x16.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
ApplicationCode/Resources/RemoveComparisonView16x16.png
Normal file
After Width: | Height: | Size: 290 B |
@ -58,6 +58,13 @@
|
||||
<file>GeoMechCasePropTable24x24.png</file>
|
||||
<file>GeoMechCases48x48.png</file>
|
||||
<file>chain.png</file>
|
||||
<file>UnLinkView16x16.png</file>
|
||||
<file>LinkView16x16.png</file>
|
||||
<file>LinkView24x24.png</file>
|
||||
<file>ComparisonView16x16.png</file>
|
||||
<file>RemoveComparisonView16x16.png</file>
|
||||
<file>MasterView16x16.png</file>
|
||||
<file>ControlledView16x16.png</file>
|
||||
<file>TileWindows24x24.png</file>
|
||||
<file>Window16x16.png</file>
|
||||
<file>LasFile16x16.png</file>
|
||||
|
BIN
ApplicationCode/Resources/UnLinkView16x16.png
Normal file
After Width: | Height: | Size: 216 B |
@ -40,11 +40,13 @@
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigVirtualPerforationTransmissibilities.h"
|
||||
|
||||
#include "RiaOptionItemFactory.h"
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
@ -53,11 +55,13 @@
|
||||
#include "RimFracture.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
@ -148,6 +152,41 @@ void RiuViewerCommands::setOwnerView( Rim3dView* owner )
|
||||
m_reservoirView = owner;
|
||||
}
|
||||
|
||||
void RiuViewerCommands::addCompareToViewMenu( caf::CmdFeatureMenuBuilder* menuBuilder )
|
||||
{
|
||||
RimGridView* mainGridView = dynamic_cast<RimGridView*>( m_reservoirView.p() );
|
||||
if ( mainGridView && !mainGridView->activeComparisonView() )
|
||||
{
|
||||
std::vector<Rim3dView*> validComparisonViews;
|
||||
|
||||
std::vector<Rim3dView*> views;
|
||||
RiaApplication::instance()->project()->allViews( views );
|
||||
for ( auto view : views )
|
||||
{
|
||||
if ( !dynamic_cast<RimGridView*>( view ) ) continue;
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( view ) ) continue;
|
||||
if ( dynamic_cast<RimGeoMechContourMapView*>( view ) ) continue;
|
||||
|
||||
if ( view != mainGridView )
|
||||
{
|
||||
validComparisonViews.push_back( view );
|
||||
}
|
||||
}
|
||||
|
||||
if ( validComparisonViews.size() )
|
||||
{
|
||||
menuBuilder->subMenuStart( "Compare To ...", QIcon( ":/ComparisonView16x16.png" ) );
|
||||
for ( auto view : validComparisonViews )
|
||||
{
|
||||
menuBuilder->addCmdFeatureWithUserData( "RicCompareTo3dViewFeature",
|
||||
view->autoName(),
|
||||
QVariant::fromValue( static_cast<void*>( view ) ) );
|
||||
}
|
||||
menuBuilder->subMenuEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -518,7 +557,10 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
|
||||
menuBuilder << "RicLinkViewFeature";
|
||||
menuBuilder << "RicShowLinkOptionsFeature";
|
||||
menuBuilder << "RicSetMasterViewFeature";
|
||||
addCompareToViewMenu( &menuBuilder );
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicUnLinkViewFeature";
|
||||
menuBuilder << "RicRemoveComparison3dViewFeature";
|
||||
}
|
||||
else if ( int2dView )
|
||||
{
|
||||
@ -1312,6 +1354,8 @@ void RiuViewerCommands::handleTextPicking( int winPosX, int winPosY, cvf::HitIte
|
||||
|
||||
ref<Ray> ray = m_viewer->mainCamera()->rayFromWindowCoordinates( translatedMousePosX, translatedMousePosY );
|
||||
|
||||
if ( ray.notNull() )
|
||||
{
|
||||
for ( size_t pIdx = 0; pIdx < partCollection.size(); ++pIdx )
|
||||
{
|
||||
DrawableText* textDrawable = dynamic_cast<DrawableText*>(partCollection[pIdx]->drawable());
|
||||
@ -1326,6 +1370,7 @@ void RiuViewerCommands::handleTextPicking( int winPosX, int winPosY, cvf::HitIte
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hitItems->sort();
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ class QMouseEvent;
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
}
|
||||
class CmdFeatureMenuBuilder;
|
||||
} // namespace caf
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -89,6 +90,8 @@ private:
|
||||
|
||||
bool handleOverlayItemPicking( int winPosX, int winPosY );
|
||||
|
||||
void addCompareToViewMenu( caf::CmdFeatureMenuBuilder* menuBuilder );
|
||||
|
||||
static void addDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
|
||||
static void removeDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
|
||||
|
||||
|