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);
if (m_wellPath->rim3dWellLogCurveCollection()->isShowingGrid())
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
{
std::set<Rim3dWellLogCurve::DrawPlane> drawPlanes;
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
{
drawPlanes.insert(rim3dWellLogCurve->drawPlane());
}
for (const Rim3dWellLogCurve::DrawPlane& drawPlane : drawPlanes)
{
appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, drawPlane, planeWidth());
}
appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve, planeWidth());
}
}
@ -217,11 +207,13 @@ cvf::Color3f Riv3dWellLogPlanePartMgr::curveColor(size_t index)
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve::DrawPlane& drawPlane,
const Rim3dWellLogCurve* rim3dWellLogCurve,
double gridIntervalSize)
{
const Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection();
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::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,
wellPathClipBoundingBox,
planeAngle(drawPlane),
planeAngle(rim3dWellLogCurve->drawPlane()),
wellPathCenterToPlotStartOffset(planePosition),
planeWidth(),
gridIntervalSize);
@ -241,7 +233,7 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
cvf::ref<cvf::Effect> curveNormalsEffect = curveNormalsEffectGen.generateCachedEffect();
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());
if (part.notNull())
@ -250,23 +242,25 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
}
}
cvf::ref<cvf::DrawableGeo> border = m_3dWellLogGridGeometryGenerator->border();
if (border.notNull())
{
cvf::ref<cvf::Part> part = createPart(border.p(), borderEffect.p());
if (part.notNull())
if (showGrid) {
cvf::ref<cvf::DrawableGeo> border = m_3dWellLogGridGeometryGenerator->border();
if (border.notNull())
{
model->addPart(part.p());
cvf::ref<cvf::Part> part = createPart(border.p(), borderEffect.p());
if (part.notNull())
{
model->addPart(part.p());
}
}
}
cvf::ref<cvf::DrawableGeo> normals = m_3dWellLogGridGeometryGenerator->curveNormalLines();
if (normals.notNull())
{
cvf::ref<cvf::Part> part = createPart(normals.p(), curveNormalsEffect.p());
if (part.notNull())
cvf::ref<cvf::DrawableGeo> normals = m_3dWellLogGridGeometryGenerator->curveNormalLines();
if (normals.notNull())
{
model->addPart(part.p());
cvf::ref<cvf::Part> part = createPart(normals.p(), curveNormalsEffect.p());
if (part.notNull())
{
model->addPart(part.p());
}
}
}
}

View File

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

View File

@ -18,6 +18,7 @@
#include "Rim3dWellLogCurveCollection.h"
#include "RiaColorTables.h"
#include "Rim3dWellLogCurve.h"
#include "RimWellPath.h"
#include "RimProject.h"
@ -45,10 +46,10 @@ Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection()
CAF_PDM_InitField(&m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", "");
m_showPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", "");
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", "", "", "", "");
m_3dWellLogCurves.uiCapability()->setUiTreeHidden(true);
}
@ -88,6 +89,14 @@ void Rim3dWellLogCurveCollection::remove3dWellLogCurve(Rim3dWellLogCurve* curve)
m_3dWellLogCurves.removeChildObject(curve);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogCurveCollection::isShowingPlot() const
{
return m_showPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -99,13 +108,14 @@ bool Rim3dWellLogCurveCollection::isShowingGrid() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogCurveCollection::isShowingPlot() const
bool Rim3dWellLogCurveCollection::isShowingBackground() const
{
return m_showPlot;
return m_showBackground;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurveCollection::PlanePosition Rim3dWellLogCurveCollection::planePosition() const
{
@ -168,8 +178,12 @@ caf::PdmFieldHandle* Rim3dWellLogCurveCollection::objectToggleField()
//--------------------------------------------------------------------------------------------------
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);
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 remove3dWellLogCurve(Rim3dWellLogCurve* curve);
bool isShowingGrid() const;
bool isShowingPlot() const;
bool isShowingGrid() const;
bool isShowingBackground() const;
PlanePosition planePosition() const;
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
void redrawAffectedViewsAndEditors();
private:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual caf::PdmFieldHandle* objectToggleField() override;
@ -63,8 +65,11 @@ private:
private:
caf::PdmField<bool> m_showPlot;
caf::PdmField<bool> m_showGrid;
caf::PdmField<caf::AppEnum<PlanePosition>> m_planePosition;
caf::PdmField<bool> m_showGrid;
caf::PdmField<bool> m_showBackground;
caf::PdmChildArrayField<Rim3dWellLogCurve*> m_3dWellLogCurves;
};

View File

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

View File

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