#2436 Separated Hide grid cells mode as a separate value. Make sure that all the possible drawstyles works as expected, both for 2D intersection view and 3D views.

This commit is contained in:
Jacob Støren
2018-04-05 07:41:29 +02:00
parent 97c2ebd955
commit f7bfe8d003
14 changed files with 243 additions and 203 deletions
@@ -302,6 +302,14 @@ cvf::ref<RivIntersectionPartMgr> Rim2dIntersectionView::flatIntersectionPartMgr(
return m_flatIntersectionPartMgr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim2dIntersectionView::isGridVisualizationMode() const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -71,6 +71,7 @@ public:
protected:
void updateLegends();
virtual bool isGridVisualizationMode() const override;
virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) override;
virtual void createDisplayModel() override;
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) override;
+23 -60
View File
@@ -23,7 +23,7 @@
#include "RiaPreferences.h"
#include "RiaViewRedrawScheduler.h"
#include "RimEclipseCase.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimMainPlotCollection.h"
#include "RimOilField.h"
@@ -47,7 +47,6 @@
#include "cvfTransform.h"
#include "cvfViewport.h"
#include <QDateTime>
#include <climits>
#include "cvfScene.h"
@@ -428,35 +427,12 @@ void Rim3dView::setupBeforeSave()
}
}
//--------------------------------------------------------------------------------------------------
///
// Surf: No Fault Surf
// Mesh -------------
// No F F G
// Fault F F G
// Mesh G G G
//
//--------------------------------------------------------------------------------------------------
bool Rim3dView::isGridVisualizationMode() const
{
return ( this->surfaceMode() == SURFACE
|| this->meshMode() == FULL_MESH);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::setMeshOnlyDrawstyle()
{
if (isGridVisualizationMode())
{
meshMode.setValueWithFieldChanged(FULL_MESH);
}
else
{
meshMode.setValueWithFieldChanged(FAULTS_MESH);
}
meshMode.setValueWithFieldChanged(FULL_MESH);
surfaceMode.setValueWithFieldChanged(NO_SURFACE);
}
@@ -465,16 +441,8 @@ void Rim3dView::setMeshOnlyDrawstyle()
//--------------------------------------------------------------------------------------------------
void Rim3dView::setMeshSurfDrawstyle()
{
if (isGridVisualizationMode())
{
surfaceMode.setValueWithFieldChanged(SURFACE);
meshMode.setValueWithFieldChanged(FULL_MESH);
}
else
{
surfaceMode.setValueWithFieldChanged(FAULTS);
meshMode.setValueWithFieldChanged(FAULTS_MESH);
}
surfaceMode.setValueWithFieldChanged(SURFACE);
meshMode.setValueWithFieldChanged(FULL_MESH);
}
//--------------------------------------------------------------------------------------------------
@@ -482,20 +450,7 @@ void Rim3dView::setMeshSurfDrawstyle()
//--------------------------------------------------------------------------------------------------
void Rim3dView::setFaultMeshSurfDrawstyle()
{
// Surf: No Fault Surf
// Mesh -------------
// No FF FF SF
// Fault FF FF SF
// Mesh SF SF SF
if (this->isGridVisualizationMode())
{
surfaceMode.setValueWithFieldChanged(SURFACE);
}
else
{
surfaceMode.setValueWithFieldChanged(FAULTS);
}
surfaceMode.setValueWithFieldChanged(SURFACE);
meshMode.setValueWithFieldChanged(FAULTS_MESH);
}
@@ -504,15 +459,7 @@ void Rim3dView::setFaultMeshSurfDrawstyle()
//--------------------------------------------------------------------------------------------------
void Rim3dView::setSurfOnlyDrawstyle()
{
if (isGridVisualizationMode())
{
surfaceMode.setValueWithFieldChanged(SURFACE);
}
else
{
surfaceMode.setValueWithFieldChanged(FAULTS);
}
surfaceMode.setValueWithFieldChanged(SURFACE);
meshMode.setValueWithFieldChanged(NO_MESH);
}
@@ -794,9 +741,20 @@ void Rim3dView::updateDisplayModelVisibility()
const cvf::uint uintMeshSurfaceBit = meshSurfaceBit;
const cvf::uint uintFaultBit = faultBit;
const cvf::uint uintMeshFaultBit = meshFaultBit;
const cvf::uint uintIntersectionCellFaceBit = intersectionCellFaceBit;
const cvf::uint uintIntersectionCellMeshBit = intersectionCellMeshBit;
const cvf::uint uintIntersectionFaultMeshBit = intersectionFaultMeshBit;
// Initialize the mask to show everything except the the bits controlled here
unsigned int mask = 0xffffffff & ~uintSurfaceBit & ~uintFaultBit & ~uintMeshSurfaceBit & ~uintMeshFaultBit ;
unsigned int mask =
0xffffffff
& ~uintSurfaceBit
& ~uintFaultBit
& ~uintMeshSurfaceBit
& ~uintMeshFaultBit
& ~intersectionCellFaceBit
& ~intersectionCellMeshBit
& ~intersectionFaultMeshBit;
// Then turn the appropriate bits on according to the user settings
@@ -804,20 +762,25 @@ void Rim3dView::updateDisplayModelVisibility()
{
mask |= uintSurfaceBit;
mask |= uintFaultBit;
mask |= intersectionCellFaceBit;
}
else if (surfaceMode == FAULTS)
{
mask |= uintFaultBit;
mask |= intersectionCellFaceBit;
}
if (meshMode == FULL_MESH)
{
mask |= uintMeshSurfaceBit;
mask |= uintMeshFaultBit;
mask |= intersectionCellMeshBit;
mask |= intersectionFaultMeshBit;
}
else if (meshMode == FAULTS_MESH)
{
mask |= uintMeshFaultBit;
mask |= intersectionFaultMeshBit;
}
m_viewer->setEnableMask(mask);
+13 -22
View File
@@ -16,43 +16,31 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiuViewerToViewInterface.h"
#include "RimViewWindow.h"
#include "RivCellSetEnum.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmObject.h"
#include "RivCellSetEnum.h"
#include "cvfArray.h"
#include "cvfBase.h"
#include "cvfCollection.h"
#include "cvfObject.h"
#include <QPointer>
class Rim3dOverlayInfoConfig;
class RimCase;
class RimCellRangeFilter;
class RimCellRangeFilterCollection;
class RimIntersectionCollection;
class RimGridCollection;
class RimPropertyFilterCollection;
class RimViewController;
class RimViewLinker;
class RiuViewer;
class RimWellPathCollection;
class RivWellPathsPartMgr;
class RimWellPath;
namespace cvf
{
@@ -72,10 +60,13 @@ namespace caf
enum PartRenderMaskEnum
{
surfaceBit = 0x00000001,
meshSurfaceBit = 0x00000002,
faultBit = 0x00000004,
meshFaultBit = 0x00000008,
surfaceBit = 1,
meshSurfaceBit = 2,
faultBit = 4,
meshFaultBit = 8,
intersectionCellFaceBit = 16,
intersectionCellMeshBit = 32,
intersectionFaultMeshBit = 64
};
@@ -117,7 +108,7 @@ public:
void disableLighting(bool disable);
bool isLightingDisabled() const;
bool isGridVisualizationMode() const;
virtual bool isGridVisualizationMode() const = 0;
void setScaleZAndUpdate(double scaleZ);
virtual bool showActiveCellsOnly();
@@ -399,7 +399,8 @@ void RimEclipseView::createDisplayModel()
if (!this->eclipsePropertyFilterCollection()->hasActiveFilters()
|| this->viewController() && this->viewController()->isVisibleCellsOveridden())
|| ( this->viewController()
&& this->viewController()->isVisibleCellsOveridden()) )
{
std::vector<RivCellSetEnum> geometryTypesToAdd;
@@ -452,28 +453,41 @@ void RimEclipseView::createDisplayModel()
{
for (size_t gtIdx = 0; gtIdx < geometryTypesToAdd.size(); ++gtIdx)
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices);
if ( isGridVisualizationMode() )
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices);
}
else
{
m_reservoirGridPartManager->ensureStaticGeometryPartsCreated( geometryTypesToAdd[gtIdx]);
}
}
}
// Set static colors
this->updateStaticCellColors();
}
else
{
std::vector<RivCellSetEnum> empty;
setVisibleGridParts(empty);
}
m_reservoirGridPartManager->clearWatertightGeometryFlags();
if (faultCollection()->showFaultsOutsideFilters() || !this->eclipsePropertyFilterCollection()->hasActiveFilters() )
if ( faultCollection()->showFaultCollection()
|| !this->eclipsePropertyFilterCollection()->hasActiveFilters() )
{
setVisibleGridPartsWatertight();
std::set<RivCellSetEnum> faultGeometryTypesToAppend = allVisibleFaultGeometryTypes();
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->showFaultsOutsideFilters());
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters());
for (size_t frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
{
for (RivCellSetEnum geometryType : faultGeometryTypesToAppend)
{
if (geometryType == PROPERTY_FILTERED || geometryType == PROPERTY_FILTERED_WELL_CELLS) continue;
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryType);
}
@@ -569,10 +583,18 @@ void RimEclipseView::updateCurrentTimeStep()
this->indicesToVisibleGrids(&gridIndices);
geometriesToRecolor.push_back( PROPERTY_FILTERED);
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), PROPERTY_FILTERED, m_currentTimeStep, gridIndices);
geometriesToRecolor.push_back( PROPERTY_FILTERED_WELL_CELLS);
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices);
if ( isGridVisualizationMode() )
{
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), PROPERTY_FILTERED, m_currentTimeStep, gridIndices);
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices);
}
else
{
m_reservoirGridPartManager->ensureDynamicGeometryPartsCreated(PROPERTY_FILTERED, m_currentTimeStep);
m_reservoirGridPartManager->ensureDynamicGeometryPartsCreated(PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep);
}
setVisibleGridParts(geometriesToRecolor);
setVisibleGridPartsWatertight();
@@ -590,7 +612,7 @@ void RimEclipseView::updateCurrentTimeStep()
}
}
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->showFaultsOutsideFilters());
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters());
if (faultLabelType == PROPERTY_FILTERED)
{
m_reservoirGridPartManager->appendFaultLabelsDynamicGeometryPartsToModel(frameParts.p(), faultLabelType, m_currentTimeStep);
@@ -614,7 +636,7 @@ void RimEclipseView::updateCurrentTimeStep()
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RANGE_FILTERED_INACTIVE, gridIndices);
if (!faultCollection()->showFaultsOutsideFilters())
if (!faultCollection()->isShowingFaultsAndFaultsOutsideFilters())
{
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameParts.p(), RANGE_FILTERED_INACTIVE);
}
@@ -623,7 +645,7 @@ void RimEclipseView::updateCurrentTimeStep()
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), INACTIVE, gridIndices);
if (!faultCollection()->showFaultsOutsideFilters())
if (!faultCollection()->isShowingFaultsAndFaultsOutsideFilters())
{
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameParts.p(), INACTIVE);
}
@@ -1475,7 +1497,7 @@ std::set<RivCellSetEnum> RimEclipseView::allVisibleFaultGeometryTypes() const
std::set<RivCellSetEnum> faultGeoTypes;
faultGeoTypes.insert(m_visibleGridParts.begin(), m_visibleGridParts.end());
if (faultCollection()->showFaultsOutsideFilters())
if (faultCollection()->isShowingFaultsAndFaultsOutsideFilters())
{
faultGeoTypes.insert(ACTIVE);
faultGeoTypes.insert(ALL_WELL_CELLS);
@@ -377,7 +377,7 @@ void RimFaultInViewCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::showFaultsOutsideFilters() const
bool RimFaultInViewCollection::isShowingFaultsAndFaultsOutsideFilters() const
{
if (!showFaultCollection) return false;
@@ -62,7 +62,7 @@ public:
bool isGridVisualizationMode() const;
bool showFaultsOutsideFilters() const;
bool isShowingFaultsAndFaultsOutsideFilters() const;
caf::PdmField<bool> showFaultFaces;
caf::PdmField<bool> showOppositeFaultFaces;
@@ -34,6 +34,7 @@
#include "cvfModel.h"
#include "cvfScene.h"
#include "RiuMainWindow.h"
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimGridView, "GenericGridView"); // Do not use. Abstract class
@@ -107,19 +108,14 @@ RimGridView::~RimGridView(void)
//--------------------------------------------------------------------------------------------------
void RimGridView::showGridCells(bool enableGridCells)
{
if (!enableGridCells)
{
m_previousGridModeMeshLinesWasFaults = meshMode() == FAULTS_MESH;
if (surfaceMode() != NO_SURFACE) surfaceMode.setValueWithFieldChanged(FAULTS);
if (meshMode() != NO_MESH) meshMode.setValueWithFieldChanged(FAULTS_MESH);
}
else
{
if (surfaceMode() != NO_SURFACE) surfaceMode.setValueWithFieldChanged(SURFACE);
if (meshMode() != NO_MESH) meshMode.setValueWithFieldChanged(m_previousGridModeMeshLinesWasFaults ? FAULTS_MESH : FULL_MESH);
}
m_gridCollection->isActive = enableGridCells;
createDisplayModel();
updateDisplayModelVisibility();
RiuMainWindow::instance()->refreshDrawStyleActions();
RiuMainWindow::instance()->refreshAnimationActions();
m_gridCollection->updateConnectedEditors();
m_gridCollection->updateUiIconFromState(enableGridCells);
}
@@ -256,6 +252,14 @@ RimViewLinker* RimGridView::assosiatedViewLinker() const
return viewLinker;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridView::isGridVisualizationMode() const
{
return this->m_gridCollection->isActive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
+13 -1
View File
@@ -20,6 +20,15 @@
#include "Rim3dView.h"
#include "cvfBase.h"
#include "cvfArray.h"
class Rim3dOverlayInfoConfig;
class RimIntersectionCollection;
class RimPropertyFilterCollection;
class RimGridCollection;
class RimCellRangeFilterCollection;
class RimGridView : public Rim3dView
{
CAF_PDM_HEADER_INIT;
@@ -46,7 +55,10 @@ public:
RimViewController* viewController() const override;
RimViewLinker* assosiatedViewLinker() const override;
protected:
virtual bool isGridVisualizationMode() const override;
protected:
virtual void onTimeStepChanged() override;
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStep) = 0;