#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:
Gaute Lindkvist 2018-11-22 08:46:01 +01:00
parent d69153c013
commit fcc8ee6e27
4 changed files with 41 additions and 12 deletions

View File

@ -23,9 +23,10 @@
#include "RicLinkVisibleViewsFeature.h"
#include "RimProject.h"
#include "Rim3dView.h"
#include "RimContourMapView.h"
#include "RimGridView.h"
#include "RimProject.h"
#include "RimViewLinkerCollection.h"
#include "RimViewLinker.h"
@ -42,9 +43,14 @@ bool RicLinkViewFeature::isCommandEnabled()
{
std::vector<caf::PdmUiItem*> allSelectedItems;
std::vector<RimGridView*> selectedGridViews;
std::vector<RimContourMapView*> selectedContourMaps;
caf::SelectionManager::instance()->selectedItems(allSelectedItems);
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;
}
@ -80,8 +86,10 @@ void RicLinkViewFeature::onActionTriggered(bool isChecked)
{
std::vector<caf::PdmUiItem*> allSelectedItems;
std::vector<RimGridView*> selectedGridViews;
caf::SelectionManager::instance()->selectedItems(allSelectedItems);
caf::SelectionManager::instance()->objectsByType(&selectedGridViews);
if (selectedGridViews.size() > 1u && allSelectedItems.size() == selectedGridViews.size())
{
RicLinkVisibleViewsFeature::linkViews(selectedGridViews);

View File

@ -23,9 +23,10 @@
#include "RicLinkVisibleViewsFeatureUi.h"
#include "RimViewController.h"
#include "RimProject.h"
#include "RimContourMapView.h"
#include "RimGridView.h"
#include "RimProject.h"
#include "RimViewController.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
@ -147,6 +148,15 @@ void RicLinkVisibleViewsFeature::linkViews(std::vector<RimGridView*>& views)
RimProject* proj = RiaApplication::instance()->project();
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)
{
// Create a new view linker
@ -155,15 +165,20 @@ void RicLinkVisibleViewsFeature::linkViews(std::vector<RimGridView*>& views)
{
return;
}
CVF_ASSERT(!masterCandidates.empty());
RicLinkVisibleViewsFeatureUi featureUi;
featureUi.setViews(views);
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;
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Select Master View", "");
propertyDialog.setWindowIcon(QIcon(":/chain.png"));
if (propertyDialog.exec() != QDialog::Accepted) return;
RimGridView* masterView = featureUi.masterView();
masterView = featureUi.masterView();
}
viewLinker = new RimViewLinker;
proj->viewLinkerCollection()->viewLinker = viewLinker;
viewLinker->setMasterView(masterView);

View File

@ -21,8 +21,9 @@
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimContourMapView.h"
#include "RimGridView.h"
#include "RimProject.h"
#include "RimViewController.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
@ -54,6 +55,11 @@ bool RicSetMasterViewFeature::isCommandEnabled()
return false;
}
if (dynamic_cast<RimContourMapView*>(activeView) != nullptr)
{
return false;
}
return true;
}

View File

@ -658,8 +658,8 @@ void RimContourMapProjection::defineUiOrdering(QString uiConfigName, caf::PdmUiO
{
caf::PdmUiGroup* mainGroup = uiOrdering.addNewGroup("Projection Settings");
mainGroup->add(&m_relativeSampleSpacing);
mainGroup->add(&m_resultAggregation);
mainGroup->add(&m_showContourLines);
mainGroup->add(&m_resultAggregation);
caf::PdmUiGroup* weightingGroup = uiOrdering.addNewGroup("Mean Weighting Options");
weightingGroup->add(&m_weightByParameter);