mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3540 Create seperate 2d view with parallel, look down and linked views
This commit is contained in:
@@ -13,6 +13,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewInViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewExec.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNew2dContourViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPropertyFilterNewExec.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterExecImpl.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertExec.h
|
||||
@@ -91,6 +92,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewInViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewExec.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNew2dContourViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterExecImpl.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertExec.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertFeature.cpp
|
||||
|
||||
99
ApplicationCode/Commands/RicNew2dContourViewFeature.cpp
Normal file
99
ApplicationCode/Commands/RicNew2dContourViewFeature.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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 "RicNew2dContourViewFeature.h"
|
||||
|
||||
#include "Rim2dEclipseView.h"
|
||||
#include "Rim2dEclipseViewCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "Rim3dView.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNew2dContourViewFeature, "RicNew2dContourViewFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNew2dContourViewFeature::isCommandEnabled()
|
||||
{
|
||||
bool selectedView = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>() != nullptr;
|
||||
bool selectedCase = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>() != nullptr;
|
||||
bool selectedMapCollection = caf::SelectionManager::instance()->selectedItemOfType<Rim2dEclipseViewCollection>();
|
||||
return selectedView || selectedCase || selectedMapCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNew2dContourViewFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimEclipseView* reservoirView = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>();
|
||||
RimEclipseCase* eclipseCase = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimEclipseCase>();
|
||||
Rim2dEclipseView* contourMap = nullptr;
|
||||
|
||||
// Find case to insert into
|
||||
if (reservoirView)
|
||||
{
|
||||
contourMap = eclipseCase->create2dContourMapFrom3dView(reservoirView);
|
||||
}
|
||||
else if (eclipseCase)
|
||||
{
|
||||
contourMap = eclipseCase->create2dContourMap();
|
||||
}
|
||||
|
||||
if (contourMap)
|
||||
{
|
||||
// Must be run before buildViewItems, as wells are created in this function
|
||||
contourMap->loadDataAndUpdate();
|
||||
|
||||
if (eclipseCase)
|
||||
{
|
||||
eclipseCase->updateConnectedEditors();
|
||||
}
|
||||
caf::SelectionManager::instance()->setSelectedItem(contourMap);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNew2dContourViewFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
Rim2dEclipseView* contourMap = caf::SelectionManager::instance()->selectedItemOfType<Rim2dEclipseView>();
|
||||
RimEclipseView* eclipseView = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>();
|
||||
if (contourMap)
|
||||
{
|
||||
actionToSetup->setText("Duplicate Contour Map");
|
||||
}
|
||||
else if (eclipseView)
|
||||
{
|
||||
actionToSetup->setText("New Contour Map From 3d View");
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setText("New Contour Map");
|
||||
}
|
||||
actionToSetup->setIcon(QIcon(":/3DView16x16.png"));
|
||||
}
|
||||
36
ApplicationCode/Commands/RicNew2dContourViewFeature.h
Normal file
36
ApplicationCode/Commands/RicNew2dContourViewFeature.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNew2dContourViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "RicNewViewFeature.h"
|
||||
|
||||
#include "Rim2dEclipseView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
@@ -158,9 +159,12 @@ RimEclipseView* RicNewViewFeature::selectedEclipseView()
|
||||
std::vector<RimEclipseView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
if (selection.size() > 0)
|
||||
for (RimEclipseView* view : selection)
|
||||
{
|
||||
return selection[0];
|
||||
if (dynamic_cast<Rim2dEclipseView*>(view) == nullptr)
|
||||
{
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
@@ -77,11 +77,10 @@ void RicRangeFilterNewExec::redo()
|
||||
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(rangeFilter);
|
||||
|
||||
// Trigger update of view following the range filter update
|
||||
RimGridView* view = nullptr;
|
||||
m_cellRangeFilterCollection->firstAncestorOrThisOfTypeAsserted(view);
|
||||
|
||||
//Enable display of grid cells, to be able to show generated range filter
|
||||
view->showGridCells(true);
|
||||
view->rangeFiltersUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
#include "RicTogglePerspectiveViewFeature.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "Rim2dEclipseView.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
@@ -34,7 +36,9 @@ CAF_CMD_SOURCE_INIT(RicTogglePerspectiveViewFeature, "RicTogglePerspectiveViewFe
|
||||
bool RicTogglePerspectiveViewFeature::isCommandEnabled()
|
||||
{
|
||||
this->action(); // Retrieve the action to update the looks
|
||||
return RiaApplication::instance()->activeGridView() && RiaApplication::instance()->activeReservoirView()->viewer();
|
||||
RimGridView* activeGridView = RiaApplication::instance()->activeGridView();
|
||||
Rim2dEclipseView* view2d = dynamic_cast<Rim2dEclipseView*>(activeGridView);
|
||||
return !view2d && activeGridView && RiaApplication::instance()->activeReservoirView()->viewer();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -63,7 +63,14 @@ bool RicLinkVisibleViewsFeature::isCommandEnabled()
|
||||
}
|
||||
|
||||
|
||||
if (visibleGridViews.size() >= 2 && (linkedviews.size() < visibleGridViews.size())) return true;
|
||||
if (visibleGridViews.size() >= 2 && (linkedviews.size() < visibleGridViews.size()))
|
||||
{
|
||||
std::vector<RimGridView*> views;
|
||||
findNotLinkedVisibleViews(views);
|
||||
RicLinkVisibleViewsFeatureUi testUi;
|
||||
testUi.setViews(views);
|
||||
return !testUi.masterViewCandidates().empty();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaOptionItemFactory.h"
|
||||
|
||||
#include "Rim2dEclipseView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimViewLinker.h"
|
||||
@@ -47,19 +48,21 @@ void RicLinkVisibleViewsFeatureUi::setViews(const std::vector<RimGridView*>& all
|
||||
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
|
||||
// Set Active view as master view
|
||||
for (size_t i = 0; i < allViews.size(); i++)
|
||||
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 == allViews[i])
|
||||
if (activeView == masterCandidates[i])
|
||||
{
|
||||
m_masterView = allViews[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to use first view if no active view is present
|
||||
if (!m_masterView && allViews.size() > 0)
|
||||
if (!m_masterView && masterCandidates.size() > 0)
|
||||
{
|
||||
m_masterView = allViews[0];
|
||||
m_masterView = masterCandidates[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +74,24 @@ 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++)
|
||||
{
|
||||
Rim2dEclipseView* contourMap = dynamic_cast<Rim2dEclipseView*>(m_allViews[i]);
|
||||
if (contourMap == nullptr)
|
||||
{
|
||||
masterCandidates.push_back(m_allViews[i]);
|
||||
}
|
||||
}
|
||||
return masterCandidates;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -81,7 +102,7 @@ QList<caf::PdmOptionItemInfo> RicLinkVisibleViewsFeatureUi::calculateValueOption
|
||||
|
||||
if (fieldNeedingOptions == &m_masterView)
|
||||
{
|
||||
for (RimGridView* v : m_allViews)
|
||||
for (RimGridView* v : masterViewCandidates())
|
||||
{
|
||||
RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName(v, &options);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,9 @@ class RicLinkVisibleViewsFeatureUi : public caf::PdmObject
|
||||
public:
|
||||
RicLinkVisibleViewsFeatureUi(void);
|
||||
|
||||
void setViews(const std::vector<RimGridView*>& allViews);
|
||||
RimGridView* masterView();
|
||||
void setViews(const std::vector<RimGridView*>& allViews);
|
||||
RimGridView* masterView();
|
||||
std::vector<RimGridView*> masterViewCandidates() const;
|
||||
|
||||
protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
|
||||
Reference in New Issue
Block a user