Make draw plane selection for curves be unrelated to 3d Track (somewhat related to #2825).

* Makes more sense user wise and makes for better code.
* Helps refactor code to relate grids to curves so the curves can have access to the grid
   it is being drawn on.
* This will help fix #2825 by being able to project curve points onto the exact triangle geometry.
This commit is contained in:
Gaute Lindkvist 2018-04-30 09:22:59 +02:00
parent 7307b97466
commit 1f44ea1ea3
14 changed files with 153 additions and 216 deletions

View File

@ -47,14 +47,14 @@ Riv3dWellLogCurveGeometryGenerator::Riv3dWellLogCurveGeometryGenerator(RimWellPa
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
const std::vector<double>& resultValues,
const std::vector<double>& resultMds,
double minResultValue,
double maxResultValue,
double planeAngle,
const Rim3dWellLogCurve* rim3dWellLogCurve,
double planeOffsetFromWellPathCenter,
double planeWidth)
{
std::vector<double> resultValues;
std::vector<double> resultMds;
rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds);
m_planeWidth = planeWidth;
// Make sure all drawables are cleared in case we return early to avoid a
@ -68,7 +68,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
if (resultValues.empty()) return;
CVF_ASSERT(resultValues.size() == resultMds.size());
if (maxResultValue - minResultValue < 1.0e-6)
if (rim3dWellLogCurve->maxCurveValue() - rim3dWellLogCurve->minCurveValue() < 1.0e-6)
{
return;
}
@ -90,7 +90,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
wellPathPoint = displayCoordTransform->transformToDisplayCoord(wellPathPoint);
}
std::vector<cvf::Vec3d> wellPathCurveNormals = RigWellPathGeometryTools::calculateLineSegmentNormals(wellPathPoints, planeAngle);
std::vector<cvf::Vec3d> wellPathCurveNormals = RigWellPathGeometryTools::calculateLineSegmentNormals(wellPathPoints, rim3dWellLogCurve->drawPlaneAngle());
std::vector<cvf::Vec3d> interpolatedWellPathPoints;
std::vector<cvf::Vec3d> interpolatedCurveNormals;
@ -123,7 +123,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
{
if (!RigCurveDataTools::isValidValue(result, false)) continue;
result = cvf::Math::clamp(result, minResultValue, maxResultValue);
result = cvf::Math::clamp(result, rim3dWellLogCurve->minCurveValue(), rim3dWellLogCurve->maxCurveValue());
maxClampedResult = std::max(result, maxClampedResult);
minClampedResult = std::min(result, minClampedResult);

View File

@ -39,6 +39,7 @@ class BoundingBox;
class RigWellPath;
class RimWellPath;
class Rim3dWellLogCurve;
class Riv3dWellLogCurveGeometryGenerator : public cvf::Object
{
@ -48,13 +49,9 @@ public:
void createCurveDrawables(const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
const std::vector<double>& resultValues,
const std::vector<double>& resultMds,
double planeAngle,
const Rim3dWellLogCurve* rim3dWellLogCurve,
double planeOffsetFromWellPathCenter,
double planeWidth,
double minResultValue,
double maxResultValue);
double planeWidth);
void clearCurvePointsAndGeometry();

View File

@ -56,6 +56,8 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
{
CVF_ASSERT(gridIntervalSize > 0);
clearGeometry();
if (!wellPathGeometry() || wellPathGeometry()->m_measuredDepths.empty())
{
return false;
@ -81,7 +83,7 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
wellPathPoint = displayCoordTransform->transformToDisplayCoord(wellPathPoint);
}
std::vector<cvf::Vec3d> wellPathSegmentNormals =
std::vector<cvf::Vec3d> segmentNormals =
RigWellPathGeometryTools::calculateLineSegmentNormals(wellPathPoints, planeAngle);
@ -106,11 +108,10 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
// Note that normals are calculated on the full non-clipped well path to increase the likelihood of creating good normals
// for the end points of the curve. So we need to clip the remainder here.
wellPathSegmentNormals.erase(wellPathSegmentNormals.begin(), wellPathSegmentNormals.end() - wellPathPoints.size());
segmentNormals.erase(segmentNormals.begin(), segmentNormals.end() - wellPathPoints.size());
{
std::vector<cvf::Vec3f> vertices;
vertices.reserve(wellPathPoints.size() * 2);
m_vertices.reserve(wellPathPoints.size() * 2);
std::vector<cvf::uint> backgroundIndices;
backgroundIndices.reserve(wellPathPoints.size() * 2);
@ -118,15 +119,15 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
// Vertices are used for both surface and border
for (size_t i = 0; i < wellPathPoints.size(); i++)
{
vertices.push_back(cvf::Vec3f(
wellPathPoints[i] + wellPathSegmentNormals[i] * planeOffsetFromWellPathCenter));
vertices.push_back(cvf::Vec3f(
wellPathPoints[i] + wellPathSegmentNormals[i] * (planeOffsetFromWellPathCenter + planeWidth)));
m_vertices.push_back(cvf::Vec3f(
wellPathPoints[i] + segmentNormals[i] * planeOffsetFromWellPathCenter));
m_vertices.push_back(cvf::Vec3f(
wellPathPoints[i] + segmentNormals[i] * (planeOffsetFromWellPathCenter + planeWidth)));
backgroundIndices.push_back((cvf::uint) (2 * i));
backgroundIndices.push_back((cvf::uint) (2 * i + 1));
}
cvf::ref<cvf::Vec3fArray> vertexArray = new cvf::Vec3fArray(vertices);
cvf::ref<cvf::Vec3fArray> vertexArray = new cvf::Vec3fArray(m_vertices);
{
// Background specific
@ -141,9 +142,9 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
{
std::vector<cvf::uint> borderIndices;
borderIndices.reserve(vertices.size());
borderIndices.reserve(m_vertices.size());
int secondLastEvenVertex = (int) vertices.size() - 4;
int secondLastEvenVertex = (int) m_vertices.size() - 4;
// Border close to the well. All even indices.
for (int i = 0; i <= secondLastEvenVertex; i += 2)
@ -153,11 +154,11 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
}
// Connect to border away from well
borderIndices.push_back((cvf::uint) (vertices.size() - 2));
borderIndices.push_back((cvf::uint) (vertices.size() - 1));
borderIndices.push_back((cvf::uint) (m_vertices.size() - 2));
borderIndices.push_back((cvf::uint) (m_vertices.size() - 1));
int secondOddVertex = 3;
int lastOddVertex = (int) vertices.size() - 1;
int lastOddVertex = (int) m_vertices.size() - 1;
// Border away from from well are odd indices in reverse order to create a closed surface.
for (int i = lastOddVertex; i >= secondOddVertex; i -= 2)
@ -190,15 +191,15 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
while (md >= firstMd)
{
cvf::Vec3d point = wellPathGeometry()->interpolatedVectorAlongWellPath(wellPathPoints, md);
cvf::Vec3d curveNormal = wellPathGeometry()->interpolatedVectorAlongWellPath(wellPathSegmentNormals, md);
cvf::Vec3d curveNormal = wellPathGeometry()->interpolatedVectorAlongWellPath(segmentNormals, md);
interpolatedGridPoints.push_back(point);
interpolatedGridCurveNormals.push_back(curveNormal.getNormalized());
md -= gridIntervalSize;
}
std::vector<cvf::Vec3f> vertices;
std::vector<cvf::Vec3f> arrowVertices;
std::vector<cvf::Vec3f> arrowVectors;
vertices.reserve(interpolatedGridPoints.size());
arrowVertices.reserve(interpolatedGridPoints.size());
arrowVectors.reserve(interpolatedGridPoints.size());
double shaftRelativeRadius = 0.0125f;
@ -208,14 +209,14 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
// Normal lines. Start from one to avoid drawing at surface edge.
for (size_t i = 1; i < interpolatedGridCurveNormals.size(); i++)
{
vertices.push_back(cvf::Vec3f(interpolatedGridPoints[i] + interpolatedGridCurveNormals[i] * planeOffsetFromWellPathCenter));
arrowVertices.push_back(cvf::Vec3f(interpolatedGridPoints[i] + interpolatedGridCurveNormals[i] * planeOffsetFromWellPathCenter));
arrowVectors.push_back(cvf::Vec3f(interpolatedGridCurveNormals[i] * planeWidth * totalArrowScaling));
}
m_curveNormalVectors = new cvf::DrawableVectors();
cvf::ref<cvf::Vec3fArray> vertexArray = new cvf::Vec3fArray(vertices);
cvf::ref<cvf::Vec3fArray> vertexArray = new cvf::Vec3fArray(arrowVertices);
cvf::ref<cvf::Vec3fArray> vectorArray = new cvf::Vec3fArray(arrowVectors);
// Create the arrow glyph for the vector drawer
@ -233,21 +234,49 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
return true;
}
cvf::ref<cvf::DrawableGeo> Riv3dWellLogGridGeometryGenerator::background()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogGridGeometryGenerator::clearGeometry()
{
m_background = nullptr;
m_border = nullptr;
m_curveNormalVectors = nullptr;
m_vertices.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> Riv3dWellLogGridGeometryGenerator::background() const
{
return m_background;
}
cvf::ref<cvf::DrawableGeo> Riv3dWellLogGridGeometryGenerator::border()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> Riv3dWellLogGridGeometryGenerator::border() const
{
return m_border;
}
cvf::ref<cvf::DrawableVectors> Riv3dWellLogGridGeometryGenerator::curveNormalVectors()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableVectors> Riv3dWellLogGridGeometryGenerator::curveNormalVectors() const
{
return m_curveNormalVectors;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<cvf::Vec3f>& Riv3dWellLogGridGeometryGenerator::vertices() const
{
return m_vertices;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -51,10 +51,15 @@ public:
double planeOffsetFromWellPathCenter,
double planeWidth,
double gridIntervalSize);
void clearGeometry();
cvf::ref<cvf::DrawableGeo> background() const;
cvf::ref<cvf::DrawableGeo> border() const;
cvf::ref<cvf::DrawableVectors> curveNormalVectors() const;
const std::vector<cvf::Vec3f>& vertices() const;
cvf::ref<cvf::DrawableGeo> background();
cvf::ref<cvf::DrawableGeo> border();
cvf::ref<cvf::DrawableVectors> curveNormalVectors();
private:
const RigWellPath* wellPathGeometry() const;
@ -63,4 +68,6 @@ private:
cvf::ref<cvf::DrawableGeo> m_background;
cvf::ref<cvf::DrawableGeo> m_border;
cvf::ref<cvf::DrawableVectors> m_curveNormalVectors;
std::vector<cvf::Vec3f> m_vertices;
};

View File

@ -70,71 +70,55 @@ void Riv3dWellLogPlanePartMgr::appendPlaneToModel(cvf::ModelBasicList*
if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
append3dWellLogCurvesToModel(model, displayCoordTransform, wellPathClipBoundingBox);
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
{
appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve, planeWidth());
append3dWellLogCurveToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox)
void Riv3dWellLogPlanePartMgr::append3dWellLogCurveToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
Rim3dWellLogCurve* rim3dWellLogCurve)
{
if (m_wellPath.isNull()) return;
if (!m_wellPath->rim3dWellLogCurveCollection()) return;
if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
CVF_ASSERT(rim3dWellLogCurve);
if (!rim3dWellLogCurve->isShowingCurve()) return;
Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection();
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
cvf::ref<Riv3dWellLogCurveGeometryGenerator> generator = rim3dWellLogCurve->geometryGenerator();
if (generator.isNull())
{
cvf::ref<Riv3dWellLogCurveGeometryGenerator> generator = rim3dWellLogCurve->geometryGenerator();
if (generator.isNull())
{
generator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p());
rim3dWellLogCurve->setGeometryGenerator(generator.p());
}
if (!rim3dWellLogCurve->isShowingCurve()) continue;
generator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p());
rim3dWellLogCurve->setGeometryGenerator(generator.p());
}
std::vector<double> resultValues;
std::vector<double> resultMds;
rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds);
generator->createCurveDrawables(displayCoordTransform,
wellPathClipBoundingBox,
rim3dWellLogCurve,
wellPathCenterToPlotStartOffset(rim3dWellLogCurve),
planeWidth());
generator->createCurveDrawables(displayCoordTransform,
wellPathClipBoundingBox,
resultValues,
resultMds,
rim3dWellLogCurve->minCurveValue(),
rim3dWellLogCurve->maxCurveValue(),
planeAngle(curveCollection, rim3dWellLogCurve),
wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve),
planeWidth());
cvf::ref<cvf::DrawableGeo> curveDrawable = generator->curveDrawable();
cvf::ref<cvf::DrawableGeo> curveDrawable = generator->curveDrawable();
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
{
return;
}
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
{
continue;
}
caf::MeshEffectGenerator meshEffectGen(rim3dWellLogCurve->color());
meshEffectGen.setLineWidth(2.0f);
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
caf::MeshEffectGenerator meshEffectGen(rim3dWellLogCurve->color());
meshEffectGen.setLineWidth(2.0f);
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
cvf::ref<cvf::Part> part = new cvf::Part;
part->setDrawable(curveDrawable.p());
part->setEffect(effect.p());
cvf::ref<cvf::Part> part = new cvf::Part;
part->setDrawable(curveDrawable.p());
part->setEffect(effect.p());
if (part.notNull())
{
model->addPart(part.p());
}
if (part.notNull())
{
model->addPart(part.p());
}
}
@ -157,48 +141,10 @@ cvf::ref<cvf::Part> Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double Riv3dWellLogPlanePartMgr::planeAngle(const Rim3dWellLogCurveCollection* collection,
const Rim3dWellLogCurve* curve)
double Riv3dWellLogPlanePartMgr::wellPathCenterToPlotStartOffset(const Rim3dWellLogCurve* curve) const
{
switch (curve->drawPlane())
{
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(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve) const
{
bool centered = false;
if (curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_LEFT ||
curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_RIGHT)
{
centered = collection->planePositionHorizontal() == Rim3dWellLogCurveCollection::ON_WELLPATH;
}
else
{
centered = collection->planePositionVertical() == Rim3dWellLogCurveCollection::ON_WELLPATH;
}
if (centered)
if (curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_CENTER ||
curve->drawPlane() == Rim3dWellLogCurve::VERTICAL_CENTER)
{
return -0.5*planeWidth();
}
@ -251,8 +197,8 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform,
wellPathClipBoundingBox,
planeAngle(curveCollection, rim3dWellLogCurve),
wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve),
rim3dWellLogCurve->drawPlaneAngle(),
wellPathCenterToPlotStartOffset(rim3dWellLogCurve),
planeWidth(),
gridIntervalSize);
if (!gridCreated) return;

View File

@ -56,9 +56,10 @@ public:
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox);
private:
void append3dWellLogCurvesToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox);
void append3dWellLogCurveToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
Rim3dWellLogCurve* rim3dWellLogCurve);
void appendGridToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
@ -68,8 +69,7 @@ private:
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
static double planeAngle(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve);
double wellPathCenterToPlotStartOffset(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve) const;
double wellPathCenterToPlotStartOffset(const Rim3dWellLogCurve* curve) const;
double planeWidth() const;
private:

View File

@ -28,17 +28,6 @@
CAF_PDM_SOURCE_INIT(Rim3dWellLogCurveCollection, "Rim3dWellLogCurveCollection");
namespace caf
{
template<>
void AppEnum< Rim3dWellLogCurveCollection::PlanePosition >::setUp()
{
addItem(Rim3dWellLogCurveCollection::ALONG_WELLPATH, "ALONG_WELLPATH", "Beside Well Path");
addItem(Rim3dWellLogCurveCollection::ON_WELLPATH, "ON_WELLPATH", "Centered On Well Path");
setDefault(Rim3dWellLogCurveCollection::ALONG_WELLPATH);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -49,8 +38,6 @@ Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection()
CAF_PDM_InitField(&m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", "");
m_showPlot.uiCapability()->setUiHidden(true);
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", "", "", "");
@ -121,22 +108,6 @@ bool Rim3dWellLogCurveCollection::isShowingBackground() const
return m_showBackground;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurveCollection::PlanePosition Rim3dWellLogCurveCollection::planePositionVertical() const
{
return m_planePositionVertical();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurveCollection::PlanePosition Rim3dWellLogCurveCollection::planePositionHorizontal() const
{
return m_planePositionHorizontal();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -232,8 +203,6 @@ caf::PdmFieldHandle* Rim3dWellLogCurveCollection::objectToggleField()
void Rim3dWellLogCurveCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
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

@ -36,13 +36,6 @@ class Rim3dWellLogCurveCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
enum PlanePosition
{
ALONG_WELLPATH,
ON_WELLPATH
};
public:
Rim3dWellLogCurveCollection();
virtual ~Rim3dWellLogCurveCollection();
@ -55,8 +48,6 @@ public:
bool isShowingGrid() const;
bool isShowingBackground() const;
PlanePosition planePositionVertical() const;
PlanePosition planePositionHorizontal() const;
float planeWidthScaling() const;
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
@ -73,8 +64,6 @@ 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_planePositionVertical;
caf::PdmField<caf::AppEnum<PlanePosition>> m_planePositionHorizontal;
caf::PdmField<float> m_planeWidthScaling;
caf::PdmField<bool> m_showGrid;

View File

@ -44,8 +44,10 @@ namespace caf
void AppEnum< Rim3dWellLogCurve::DrawPlane >::setUp()
{
addItem(Rim3dWellLogCurve::VERTICAL_ABOVE, "VERTICAL_ABOVE", "Above");
addItem(Rim3dWellLogCurve::VERTICAL_CENTER, "VERTICAL_CENTER", "Centered - Vertical");
addItem(Rim3dWellLogCurve::VERTICAL_BELOW, "VERTICAL_BELOW", "Below");
addItem(Rim3dWellLogCurve::HORIZONTAL_LEFT, "HORIZONTAL_LEFT", "Left");
addItem(Rim3dWellLogCurve::HORIZONTAL_CENTER, "HORIZONTAL_CENTER", "Centered - Horizontal");
addItem(Rim3dWellLogCurve::HORIZONTAL_RIGHT, "HORIZONTAL_RIGHT", "Right");
setDefault(Rim3dWellLogCurve::VERTICAL_ABOVE);
}
@ -96,6 +98,28 @@ Rim3dWellLogCurve::DrawPlane Rim3dWellLogCurve::drawPlane() const
return m_drawPlane();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double Rim3dWellLogCurve::drawPlaneAngle() const
{
switch (drawPlane())
{
case HORIZONTAL_LEFT:
case HORIZONTAL_CENTER:
return cvf::PI_D / 2.0;
case HORIZONTAL_RIGHT:
return -cvf::PI_D / 2.0;
case VERTICAL_ABOVE:
case VERTICAL_CENTER:
return 0.0;
case VERTICAL_BELOW:
return cvf::PI_D;
default:
return 0;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -173,35 +197,6 @@ void Rim3dWellLogCurve::configurationUiOrdering(caf::PdmUiOrdering& uiOrdering)
configurationGroup->add(&m_maxCurveValue);
}
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"), 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"), Rim3dWellLogCurve::HORIZONTAL_LEFT));
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -43,9 +43,11 @@ public:
enum DrawPlane
{
VERTICAL_ABOVE,
VERTICAL_BELOW,
VERTICAL_CENTER,
VERTICAL_BELOW,
HORIZONTAL_LEFT,
HORIZONTAL_RIGHT
HORIZONTAL_CENTER,
HORIZONTAL_RIGHT
};
typedef caf::AppEnum<DrawPlane> DrawPlaneEnum;
public:
@ -56,7 +58,10 @@ public:
virtual QString name() const = 0;
virtual QString resultPropertyString() const = 0;
DrawPlane drawPlane() const;
double drawPlaneAngle() const;
cvf::Color3f color() const;
bool isShowingCurve() const;
@ -79,7 +84,6 @@ protected:
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void configurationUiOrdering(caf::PdmUiOrdering& uiOrdering);
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
virtual void initAfterRead();
private:

View File

@ -78,7 +78,7 @@ Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve()
m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
m_geomResultDefinition = new RimGeoMechResultDefinition;
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameGenerator", "", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
m_nameConfig = new RimWellLogExtractionCurveNameConfig(this);
}
@ -328,7 +328,7 @@ void Rim3dWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::Pd
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
caf::PdmUiGroup* nameGroup = m_nameConfig()->createUiGroup(uiConfigName, uiOrdering);
m_nameConfig()->createUiGroup(uiConfigName, uiOrdering);
uiOrdering.skipRemainingFields(true);
}

View File

@ -252,7 +252,7 @@ void Rim3dWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
caf::PdmUiGroup* nameGroup = m_nameConfig()->createUiGroup(uiConfigName, uiOrdering);
m_nameConfig()->createUiGroup(uiConfigName, uiOrdering);
uiOrdering.skipRemainingFields(true);
}

View File

@ -213,6 +213,8 @@ void Rim3dWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
m_nameConfig()->createUiGroup(uiConfigName, uiOrdering);
uiOrdering.skipRemainingFields(true);
}

View File

@ -26,7 +26,7 @@
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimCurveNameConfig, "RimCurveNameGenerator");
CAF_PDM_SOURCE_INIT(RimCurveNameConfig, "RimCurveNameConfig");
//--------------------------------------------------------------------------------------------------
///
@ -108,7 +108,6 @@ void RimCurveNameConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel
if (changedField == &m_isUsingAutoName && !isUsingAutoName())
{
m_customName = m_configHolder->createCurveAutoName();
m_customName.uiCapability()->updateConnectedEditors();
}
updateAllSettings();
@ -152,7 +151,7 @@ void RimCurveNameConfig::updateAllSettings()
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameGenerator");
CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig");
//--------------------------------------------------------------------------------------------------
///
@ -244,7 +243,7 @@ void RimWellLogExtractionCurveNameConfig::updateAllSettings()
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameGenerator");
CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig");
//--------------------------------------------------------------------------------------------------
///
@ -261,7 +260,7 @@ RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig(const RimCurveNameC
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameGenerator");
CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig");
//--------------------------------------------------------------------------------------------------
///