(#266) Refactoring

Limit usage of RivGridBoxGenerator to only RiuViewer
Update colors of grid box based on background color
Use dark gray instead of pure black
This commit is contained in:
Magne Sjaastad
2015-11-16 14:08:17 +01:00
parent a7656e2367
commit 401cfe81a1
9 changed files with 108 additions and 77 deletions

View File

@@ -70,7 +70,6 @@
#include <QMessageBox>
#include <limits.h>
#include "RivGridBoxGenerator.h"
@@ -1647,6 +1646,14 @@ void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalV
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseView::showActiveCellsOnly()
{
return !showInactiveCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1677,32 +1684,6 @@ void RimEclipseView::createPartCollectionFromSelection(cvf::Collection<cvf::Part
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::updateGridBoxData()
{
if (viewer())
{
RivGridBoxGenerator* gridBoxGen = viewer()->gridBoxGenerator();
gridBoxGen->setScaleZ(scaleZ);
if (showInactiveCells)
{
gridBoxGen->setGridBoxDomainCoordBoundingBox(ownerCase()->allCellsBoundingBox());
}
else
{
gridBoxGen->setGridBoxDomainCoordBoundingBox(ownerCase()->activeCellsBoundingBox());
}
gridBoxGen->setDisplayModelOffset(ownerCase()->displayModelOffset());
gridBoxGen->createGridBoxParts();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -126,8 +126,6 @@ public:
const std::vector<RivCellSetEnum>& visibleGridParts() const { return m_visibleGridParts;}
cvf::cref<RivReservoirViewPartMgr> reservoirGridPartManager() const { return m_reservoirGridPartManager.p(); }
virtual void updateGridBoxData();
// Does this belong here, really ?
void calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleCells, RigGridBase * grid);
@@ -141,6 +139,7 @@ protected:
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts);
virtual bool showActiveCellsOnly();
private:
void createDisplayModel();

View File

@@ -43,7 +43,6 @@
#include "RivGeoMechPartMgr.h"
#include "RivGeoMechPartMgrCache.h"
#include "RivGeoMechVizLogic.h"
#include "RivGridBoxGenerator.h"
#include "RivSingleCellPartGenerator.h"
#include "cafCadNavigation.h"

View File

@@ -19,7 +19,6 @@
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "RivGridBoxGenerator.h"
#include "RivWellPathCollectionPartMgr.h"
#include "cafFrameAnimationControl.h"
@@ -181,7 +180,6 @@ void RimView::updateViewerWidget()
m_viewer = new RiuViewer(glFormat, NULL);
m_viewer->setOwnerReservoirView(this);
this->updateGridBoxData();
RiuMainWindow::instance()->addViewer(m_viewer->layoutWidget(), windowGeometry());
m_viewer->setMinNearPlaneDistance(10);
@@ -199,6 +197,8 @@ void RimView::updateViewerWidget()
if (isViewerCreated) m_viewer->mainCamera()->setViewMatrix(cameraPosition);
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
this->updateGridBoxData();
m_viewer->update();
}
else
@@ -787,15 +787,9 @@ void RimView::removeModelByName(cvf::Scene* scene, const cvf::String& modelName)
//--------------------------------------------------------------------------------------------------
void RimView::updateGridBoxData()
{
if (viewer())
if (m_viewer)
{
RivGridBoxGenerator* gridBoxGen = viewer()->gridBoxGenerator();
gridBoxGen->setScaleZ(scaleZ);
gridBoxGen->setDisplayModelOffset(cvf::Vec3d::ZERO);
gridBoxGen->setGridBoxDomainCoordBoundingBox(ownerCase()->allCellsBoundingBox());
gridBoxGen->createGridBoxParts();
m_viewer->updateGridBoxData();
}
}
@@ -839,9 +833,17 @@ void RimView::createOverlayDisplayModel()
if (showGridBox)
{
overlayScene->addModel(m_viewer->gridBoxGenerator()->model());
overlayScene->addModel(m_viewer->gridBoxModel());
}
m_viewer->setOverlayScene(overlayScene.p());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimView::showActiveCellsOnly()
{
return false;
}

View File

@@ -141,7 +141,7 @@ public:
cvf::ref<cvf::UByteArray> currentTotalCellVisibility();
virtual void updateGridBoxData();
virtual bool showActiveCellsOnly();
public:
virtual void loadDataAndUpdate() = 0;
@@ -164,6 +164,8 @@ protected:
virtual void createDisplayModel() = 0;
void createOverlayDisplayModel();
void updateGridBoxData();
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0;
virtual void updateDisplayModelVisibility() = 0;