mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2331 WIP: Creating new RimGridView base class
This commit is contained in:
@@ -634,11 +634,6 @@ void Rim3dView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const
|
|||||||
if (scaleZ < 1) scaleZ = 1;
|
if (scaleZ < 1) scaleZ = 1;
|
||||||
|
|
||||||
this->updateGridBoxData();
|
this->updateGridBoxData();
|
||||||
|
|
||||||
// Regenerate well paths
|
|
||||||
RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL;
|
|
||||||
RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL;
|
|
||||||
|
|
||||||
crossSectionCollection->updateIntersectionBoxGeometry();
|
crossSectionCollection->updateIntersectionBoxGeometry();
|
||||||
|
|
||||||
if (m_viewer)
|
if (m_viewer)
|
||||||
@@ -1124,3 +1119,291 @@ void Rim3dView::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
|
|||||||
RimViewWindow::setMdiWindowGeometry(windowGeometry);
|
RimViewWindow::setMdiWindowGeometry(windowGeometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimGridView, "GenericGridView"); // Do not use. Abstract class
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGridView::RimGridView()
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_rangeFilterCollection, "RangeFilters", "Range Filters", "", "", "");
|
||||||
|
m_rangeFilterCollection.uiCapability()->setUiHidden(true);
|
||||||
|
m_rangeFilterCollection = new RimCellRangeFilterCollection();
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_overrideRangeFilterCollection, "RangeFiltersControlled", "Range Filters (controlled)", "", "", "");
|
||||||
|
m_overrideRangeFilterCollection.uiCapability()->setUiHidden(true);
|
||||||
|
m_overrideRangeFilterCollection.xmlCapability()->setIOWritable(false);
|
||||||
|
m_overrideRangeFilterCollection.xmlCapability()->setIOReadable(false);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&crossSectionCollection, "CrossSections", "Intersections", "", "", "");
|
||||||
|
crossSectionCollection.uiCapability()->setUiHidden(true);
|
||||||
|
crossSectionCollection = new RimIntersectionCollection();
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_gridCollection, "GridCollection", "GridCollection", "", "", "");
|
||||||
|
m_gridCollection.uiCapability()->setUiHidden(true);
|
||||||
|
m_gridCollection = new RimGridCollection();
|
||||||
|
|
||||||
|
m_previousGridModeMeshLinesWasFaults = false;
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_overlayInfoConfig, "OverlayInfoConfig", "Info Box", "", "", "");
|
||||||
|
m_overlayInfoConfig = new Rim3dOverlayInfoConfig();
|
||||||
|
m_overlayInfoConfig->setReservoirView(this);
|
||||||
|
m_overlayInfoConfig.uiCapability()->setUiHidden(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGridView::~RimGridView(void)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
delete this->m_overlayInfoConfig();
|
||||||
|
|
||||||
|
delete m_rangeFilterCollection;
|
||||||
|
delete m_overrideRangeFilterCollection;
|
||||||
|
delete crossSectionCollection;
|
||||||
|
delete m_gridCollection;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
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;
|
||||||
|
m_gridCollection->updateConnectedEditors();
|
||||||
|
m_gridCollection->updateUiIconFromState(enableGridCells);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
// Surf: No Fault Surf
|
||||||
|
// Mesh -------------
|
||||||
|
// No F F G
|
||||||
|
// Fault F F G
|
||||||
|
// Mesh G G G
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGridView::isGridVisualizationMode() const
|
||||||
|
{
|
||||||
|
return ( this->surfaceMode() == SURFACE
|
||||||
|
|| this->meshMode() == FULL_MESH);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if (changedField == &scaleZ)
|
||||||
|
{
|
||||||
|
crossSectionCollection->updateIntersectionBoxGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
Rim3dView::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::ref<cvf::UByteArray> RimGridView::currentTotalCellVisibility()
|
||||||
|
{
|
||||||
|
if (m_currentReservoirCellVisibility.isNull())
|
||||||
|
{
|
||||||
|
m_currentReservoirCellVisibility = new cvf::UByteArray;
|
||||||
|
this->calculateCurrentTotalCellVisibility(m_currentReservoirCellVisibility.p(), m_currentTimeStep());
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_currentReservoirCellVisibility;
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimCellRangeFilterCollection* RimGridView::rangeFilterCollection()
|
||||||
|
{
|
||||||
|
if (this->viewController() && this->viewController()->isRangeFiltersControlled() && m_overrideRangeFilterCollection)
|
||||||
|
{
|
||||||
|
return m_overrideRangeFilterCollection;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_rangeFilterCollection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const RimCellRangeFilterCollection* RimGridView::rangeFilterCollection() const
|
||||||
|
{
|
||||||
|
if (this->viewController() && this->viewController()->isRangeFiltersControlled() && m_overrideRangeFilterCollection)
|
||||||
|
{
|
||||||
|
return m_overrideRangeFilterCollection;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_rangeFilterCollection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool Rim3dView::hasOverridenRangeFilterCollection()
|
||||||
|
{
|
||||||
|
return m_overrideRangeFilterCollection() != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridView::setOverrideRangeFilterCollection(RimCellRangeFilterCollection* rfc)
|
||||||
|
{
|
||||||
|
if (m_overrideRangeFilterCollection()) delete m_overrideRangeFilterCollection();
|
||||||
|
|
||||||
|
m_overrideRangeFilterCollection = rfc;
|
||||||
|
this->scheduleGeometryRegen(RANGE_FILTERED);
|
||||||
|
this->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
||||||
|
|
||||||
|
this->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridView::replaceRangeFilterCollectionWithOverride()
|
||||||
|
{
|
||||||
|
RimCellRangeFilterCollection* overrideRfc = m_overrideRangeFilterCollection;
|
||||||
|
CVF_ASSERT(overrideRfc);
|
||||||
|
|
||||||
|
RimCellRangeFilterCollection* currentRfc = m_rangeFilterCollection;
|
||||||
|
if (currentRfc)
|
||||||
|
{
|
||||||
|
delete currentRfc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must call removeChildObject() to make sure the object has no parent
|
||||||
|
// No parent is required when assigning a object into a field
|
||||||
|
m_overrideRangeFilterCollection.removeChildObject(overrideRfc);
|
||||||
|
|
||||||
|
m_rangeFilterCollection = overrideRfc;
|
||||||
|
|
||||||
|
this->uiCapability()->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimViewController* RimGridView::viewController() const
|
||||||
|
{
|
||||||
|
RimViewController* viewController = NULL;
|
||||||
|
std::vector<caf::PdmObjectHandle*> reffingObjs;
|
||||||
|
|
||||||
|
this->objectsWithReferringPtrFields(reffingObjs);
|
||||||
|
for (size_t i = 0; i < reffingObjs.size(); ++i)
|
||||||
|
{
|
||||||
|
viewController = dynamic_cast<RimViewController*>(reffingObjs[i]);
|
||||||
|
if (viewController) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return viewController;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGridView::isMasterView() const
|
||||||
|
{
|
||||||
|
RimViewLinker* viewLinker = this->assosiatedViewLinker();
|
||||||
|
if (viewLinker && this == viewLinker->masterView())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimViewLinker* RimGridView::assosiatedViewLinker() const
|
||||||
|
{
|
||||||
|
RimViewLinker* viewLinker = this->viewLinkerIfMasterView();
|
||||||
|
if (!viewLinker)
|
||||||
|
{
|
||||||
|
RimViewController* viewController = this->viewController();
|
||||||
|
if (viewController)
|
||||||
|
{
|
||||||
|
viewLinker = viewController->ownerViewLinker();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return viewLinker;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Rim3dOverlayInfoConfig* RimGridView::overlayInfoConfig() const
|
||||||
|
{
|
||||||
|
return m_overlayInfoConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridView::selectOverlayInfoConfig()
|
||||||
|
{
|
||||||
|
RiuMainWindow::instance()->selectAsCurrentItem(m_overlayInfoConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridView::removeModelByName(cvf::Scene* scene, const cvf::String& modelName)
|
||||||
|
{
|
||||||
|
std::vector<cvf::Model*> modelsToBeRemoved;
|
||||||
|
for (cvf::uint i = 0; i < scene->modelCount(); i++)
|
||||||
|
{
|
||||||
|
if (scene->model(i)->name() == modelName)
|
||||||
|
{
|
||||||
|
modelsToBeRemoved.push_back(scene->model(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < modelsToBeRemoved.size(); i++)
|
||||||
|
{
|
||||||
|
scene->removeModel(modelsToBeRemoved[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -243,5 +243,58 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RimGridView : public Rim3dView
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimGridView();
|
||||||
|
virtual ~RimGridView(void);
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
caf::PdmChildField<RimIntersectionCollection*> crossSectionCollection;
|
||||||
|
|
||||||
|
void showGridCells(bool enableGridCells);
|
||||||
|
bool isGridVisualizationMode() const;
|
||||||
|
|
||||||
|
cvf::ref<cvf::UByteArray> currentTotalCellVisibility();
|
||||||
|
|
||||||
|
virtual const RimPropertyFilterCollection* propertyFilterCollection() const = 0;
|
||||||
|
RimCellRangeFilterCollection* rangeFilterCollection();
|
||||||
|
const RimCellRangeFilterCollection* rangeFilterCollection() const;
|
||||||
|
|
||||||
|
bool hasOverridenRangeFilterCollection();
|
||||||
|
void setOverrideRangeFilterCollection(RimCellRangeFilterCollection* rfc);
|
||||||
|
void replaceRangeFilterCollectionWithOverride();
|
||||||
|
|
||||||
|
RimViewController* viewController() const override;
|
||||||
|
bool isMasterView() const;
|
||||||
|
RimViewLinker* assosiatedViewLinker() const override;
|
||||||
|
|
||||||
|
Rim3dOverlayInfoConfig* overlayInfoConfig() const;
|
||||||
|
protected:
|
||||||
|
static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName);
|
||||||
|
|
||||||
|
virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) = 0;
|
||||||
|
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStep) = 0;
|
||||||
|
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
|
||||||
|
virtual void selectOverlayInfoConfig() override;
|
||||||
|
|
||||||
|
protected: // Fields
|
||||||
|
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
|
||||||
|
|
||||||
|
caf::PdmChildField<RimCellRangeFilterCollection*> m_rangeFilterCollection;
|
||||||
|
caf::PdmChildField<RimCellRangeFilterCollection*> m_overrideRangeFilterCollection;
|
||||||
|
|
||||||
|
caf::PdmChildField<RimGridCollection*> m_gridCollection;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
cvf::ref<cvf::UByteArray> m_currentReservoirCellVisibility;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RimViewLinker* viewLinkerIfMasterView() const;
|
||||||
|
bool m_previousGridModeMeshLinesWasFaults;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ enum PartRenderMaskEnum
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimEclipseView : public Rim3dView
|
class RimEclipseView : public RimGridView
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace cvf {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimGeoMechView : public Rim3dView
|
class RimGeoMechView : public RimGridView
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user