mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#266) Added interface for all/activeCellsBoundingBox and displayModelOffset
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimCase.h"
|
||||
|
||||
#include "cafPdmObjectFactory.h"
|
||||
|
||||
#include <QFile>
|
||||
@@ -203,4 +204,12 @@ QString RimCase::relocateFile(const QString& orgFileName, const QString& orgNew
|
||||
if (foundFile) *foundFile = false;
|
||||
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimCase::displayModelOffset() const
|
||||
{
|
||||
return cvf::Vec3d::ZERO;
|
||||
}
|
||||
|
||||
@@ -18,13 +18,20 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimView;
|
||||
|
||||
namespace cvf {
|
||||
class BoundingBox;
|
||||
}
|
||||
|
||||
class RimCase : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
@@ -44,6 +51,11 @@ public:
|
||||
virtual QStringList timeStepStrings() = 0;
|
||||
virtual QString timeStepName(int frameIdx) = 0;
|
||||
|
||||
virtual cvf::BoundingBox activeCellsBoundingBox() const = 0;
|
||||
virtual cvf::BoundingBox allCellsBoundingBox() const = 0;
|
||||
|
||||
virtual cvf::Vec3d displayModelOffset() const;
|
||||
|
||||
protected:
|
||||
static QString relocateFile(const QString& fileName, const QString& newProjectPath, const QString& oldProjectPath,
|
||||
bool* foundFile, std::vector<QString>* searchedPaths);
|
||||
|
||||
@@ -356,6 +356,51 @@ void RimEclipseCase::setReservoirData(RigCaseData* eclipseCase)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimEclipseCase::activeCellsBoundingBox() const
|
||||
{
|
||||
if (m_rigEclipseCase.notNull() && m_rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS))
|
||||
{
|
||||
return m_rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->geometryBoundingBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cvf::BoundingBox();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimEclipseCase::allCellsBoundingBox() const
|
||||
{
|
||||
if (m_rigEclipseCase.notNull() && m_rigEclipseCase->mainGrid())
|
||||
{
|
||||
return m_rigEclipseCase->mainGrid()->boundingBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cvf::BoundingBox();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimEclipseCase::displayModelOffset() const
|
||||
{
|
||||
if (m_rigEclipseCase.notNull() && m_rigEclipseCase->mainGrid())
|
||||
{
|
||||
return m_rigEclipseCase->mainGrid()->displayModelOffset();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cvf::Vec3d::ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -468,4 +513,4 @@ QString RimEclipseCase::timeStepName(int frameIdx)
|
||||
QDateTime date = results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDate(0,frameIdx);
|
||||
return date.toString(m_timeStepFormatString);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,9 @@ public:
|
||||
RigCaseData* reservoirData();
|
||||
const RigCaseData* reservoirData() const;
|
||||
|
||||
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
|
||||
RimEclipseView* createAndAddReservoirView();
|
||||
RimEclipseView* createAndAddReservoirView();
|
||||
|
||||
void removeResult(const QString& resultName);
|
||||
|
||||
@@ -88,6 +88,10 @@ public:
|
||||
virtual QStringList timeStepStrings();
|
||||
virtual QString timeStepName(int frameIdx);
|
||||
|
||||
virtual cvf::BoundingBox activeCellsBoundingBox() const;
|
||||
virtual cvf::BoundingBox allCellsBoundingBox() const;
|
||||
virtual cvf::Vec3d displayModelOffset() const;
|
||||
|
||||
// Overridden methods from PdmObject
|
||||
public:
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <limits.h>
|
||||
#include "RivGridBoxGenerator.h"
|
||||
|
||||
|
||||
|
||||
@@ -227,6 +228,8 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
}
|
||||
else if (changedField == &showInactiveCells)
|
||||
{
|
||||
this->updateGridBoxData();
|
||||
|
||||
this->scheduleGeometryRegen(INACTIVE);
|
||||
this->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
||||
|
||||
@@ -480,8 +483,6 @@ void RimEclipseView::createDisplayModel()
|
||||
m_overlayInfoConfig()->update3DInfo();
|
||||
updateLegends();
|
||||
}
|
||||
|
||||
m_viewer->showGridBox(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1682,6 +1683,32 @@ void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalV
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -126,6 +126,8 @@ 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);
|
||||
|
||||
|
||||
@@ -18,14 +18,19 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifOdbReader.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
|
||||
#include <QFile>
|
||||
@@ -179,3 +184,26 @@ QString RimGeoMechCase::timeStepName(int frameIdx)
|
||||
|
||||
return QString::fromStdString(stepNames[frameIdx]);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimGeoMechCase::activeCellsBoundingBox() const
|
||||
{
|
||||
return allCellsBoundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimGeoMechCase::allCellsBoundingBox() const
|
||||
{
|
||||
if (m_geoMechCaseData.notNull() && m_geoMechCaseData->femParts())
|
||||
{
|
||||
return m_geoMechCaseData->femParts()->boundingBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cvf::BoundingBox();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@ public:
|
||||
virtual QStringList timeStepStrings();
|
||||
virtual QString timeStepName(int frameIdx);
|
||||
|
||||
virtual cvf::BoundingBox activeCellsBoundingBox() const;
|
||||
virtual cvf::BoundingBox allCellsBoundingBox() const;
|
||||
|
||||
// Fields:
|
||||
caf::PdmChildArrayField<RimGeoMechView*> geoMechViews;
|
||||
|
||||
|
||||
@@ -250,8 +250,6 @@ void RimGeoMechView::createDisplayModel()
|
||||
m_vizLogic->updateStaticCellColors(-1);
|
||||
m_overlayInfoConfig()->update3DInfo();
|
||||
}
|
||||
|
||||
m_viewer->showGridBox(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivGridBoxGenerator.h"
|
||||
#include "RivWellPathCollectionPartMgr.h"
|
||||
|
||||
#include "cafFrameAnimationControl.h"
|
||||
@@ -178,6 +179,7 @@ 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);
|
||||
@@ -246,6 +248,17 @@ void RimView::setCurrentTimeStep(int frameIndex)
|
||||
m_currentReservoirCellVisibility = NULL;
|
||||
}
|
||||
this->updateCurrentTimeStep();
|
||||
|
||||
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
||||
if (frameScene)
|
||||
{
|
||||
frameScene->removeModel(m_viewer->gridBoxGenerator()->model());
|
||||
|
||||
if (true)
|
||||
{
|
||||
frameScene->addModel(m_viewer->gridBoxGenerator()->model());
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -464,6 +477,8 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
||||
{
|
||||
if (scaleZ < 1) scaleZ = 1;
|
||||
|
||||
this->updateGridBoxData();
|
||||
|
||||
// Regenerate well paths
|
||||
RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL;
|
||||
RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL;
|
||||
@@ -771,3 +786,20 @@ void RimView::removeModelByName(cvf::Scene* scene, const cvf::String& modelName)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimView::updateGridBoxData()
|
||||
{
|
||||
if (viewer())
|
||||
{
|
||||
RivGridBoxGenerator* gridBoxGen = viewer()->gridBoxGenerator();
|
||||
|
||||
gridBoxGen->setScaleZ(scaleZ);
|
||||
gridBoxGen->setDisplayModelOffset(cvf::Vec3d::ZERO);
|
||||
gridBoxGen->setGridBoxDomainCoordBoundingBox(ownerCase()->allCellsBoundingBox());
|
||||
|
||||
gridBoxGen->createGridBoxParts();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,8 @@ public:
|
||||
|
||||
cvf::ref<cvf::UByteArray> currentTotalCellVisibility();
|
||||
|
||||
virtual void updateGridBoxData();
|
||||
|
||||
public:
|
||||
virtual void loadDataAndUpdate() = 0;
|
||||
virtual RimCase* ownerCase() = 0;
|
||||
|
||||
Reference in New Issue
Block a user