3D Well Log Curves(#2671): Make curve draw plane background optional

This commit is contained in:
Gaute Lindkvist 2018-04-17 08:30:06 +02:00
parent 092624799e
commit 501e80b1ad
6 changed files with 56 additions and 42 deletions

View File

@ -69,19 +69,9 @@ void Riv3dWellLogPlanePartMgr::appendPlaneToModel(cvf::ModelBasicList*
append3dWellLogCurvesToModel(model, displayCoordTransform, wellPathClipBoundingBox); append3dWellLogCurvesToModel(model, displayCoordTransform, wellPathClipBoundingBox);
if (m_wellPath->rim3dWellLogCurveCollection()->isShowingGrid())
{
std::set<Rim3dWellLogCurve::DrawPlane> drawPlanes;
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves()) for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
{ {
drawPlanes.insert(rim3dWellLogCurve->drawPlane()); appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve, planeWidth());
}
for (const Rim3dWellLogCurve::DrawPlane& drawPlane : drawPlanes)
{
appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, drawPlane, planeWidth());
}
} }
} }
@ -217,11 +207,13 @@ cvf::Color3f Riv3dWellLogPlanePartMgr::curveColor(size_t index)
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox, const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve::DrawPlane& drawPlane, const Rim3dWellLogCurve* rim3dWellLogCurve,
double gridIntervalSize) double gridIntervalSize)
{ {
const Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection(); const Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection();
Rim3dWellLogCurveCollection::PlanePosition planePosition = curveCollection->planePosition(); Rim3dWellLogCurveCollection::PlanePosition planePosition = curveCollection->planePosition();
bool showGrid = curveCollection->isShowingGrid();
bool showBackground = curveCollection->isShowingBackground();
caf::SurfaceEffectGenerator backgroundEffectGen(cvf::Color4f(1.0, 1.0, 1.0, 1.0), caf::PO_2); caf::SurfaceEffectGenerator backgroundEffectGen(cvf::Color4f(1.0, 1.0, 1.0, 1.0), caf::PO_2);
caf::MeshEffectGenerator gridBorderEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f)); caf::MeshEffectGenerator gridBorderEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f));
@ -230,7 +222,7 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform, bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform,
wellPathClipBoundingBox, wellPathClipBoundingBox,
planeAngle(drawPlane), planeAngle(rim3dWellLogCurve->drawPlane()),
wellPathCenterToPlotStartOffset(planePosition), wellPathCenterToPlotStartOffset(planePosition),
planeWidth(), planeWidth(),
gridIntervalSize); gridIntervalSize);
@ -241,7 +233,7 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
cvf::ref<cvf::Effect> curveNormalsEffect = curveNormalsEffectGen.generateCachedEffect(); cvf::ref<cvf::Effect> curveNormalsEffect = curveNormalsEffectGen.generateCachedEffect();
cvf::ref<cvf::DrawableGeo> background = m_3dWellLogGridGeometryGenerator->background(); cvf::ref<cvf::DrawableGeo> background = m_3dWellLogGridGeometryGenerator->background();
if (background.notNull()) if (showBackground && background.notNull())
{ {
cvf::ref<cvf::Part> part = createPart(background.p(), backgroundEffect.p()); cvf::ref<cvf::Part> part = createPart(background.p(), backgroundEffect.p());
if (part.notNull()) if (part.notNull())
@ -250,6 +242,7 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
} }
} }
if (showGrid) {
cvf::ref<cvf::DrawableGeo> border = m_3dWellLogGridGeometryGenerator->border(); cvf::ref<cvf::DrawableGeo> border = m_3dWellLogGridGeometryGenerator->border();
if (border.notNull()) if (border.notNull())
{ {
@ -270,3 +263,4 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
} }
} }
} }
}

View File

@ -64,7 +64,7 @@ private:
void appendGridToModel(cvf::ModelBasicList* model, void appendGridToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox, const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve::DrawPlane& drawPlane, const Rim3dWellLogCurve* rim3dWellLogCurve,
double gridIntervalSize); double gridIntervalSize);
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect); cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);

View File

@ -18,6 +18,7 @@
#include "Rim3dWellLogCurveCollection.h" #include "Rim3dWellLogCurveCollection.h"
#include "RiaColorTables.h"
#include "Rim3dWellLogCurve.h" #include "Rim3dWellLogCurve.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimProject.h" #include "RimProject.h"
@ -45,10 +46,10 @@ Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection()
CAF_PDM_InitField(&m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", ""); CAF_PDM_InitField(&m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", "");
m_showPlot.uiCapability()->setUiHidden(true); m_showPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_planePosition, "PlanePosition", "Plane Position", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_planePosition, "PlanePosition", "Plane Position", "", "", "");
CAF_PDM_InitField(&m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", "");
CAF_PDM_InitField(&m_showBackground, "Show3dWellLogBackground", false, "Show Background", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_3dWellLogCurves, "ArrayOf3dWellLogCurves", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_3dWellLogCurves, "ArrayOf3dWellLogCurves", "", "", "", "");
m_3dWellLogCurves.uiCapability()->setUiTreeHidden(true); m_3dWellLogCurves.uiCapability()->setUiTreeHidden(true);
} }
@ -88,6 +89,14 @@ void Rim3dWellLogCurveCollection::remove3dWellLogCurve(Rim3dWellLogCurve* curve)
m_3dWellLogCurves.removeChildObject(curve); m_3dWellLogCurves.removeChildObject(curve);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogCurveCollection::isShowingPlot() const
{
return m_showPlot;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -99,11 +108,12 @@ bool Rim3dWellLogCurveCollection::isShowingGrid() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool Rim3dWellLogCurveCollection::isShowingPlot() const bool Rim3dWellLogCurveCollection::isShowingBackground() const
{ {
return m_showPlot; return m_showBackground;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -168,8 +178,12 @@ caf::PdmFieldHandle* Rim3dWellLogCurveCollection::objectToggleField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurveCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void Rim3dWellLogCurveCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{ {
caf::PdmUiGroup* settingsGroup = uiOrdering.addNewGroup("Track Settings"); caf::PdmUiGroup* settingsGroup = uiOrdering.addNewGroup("Draw Plane Settings");
settingsGroup->add(&m_showGrid);
settingsGroup->add(&m_planePosition); settingsGroup->add(&m_planePosition);
caf::PdmUiGroup* appearanceSettingsGroup = uiOrdering.addNewGroup("Draw Plane Appearance");
appearanceSettingsGroup->add(&m_showGrid);
appearanceSettingsGroup->add(&m_showBackground);
} }

View File

@ -48,13 +48,15 @@ public:
void add3dWellLogCurve(Rim3dWellLogCurve* curve); void add3dWellLogCurve(Rim3dWellLogCurve* curve);
void remove3dWellLogCurve(Rim3dWellLogCurve* curve); void remove3dWellLogCurve(Rim3dWellLogCurve* curve);
bool isShowingGrid() const;
bool isShowingPlot() const; bool isShowingPlot() const;
bool isShowingGrid() const;
bool isShowingBackground() const;
PlanePosition planePosition() const; PlanePosition planePosition() const;
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const; std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
void redrawAffectedViewsAndEditors(); void redrawAffectedViewsAndEditors();
private: private:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual caf::PdmFieldHandle* objectToggleField() override; virtual caf::PdmFieldHandle* objectToggleField() override;
@ -63,8 +65,11 @@ private:
private: private:
caf::PdmField<bool> m_showPlot; caf::PdmField<bool> m_showPlot;
caf::PdmField<bool> m_showGrid;
caf::PdmField<caf::AppEnum<PlanePosition>> m_planePosition; caf::PdmField<caf::AppEnum<PlanePosition>> m_planePosition;
caf::PdmField<bool> m_showGrid;
caf::PdmField<bool> m_showBackground;
caf::PdmChildArrayField<Rim3dWellLogCurve*> m_3dWellLogCurves; caf::PdmChildArrayField<Rim3dWellLogCurve*> m_3dWellLogCurves;
}; };

View File

@ -164,8 +164,10 @@ caf::PdmFieldHandle* Rim3dWellLogCurve::userDescriptionField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering) void Rim3dWellLogCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering)
{ {
uiOrdering.add(&m_drawPlane); caf::PdmUiGroup* curveAppearanceGroup = uiOrdering.addNewGroup("Curve Appearance");
uiOrdering.add(&m_drawStyle); curveAppearanceGroup->add(&m_drawPlane);
uiOrdering.add(&m_coloringStyle); curveAppearanceGroup->add(&m_drawStyle);
curveAppearanceGroup->add(&m_coloringStyle);
} }

View File

@ -71,7 +71,6 @@ protected:
virtual caf::PdmFieldHandle* objectToggleField() override; virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual caf::PdmFieldHandle* userDescriptionField() override; virtual caf::PdmFieldHandle* userDescriptionField() override;
void appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering); void appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering);
protected: protected: