#2428 Fracture: backwards compatibility of "Show mesh"-toggle

This commit is contained in:
Rebecca Cox 2018-02-02 09:06:24 +01:00
parent f21f6e969f
commit eef5fe6e55
6 changed files with 144 additions and 0 deletions

View File

@ -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);
}
}
}
}
}

View File

@ -49,4 +49,7 @@ public:
void setDefaultConductivityResultIfEmpty();
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
protected:
virtual void initAfterRead() override;
};

View File

@ -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();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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;
};

View File

@ -89,6 +89,14 @@ RimStimPlanColors::~RimStimPlanColors()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanColors::setShowStimPlanMesh(bool showStimPlanMesh)
{
m_showStimPlanMesh = showStimPlanMesh;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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();