3D Well Log Curves (#2673): Consolidate the draw plane position control.

This commit is contained in:
Gaute Lindkvist 2018-04-18 08:38:15 +02:00
parent 56dd1b3eb9
commit d7204363a0
9 changed files with 112 additions and 56 deletions

View File

@ -87,7 +87,6 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
const Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection();
Rim3dWellLogCurveCollection::PlanePosition planePosition = curveCollection->planePosition();
size_t colorIndex = 0;
@ -105,8 +104,8 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
wellPathClipBoundingBox,
resultValues,
resultMds,
planeAngle(rim3dWellLogCurve->drawPlane()),
wellPathCenterToPlotStartOffset(planePosition),
planeAngle(curveCollection, rim3dWellLogCurve),
wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve),
planeWidth());
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
@ -129,6 +128,9 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Part> Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable, cvf::Effect* effect)
{
cvf::ref<cvf::Part> part = new cvf::Part;
@ -145,41 +147,57 @@ cvf::ref<cvf::Part> Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double Riv3dWellLogPlanePartMgr::planeAngle(const Rim3dWellLogCurve::DrawPlane& drawPlane)
double Riv3dWellLogPlanePartMgr::planeAngle(const Rim3dWellLogCurveCollection* collection,
const Rim3dWellLogCurve* curve)
{
switch (drawPlane)
switch (curve->drawPlane())
{
case Rim3dWellLogCurve::HORIZONTAL_LEFT:
return cvf::PI_D / 2.0;
case Rim3dWellLogCurve::HORIZONTAL_RIGHT:
return -cvf::PI_D / 2.0;
case Rim3dWellLogCurve::VERTICAL_ABOVE:
return 0.0;
case Rim3dWellLogCurve::VERTICAL_BELOW:
return cvf::PI_D;
default:
return 0;
case Rim3dWellLogCurve::HORIZONTAL_LEFT:
return cvf::PI_D / 2.0;
case Rim3dWellLogCurve::HORIZONTAL_RIGHT:
if (collection->planePositionHorizontal() == Rim3dWellLogCurveCollection::ON_WELLPATH)
{
return cvf::PI_D / 2.0; // Always left when on well path
}
return -cvf::PI_D / 2.0;
case Rim3dWellLogCurve::VERTICAL_ABOVE:
return 0.0;
case Rim3dWellLogCurve::VERTICAL_BELOW:
if (collection->planePositionVertical() == Rim3dWellLogCurveCollection::ON_WELLPATH)
{
return 0.0; // Always above when on well path.
}
return cvf::PI_D;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double Riv3dWellLogPlanePartMgr::wellPathCenterToPlotStartOffset(Rim3dWellLogCurveCollection::PlanePosition planePosition) const
double Riv3dWellLogPlanePartMgr::wellPathCenterToPlotStartOffset(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve) const
{
if (!m_gridView) return 0;
double cellSize = m_gridView->ownerCase()->characteristicCellSize();
if (planePosition == Rim3dWellLogCurveCollection::ALONG_WELLPATH)
bool centered = false;
if (curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_LEFT ||
curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_RIGHT)
{
double wellPathOffset = std::min(m_wellPath->wellPathRadius(cellSize), 0.1 * planeWidth());
return m_wellPath->wellPathRadius(cellSize) + wellPathOffset;
centered = collection->planePositionHorizontal() == Rim3dWellLogCurveCollection::ON_WELLPATH;
}
else
{
centered = collection->planePositionVertical() == Rim3dWellLogCurveCollection::ON_WELLPATH;
}
if (centered)
{
return -0.5*planeWidth();
}
else
{
double cellSize = m_gridView->ownerCase()->characteristicCellSize();
double wellPathOffset = std::min(m_wellPath->wellPathRadius(cellSize), 0.1 * planeWidth());
return m_wellPath->wellPathRadius(cellSize) + wellPathOffset;
}
}
//--------------------------------------------------------------------------------------------------
@ -204,7 +222,6 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
double gridIntervalSize)
{
const Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection();
Rim3dWellLogCurveCollection::PlanePosition planePosition = curveCollection->planePosition();
bool showGrid = curveCollection->isShowingGrid();
bool showBackground = curveCollection->isShowingBackground();
@ -215,8 +232,8 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform,
wellPathClipBoundingBox,
planeAngle(rim3dWellLogCurve->drawPlane()),
wellPathCenterToPlotStartOffset(planePosition),
planeAngle(curveCollection, rim3dWellLogCurve),
wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve),
planeWidth(),
gridIntervalSize);
if (!gridCreated) return;

View File

@ -69,9 +69,8 @@ private:
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
static double planeAngle(const Rim3dWellLogCurve::DrawPlane& drawPlane);
double wellPathCenterToPlotStartOffset(Rim3dWellLogCurveCollection::PlanePosition planePosition) const;
static double planeAngle(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve);
double wellPathCenterToPlotStartOffset(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve) const;
double planeWidth() const;
private:

View File

@ -32,8 +32,8 @@ namespace caf
template<>
void AppEnum< Rim3dWellLogCurveCollection::PlanePosition >::setUp()
{
addItem(Rim3dWellLogCurveCollection::ALONG_WELLPATH, "ALONG_WELLPATH", "On One Side of Well Path");
addItem(Rim3dWellLogCurveCollection::ON_WELLPATH, "ON_WELLPATH", "On Well Path");
addItem(Rim3dWellLogCurveCollection::ALONG_WELLPATH, "ALONG_WELLPATH", "Beside Well Path");
addItem(Rim3dWellLogCurveCollection::ON_WELLPATH, "ON_WELLPATH", "Centered On Well Path");
setDefault(Rim3dWellLogCurveCollection::ALONG_WELLPATH);
}
}
@ -48,8 +48,9 @@ Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection()
CAF_PDM_InitField(&m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", "");
m_showPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_planePosition, "PlanePosition", "Plane Position", "", "", "");
CAF_PDM_InitField(&m_planeWidthScaling, "PlaneWidthScaling", 1.0f, "Plane Width Scaling Factor", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_planePositionVertical, "PlanePositionVertical", "Vertical Position", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_planePositionHorizontal, "PlanePositionHorizontal", "Horizontal Position", "", "", "");
CAF_PDM_InitField(&m_planeWidthScaling, "PlaneWidthScaling", 1.0f, "Width Scaling", "", "", "");
m_planeWidthScaling.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", "");
CAF_PDM_InitField(&m_showBackground, "Show3dWellLogBackground", false, "Show Background", "", "", "");
@ -118,13 +119,20 @@ bool Rim3dWellLogCurveCollection::isShowingBackground() const
return m_showBackground;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurveCollection::PlanePosition Rim3dWellLogCurveCollection::planePositionVertical() const
{
return m_planePositionVertical();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurveCollection::PlanePosition Rim3dWellLogCurveCollection::planePosition() const
Rim3dWellLogCurveCollection::PlanePosition Rim3dWellLogCurveCollection::planePositionHorizontal() const
{
return m_planePosition();
return m_planePositionHorizontal();
}
//--------------------------------------------------------------------------------------------------
@ -191,8 +199,9 @@ caf::PdmFieldHandle* Rim3dWellLogCurveCollection::objectToggleField()
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurveCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* settingsGroup = uiOrdering.addNewGroup("Draw Plane Settings");
settingsGroup->add(&m_planePosition);
caf::PdmUiGroup* settingsGroup = uiOrdering.addNewGroup("Draw Plane Configuration");
settingsGroup->add(&m_planePositionVertical);
settingsGroup->add(&m_planePositionHorizontal);
settingsGroup->add(&m_planeWidthScaling);
caf::PdmUiGroup* appearanceSettingsGroup = uiOrdering.addNewGroup("Draw Plane Appearance");

View File

@ -52,7 +52,8 @@ public:
bool isShowingGrid() const;
bool isShowingBackground() const;
PlanePosition planePosition() const;
PlanePosition planePositionVertical() const;
PlanePosition planePositionHorizontal() const;
float planeWidthScaling() const;
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
@ -65,7 +66,8 @@ private:
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
private:
caf::PdmField<bool> m_showPlot;
caf::PdmField<caf::AppEnum<PlanePosition>> m_planePosition;
caf::PdmField<caf::AppEnum<PlanePosition>> m_planePositionVertical;
caf::PdmField<caf::AppEnum<PlanePosition>> m_planePositionHorizontal;
caf::PdmField<float> m_planeWidthScaling;
caf::PdmField<bool> m_showGrid;

View File

@ -18,6 +18,7 @@
#include "Rim3dWellLogCurve.h"
#include "Rim3dWellLogCurveCollection.h"
#include "RimProject.h"
//==================================================================================================
@ -32,10 +33,10 @@ namespace caf
template<>
void AppEnum< Rim3dWellLogCurve::DrawPlane >::setUp()
{
addItem(Rim3dWellLogCurve::VERTICAL_ABOVE, "VERTICAL_ABOVE", "Vertical - Above");
addItem(Rim3dWellLogCurve::VERTICAL_BELOW, "VERTICAL_BELOW", "Vertical - Below");
addItem(Rim3dWellLogCurve::HORIZONTAL_LEFT, "HORIZONTAL_LEFT", "Horizontal - Left");
addItem(Rim3dWellLogCurve::HORIZONTAL_RIGHT, "HORIZONTAL_RIGHT", "Horizontal - Right");
addItem(Rim3dWellLogCurve::VERTICAL_ABOVE, "VERTICAL_ABOVE", "Beside Well Path - Above");
addItem(Rim3dWellLogCurve::VERTICAL_BELOW, "VERTICAL_BELOW", "Beside Well Path - Below");
addItem(Rim3dWellLogCurve::HORIZONTAL_LEFT, "HORIZONTAL_LEFT", "Beside Well Path - Left");
addItem(Rim3dWellLogCurve::HORIZONTAL_RIGHT, "HORIZONTAL_RIGHT", "Beside Well Path - Right");
setDefault(Rim3dWellLogCurve::VERTICAL_ABOVE);
}
}
@ -50,7 +51,7 @@ Rim3dWellLogCurve::Rim3dWellLogCurve()
CAF_PDM_InitField(&m_showCurve, "Show3dWellLogCurve", true, "Show 3d Well Log Curve", "", "", "");
m_showCurve.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_drawPlane, "DrawPlane", "Draw Plane", "", "", "");
CAF_PDM_InitField(&m_drawPlane, "DrawPlane", DrawPlaneEnum(VERTICAL_ABOVE), "Draw Plane", "", "", "");
CAF_PDM_InitField(&m_color, "CurveColor", cvf::Color3f(0.0f, 0.0f, 0.0f), "Curve Color", "", "", "");
CAF_PDM_InitField(&m_name, "Name", QString("3D Well Log Curve"), "3d Well Log Curve", "", "", "");
m_name.uiCapability()->setUiHidden(true);
@ -141,10 +142,38 @@ caf::PdmFieldHandle* Rim3dWellLogCurve::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering)
void Rim3dWellLogCurve::configurationUiOrdering(caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* curveAppearanceGroup = uiOrdering.addNewGroup("Curve Appearance");
curveAppearanceGroup->add(&m_drawPlane);
curveAppearanceGroup->add(&m_color);
caf::PdmUiGroup* configurationGroup = uiOrdering.addNewGroup("Curve Configuration");
configurationGroup->add(&m_drawPlane);
configurationGroup->add(&m_color);
}
QList<caf::PdmOptionItemInfo> Rim3dWellLogCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_drawPlane)
{
Rim3dWellLogCurveCollection* collection;
this->firstAncestorOrThisOfTypeAsserted(collection);
if (collection->planePositionVertical() == Rim3dWellLogCurveCollection::ALONG_WELLPATH)
{
options.push_back(caf::PdmOptionItemInfo(DrawPlaneEnum::uiText(Rim3dWellLogCurve::VERTICAL_ABOVE), Rim3dWellLogCurve::VERTICAL_ABOVE));
options.push_back(caf::PdmOptionItemInfo(DrawPlaneEnum::uiText(Rim3dWellLogCurve::VERTICAL_BELOW), Rim3dWellLogCurve::VERTICAL_BELOW));
}
else
{
options.push_back(caf::PdmOptionItemInfo(QString("Vertical - Centered"), Rim3dWellLogCurve::VERTICAL_ABOVE));
}
if (collection->planePositionHorizontal() == Rim3dWellLogCurveCollection::ALONG_WELLPATH)
{
options.push_back(caf::PdmOptionItemInfo(DrawPlaneEnum::uiText(Rim3dWellLogCurve::HORIZONTAL_LEFT), Rim3dWellLogCurve::HORIZONTAL_LEFT));
options.push_back(caf::PdmOptionItemInfo(DrawPlaneEnum::uiText(Rim3dWellLogCurve::HORIZONTAL_RIGHT), Rim3dWellLogCurve::HORIZONTAL_RIGHT));
}
else
{
options.push_back(caf::PdmOptionItemInfo(QString("Horizontal - Centered"), Rim3dWellLogCurve::HORIZONTAL_LEFT));
}
}
return options;
}

View File

@ -40,7 +40,7 @@ public:
HORIZONTAL_LEFT,
HORIZONTAL_RIGHT
};
typedef caf::AppEnum<DrawPlane> DrawPlaneEnum;
public:
Rim3dWellLogCurve();
virtual ~Rim3dWellLogCurve();
@ -58,7 +58,8 @@ 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);
void configurationUiOrdering(caf::PdmUiOrdering& uiOrdering);
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
protected:
caf::PdmField<QString> m_name;

View File

@ -174,6 +174,8 @@ QList<caf::PdmOptionItemInfo> Rim3dWellLogExtractionCurve::calculateValueOptions
{
QList<caf::PdmOptionItemInfo> options;
options = Rim3dWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
if (fieldNeedingOptions == &m_case)
{
RimTools::caseOptionItems(&options);
@ -225,8 +227,7 @@ void Rim3dWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::Pd
curveDataGroup->add(&m_timeStep);
}
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
Rim3dWellLogCurve::appearanceUiOrdering(*appearanceGroup);
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
uiOrdering.skipRemainingFields(true);
}

View File

@ -154,8 +154,7 @@ void Rim3dWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
curveDataGroup->add(&m_wellLogFile);
curveDataGroup->add(&m_wellLogChannnelName);
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
Rim3dWellLogCurve::appearanceUiOrdering(*appearanceGroup);
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
uiOrdering.skipRemainingFields(true);
}

View File

@ -138,8 +138,7 @@ void Rim3dWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde
curveDataGroup->add(&m_wellLogChannelName);
curveDataGroup->add(&m_timeStep);
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
Rim3dWellLogCurve::appearanceUiOrdering(*appearanceGroup);
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
uiOrdering.skipRemainingFields(true);
}