mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2428 Fracture: backwards compatibility of "Show mesh"-toggle
This commit is contained in:
parent
f21f6e969f
commit
eef5fe6e55
@ -20,12 +20,25 @@
|
||||
|
||||
#include "RigStatisticsMath.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
#include "RimFracture.h"
|
||||
#include "RimFractureTemplate.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimStimPlanColors.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathFracture.h"
|
||||
#include "RimWellPathFractureCollection.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFractureTemplateCollection, "FractureDefinitionCollection");
|
||||
@ -161,3 +174,107 @@ void RimFractureTemplateCollection::updateFilePathsFromProjectPath(const QString
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureTemplateCollection::initAfterRead()
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
if (proj && proj->isProjectFileVersionEqualOrOlderThan("2018.1.0.103"))
|
||||
{
|
||||
bool setAllShowMeshToFalseOnAllEclipseViews = false;
|
||||
|
||||
std::vector<RimWellPathFracture*> wellPathFractures;
|
||||
RimWellPathCollection* wellPathCollection = proj->activeOilField()->wellPathCollection();
|
||||
wellPathCollection->descendantsIncludingThisOfType(wellPathFractures);
|
||||
|
||||
for (RimWellPathFracture* fracture : wellPathFractures)
|
||||
{
|
||||
RimStimPlanFractureTemplate* stimPlanFractureTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(fracture->fractureTemplate());
|
||||
if (stimPlanFractureTemplate)
|
||||
{
|
||||
if (stimPlanFractureTemplate->showStimPlanMesh() == false)
|
||||
{
|
||||
setAllShowMeshToFalseOnAllEclipseViews = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimEclipseView*> eclipseViews;
|
||||
|
||||
std::vector<RimCase*> rimCases;
|
||||
proj->allCases(rimCases);
|
||||
|
||||
for (RimCase* rimCase : rimCases)
|
||||
{
|
||||
for (Rim3dView* view : rimCase->views())
|
||||
{
|
||||
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(view);
|
||||
if (eclView)
|
||||
{
|
||||
eclipseViews.push_back(eclView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (RimEclipseView* eclipseView : eclipseViews)
|
||||
{
|
||||
if (setAllShowMeshToFalseOnAllEclipseViews)
|
||||
{
|
||||
eclipseView->stimPlanColors->setShowStimPlanMesh(false);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Find all fractures in all simWells
|
||||
std::map<RimStimPlanFractureTemplate*, bool> stimPlanFractureTemplatesInView;
|
||||
|
||||
std::vector<RimFracture*> fractures;
|
||||
if (eclipseView->wellCollection)
|
||||
{
|
||||
eclipseView->wellCollection->descendantsIncludingThisOfType(fractures);
|
||||
}
|
||||
if (fractures.empty()) continue;
|
||||
|
||||
for (RimFracture* fracture : fractures)
|
||||
{
|
||||
RimStimPlanFractureTemplate* stimPlanFractureTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(fracture->fractureTemplate());
|
||||
if (stimPlanFractureTemplate)
|
||||
{
|
||||
stimPlanFractureTemplatesInView[stimPlanFractureTemplate];
|
||||
}
|
||||
}
|
||||
|
||||
if (stimPlanFractureTemplatesInView.empty()) continue;
|
||||
|
||||
auto templateIt = stimPlanFractureTemplatesInView.begin();
|
||||
|
||||
if (stimPlanFractureTemplatesInView.size() == 1)
|
||||
{
|
||||
eclipseView->stimPlanColors->setShowStimPlanMesh(templateIt->first->showStimPlanMesh());
|
||||
}
|
||||
else
|
||||
{
|
||||
bool anySetShowStimPlanMeshIsSetToFalse = false;
|
||||
for (templateIt; templateIt != stimPlanFractureTemplatesInView.end(); templateIt++)
|
||||
{
|
||||
if (templateIt->first->showStimPlanMesh() == false)
|
||||
{
|
||||
anySetShowStimPlanMeshIsSetToFalse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (anySetShowStimPlanMeshIsSetToFalse)
|
||||
{
|
||||
eclipseView->stimPlanColors->setShowStimPlanMesh(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
eclipseView->stimPlanColors->setShowStimPlanMesh(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,4 +49,7 @@ public:
|
||||
void setDefaultConductivityResultIfEmpty();
|
||||
|
||||
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||||
protected:
|
||||
virtual void initAfterRead() override;
|
||||
|
||||
};
|
||||
|
@ -75,6 +75,9 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate()
|
||||
CAF_PDM_InitField(&m_conductivityScalingFactor, "ConductivityFactor", 1.0, "Conductivity Scaling Factor", "", "The conductivity values read from file will be scaled with this parameters", "");
|
||||
CAF_PDM_InitField(&m_conductivityResultNameOnFile, "ConductivityResultName", QString(""), "Active Conductivity Result Name", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_showStimPlanMesh_OBSOLETE, "ShowStimPlanMesh", true, "", "", "", "");
|
||||
m_showStimPlanMesh_OBSOLETE.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_fractureGrid = new RigFractureGrid();
|
||||
m_readError = false;
|
||||
}
|
||||
@ -430,6 +433,14 @@ QString RimStimPlanFractureTemplate::mapUiResultNameToFileResultName(const QStri
|
||||
return fileResultName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimStimPlanFractureTemplate::showStimPlanMesh() const
|
||||
{
|
||||
return m_showStimPlanMesh_OBSOLETE();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -88,6 +88,8 @@ public:
|
||||
QString mapUiResultNameToFileResultName(const QString& uiResultName) const;
|
||||
void setDefaultConductivityResultIfEmpty();
|
||||
|
||||
bool showStimPlanMesh() const;
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
@ -114,4 +116,6 @@ private:
|
||||
caf::PdmField<double> m_conductivityScalingFactor;
|
||||
cvf::ref<RigFractureGrid> m_fractureGrid;
|
||||
bool m_readError;
|
||||
|
||||
caf::PdmField<bool> m_showStimPlanMesh_OBSOLETE;
|
||||
};
|
||||
|
@ -89,6 +89,14 @@ RimStimPlanColors::~RimStimPlanColors()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStimPlanColors::setShowStimPlanMesh(bool showStimPlanMesh)
|
||||
{
|
||||
m_showStimPlanMesh = showStimPlanMesh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
QString unit() const;
|
||||
cvf::Color3f defaultColor() const;
|
||||
bool showStimPlanMesh() const { return m_showStimPlanMesh; }
|
||||
void setShowStimPlanMesh(bool showStimPlanMesh);
|
||||
|
||||
void loadDataAndUpdate();
|
||||
void updateLegendData();
|
||||
|
Loading…
Reference in New Issue
Block a user