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* activeView = RiaApplication::instance()->activeGridView();
|
||||||
RimGridView* viewOrComparisonView = activeView;
|
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() ) )
|
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}/RicShowLinkOptionsFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicRemoveComparison3dViewFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicCompareTo3dViewFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
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}/RicShowLinkOptionsFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicRemoveComparison3dViewFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicCompareTo3dViewFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
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 "RicDeleteAllLinkedViewsFeature.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
#include "RimGridView.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
#include "RimViewLinkerCollection.h"
|
#include "RimViewLinkerCollection.h"
|
||||||
@ -30,19 +31,11 @@
|
|||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicDeleteAllLinkedViewsFeature, "RicDeleteAllLinkedViewsFeature" );
|
CAF_CMD_SOURCE_INIT( RicDeleteAllLinkedViewsFeature, "RicDeleteAllLinkedViewsFeature" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
class DeleteAllLinkedViewsImpl
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RicDeleteAllLinkedViewsFeature::isCommandEnabled()
|
|
||||||
{
|
|
||||||
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimViewLinkerCollection>() != nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicDeleteAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
static void execute()
|
||||||
|
{
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
|
|
||||||
RimViewLinker* viewLinker = proj->viewLinkerCollection()->viewLinker();
|
RimViewLinker* viewLinker = proj->viewLinkerCollection()->viewLinker();
|
||||||
@ -58,6 +51,23 @@ void RicDeleteAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
|||||||
|
|
||||||
proj->uiCapability()->updateConnectedEditors();
|
proj->uiCapability()->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicDeleteAllLinkedViewsFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimViewLinkerCollection>() != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDeleteAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
||||||
|
{
|
||||||
|
DeleteAllLinkedViewsImpl::execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -65,6 +75,6 @@ void RicDeleteAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicDeleteAllLinkedViewsFeature::setupActionLook( QAction* actionToSetup )
|
void RicDeleteAllLinkedViewsFeature::setupActionLook( QAction* actionToSetup )
|
||||||
{
|
{
|
||||||
actionToSetup->setText( "Delete All Linked Views" );
|
actionToSetup->setText( "Unlink All Views" );
|
||||||
actionToSetup->setIcon( QIcon( ":/Erase.png" ) );
|
actionToSetup->setIcon( QIcon( ":/UnLinkView16x16.png" ) );
|
||||||
}
|
}
|
||||||
|
@ -25,59 +25,97 @@
|
|||||||
|
|
||||||
#include "Rim3dView.h"
|
#include "Rim3dView.h"
|
||||||
#include "RimEclipseContourMapView.h"
|
#include "RimEclipseContourMapView.h"
|
||||||
|
#include "RimGeoMechContourMapView.h"
|
||||||
#include "RimGridView.h"
|
#include "RimGridView.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
#include "RimViewLinkerCollection.h"
|
#include "RimViewLinkerCollection.h"
|
||||||
|
|
||||||
|
#include "RiuViewer.h"
|
||||||
|
#include "RiuViewerCommands.h"
|
||||||
|
|
||||||
|
#include "cafCmdFeatureManager.h"
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicLinkViewFeature, "RicLinkViewFeature" );
|
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()
|
bool RicLinkViewFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
RicLinkViewFeatureImpl cmdImpl;
|
||||||
std::vector<RimGridView*> selectedGridViews;
|
return cmdImpl.prepareToExecute();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -85,26 +123,10 @@ bool RicLinkViewFeature::isCommandEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicLinkViewFeature::onActionTriggered( bool isChecked )
|
void RicLinkViewFeature::onActionTriggered( bool isChecked )
|
||||||
{
|
{
|
||||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
RicLinkViewFeatureImpl cmdImpl;
|
||||||
std::vector<RimGridView*> selectedGridViews;
|
if ( cmdImpl.prepareToExecute() )
|
||||||
|
|
||||||
caf::SelectionManager::instance()->selectedItems( allSelectedItems );
|
|
||||||
caf::SelectionManager::instance()->objectsByType( &selectedGridViews );
|
|
||||||
|
|
||||||
if ( selectedGridViews.size() > 1u && allSelectedItems.size() == selectedGridViews.size() )
|
|
||||||
{
|
{
|
||||||
RicLinkVisibleViewsFeature::linkViews( selectedGridViews );
|
cmdImpl.execute();
|
||||||
}
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,15 +135,25 @@ void RicLinkViewFeature::onActionTriggered( bool isChecked )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
void RicLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
||||||
{
|
{
|
||||||
std::vector<RimGridView*> selectedGridViews;
|
RicLinkViewFeatureImpl cmdImpl;
|
||||||
caf::SelectionManager::instance()->objectsByType( &selectedGridViews );
|
cmdImpl.prepareToExecute();
|
||||||
if ( selectedGridViews.size() > 1u )
|
|
||||||
|
|
||||||
|
if ( cmdImpl.viewsToLink().size() >= 2u )
|
||||||
{
|
{
|
||||||
actionToSetup->setText( "Link Selected Views" );
|
actionToSetup->setText( "Link Selected Views" );
|
||||||
|
actionToSetup->setIcon( QIcon( ":/LinkView16x16.png" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actionToSetup->setText( "Link View" );
|
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 "cafPdmUiPropertyViewDialog.h"
|
||||||
|
|
||||||
|
#include "RimGeoMechContourMapView.h"
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
@ -65,7 +66,7 @@ bool RicLinkVisibleViewsFeature::isCommandEnabled()
|
|||||||
if ( visibleGridViews.size() >= 2 && ( linkedviews.size() < visibleGridViews.size() ) )
|
if ( visibleGridViews.size() >= 2 && ( linkedviews.size() < visibleGridViews.size() ) )
|
||||||
{
|
{
|
||||||
std::vector<RimGridView*> views;
|
std::vector<RimGridView*> views;
|
||||||
findNotLinkedVisibleViews( views );
|
findLinkableVisibleViews( views );
|
||||||
RicLinkVisibleViewsFeatureUi testUi;
|
RicLinkVisibleViewsFeatureUi testUi;
|
||||||
testUi.setViews( views );
|
testUi.setViews( views );
|
||||||
return !testUi.masterViewCandidates().empty();
|
return !testUi.masterViewCandidates().empty();
|
||||||
@ -79,10 +80,10 @@ bool RicLinkVisibleViewsFeature::isCommandEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicLinkVisibleViewsFeature::onActionTriggered( bool isChecked )
|
void RicLinkVisibleViewsFeature::onActionTriggered( bool isChecked )
|
||||||
{
|
{
|
||||||
std::vector<RimGridView*> views;
|
std::vector<RimGridView*> linkableViews;
|
||||||
findNotLinkedVisibleViews( views );
|
findLinkableVisibleViews( linkableViews );
|
||||||
|
|
||||||
linkViews( views );
|
linkViews( linkableViews );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ void RicLinkVisibleViewsFeature::onActionTriggered( bool isChecked )
|
|||||||
void RicLinkVisibleViewsFeature::setupActionLook( QAction* actionToSetup )
|
void RicLinkVisibleViewsFeature::setupActionLook( QAction* actionToSetup )
|
||||||
{
|
{
|
||||||
actionToSetup->setText( "Link Visible Views" );
|
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();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
|
|
||||||
std::vector<RimGridView*> alreadyLinkedViews;
|
std::vector<RimGridView*> alreadyLinkedViews;
|
||||||
allLinkedViews( alreadyLinkedViews );
|
allLinkedViews( alreadyLinkedViews );
|
||||||
|
|
||||||
std::vector<RimGridView*> visibleViews;
|
std::vector<RimGridView*> visibleGridViews;
|
||||||
proj->allVisibleGridViews( visibleViews );
|
proj->allVisibleGridViews( visibleGridViews );
|
||||||
|
|
||||||
for ( size_t i = 0; i < visibleViews.size(); i++ )
|
for ( auto gridView : visibleGridViews )
|
||||||
{
|
{
|
||||||
bool isLinked = false;
|
if ( dynamic_cast<RimEclipseContourMapView*>( gridView ) ) continue;
|
||||||
for ( size_t j = 0; j < alreadyLinkedViews.size(); j++ )
|
if ( dynamic_cast<RimGeoMechContourMapView*>( gridView ) ) continue;
|
||||||
{
|
if ( gridView->assosiatedViewLinker() ) continue;
|
||||||
if ( visibleViews[i] == alreadyLinkedViews[j] )
|
|
||||||
{
|
|
||||||
isLinked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !isLinked )
|
views.push_back( gridView );
|
||||||
{
|
|
||||||
views.push_back( visibleViews[i] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicLinkVisibleViewsFeature::linkViews( std::vector<RimGridView*>& views )
|
void RicLinkVisibleViewsFeature::linkViews( std::vector<RimGridView*>& linkableViews )
|
||||||
{
|
{
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker();
|
RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker();
|
||||||
|
|
||||||
std::vector<RimGridView*> masterCandidates;
|
std::vector<RimGridView*> masterCandidates = linkableViews;
|
||||||
for ( RimGridView* view : views )
|
|
||||||
{
|
|
||||||
if ( dynamic_cast<RimEclipseContourMapView*>( view ) == nullptr )
|
|
||||||
{
|
|
||||||
masterCandidates.push_back( view );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !viewLinker )
|
if ( !viewLinker )
|
||||||
{
|
{
|
||||||
// Create a new view linker
|
// Create a new view linker
|
||||||
|
|
||||||
if ( views.size() < 2 )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CVF_ASSERT( !masterCandidates.empty() );
|
|
||||||
|
|
||||||
RimGridView* masterView = masterCandidates.front();
|
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;
|
viewLinker = new RimViewLinker;
|
||||||
|
|
||||||
proj->viewLinkerCollection()->viewLinker = viewLinker;
|
proj->viewLinkerCollection()->viewLinker = viewLinker;
|
||||||
viewLinker->setMasterView( masterView );
|
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;
|
if ( rimView == viewLinker->masterView() ) continue;
|
||||||
|
|
||||||
viewLinker->addDependentView( rimView );
|
viewLinker->addDependentView( rimView );
|
||||||
|
@ -43,6 +43,6 @@ protected:
|
|||||||
void setupActionLook( QAction* actionToSetup ) override;
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void findNotLinkedVisibleViews( std::vector<RimGridView*>& views );
|
void findLinkableVisibleViews( std::vector<RimGridView*>& views );
|
||||||
void allLinkedViews( std::vector<RimGridView*>& views );
|
void allLinkedViews( std::vector<RimGridView*>& views );
|
||||||
};
|
};
|
||||||
|
@ -34,9 +34,9 @@ CAF_PDM_SOURCE_INIT( RicLinkVisibleViewsFeatureUi, "RicLinkVisibleViewsFeatureUi
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RicLinkVisibleViewsFeatureUi::RicLinkVisibleViewsFeatureUi( void )
|
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 "Riu3DMainWindowTools.h"
|
||||||
|
|
||||||
|
#include "RimGeoMechContourMapView.h"
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
@ -42,23 +43,13 @@ bool RicSetMasterViewFeature::isCommandEnabled()
|
|||||||
{
|
{
|
||||||
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||||
if ( !activeView ) return false;
|
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();
|
RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
|
||||||
if ( viewLinker && viewLinker->masterView() == activeView )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !proj->viewLinkerCollection()->viewLinker() )
|
if ( !viewLinker ) return false;
|
||||||
{
|
if ( viewLinker->masterView() == activeView ) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( dynamic_cast<RimEclipseContourMapView*>( activeView ) != nullptr )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -96,5 +87,6 @@ void RicSetMasterViewFeature::onActionTriggered( bool isChecked )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicSetMasterViewFeature::setupActionLook( QAction* actionToSetup )
|
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 )
|
void RicShowLinkOptionsFeature::setupActionLook( QAction* actionToSetup )
|
||||||
{
|
{
|
||||||
actionToSetup->setText( "Show Link Options" );
|
actionToSetup->setText( "Show Linked View Options" );
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include "RimViewLinkerCollection.h"
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicUnLinkViewFeature, "RicUnLinkViewFeature" );
|
CAF_CMD_SOURCE_INIT( RicUnLinkViewFeature, "RicUnLinkViewFeature" );
|
||||||
|
|
||||||
@ -43,9 +44,7 @@ bool RicUnLinkViewFeature::isCommandEnabled()
|
|||||||
;
|
;
|
||||||
if ( !activeView ) return false;
|
if ( !activeView ) return false;
|
||||||
|
|
||||||
RimViewController* viewController = activeView->viewController();
|
if ( activeView->assosiatedViewLinker() )
|
||||||
|
|
||||||
if ( viewController )
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -63,16 +62,39 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
|
|||||||
if ( !activeView ) return;
|
if ( !activeView ) return;
|
||||||
|
|
||||||
RimViewController* viewController = activeView->viewController();
|
RimViewController* viewController = activeView->viewController();
|
||||||
viewController->applyRangeFilterCollectionByUserChoice();
|
RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
|
||||||
|
|
||||||
caf::SelectionManager::instance()->setSelectedItem( viewController );
|
if ( viewController )
|
||||||
caf::CmdFeature* feature = caf::CmdFeatureManager::instance()->getCommandFeature( "RicDeleteItemFeature" );
|
|
||||||
if ( feature )
|
|
||||||
{
|
{
|
||||||
feature->action()->trigger();
|
viewController->applyRangeFilterCollectionByUserChoice();
|
||||||
|
delete viewController;
|
||||||
return;
|
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 )
|
void RicUnLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
||||||
{
|
{
|
||||||
actionToSetup->setText( "Unlink View" );
|
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 )
|
Rim3dView::Rim3dView( void )
|
||||||
|
: m_isCallingUpdateTimestepAndRedraw( false )
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
RiaPreferences* preferences = app->preferences();
|
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_showZScaleLabel, "ShowZScale", true, "Show Z Scale Label", "", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_isComparisonViewEnabled, "EnableComparisonView", false, "Enable", "", "", "" );
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_comparisonView, "ComparisonView", "Comparison View", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_comparisonView, "ComparisonView", "Comparison View", "", "", "" );
|
||||||
|
|
||||||
m_crossSectionVizModel = new cvf::ModelBasicList;
|
m_crossSectionVizModel = new cvf::ModelBasicList;
|
||||||
@ -291,7 +291,8 @@ void Rim3dView::updateMdiWindowTitle()
|
|||||||
{
|
{
|
||||||
if ( m_viewer )
|
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( &m_showGridBox );
|
||||||
viewGroup->add( &isPerspectiveView );
|
viewGroup->add( &isPerspectiveView );
|
||||||
viewGroup->add( &m_disableLighting );
|
viewGroup->add( &m_disableLighting );
|
||||||
|
viewGroup->add( &m_comparisonView );
|
||||||
|
|
||||||
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Grid Appearance" );
|
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Grid Appearance" );
|
||||||
gridGroup->add( &scaleZ );
|
gridGroup->add( &scaleZ );
|
||||||
@ -329,10 +331,6 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr
|
|||||||
gridGroup->add( &meshMode );
|
gridGroup->add( &meshMode );
|
||||||
gridGroup->add( &surfaceMode );
|
gridGroup->add( &surfaceMode );
|
||||||
|
|
||||||
caf::PdmUiGroup* compViewGroup = uiOrdering.addNewGroup( "Comparison View" );
|
|
||||||
compViewGroup->add( &m_isComparisonViewEnabled );
|
|
||||||
compViewGroup->add( &m_comparisonView );
|
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields( true );
|
uiOrdering.skipRemainingFields( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,6 +410,15 @@ bool Rim3dView::isScaleZEditable()
|
|||||||
( this->viewController() && this->viewController()->isCameraLinked() ) );
|
( 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()
|
void Rim3dView::updateCurrentTimeStepAndRedraw()
|
||||||
{
|
{
|
||||||
|
if ( m_isCallingUpdateTimestepAndRedraw ) return;
|
||||||
|
|
||||||
if ( nativeOrOverrideViewer() )
|
if ( nativeOrOverrideViewer() )
|
||||||
{
|
{
|
||||||
this->updateCurrentTimeStep();
|
this->updateCurrentTimeStep();
|
||||||
@ -498,6 +507,8 @@ void Rim3dView::updateCurrentTimeStepAndRedraw()
|
|||||||
nativeOrOverrideViewer()->update();
|
nativeOrOverrideViewer()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_isCallingUpdateTimestepAndRedraw = true;
|
||||||
|
|
||||||
std::set<Rim3dView*> containerViews = this->viewsUsingThisAsComparisonView();
|
std::set<Rim3dView*> containerViews = this->viewsUsingThisAsComparisonView();
|
||||||
if ( !containerViews.empty() && !isUsingOverrideViewer() )
|
if ( !containerViews.empty() && !isUsingOverrideViewer() )
|
||||||
{
|
{
|
||||||
@ -506,6 +517,7 @@ void Rim3dView::updateCurrentTimeStepAndRedraw()
|
|||||||
view->updateCurrentTimeStepAndRedraw();
|
view->updateCurrentTimeStepAndRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_isCallingUpdateTimestepAndRedraw = false;
|
||||||
|
|
||||||
RimProject* project;
|
RimProject* project;
|
||||||
firstAncestorOrThisOfTypeAsserted( project );
|
firstAncestorOrThisOfTypeAsserted( project );
|
||||||
@ -806,18 +818,10 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
m_viewer->showZScaleLabel( m_showZScaleLabel() );
|
m_viewer->showZScaleLabel( m_showZScaleLabel() );
|
||||||
m_viewer->update();
|
m_viewer->update();
|
||||||
}
|
}
|
||||||
else if ( changedField == &m_isComparisonViewEnabled )
|
|
||||||
{
|
|
||||||
createDisplayModelAndRedraw();
|
|
||||||
}
|
|
||||||
else if ( changedField == &m_comparisonView )
|
else if ( changedField == &m_comparisonView )
|
||||||
{
|
|
||||||
if ( m_isComparisonViewEnabled() )
|
|
||||||
{
|
{
|
||||||
createDisplayModelAndRedraw();
|
createDisplayModelAndRedraw();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -974,9 +978,12 @@ void Rim3dView::updateAnnotationItems()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void Rim3dView::setScaleZAndUpdate( double scalingFactor )
|
void Rim3dView::setScaleZAndUpdate( double scalingFactor )
|
||||||
{
|
{
|
||||||
|
if ( this->scaleZ != scalingFactor )
|
||||||
|
{
|
||||||
this->scaleZ = scalingFactor;
|
this->scaleZ = scalingFactor;
|
||||||
|
|
||||||
updateScaling();
|
updateScaling();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1001,9 +1008,9 @@ void Rim3dView::updateScaling()
|
|||||||
viewer()->setPointOfInterest( poi );
|
viewer()->setPointOfInterest( poi );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeComparisonView())
|
if ( activeComparisonView() )
|
||||||
{
|
{
|
||||||
activeComparisonView()->setScaleZAndUpdate(scaleZ);
|
activeComparisonView()->setScaleZAndUpdate( scaleZ );
|
||||||
}
|
}
|
||||||
|
|
||||||
updateScaleTransform();
|
updateScaleTransform();
|
||||||
@ -1403,14 +1410,7 @@ void Rim3dView::appendMeasurementToModel()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
Rim3dView* Rim3dView::activeComparisonView() const
|
Rim3dView* Rim3dView::activeComparisonView() const
|
||||||
{
|
{
|
||||||
if ( m_isComparisonViewEnabled() )
|
|
||||||
{
|
|
||||||
return m_comparisonView();
|
return m_comparisonView();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1430,7 +1430,6 @@ Rim3dView* Rim3dView::prepareComparisonView()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( depView->scaleZ() != scaleZ() )
|
if ( depView->scaleZ() != scaleZ() )
|
||||||
{
|
{
|
||||||
depView->setScaleZAndUpdate( scaleZ() );
|
depView->setScaleZAndUpdate( scaleZ() );
|
||||||
@ -1452,6 +1451,5 @@ void Rim3dView::restoreComparisonView()
|
|||||||
CVF_ASSERT( depView );
|
CVF_ASSERT( depView );
|
||||||
|
|
||||||
depView->setOverrideViewer( nullptr );
|
depView->setOverrideViewer( nullptr );
|
||||||
viewer()->setCurrentComparisonFrame(depView->currentTimeStep());
|
viewer()->setCurrentComparisonFrame( depView->currentTimeStep() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,7 @@ public:
|
|||||||
bool isMasterView() const;
|
bool isMasterView() const;
|
||||||
Rim3dView* activeComparisonView() const;
|
Rim3dView* activeComparisonView() const;
|
||||||
bool isScaleZEditable();
|
bool isScaleZEditable();
|
||||||
|
void setComparisonView(Rim3dView* compView);
|
||||||
|
|
||||||
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
|
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
|
||||||
|
|
||||||
@ -310,6 +311,7 @@ private:
|
|||||||
QPointer<RiuViewer> m_overrideViewer;
|
QPointer<RiuViewer> m_overrideViewer;
|
||||||
int m_comparisonViewOrgTimestep;
|
int m_comparisonViewOrgTimestep;
|
||||||
double m_comparisonViewOrgZScale;
|
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::PdmField<QString> m_name_OBSOLETE;
|
||||||
caf::PdmChildField<RimViewNameConfig*> m_nameConfig;
|
caf::PdmChildField<RimViewNameConfig*> m_nameConfig;
|
||||||
@ -319,6 +321,5 @@ private:
|
|||||||
caf::PdmField<cvf::Color3f> m_backgroundColor;
|
caf::PdmField<cvf::Color3f> m_backgroundColor;
|
||||||
caf::PdmField<bool> m_showGridBox;
|
caf::PdmField<bool> m_showGridBox;
|
||||||
caf::PdmField<bool> m_showZScaleLabel;
|
caf::PdmField<bool> m_showZScaleLabel;
|
||||||
caf::PdmField<bool> m_isComparisonViewEnabled;
|
|
||||||
caf::PdmPtrField<Rim3dView*> m_comparisonView;
|
caf::PdmPtrField<Rim3dView*> m_comparisonView;
|
||||||
};
|
};
|
||||||
|
@ -86,6 +86,9 @@ RimGridView::~RimGridView( void )
|
|||||||
|
|
||||||
if ( proj && this->isMasterView() )
|
if ( proj && this->isMasterView() )
|
||||||
{
|
{
|
||||||
|
RimViewLinker* viewLinker = this->assosiatedViewLinker();
|
||||||
|
viewLinker->setMasterView(nullptr);
|
||||||
|
|
||||||
delete proj->viewLinkerCollection->viewLinker();
|
delete proj->viewLinkerCollection->viewLinker();
|
||||||
proj->viewLinkerCollection->viewLinker = nullptr;
|
proj->viewLinkerCollection->viewLinker = nullptr;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ RimProject::RimProject( void )
|
|||||||
CAF_PDM_InitFieldNoDefault( &viewLinkerCollection,
|
CAF_PDM_InitFieldNoDefault( &viewLinkerCollection,
|
||||||
"LinkedViews",
|
"LinkedViews",
|
||||||
"Linked Views (field in RimProject",
|
"Linked Views (field in RimProject",
|
||||||
":/chain.png",
|
":/LinkView16x16.png",
|
||||||
"",
|
"",
|
||||||
"" );
|
"" );
|
||||||
viewLinkerCollection.uiCapability()->setUiHidden( true );
|
viewLinkerCollection.uiCapability()->setUiHidden( true );
|
||||||
|
@ -95,6 +95,10 @@ RimViewController::RimViewController()
|
|||||||
RimViewController::~RimViewController()
|
RimViewController::~RimViewController()
|
||||||
{
|
{
|
||||||
this->removeOverrides();
|
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 );
|
RimGridView* previousManagedView = dynamic_cast<RimGridView*>( prevValue );
|
||||||
RimViewController::removeOverrides( previousManagedView );
|
RimViewController::removeOverrides( previousManagedView );
|
||||||
|
|
||||||
|
ownerViewLinker()->notifyManagedViewChange(previousManagedView, m_managedView());
|
||||||
|
|
||||||
setManagedView( m_managedView() );
|
setManagedView( m_managedView() );
|
||||||
|
|
||||||
m_name.uiCapability()->updateConnectedEditors();
|
m_name.uiCapability()->updateConnectedEditors();
|
||||||
@ -469,6 +475,11 @@ RimGridView* RimViewController::managedView() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimViewController::setManagedView( RimGridView* view )
|
void RimViewController::setManagedView( RimGridView* view )
|
||||||
{
|
{
|
||||||
|
if (m_managedView != view)
|
||||||
|
{
|
||||||
|
ownerViewLinker()->notifyManagedViewChange(m_managedView(), view);
|
||||||
|
}
|
||||||
|
|
||||||
m_managedView = view;
|
m_managedView = view;
|
||||||
|
|
||||||
updateOptionSensitivity();
|
updateOptionSensitivity();
|
||||||
@ -478,6 +489,7 @@ void RimViewController::setManagedView( RimGridView* view )
|
|||||||
updateCameraLink();
|
updateCameraLink();
|
||||||
updateDisplayNameAndIcon();
|
updateDisplayNameAndIcon();
|
||||||
updateTimeStepLink();
|
updateTimeStepLink();
|
||||||
|
m_managedView->updateHolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -949,7 +961,7 @@ bool RimViewController::isRangeFiltersControlled() const
|
|||||||
{
|
{
|
||||||
if ( !isRangeFilterControlPossible() ) return false;
|
if ( !isRangeFilterControlPossible() ) return false;
|
||||||
|
|
||||||
if ( ownerViewLinker()->isActive() && this->m_isActive() )
|
if (ownerViewLinker() && ownerViewLinker()->isActive() && this->m_isActive() )
|
||||||
{
|
{
|
||||||
return m_syncRangeFilters;
|
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 );
|
questionText = QString( "The range filters in the view \"%1\" are about to be unlinked." ).arg( viewName );
|
||||||
|
|
||||||
msgBox.setText( questionText );
|
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 );
|
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No );
|
||||||
|
|
||||||
int ret = msgBox.exec();
|
int ret = msgBox.exec();
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
#include "RiuViewer.h"
|
#include "RiuViewer.h"
|
||||||
|
|
||||||
|
#include "RiaOptionItemFactory.h"
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cafQIconProvider.h"
|
#include "cafQIconProvider.h"
|
||||||
#include "cvfCamera.h"
|
#include "cvfCamera.h"
|
||||||
@ -70,6 +71,10 @@ RimViewLinker::RimViewLinker()
|
|||||||
CAF_PDM_InitFieldNoDefault(&m_viewControllers, "ManagedViews", "Managed Views", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_viewControllers, "ManagedViews", "Managed Views", "", "", "");
|
||||||
m_viewControllers.uiCapability()->setUiHidden(true);
|
m_viewControllers.uiCapability()->setUiHidden(true);
|
||||||
m_viewControllers.uiCapability()->setUiTreeChildrenHidden(true);
|
m_viewControllers.uiCapability()->setUiTreeChildrenHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_comparisonView, "LinkedComparisonView", "Comparison View", "", "", "");
|
||||||
|
m_comparisonView.xmlCapability()->disableIO();
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +86,9 @@ RimViewLinker::~RimViewLinker()
|
|||||||
removeOverrides();
|
removeOverrides();
|
||||||
|
|
||||||
m_viewControllers.deleteAllChildObjects();
|
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()
|
void RimViewLinker::updateDependentViews()
|
||||||
{
|
{
|
||||||
|
if (m_viewControllers.empty()) return;
|
||||||
|
|
||||||
updateOverrides();
|
updateOverrides();
|
||||||
updateCellResult();
|
updateCellResult();
|
||||||
updateScaleZ( m_masterView, m_masterView->scaleZ() );
|
updateScaleZ( m_masterView, m_masterView->scaleZ() );
|
||||||
@ -297,7 +307,8 @@ QString RimViewLinker::displayNameForView( RimGridView* view )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimViewLinker::setMasterView( 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
|
// Remove the view as dependent view
|
||||||
if ( previousViewController )
|
if ( previousViewController )
|
||||||
@ -343,6 +354,10 @@ void RimViewLinker::allViews( std::vector<RimGridView*>& views ) const
|
|||||||
void RimViewLinker::initAfterRead()
|
void RimViewLinker::initAfterRead()
|
||||||
{
|
{
|
||||||
updateUiNameAndIcon();
|
updateUiNameAndIcon();
|
||||||
|
if ( m_masterView() )
|
||||||
|
{
|
||||||
|
m_comparisonView = dynamic_cast<RimGridView*>( m_masterView->activeComparisonView() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -399,6 +414,9 @@ void RimViewLinker::updateUiNameAndIcon()
|
|||||||
{
|
{
|
||||||
caf::QIconProvider iconProvider;
|
caf::QIconProvider iconProvider;
|
||||||
RimViewLinker::findNameAndIconFromView( &m_name.v(), &iconProvider, m_masterView );
|
RimViewLinker::findNameAndIconFromView( &m_name.v(), &iconProvider, m_masterView );
|
||||||
|
|
||||||
|
if (m_masterView) m_masterView->updateHolder();
|
||||||
|
|
||||||
setUiIcon( iconProvider );
|
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,10 +613,13 @@ void RimViewLinker::addDependentView( RimGridView* view )
|
|||||||
{
|
{
|
||||||
CVF_ASSERT( view && view != m_masterView );
|
CVF_ASSERT( view && view != m_masterView );
|
||||||
|
|
||||||
|
if ( !view->viewController() )
|
||||||
|
{
|
||||||
RimViewController* viewContr = new RimViewController;
|
RimViewController* viewContr = new RimViewController;
|
||||||
this->m_viewControllers.push_back( viewContr );
|
this->m_viewControllers.push_back( viewContr );
|
||||||
|
|
||||||
viewContr->setManagedView( view );
|
viewContr->setManagedView( view );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -535,7 +644,7 @@ void RimViewLinker::addViewControllers( caf::PdmUiTreeOrdering& uiTreeOrdering )
|
|||||||
{
|
{
|
||||||
for ( const auto& viewController : m_viewControllers )
|
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 );
|
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;
|
bool isFirstViewDependentOnSecondView( const RimGridView* firstView, const RimGridView* secondView ) const;
|
||||||
void updateDependentViews();
|
void updateDependentViews();
|
||||||
void removeViewController( RimViewController* viewController );
|
void removeViewController( RimViewController* viewController );
|
||||||
|
RimGridView* firstControlledView();
|
||||||
|
|
||||||
void updateOverrides();
|
void updateOverrides();
|
||||||
|
|
||||||
@ -91,12 +92,24 @@ public:
|
|||||||
|
|
||||||
void updateCursorPosition( const RimGridView* sourceView, const cvf::Vec3d& domainCoord );
|
void updateCursorPosition( const RimGridView* sourceView, const cvf::Vec3d& domainCoord );
|
||||||
|
|
||||||
|
void notifyManagedViewChange(RimGridView* oldManagedView, RimGridView* newManagedView);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
caf::PdmFieldHandle* userDescriptionField() override
|
caf::PdmFieldHandle* userDescriptionField() override
|
||||||
{
|
{
|
||||||
return &m_name;
|
return &m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initAfterRead() override;
|
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:
|
private:
|
||||||
static QString displayNameForView( RimGridView* view );
|
static QString displayNameForView( RimGridView* view );
|
||||||
@ -109,4 +122,5 @@ private:
|
|||||||
caf::PdmChildArrayField<RimViewController*> m_viewControllers;
|
caf::PdmChildArrayField<RimViewController*> m_viewControllers;
|
||||||
caf::PdmPtrField<RimGridView*> m_masterView;
|
caf::PdmPtrField<RimGridView*> m_masterView;
|
||||||
caf::PdmField<QString> m_name;
|
caf::PdmField<QString> m_name;
|
||||||
|
caf::PdmPtrField<RimGridView*> m_comparisonView;
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimViewLinkerCollection, "RimViewLinkerCollection" );
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimViewLinkerCollection::RimViewLinkerCollection( void )
|
RimViewLinkerCollection::RimViewLinkerCollection( void )
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Linked Views", ":/chain.png", "", "" );
|
CAF_PDM_InitObject( "Linked Views", ":/LinkView16x16.png", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" );
|
CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" );
|
||||||
isActive.uiCapability()->setUiHidden( true );
|
isActive.uiCapability()->setUiHidden( true );
|
||||||
|
@ -53,8 +53,13 @@ void RimViewManipulator::applySourceViewCameraOnDestinationViews( RimGridView*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Source bounding box in global coordinates including scaleZ
|
// 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;
|
cvf::Vec3d offset = cvf::Vec3d::ZERO;
|
||||||
RimCase* sourceOwnerCase = sourceView->ownerCase();
|
RimCase* sourceOwnerCase = sourceView->ownerCase();
|
||||||
if ( sourceOwnerCase )
|
if ( sourceOwnerCase )
|
||||||
@ -68,8 +73,8 @@ void RimViewManipulator::applySourceViewCameraOnDestinationViews( RimGridView*
|
|||||||
if ( setPointOfInterest ) sourcePointOfInterest += offset;
|
if ( setPointOfInterest ) sourcePointOfInterest += offset;
|
||||||
|
|
||||||
cvf::Mat4d trans;
|
cvf::Mat4d trans;
|
||||||
trans.setTranslation( offset );
|
trans.setTranslation(offset);
|
||||||
sourceSceneBB.transform( trans );
|
sourceSceneBB.transform(trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( RimGridView* destinationView : destinationViews )
|
for ( RimGridView* destinationView : destinationViews )
|
||||||
@ -84,7 +89,12 @@ void RimViewManipulator::applySourceViewCameraOnDestinationViews( RimGridView*
|
|||||||
destinationViewer->enableParallelProjection( !sourceView->isPerspectiveView );
|
destinationViewer->enableParallelProjection( !sourceView->isPerspectiveView );
|
||||||
|
|
||||||
// Destination bounding box in global coordinates including scaleZ
|
// 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 destinationCamEye = sourceCamGlobalEye;
|
||||||
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint;
|
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint;
|
||||||
cvf::Vec3d offset = cvf::Vec3d::ZERO;
|
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>GeoMechCasePropTable24x24.png</file>
|
||||||
<file>GeoMechCases48x48.png</file>
|
<file>GeoMechCases48x48.png</file>
|
||||||
<file>chain.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>TileWindows24x24.png</file>
|
||||||
<file>Window16x16.png</file>
|
<file>Window16x16.png</file>
|
||||||
<file>LasFile16x16.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 "RigMainGrid.h"
|
||||||
#include "RigVirtualPerforationTransmissibilities.h"
|
#include "RigVirtualPerforationTransmissibilities.h"
|
||||||
|
|
||||||
|
#include "RiaOptionItemFactory.h"
|
||||||
#include "Rim2dIntersectionView.h"
|
#include "Rim2dIntersectionView.h"
|
||||||
#include "RimCellEdgeColors.h"
|
#include "RimCellEdgeColors.h"
|
||||||
#include "RimContextCommandBuilder.h"
|
#include "RimContextCommandBuilder.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
|
#include "RimEclipseContourMapView.h"
|
||||||
#include "RimEclipseFaultColors.h"
|
#include "RimEclipseFaultColors.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimEllipseFractureTemplate.h"
|
#include "RimEllipseFractureTemplate.h"
|
||||||
@ -53,11 +55,13 @@
|
|||||||
#include "RimFracture.h"
|
#include "RimFracture.h"
|
||||||
#include "RimGeoMechCase.h"
|
#include "RimGeoMechCase.h"
|
||||||
#include "RimGeoMechCellColors.h"
|
#include "RimGeoMechCellColors.h"
|
||||||
|
#include "RimGeoMechContourMapView.h"
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RimIntersection.h"
|
#include "RimIntersection.h"
|
||||||
#include "RimIntersectionBox.h"
|
#include "RimIntersectionBox.h"
|
||||||
#include "RimLegendConfig.h"
|
#include "RimLegendConfig.h"
|
||||||
#include "RimPerforationInterval.h"
|
#include "RimPerforationInterval.h"
|
||||||
|
#include "RimProject.h"
|
||||||
#include "RimSimWellInView.h"
|
#include "RimSimWellInView.h"
|
||||||
#include "RimStimPlanFractureTemplate.h"
|
#include "RimStimPlanFractureTemplate.h"
|
||||||
#include "RimTextAnnotation.h"
|
#include "RimTextAnnotation.h"
|
||||||
@ -148,6 +152,41 @@ void RiuViewerCommands::setOwnerView( Rim3dView* owner )
|
|||||||
m_reservoirView = 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 << "RicLinkViewFeature";
|
||||||
menuBuilder << "RicShowLinkOptionsFeature";
|
menuBuilder << "RicShowLinkOptionsFeature";
|
||||||
menuBuilder << "RicSetMasterViewFeature";
|
menuBuilder << "RicSetMasterViewFeature";
|
||||||
|
addCompareToViewMenu( &menuBuilder );
|
||||||
|
menuBuilder.addSeparator();
|
||||||
menuBuilder << "RicUnLinkViewFeature";
|
menuBuilder << "RicUnLinkViewFeature";
|
||||||
|
menuBuilder << "RicRemoveComparison3dViewFeature";
|
||||||
}
|
}
|
||||||
else if ( int2dView )
|
else if ( int2dView )
|
||||||
{
|
{
|
||||||
@ -1312,17 +1354,20 @@ void RiuViewerCommands::handleTextPicking( int winPosX, int winPosY, cvf::HitIte
|
|||||||
|
|
||||||
ref<Ray> ray = m_viewer->mainCamera()->rayFromWindowCoordinates( translatedMousePosX, translatedMousePosY );
|
ref<Ray> ray = m_viewer->mainCamera()->rayFromWindowCoordinates( translatedMousePosX, translatedMousePosY );
|
||||||
|
|
||||||
|
if ( ray.notNull() )
|
||||||
|
{
|
||||||
for ( size_t pIdx = 0; pIdx < partCollection.size(); ++pIdx )
|
for ( size_t pIdx = 0; pIdx < partCollection.size(); ++pIdx )
|
||||||
{
|
{
|
||||||
DrawableText* textDrawable = dynamic_cast<DrawableText*>( partCollection[pIdx]->drawable() );
|
DrawableText* textDrawable = dynamic_cast<DrawableText*>(partCollection[pIdx]->drawable());
|
||||||
if ( textDrawable )
|
if ( textDrawable )
|
||||||
{
|
{
|
||||||
cvf::Vec3d ppoint;
|
cvf::Vec3d ppoint;
|
||||||
if ( textDrawable->rayIntersect( *ray, *( m_viewer->mainCamera() ), &ppoint ) )
|
if ( textDrawable->rayIntersect(*ray, *(m_viewer->mainCamera()), &ppoint) )
|
||||||
{
|
{
|
||||||
cvf::ref<HitItem> hitItem = new HitItem( 0, ppoint );
|
cvf::ref<HitItem> hitItem = new HitItem(0, ppoint);
|
||||||
hitItem->setPart( partCollection[pIdx].p() );
|
hitItem->setPart(partCollection[pIdx].p());
|
||||||
hitItems->add( hitItem.p() );
|
hitItems->add(hitItem.p());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ class QMouseEvent;
|
|||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
class PdmObject;
|
class PdmObject;
|
||||||
}
|
class CmdFeatureMenuBuilder;
|
||||||
|
} // namespace caf
|
||||||
|
|
||||||
namespace cvf
|
namespace cvf
|
||||||
{
|
{
|
||||||
@ -89,6 +90,8 @@ private:
|
|||||||
|
|
||||||
bool handleOverlayItemPicking( int winPosX, int winPosY );
|
bool handleOverlayItemPicking( int winPosX, int winPosY );
|
||||||
|
|
||||||
|
void addCompareToViewMenu( caf::CmdFeatureMenuBuilder* menuBuilder );
|
||||||
|
|
||||||
static void addDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
|
static void addDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
|
||||||
static void removeDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
|
static void removeDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
|
||||||
|
|
||||||
|