mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 07:16:53 -06:00
#3736 Fix Linking issues related to Contour Maps.
* They are not allowed to be master views so a few things should be disallowed.
This commit is contained in:
parent
d69153c013
commit
fcc8ee6e27
@ -23,9 +23,10 @@
|
|||||||
|
|
||||||
#include "RicLinkVisibleViewsFeature.h"
|
#include "RicLinkVisibleViewsFeature.h"
|
||||||
|
|
||||||
#include "RimProject.h"
|
|
||||||
#include "Rim3dView.h"
|
#include "Rim3dView.h"
|
||||||
|
#include "RimContourMapView.h"
|
||||||
#include "RimGridView.h"
|
#include "RimGridView.h"
|
||||||
|
#include "RimProject.h"
|
||||||
#include "RimViewLinkerCollection.h"
|
#include "RimViewLinkerCollection.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
|
|
||||||
@ -42,9 +43,14 @@ bool RicLinkViewFeature::isCommandEnabled()
|
|||||||
{
|
{
|
||||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
std::vector<caf::PdmUiItem*> allSelectedItems;
|
||||||
std::vector<RimGridView*> selectedGridViews;
|
std::vector<RimGridView*> selectedGridViews;
|
||||||
|
std::vector<RimContourMapView*> selectedContourMaps;
|
||||||
|
|
||||||
caf::SelectionManager::instance()->selectedItems(allSelectedItems);
|
caf::SelectionManager::instance()->selectedItems(allSelectedItems);
|
||||||
caf::SelectionManager::instance()->objectsByType(&selectedGridViews);
|
caf::SelectionManager::instance()->objectsByType(&selectedGridViews);
|
||||||
if (selectedGridViews.size() > 1u && allSelectedItems.size() == selectedGridViews.size())
|
caf::SelectionManager::instance()->objectsByType(&selectedContourMaps);
|
||||||
|
size_t selectedRegularGridViews = selectedGridViews.size() - selectedContourMaps.size();
|
||||||
|
|
||||||
|
if (selectedGridViews.size() > 1u && selectedRegularGridViews >= 1u && allSelectedItems.size() == selectedGridViews.size())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -80,8 +86,10 @@ void RicLinkViewFeature::onActionTriggered(bool isChecked)
|
|||||||
{
|
{
|
||||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
std::vector<caf::PdmUiItem*> allSelectedItems;
|
||||||
std::vector<RimGridView*> selectedGridViews;
|
std::vector<RimGridView*> selectedGridViews;
|
||||||
|
|
||||||
caf::SelectionManager::instance()->selectedItems(allSelectedItems);
|
caf::SelectionManager::instance()->selectedItems(allSelectedItems);
|
||||||
caf::SelectionManager::instance()->objectsByType(&selectedGridViews);
|
caf::SelectionManager::instance()->objectsByType(&selectedGridViews);
|
||||||
|
|
||||||
if (selectedGridViews.size() > 1u && allSelectedItems.size() == selectedGridViews.size())
|
if (selectedGridViews.size() > 1u && allSelectedItems.size() == selectedGridViews.size())
|
||||||
{
|
{
|
||||||
RicLinkVisibleViewsFeature::linkViews(selectedGridViews);
|
RicLinkVisibleViewsFeature::linkViews(selectedGridViews);
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
|
|
||||||
#include "RicLinkVisibleViewsFeatureUi.h"
|
#include "RicLinkVisibleViewsFeatureUi.h"
|
||||||
|
|
||||||
#include "RimViewController.h"
|
#include "RimContourMapView.h"
|
||||||
#include "RimProject.h"
|
|
||||||
#include "RimGridView.h"
|
#include "RimGridView.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimViewController.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
#include "RimViewLinkerCollection.h"
|
#include "RimViewLinkerCollection.h"
|
||||||
|
|
||||||
@ -147,6 +148,15 @@ void RicLinkVisibleViewsFeature::linkViews(std::vector<RimGridView*>& views)
|
|||||||
RimProject* proj = RiaApplication::instance()->project();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker();
|
RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker();
|
||||||
|
|
||||||
|
std::vector<RimGridView*> masterCandidates;
|
||||||
|
for (RimGridView* view : views)
|
||||||
|
{
|
||||||
|
if (dynamic_cast<RimContourMapView*>(view) == nullptr)
|
||||||
|
{
|
||||||
|
masterCandidates.push_back(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!viewLinker)
|
if (!viewLinker)
|
||||||
{
|
{
|
||||||
// Create a new view linker
|
// Create a new view linker
|
||||||
@ -155,15 +165,20 @@ void RicLinkVisibleViewsFeature::linkViews(std::vector<RimGridView*>& views)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
CVF_ASSERT(!masterCandidates.empty());
|
||||||
|
|
||||||
RicLinkVisibleViewsFeatureUi featureUi;
|
RimGridView* masterView = masterCandidates.front();
|
||||||
featureUi.setViews(views);
|
if (masterCandidates.size() > 1u)
|
||||||
|
{
|
||||||
|
RicLinkVisibleViewsFeatureUi featureUi;
|
||||||
|
featureUi.setViews(masterCandidates);
|
||||||
|
|
||||||
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Select Master View", "");
|
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Select Master View", "");
|
||||||
propertyDialog.setWindowIcon(QIcon(":/chain.png"));
|
propertyDialog.setWindowIcon(QIcon(":/chain.png"));
|
||||||
if (propertyDialog.exec() != QDialog::Accepted) return;
|
if (propertyDialog.exec() != QDialog::Accepted) return;
|
||||||
|
|
||||||
RimGridView* masterView = featureUi.masterView();
|
masterView = featureUi.masterView();
|
||||||
|
}
|
||||||
viewLinker = new RimViewLinker;
|
viewLinker = new RimViewLinker;
|
||||||
proj->viewLinkerCollection()->viewLinker = viewLinker;
|
proj->viewLinkerCollection()->viewLinker = viewLinker;
|
||||||
viewLinker->setMasterView(masterView);
|
viewLinker->setMasterView(masterView);
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
#include "RimProject.h"
|
#include "RimContourMapView.h"
|
||||||
#include "RimGridView.h"
|
#include "RimGridView.h"
|
||||||
|
#include "RimProject.h"
|
||||||
#include "RimViewController.h"
|
#include "RimViewController.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
#include "RimViewLinkerCollection.h"
|
#include "RimViewLinkerCollection.h"
|
||||||
@ -54,6 +55,11 @@ bool RicSetMasterViewFeature::isCommandEnabled()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dynamic_cast<RimContourMapView*>(activeView) != nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,8 +658,8 @@ void RimContourMapProjection::defineUiOrdering(QString uiConfigName, caf::PdmUiO
|
|||||||
{
|
{
|
||||||
caf::PdmUiGroup* mainGroup = uiOrdering.addNewGroup("Projection Settings");
|
caf::PdmUiGroup* mainGroup = uiOrdering.addNewGroup("Projection Settings");
|
||||||
mainGroup->add(&m_relativeSampleSpacing);
|
mainGroup->add(&m_relativeSampleSpacing);
|
||||||
mainGroup->add(&m_resultAggregation);
|
|
||||||
mainGroup->add(&m_showContourLines);
|
mainGroup->add(&m_showContourLines);
|
||||||
|
mainGroup->add(&m_resultAggregation);
|
||||||
|
|
||||||
caf::PdmUiGroup* weightingGroup = uiOrdering.addNewGroup("Mean Weighting Options");
|
caf::PdmUiGroup* weightingGroup = uiOrdering.addNewGroup("Mean Weighting Options");
|
||||||
weightingGroup->add(&m_weightByParameter);
|
weightingGroup->add(&m_weightByParameter);
|
||||||
|
Loading…
Reference in New Issue
Block a user