mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Rename ApplicationCode to ApplicationLibCode
This commit is contained in:
36
ApplicationLibCode/Commands/ViewLink/CMakeLists_files.cmake
Normal file
36
ApplicationLibCode/Commands/ViewLink/CMakeLists_files.cmake
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicLinkVisibleViewsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicLinkVisibleViewsFeatureUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowAllLinkedViewsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicLinkViewFeature.h
|
||||
${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
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicLinkVisibleViewsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicLinkVisibleViewsFeatureUi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowAllLinkedViewsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicLinkViewFeature.cpp
|
||||
${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 COMMAND_CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\ViewLink" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "Rim3dOverlayInfoConfig.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();
|
||||
activeView->overlayInfoConfig()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCompareTo3dViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
QVariant userData = actionToSetup->data();
|
||||
|
||||
auto view = static_cast<Rim3dView*>( userData.value<void*>() );
|
||||
if ( view )
|
||||
{
|
||||
auto icon = view->uiIconProvider().icon();
|
||||
if ( icon ) actionToSetup->setIcon( *icon );
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::IconProvider iconProvider( ":/ComparisonView16x16.png" );
|
||||
auto icon = iconProvider.icon();
|
||||
if ( icon ) actionToSetup->setIcon( *icon );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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;
|
||||
};
|
||||
@@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicDeleteAllLinkedViewsFeature.h"
|
||||
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteAllLinkedViewsFeature, "RicDeleteAllLinkedViewsFeature" );
|
||||
|
||||
class DeleteAllLinkedViewsImpl
|
||||
{
|
||||
public:
|
||||
static void execute()
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
|
||||
RimViewLinker* viewLinker = proj->viewLinkerCollection()->viewLinker();
|
||||
if ( viewLinker )
|
||||
{
|
||||
// Remove the view linker object from the view linker collection
|
||||
// viewLinkerCollection->viewLinker is a PdmChildField containing one RimViewLinker child object
|
||||
proj->viewLinkerCollection->viewLinker.removeChildObject( viewLinker );
|
||||
|
||||
viewLinker->applyRangeFilterCollectionByUserChoice();
|
||||
|
||||
delete viewLinker;
|
||||
|
||||
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( "Unlink All Views" );
|
||||
actionToSetup->setIcon( QIcon( ":/UnLinkView.svg" ) );
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicDeleteAllLinkedViewsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
155
ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.cpp
Normal file
155
ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicLinkViewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicLinkVisibleViewsFeature.h"
|
||||
|
||||
#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()
|
||||
{
|
||||
RicLinkViewFeatureImpl cmdImpl;
|
||||
return cmdImpl.prepareToExecute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RicLinkViewFeatureImpl cmdImpl;
|
||||
if ( cmdImpl.prepareToExecute() )
|
||||
{
|
||||
cmdImpl.execute();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
RicLinkViewFeatureImpl cmdImpl;
|
||||
cmdImpl.prepareToExecute();
|
||||
|
||||
if ( cmdImpl.viewsToLink().size() >= 2u )
|
||||
{
|
||||
actionToSetup->setText( "Link Selected Views" );
|
||||
actionToSetup->setIcon( QIcon( ":/LinkView.svg" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setText( "Link View" );
|
||||
if ( RimProject::current()->viewLinkerCollection()->viewLinker() )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/ControlledView16x16.png" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/MasterView16x16.png" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
38
ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.h
Normal file
38
ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicLinkViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,171 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicLinkVisibleViewsFeature.h"
|
||||
|
||||
#include "RicLinkVisibleViewsFeatureUi.h"
|
||||
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include <QAction>
|
||||
#include <QTreeView>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicLinkVisibleViewsFeature, "RicLinkVisibleViewsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicLinkVisibleViewsFeature::isCommandEnabled()
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( !proj ) return false;
|
||||
|
||||
std::vector<Rim3dView*> visibleViews;
|
||||
std::vector<RimGridView*> linkedviews;
|
||||
std::vector<RimGridView*> visibleGridViews;
|
||||
|
||||
proj->allVisibleViews( visibleViews );
|
||||
for ( Rim3dView* view : visibleViews )
|
||||
{
|
||||
RimGridView* gridView = dynamic_cast<RimGridView*>( view );
|
||||
if ( gridView ) visibleGridViews.push_back( gridView );
|
||||
}
|
||||
|
||||
if ( proj->viewLinkerCollection() && proj->viewLinkerCollection()->viewLinker() )
|
||||
{
|
||||
proj->viewLinkerCollection()->viewLinker()->allViews( linkedviews );
|
||||
}
|
||||
|
||||
if ( visibleGridViews.size() >= 2 && ( linkedviews.size() < visibleGridViews.size() ) )
|
||||
{
|
||||
std::vector<RimGridView*> views;
|
||||
findLinkableVisibleViews( views );
|
||||
RicLinkVisibleViewsFeatureUi testUi;
|
||||
testUi.setViews( views );
|
||||
return !testUi.masterViewCandidates().empty();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimGridView*> linkableViews;
|
||||
findLinkableVisibleViews( linkableViews );
|
||||
|
||||
linkViews( linkableViews );
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Link Visible Views" );
|
||||
actionToSetup->setIcon( QIcon( ":/LinkView.svg" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeature::allLinkedViews( std::vector<RimGridView*>& views )
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj->viewLinkerCollection()->viewLinker() )
|
||||
{
|
||||
proj->viewLinkerCollection()->viewLinker()->allViews( views );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeature::findLinkableVisibleViews( std::vector<RimGridView*>& views )
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
|
||||
std::vector<RimGridView*> alreadyLinkedViews;
|
||||
allLinkedViews( alreadyLinkedViews );
|
||||
|
||||
std::vector<RimGridView*> visibleGridViews;
|
||||
proj->allVisibleGridViews( visibleGridViews );
|
||||
|
||||
for ( auto gridView : visibleGridViews )
|
||||
{
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( gridView ) ) continue;
|
||||
if ( dynamic_cast<RimGeoMechContourMapView*>( gridView ) ) continue;
|
||||
if ( gridView->assosiatedViewLinker() ) continue;
|
||||
|
||||
views.push_back( gridView );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeature::linkViews( std::vector<RimGridView*>& linkableViews )
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker();
|
||||
|
||||
std::vector<RimGridView*> masterCandidates = linkableViews;
|
||||
|
||||
if ( !viewLinker )
|
||||
{
|
||||
// Create a new view linker
|
||||
|
||||
RimGridView* masterView = masterCandidates.front();
|
||||
|
||||
viewLinker = new RimViewLinker;
|
||||
|
||||
proj->viewLinkerCollection()->viewLinker = viewLinker;
|
||||
viewLinker->setMasterView( masterView );
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < linkableViews.size(); i++ )
|
||||
{
|
||||
RimGridView* rimView = linkableViews[i];
|
||||
if ( rimView == viewLinker->masterView() ) continue;
|
||||
|
||||
viewLinker->addDependentView( rimView );
|
||||
}
|
||||
|
||||
viewLinker->updateDependentViews();
|
||||
|
||||
viewLinker->updateUiNameAndIcon();
|
||||
|
||||
proj->viewLinkerCollection.uiCapability()->updateConnectedEditors();
|
||||
proj->updateConnectedEditors();
|
||||
|
||||
Riu3DMainWindowTools::setExpanded( proj->viewLinkerCollection() );
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicLinkVisibleViewsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void linkViews( std::vector<RimGridView*>& views );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
void findLinkableVisibleViews( std::vector<RimGridView*>& views );
|
||||
void allLinkedViews( std::vector<RimGridView*>& views );
|
||||
};
|
||||
@@ -0,0 +1,113 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicLinkVisibleViewsFeatureUi.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaOptionItemFactory.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicLinkVisibleViewsFeatureUi, "RicLinkVisibleViewsFeatureUi" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicLinkVisibleViewsFeatureUi::RicLinkVisibleViewsFeatureUi( void )
|
||||
{
|
||||
CAF_PDM_InitObject( "Link Visible Views Feature UI", ":/LinkView16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_masterView, "MasterView", "Primary View", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLinkVisibleViewsFeatureUi::setViews( const std::vector<RimGridView*>& allViews )
|
||||
{
|
||||
m_allViews = allViews;
|
||||
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
|
||||
std::vector<RimGridView*> masterCandidates = masterViewCandidates();
|
||||
|
||||
// Set Active view as master view if the active view isn't a contour map.
|
||||
for ( size_t i = 0; i < masterCandidates.size(); i++ )
|
||||
{
|
||||
if ( activeView == masterCandidates[i] )
|
||||
{
|
||||
m_masterView = allViews[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to use first view if no active view is present
|
||||
if ( !m_masterView && masterCandidates.size() > 0 )
|
||||
{
|
||||
m_masterView = masterCandidates[0];
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridView* RicLinkVisibleViewsFeatureUi::masterView()
|
||||
{
|
||||
return m_masterView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridView*> RicLinkVisibleViewsFeatureUi::masterViewCandidates() const
|
||||
{
|
||||
std::vector<RimGridView*> masterCandidates;
|
||||
// Set Active view as master view if the active view isn't a contour map.
|
||||
for ( size_t i = 0; i < m_allViews.size(); i++ )
|
||||
{
|
||||
RimEclipseContourMapView* contourMap = dynamic_cast<RimEclipseContourMapView*>( m_allViews[i] );
|
||||
if ( contourMap == nullptr )
|
||||
{
|
||||
masterCandidates.push_back( m_allViews[i] );
|
||||
}
|
||||
}
|
||||
return masterCandidates;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RicLinkVisibleViewsFeatureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_masterView )
|
||||
{
|
||||
for ( RimGridView* v : masterViewCandidates() )
|
||||
{
|
||||
RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName( v, &options );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicLinkVisibleViewsFeatureUi : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicLinkVisibleViewsFeatureUi( void );
|
||||
|
||||
void setViews( const std::vector<RimGridView*>& allViews );
|
||||
RimGridView* masterView();
|
||||
std::vector<RimGridView*> masterViewCandidates() const;
|
||||
|
||||
protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimGridView*> m_masterView;
|
||||
|
||||
std::vector<RimGridView*> m_allViews;
|
||||
};
|
||||
@@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "Rim3dOverlayInfoConfig.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimGridView.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() && m_activeView->viewer()->viewerCommands() &&
|
||||
m_activeView->viewer()->viewerCommands()->isCurrentPickInComparisonView() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void execute()
|
||||
{
|
||||
m_activeView->setComparisonView( nullptr );
|
||||
m_activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
auto gridView = dynamic_cast<RimGridView*>( m_activeView );
|
||||
if ( gridView ) gridView->overlayInfoConfig()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
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( "Stop Comparison" );
|
||||
actionToSetup->setIcon( QIcon( ":/RemoveComparisonView16x16.png" ) );
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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;
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicSetMasterViewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include <QAction>
|
||||
#include <QTreeView>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicSetMasterViewFeature, "RicSetMasterViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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;
|
||||
|
||||
RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
|
||||
|
||||
if ( !viewLinker ) return false;
|
||||
if ( viewLinker->masterView() == activeView ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSetMasterViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !activeView ) return;
|
||||
|
||||
RimProject* proj = RimProject::current();
|
||||
RimViewLinker* viewLinker = proj->viewLinkerCollection()->viewLinker();
|
||||
|
||||
viewLinker->applyRangeFilterCollectionByUserChoice();
|
||||
|
||||
RimGridView* previousMasterView = viewLinker->masterView();
|
||||
|
||||
viewLinker->setMasterView( activeView );
|
||||
viewLinker->updateDependentViews();
|
||||
|
||||
viewLinker->addDependentView( previousMasterView );
|
||||
|
||||
proj->viewLinkerCollection.uiCapability()->updateConnectedEditors();
|
||||
proj->updateConnectedEditors();
|
||||
|
||||
// Set managed view collection to selected and expanded in project tree
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( viewLinker );
|
||||
Riu3DMainWindowTools::setExpanded( viewLinker );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSetMasterViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Set As Primary Linked View" );
|
||||
actionToSetup->setIcon( QIcon( ":/MasterView16x16.png" ) );
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSetMasterViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicShowAllLinkedViewsFeature.h"
|
||||
|
||||
#include "RimGridView.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicShowAllLinkedViewsFeature, "RicShowAllLinkedViewsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowAllLinkedViewsFeature::isCommandEnabled()
|
||||
{
|
||||
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimViewLinkerCollection>() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimViewLinker*> linkedViews;
|
||||
caf::SelectionManager::instance()->objectsByType( &linkedViews );
|
||||
|
||||
std::vector<RimViewController*> managedViews;
|
||||
caf::SelectionManager::instance()->objectsByType( &managedViews );
|
||||
for ( size_t i = 0; i < managedViews.size(); i++ )
|
||||
{
|
||||
RimViewLinker* rimLinked = nullptr;
|
||||
managedViews[i]->firstAncestorOrThisOfType( rimLinked );
|
||||
CVF_ASSERT( rimLinked );
|
||||
|
||||
linkedViews.push_back( rimLinked );
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < linkedViews.size(); i++ )
|
||||
{
|
||||
std::vector<RimGridView*> views;
|
||||
linkedViews[i]->allViews( views );
|
||||
|
||||
for ( size_t j = 0; j < views.size(); j++ )
|
||||
{
|
||||
views[j]->forceShowWindowOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowAllLinkedViewsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Open All Linked Views" );
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicShowAllLinkedViewsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicShowLinkOptionsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicShowLinkOptionsFeature, "RicShowLinkOptionsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowLinkOptionsFeature::isCommandEnabled()
|
||||
{
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !activeView ) return false;
|
||||
|
||||
RimViewController* viewController = activeView->viewController();
|
||||
|
||||
if ( viewController )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowLinkOptionsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !activeView ) return;
|
||||
|
||||
RimViewController* viewController = activeView->viewController();
|
||||
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( viewController );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowLinkOptionsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Show Linked View Options" );
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicShowLinkOptionsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
108
ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp
Normal file
108
ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicUnLinkViewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicUnLinkViewFeature, "RicUnLinkViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicUnLinkViewFeature::isCommandEnabled()
|
||||
{
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
;
|
||||
if ( !activeView ) return false;
|
||||
|
||||
if ( activeView->assosiatedViewLinker() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
;
|
||||
if ( !activeView ) return;
|
||||
|
||||
RimViewController* viewController = activeView->viewController();
|
||||
RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
|
||||
|
||||
if ( viewController )
|
||||
{
|
||||
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
|
||||
RimProject::current()->viewLinkerCollection->viewLinker.removeChildObject( viewLinker );
|
||||
|
||||
delete viewLinker;
|
||||
}
|
||||
activeView->updateAutoName();
|
||||
}
|
||||
|
||||
RimProject::current()->viewLinkerCollection.uiCapability()->updateConnectedEditors();
|
||||
RimProject::current()->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicUnLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Unlink View" );
|
||||
actionToSetup->setIcon( QIcon( ":/UnLinkView.svg" ) );
|
||||
}
|
||||
38
ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.h
Normal file
38
ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicUnLinkViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
Reference in New Issue
Block a user