#2591 3D well log curves: Option to turn grid on/off

This commit is contained in:
Unknown
2018-03-20 11:29:59 +01:00
committed by unknown
parent 60120c70d5
commit 8766ea3057
9 changed files with 111 additions and 24 deletions
@@ -61,7 +61,7 @@ cvf::ref<cvf::DrawableGeo>
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform, cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
const Rim3dWellLogCurve* rim3dWellLogCurve, const Rim3dWellLogCurve::DrawPlane drawPlane,
double gridIntervalSize) const double gridIntervalSize) const
{ {
CVF_ASSERT(gridIntervalSize > 0); CVF_ASSERT(gridIntervalSize > 0);
@@ -89,7 +89,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
md += gridIntervalSize; md += gridIntervalSize;
} }
pointNormals = calculatePointNormals(rim3dWellLogCurve->drawPlane(), gridPoints); pointNormals = calculatePointNormals(drawPlane, gridPoints);
if (pointNormals.size() != gridPoints.size()) return nullptr; if (pointNormals.size() != gridPoints.size()) return nullptr;
std::vector<cvf::Vec3f> vertices; std::vector<cvf::Vec3f> vertices;
@@ -44,9 +44,10 @@ public:
cvf::ref<cvf::DrawableGeo> createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform, cvf::ref<cvf::DrawableGeo> createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform,
const Rim3dWellLogCurve* rim3dWellLogCurve) const; const Rim3dWellLogCurve* rim3dWellLogCurve) const;
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
const Rim3dWellLogCurve* rim3dWellLogCurve, cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
double gridIntervalSize) const; const Rim3dWellLogCurve::DrawPlane drawPlane,
double gridIntervalSize) const;
private: private:
void createCurveVerticesAndIndices(const Rim3dWellLogCurve* rim3dWellLogCurve, void createCurveVerticesAndIndices(const Rim3dWellLogCurve* rim3dWellLogCurve,
@@ -61,8 +61,8 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
continue; continue;
} }
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(255, 0, 0, 0.5), caf::PO_1); caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.9f, 0.0f, 0.0f));
cvf::ref<cvf::Effect> effect = surfaceGen.generateCachedEffect(); cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
cvf::ref<cvf::Part> part = new cvf::Part; cvf::ref<cvf::Part> part = new cvf::Part;
part->setDrawable(curveDrawable.p()); part->setDrawable(curveDrawable.p());
@@ -73,24 +73,48 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
model->addPart(part.p()); model->addPart(part.p());
} }
} }
}
//TODO: Atm, only the grid for the first curve is drawn. cvf::ref<cvf::Part> Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable, cvf::Effect* effect)
cvf::ref<cvf::Drawable> gridDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(displayCoordTransform, rim3dWellLogCurves[0], 200); {
cvf::ref<cvf::Part> part = new cvf::Part;
if (gridDrawable.isNull() || !gridDrawable->boundingBox().isValid()) if (drawable && drawable->boundingBox().isValid())
{ {
return; part->setDrawable(drawable);
part->setEffect(effect);
} }
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(255, 255, 0, 1), caf::PO_1); return part;
cvf::ref<cvf::Effect> effect = surfaceGen.generateCachedEffect(); }
cvf::ref<cvf::Part> part = new cvf::Part; //--------------------------------------------------------------------------------------------------
part->setDrawable(gridDrawable.p()); ///
part->setEffect(effect.p()); //--------------------------------------------------------------------------------------------------
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double gridIntervalSize)
{
caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f));
if (part.notNull())
{ {
model->addPart(part.p()); cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(displayCoordTransform, Rim3dWellLogCurve::HORIZONTAL_LEFT, gridIntervalSize);
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
if (part.notNull())
{
model->addPart(part.p());
}
}
{
cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(displayCoordTransform, Rim3dWellLogCurve::HORIZONTAL_RIGHT, gridIntervalSize);
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
if (part.notNull())
{
model->addPart(part.p());
}
} }
} }
@@ -30,6 +30,9 @@
namespace cvf namespace cvf
{ {
class ModelBasicList; class ModelBasicList;
class Drawable;
class Effect;
class Part;
} }
namespace caf namespace caf
@@ -49,6 +52,11 @@ public:
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
std::vector<Rim3dWellLogCurve*> rim3dWellLogCurves); std::vector<Rim3dWellLogCurve*> rim3dWellLogCurves);
void appendGridToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
double gridIntervalSize);
private:
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
private: private:
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator; cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator;
cvf::ref<RigWellPath> m_wellPathGeometry; cvf::ref<RigWellPath> m_wellPathGeometry;
@@ -28,6 +28,7 @@
#include "RigVirtualPerforationTransmissibilities.h" #include "RigVirtualPerforationTransmissibilities.h"
#include "RigWellPath.h" #include "RigWellPath.h"
#include "Rim3dWellLogCurveCollection.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimFishboneWellPath.h" #include "RimFishboneWellPath.h"
@@ -457,17 +458,26 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
if (m_rimWellPath.isNull()) return; if (m_rimWellPath.isNull()) return;
if (wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) if (wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
return;
if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false) if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false)
{
return; return;
}
appendPerforationsToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize); appendPerforationsToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize);
appendVirtualTransmissibilitiesToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize); appendVirtualTransmissibilitiesToModel(model, timeStepIndex, displayCoordTransform, characteristicCellSize);
if (!m_rimWellPath->rim3dWellLogCurveCollection()) return;
if (!m_rimWellPath->rim3dWellLogCurveCollection()->showPlot()) return;
m_3dWellLogCurvePartMgr = new Riv3dWellLogPlanePartMgr(m_rimWellPath->wellPathGeometry()); m_3dWellLogCurvePartMgr = new Riv3dWellLogPlanePartMgr(m_rimWellPath->wellPathGeometry());
m_3dWellLogCurvePartMgr->append3dWellLogCurvesToModel(model, displayCoordTransform, m_rimWellPath->vectorOf3dWellLogCurves()); m_3dWellLogCurvePartMgr->append3dWellLogCurvesToModel(model, displayCoordTransform, m_rimWellPath->vectorOf3dWellLogCurves());
if (m_rimWellPath->rim3dWellLogCurveCollection()->showGrid())
{
m_3dWellLogCurvePartMgr->appendGridToModel(model, displayCoordTransform, 200);
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -19,6 +19,7 @@
#include "Rim3dWellLogCurveCollection.h" #include "Rim3dWellLogCurveCollection.h"
#include "Rim3dWellLogCurve.h" #include "Rim3dWellLogCurve.h"
#include "RimProject.h"
CAF_PDM_SOURCE_INIT(Rim3dWellLogCurveCollection, "Rim3dWellLogCurveCollection"); CAF_PDM_SOURCE_INIT(Rim3dWellLogCurveCollection, "Rim3dWellLogCurveCollection");
@@ -29,8 +30,10 @@ Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection()
{ {
CAF_PDM_InitObject("3D Track", ":/WellLogCurve16x16.png", "", ""); CAF_PDM_InitObject("3D Track", ":/WellLogCurve16x16.png", "", "");
CAF_PDM_InitField(&m_showCurves, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", ""); CAF_PDM_InitField(&m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", "");
m_showCurves.uiCapability()->setUiHidden(true); m_showPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_3dWellLogCurves, "ArrayOf3dWellLogCurves", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_3dWellLogCurves, "ArrayOf3dWellLogCurves", "", "", "", "");
m_3dWellLogCurves.uiCapability()->setUiTreeHidden(true); m_3dWellLogCurves.uiCapability()->setUiTreeHidden(true);
@@ -63,6 +66,22 @@ void Rim3dWellLogCurveCollection::add3dWellLogCurve(Rim3dWellLogCurve* curve)
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogCurveCollection::showGrid() const
{
return m_showGrid;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogCurveCollection::showPlot() const
{
return m_showPlot;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -77,10 +96,20 @@ std::vector<Rim3dWellLogCurve*> Rim3dWellLogCurveCollection::vectorOf3dWellLogCu
return curves; return curves;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurveCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
proj->createDisplayModelAndRedrawAllViews();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* Rim3dWellLogCurveCollection::objectToggleField() caf::PdmFieldHandle* Rim3dWellLogCurveCollection::objectToggleField()
{ {
return &m_showCurves; return &m_showPlot;
} }
@@ -39,12 +39,18 @@ public:
bool has3dWellLogCurves() const; bool has3dWellLogCurves() const;
void add3dWellLogCurve(Rim3dWellLogCurve* curve); void add3dWellLogCurve(Rim3dWellLogCurve* curve);
bool showGrid() const;
bool showPlot() const;
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const; std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
private: private:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual caf::PdmFieldHandle* objectToggleField() override; virtual caf::PdmFieldHandle* objectToggleField() override;
private: private:
caf::PdmField<bool> m_showCurves; caf::PdmField<bool> m_showPlot;
caf::PdmField<bool> m_showGrid;
caf::PdmChildArrayField<Rim3dWellLogCurve*> m_3dWellLogCurves; caf::PdmChildArrayField<Rim3dWellLogCurve*> m_3dWellLogCurves;
}; };
@@ -817,6 +817,14 @@ std::vector<Rim3dWellLogCurve*> RimWellPath::vectorOf3dWellLogCurves() const
return m_3dWellLogCurves->vectorOf3dWellLogCurves(); return m_3dWellLogCurves->vectorOf3dWellLogCurves();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurveCollection* RimWellPath::rim3dWellLogCurveCollection() const
{
return m_3dWellLogCurves();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -81,6 +81,7 @@ public:
void add3dWellLogCurve(Rim3dWellLogCurve* rim3dWellLogCurve); void add3dWellLogCurve(Rim3dWellLogCurve* rim3dWellLogCurve);
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const; std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
Rim3dWellLogCurveCollection* rim3dWellLogCurveCollection() const;
virtual caf::PdmFieldHandle* userDescriptionField() override; virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual caf::PdmFieldHandle* objectToggleField() override; virtual caf::PdmFieldHandle* objectToggleField() override;