#2850 Fix missing fault-label toggle and color setting awareness in 2D intersection view

This commit is contained in:
Jacob Støren
2018-05-07 18:06:09 +02:00
parent 96d7e8b062
commit 20a1e52323
3 changed files with 52 additions and 16 deletions

View File

@@ -31,6 +31,7 @@
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimFaultInViewCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechView.h"
@@ -599,6 +600,12 @@ void RivIntersectionPartMgr::createFaultLabelParts(const std::vector<std::pair<Q
if (!labelAndAnchors.size()) return;
RimEclipseView* eclipseView = nullptr;
m_rimCrossSection->firstAncestorOrThisOfType(eclipseView);
if (!(eclipseView && eclipseView->faultCollection()->showFaultLabel())) return;
cvf::Color3f defWellLabelColor = eclipseView->faultCollection()->faultLabelColor();
cvf::Font* font = RiaApplication::instance()->customFont();
std::vector<cvf::Vec3f> lineVertices;
@@ -610,7 +617,6 @@ void RivIntersectionPartMgr::createFaultLabelParts(const std::vector<std::pair<Q
drawableText->setDrawBorder(false);
drawableText->setDrawBackground(false);
drawableText->setVerticalAlignment(cvf::TextDrawer::BASELINE);
cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
drawableText->setTextColor(defWellLabelColor);
}

View File

@@ -29,6 +29,7 @@
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimFaultInView.h"
#include "RimIntersectionCollection.h"
#include "RimNoCommonAreaNNC.h"
#include "RimNoCommonAreaNncCollection.h"
@@ -108,6 +109,7 @@ void RimFaultInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
if (&faultLabelColor == changedField)
{
m_reservoirView->scheduleReservoirGridGeometryRegen();
m_reservoirView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
if (&showFaultFaces == changedField ||
@@ -124,6 +126,7 @@ void RimFaultInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
if (m_reservoirView)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
m_reservoirView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
}

View File

@@ -26,6 +26,7 @@
#include "RiaRegressionTest.h"
#include "RiaRegressionTestRunner.h"
#include "Rim2dIntersectionView.h"
#include "Rim3dView.h"
#include "RimCellEdgeColors.h"
#include "RimCommandObject.h"
@@ -37,6 +38,7 @@
#include "RimFaultInViewCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "RimIntersection.h"
#include "RimProject.h"
#include "RimSimWellInViewCollection.h"
@@ -1478,7 +1480,18 @@ void RiuMainWindow::slotToggleHideGridCellsAction(bool hideGridCells)
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotToggleFaultLabelsAction(bool showLabels)
{
RimEclipseView* activeRiv = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
RimEclipseView* activeRiv = dynamic_cast<RimEclipseView*>(activeView);
if (!activeRiv)
{
Rim2dIntersectionView* isectView = dynamic_cast<Rim2dIntersectionView*>(activeView);
if (isectView)
{
isectView->intersection()->firstAncestorOrThisOfType(activeRiv);
}
}
if (!activeRiv) return;
activeRiv->faultCollection()->showFaultLabel.setValueWithFieldChanged(showLabels);
@@ -1492,14 +1505,14 @@ void RiuMainWindow::slotToggleFaultLabelsAction(bool showLabels)
void RiuMainWindow::refreshDrawStyleActions()
{
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
bool enable = view != nullptr;
bool is3DView = view != nullptr;
bool isGridView = RiaApplication::instance()->activeGridView() != nullptr;
m_drawStyleLinesAction->setEnabled(enable);
m_drawStyleLinesSolidAction->setEnabled(enable);
m_drawStyleSurfOnlyAction->setEnabled(enable);
m_drawStyleFaultLinesSolidAction->setEnabled(enable);
m_disableLightingAction->setEnabled(enable);
m_drawStyleLinesAction->setEnabled(is3DView);
m_drawStyleLinesSolidAction->setEnabled(is3DView);
m_drawStyleSurfOnlyAction->setEnabled(is3DView);
m_drawStyleFaultLinesSolidAction->setEnabled(is3DView);
m_disableLightingAction->setEnabled(is3DView);
bool lightingDisabledInView = view ? view->isLightingDisabled() : false;
@@ -1516,22 +1529,36 @@ void RiuMainWindow::refreshDrawStyleActions()
}
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(view);
enable = enable && eclView;
m_toggleFaultsLabelAction->setEnabled(enable);
m_showWellCellsAction->setEnabled(enable);
bool hasEclipseView = eclView != nullptr;
m_showWellCellsAction->setEnabled(hasEclipseView);
if (enable)
if (hasEclipseView)
{
m_toggleFaultsLabelAction->blockSignals(true);
m_toggleFaultsLabelAction->setChecked(eclView->faultCollection()->showFaultLabel());
m_toggleFaultsLabelAction->blockSignals(false);
m_showWellCellsAction->blockSignals(true);
eclView->wellCollection()->updateStateForVisibilityCheckboxes();
m_showWellCellsAction->setChecked(eclView->wellCollection()->showWellCells());
m_showWellCellsAction->blockSignals(false);
}
if (!eclView)
{
Rim2dIntersectionView * intView = dynamic_cast<Rim2dIntersectionView*>(view);
if (intView)
{
intView->intersection()->firstAncestorOrThisOfType(eclView);
}
}
m_toggleFaultsLabelAction->setEnabled(eclView != nullptr);
if (eclView )
{
m_toggleFaultsLabelAction->blockSignals(true);
m_toggleFaultsLabelAction->setChecked(eclView->faultCollection()->showFaultLabel());
m_toggleFaultsLabelAction->blockSignals(false);
}
}