mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' of https://github.com/OPM/ResInsight into dev
This commit is contained in:
commit
4cb05f548b
@ -6,6 +6,7 @@ endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RivCellEdgeEffectGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivColorTableArray.h
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultPart.h
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultGeometryGenerator.h
|
||||
@ -22,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RivCellEdgeEffectGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivColorTableArray.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultPart.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultGeometryGenerator.cpp
|
||||
|
43
ApplicationCode/ModelVisualization/RivColorTableArray.cpp
Normal file
43
ApplicationCode/ModelVisualization/RivColorTableArray.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA, Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivColorTableArray.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Color3fArray> RivColorTableArray::colorTableArray()
|
||||
{
|
||||
cvf::ref<cvf::Color3fArray> partColors = new cvf::Color3fArray();
|
||||
partColors->reserve(10);
|
||||
|
||||
partColors->add(cvf::Color3f(101.0f/255, 132.0f/255, 96.0f/255)); // Dark green
|
||||
partColors->add(cvf::Color3f(255.0f/255, 131.0f/255, 140.0f/255)); // Old pink
|
||||
partColors->add(cvf::Color3f(210.0f/255, 176.0f/255, 112.0f/255)); // Light Brown
|
||||
partColors->add(cvf::Color3f(140.0f/255, 171.0f/255, 238.0f/255)); // Light gray blue
|
||||
partColors->add(cvf::Color3f(255.0f/255, 205.0f/255, 131.0f/255)); // Peach
|
||||
partColors->add(cvf::Color3f(220.0f/255, 212.0f/255, 166.0f/255)); // Dark off white
|
||||
partColors->add(cvf::Color3f(130.0f/255, 255.0f/255, 120.0f/255)); // Light green
|
||||
partColors->add(cvf::Color3f(166.0f/255, 220.0f/255, 215.0f/255)); // Light gray torquise
|
||||
partColors->add(cvf::Color3f(168.0f/255, 220.0f/255, 166.0f/255)); // Light gray green
|
||||
partColors->add(cvf::Color3f(255.0f/255, 64.0f/255, 236.0f/255)); // Magneta
|
||||
|
||||
return partColors;
|
||||
}
|
||||
|
29
ApplicationCode/ModelVisualization/RivColorTableArray.h
Normal file
29
ApplicationCode/ModelVisualization/RivColorTableArray.h
Normal file
@ -0,0 +1,29 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA, Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
class RivColorTableArray
|
||||
{
|
||||
public:
|
||||
static cvf::ref<cvf::Color3fArray> colorTableArray();
|
||||
};
|
@ -54,7 +54,6 @@ RivFaultPart::RivFaultPart(const RigGridBase* grid, const RimFault* rimFault)
|
||||
m_rimFault(rimFault),
|
||||
m_opacityLevel(1.0f),
|
||||
m_defaultColor(cvf::Color3::WHITE)
|
||||
|
||||
{
|
||||
m_faultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
}
|
||||
@ -74,44 +73,9 @@ void RivFaultPart::setCellVisibility(cvf::UByteArray* cellVisibilities)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPart::updateCellColor(cvf::Color4f color)
|
||||
{
|
||||
/*
|
||||
if (m_surfaceFaces.isNull() && m_faultFaces.isNull()) return;
|
||||
|
||||
// Set default effect
|
||||
caf::SurfaceEffectGenerator geometryEffgen(color, true);
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateEffect();
|
||||
|
||||
if (m_surfaceFaces.notNull()) m_surfaceFaces->setEffect(geometryOnlyEffect.p());
|
||||
if (m_faultFaces.notNull()) m_faultFaces->setEffect(geometryOnlyEffect.p());
|
||||
|
||||
if (color.a() < 1.0f)
|
||||
{
|
||||
// Set priority to make sure this transparent geometry are rendered last
|
||||
if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(100);
|
||||
if (m_faultFaces.notNull()) m_faultFaces->setPriority(100);
|
||||
}
|
||||
|
||||
m_opacityLevel = color.a();
|
||||
m_defaultColor = color.toColor3f();
|
||||
|
||||
// Update mesh colors as well, in case of change
|
||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
if (m_faultFaces.notNull())
|
||||
{
|
||||
caf::MeshEffectGenerator faultEffGen(prefs->defaultFaultGridLineColors());
|
||||
eff = faultEffGen.generateEffect();
|
||||
m_faultGridLines->setEffect(eff.p());
|
||||
}
|
||||
if (m_surfaceFaces.notNull())
|
||||
{
|
||||
caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors());
|
||||
eff = effGen.generateEffect();
|
||||
m_surfaceGridLines->setEffect(eff.p());
|
||||
}
|
||||
*/
|
||||
m_defaultColor = color;
|
||||
|
||||
updatePartEffect();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -251,13 +215,8 @@ void RivFaultPart::generatePartGeometry()
|
||||
part->setSourceInfo(m_faultGenerator.triangleToSourceGridCellMap().p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
|
||||
// Set default effect
|
||||
caf::SurfaceEffectGenerator geometryEffgen(cvf::Color4f(cvf::Color3f::WHITE), true);
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateEffect();
|
||||
part->setEffect(geometryOnlyEffect.p());
|
||||
|
||||
part->setEnableMask(faultBit);
|
||||
|
||||
m_faultFaces = part;
|
||||
}
|
||||
}
|
||||
@ -278,16 +237,53 @@ void RivFaultPart::generatePartGeometry()
|
||||
|
||||
//part->setTransform(m_scaleTransform.p());
|
||||
part->updateBoundingBox();
|
||||
|
||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
caf::MeshEffectGenerator effGen(prefs->defaultFaultGridLineColors());
|
||||
cvf::ref<cvf::Effect> eff = effGen.generateEffect();
|
||||
|
||||
part->setEnableMask(meshFaultBit);
|
||||
part->setEffect(eff.p());
|
||||
|
||||
m_faultGridLines = part;
|
||||
}
|
||||
}
|
||||
|
||||
updatePartEffect();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPart::updatePartEffect()
|
||||
{
|
||||
if (m_faultFaces.notNull())
|
||||
{
|
||||
cvf::Color3f partColor = m_defaultColor.toColor3f();
|
||||
|
||||
if (m_rimFault->showFaultColor())
|
||||
{
|
||||
partColor = m_rimFault->faultColor();
|
||||
}
|
||||
|
||||
if (m_defaultColor.a() < 1.0f)
|
||||
{
|
||||
// Set priority to make sure this transparent geometry are rendered last
|
||||
m_faultFaces->setPriority(100);
|
||||
}
|
||||
|
||||
m_opacityLevel = m_defaultColor.a();
|
||||
|
||||
// Set default effect
|
||||
caf::SurfaceEffectGenerator geometryEffgen(partColor, true);
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateEffect();
|
||||
|
||||
m_faultFaces->setEffect(geometryOnlyEffect.p());
|
||||
}
|
||||
|
||||
if (m_faultGridLines.notNull())
|
||||
{
|
||||
// Update mesh colors as well, in case of change
|
||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator faultEffGen(prefs->defaultFaultGridLineColors());
|
||||
eff = faultEffGen.generateEffect();
|
||||
m_faultGridLines->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RigGridBase.h"
|
||||
#include "RimFault.h"
|
||||
#include "RivFaultGeometryGenerator.h"
|
||||
#include "cvfColor4.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -46,7 +47,9 @@ class RivFaultPart : public cvf::Object
|
||||
public:
|
||||
RivFaultPart(const RigGridBase* grid, const RimFault* rimFault);
|
||||
|
||||
void setCellVisibility(cvf::UByteArray* cellVisibilities );
|
||||
void setCellVisibility(cvf::UByteArray* cellVisibilities);
|
||||
|
||||
void updatePartEffect();
|
||||
|
||||
void updateCellColor(cvf::Color4f color);
|
||||
void updateCellResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot);
|
||||
@ -65,7 +68,7 @@ private:
|
||||
cvf::ref<cvf::Vec2fArray> m_faultFacesTextureCoords;
|
||||
|
||||
float m_opacityLevel;
|
||||
cvf::Color3f m_defaultColor;
|
||||
cvf::Color4f m_defaultColor;
|
||||
|
||||
|
||||
cvf::ref<cvf::Part> m_faultGridLines;
|
||||
|
@ -46,6 +46,10 @@ RimFault::RimFault()
|
||||
|
||||
CAF_PDM_InitField(&showFaultLabel, "ShowFaultLabel", true, "Show fault label", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showFaultColor, "ShowFaultColor", true, "Show fault color", "", "", "");
|
||||
CAF_PDM_InitField(&faultColor, "Color", cvf::Color3f(0.588f, 0.588f, 0.804f), "Fault color", "", "", "");
|
||||
|
||||
|
||||
m_rigFault = NULL;
|
||||
}
|
||||
|
||||
@ -81,6 +85,17 @@ void RimFault::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const Q
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
if (&faultColor == changedField)
|
||||
{
|
||||
RimReservoirView* reservoirView = NULL;
|
||||
this->firstAncestorOfType(reservoirView);
|
||||
|
||||
if (reservoirView)
|
||||
{
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -22,6 +22,9 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
class RigFault;
|
||||
|
||||
//==================================================================================================
|
||||
@ -49,6 +52,10 @@ public:
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> showFaultLabel;
|
||||
|
||||
caf::PdmField<bool> showFaultColor;
|
||||
caf::PdmField<cvf::Color3f> faultColor;
|
||||
|
||||
|
||||
private:
|
||||
const RigFault* m_rigFault;
|
||||
};
|
||||
|
@ -33,6 +33,11 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimReservoirCellResultsCacher.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RivColorTableArray.h"
|
||||
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFaultCollection, "Faults");
|
||||
@ -124,3 +129,37 @@ RimFault* RimFaultCollection::findFaultByName(QString name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultCollection::syncronizeFaults()
|
||||
{
|
||||
if (!(m_reservoirView && m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData()) ) return;
|
||||
|
||||
cvf::ref<cvf::Color3fArray> partColors = RivColorTableArray::colorTableArray();
|
||||
|
||||
const cvf::Collection<RigFault> rigFaults = m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->faults();
|
||||
|
||||
std::vector<caf::PdmPointer<RimFault> > newFaults;
|
||||
|
||||
// Find corresponding fault from data model, or create a new
|
||||
|
||||
for (size_t fIdx = 0; fIdx < rigFaults.size(); ++fIdx)
|
||||
{
|
||||
RimFault* rimFault = this->findFaultByName(rigFaults[fIdx]->name());
|
||||
|
||||
if (!rimFault)
|
||||
{
|
||||
rimFault = new RimFault();
|
||||
rimFault->faultColor = partColors->get(fIdx % partColors->size());
|
||||
}
|
||||
|
||||
rimFault->setFaultGeometry(rigFaults[fIdx].p());
|
||||
|
||||
newFaults.push_back(rimFault);
|
||||
}
|
||||
|
||||
this->faults().clear();
|
||||
this->faults().insert(0, newFaults);
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
virtual ~RimFaultCollection();
|
||||
|
||||
void setReservoirView(RimReservoirView* ownerReservoirView);
|
||||
void syncronizeFaults();
|
||||
|
||||
caf::PdmField<bool> showGeometryDetectedFaults;
|
||||
|
||||
@ -55,11 +56,12 @@ public:
|
||||
|
||||
caf::PdmPointersField<RimFault*> faults;
|
||||
|
||||
RimFault* findFaultByName(QString name);
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
private:
|
||||
RimFault* findFaultByName(QString name);
|
||||
|
||||
private:
|
||||
RimReservoirView* m_reservoirView;
|
||||
|
||||
|
@ -890,7 +890,8 @@ void RimReservoirView::loadDataAndUpdate()
|
||||
|
||||
this->propertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||
|
||||
syncronizeFaults();
|
||||
this->faultCollection()->setReservoirView(this);
|
||||
this->faultCollection()->syncronizeFaults();
|
||||
|
||||
m_reservoirGridPartManager->clearGeometryCache();
|
||||
|
||||
@ -1406,41 +1407,6 @@ void RimReservoirView::syncronizeWellsWithResults()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::syncronizeFaults()
|
||||
{
|
||||
if (!(m_reservoir && m_reservoir->reservoirData()) ) return;
|
||||
|
||||
const cvf::Collection<RigFault> rigFaults = m_reservoir->reservoirData()->mainGrid()->faults();
|
||||
|
||||
std::vector<caf::PdmPointer<RimFault> > newFaults;
|
||||
|
||||
// Find corresponding fault from data model, or create a new
|
||||
|
||||
for (size_t fIdx = 0; fIdx < rigFaults.size(); ++fIdx)
|
||||
{
|
||||
RimFault* rimFault = this->faultCollection()->findFaultByName(rigFaults[fIdx]->name());
|
||||
|
||||
if (!rimFault)
|
||||
{
|
||||
rimFault = new RimFault();
|
||||
}
|
||||
|
||||
rimFault->setFaultGeometry(rigFaults[fIdx].p());
|
||||
|
||||
newFaults.push_back(rimFault);
|
||||
}
|
||||
|
||||
this->faultCollection()->faults().clear();
|
||||
this->faultCollection()->faults().insert(0, newFaults);
|
||||
|
||||
// Make sure all the faults have their reservoirView ptr setup correctly
|
||||
this->faultCollection()->setReservoirView(this);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -202,7 +202,6 @@ protected:
|
||||
// Really private
|
||||
private:
|
||||
void syncronizeWellsWithResults();
|
||||
void syncronizeFaults();
|
||||
void clampCurrentTimestep();
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user