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

View File

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

View File

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

View File

@ -51,10 +51,15 @@ public:
double planeOffsetFromWellPathCenter, double planeOffsetFromWellPathCenter,
double planeWidth, double planeWidth,
double gridIntervalSize); 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: private:
const RigWellPath* wellPathGeometry() const; const RigWellPath* wellPathGeometry() const;
@ -63,4 +68,6 @@ private:
cvf::ref<cvf::DrawableGeo> m_background; cvf::ref<cvf::DrawableGeo> m_background;
cvf::ref<cvf::DrawableGeo> m_border; cvf::ref<cvf::DrawableGeo> m_border;
cvf::ref<cvf::DrawableVectors> m_curveNormalVectors; 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; if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
append3dWellLogCurvesToModel(model, displayCoordTransform, wellPathClipBoundingBox);
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves()) for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
{ {
appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve, planeWidth()); appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve, planeWidth());
append3dWellLogCurveToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve);
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList* model, void Riv3dWellLogPlanePartMgr::append3dWellLogCurveToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform, const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox) const cvf::BoundingBox& wellPathClipBoundingBox,
Rim3dWellLogCurve* rim3dWellLogCurve)
{ {
if (m_wellPath.isNull()) return; CVF_ASSERT(rim3dWellLogCurve);
if (!m_wellPath->rim3dWellLogCurveCollection()) return; if (!rim3dWellLogCurve->isShowingCurve()) return;
if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection(); cvf::ref<Riv3dWellLogCurveGeometryGenerator> generator = rim3dWellLogCurve->geometryGenerator();
if (generator.isNull())
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
{ {
cvf::ref<Riv3dWellLogCurveGeometryGenerator> generator = rim3dWellLogCurve->geometryGenerator(); generator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p());
if (generator.isNull()) rim3dWellLogCurve->setGeometryGenerator(generator.p());
{ }
generator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p());
rim3dWellLogCurve->setGeometryGenerator(generator.p());
}
if (!rim3dWellLogCurve->isShowingCurve()) continue;
std::vector<double> resultValues; generator->createCurveDrawables(displayCoordTransform,
std::vector<double> resultMds; wellPathClipBoundingBox,
rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds); rim3dWellLogCurve,
wellPathCenterToPlotStartOffset(rim3dWellLogCurve),
planeWidth());
generator->createCurveDrawables(displayCoordTransform, cvf::ref<cvf::DrawableGeo> curveDrawable = generator->curveDrawable();
wellPathClipBoundingBox,
resultValues,
resultMds,
rim3dWellLogCurve->minCurveValue(),
rim3dWellLogCurve->maxCurveValue(),
planeAngle(curveCollection, rim3dWellLogCurve),
wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve),
planeWidth());
cvf::ref<cvf::DrawableGeo> curveDrawable = generator->curveDrawable(); if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
{
return;
}
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid()) caf::MeshEffectGenerator meshEffectGen(rim3dWellLogCurve->color());
{ meshEffectGen.setLineWidth(2.0f);
continue; cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
}
caf::MeshEffectGenerator meshEffectGen(rim3dWellLogCurve->color()); cvf::ref<cvf::Part> part = new cvf::Part;
meshEffectGen.setLineWidth(2.0f); part->setDrawable(curveDrawable.p());
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect(); part->setEffect(effect.p());
cvf::ref<cvf::Part> part = new cvf::Part; if (part.notNull())
part->setDrawable(curveDrawable.p()); {
part->setEffect(effect.p()); 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, double Riv3dWellLogPlanePartMgr::wellPathCenterToPlotStartOffset(const Rim3dWellLogCurve* curve) const
const Rim3dWellLogCurve* curve)
{ {
switch (curve->drawPlane()) if (curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_CENTER ||
{ curve->drawPlane() == Rim3dWellLogCurve::VERTICAL_CENTER)
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)
{ {
return -0.5*planeWidth(); return -0.5*planeWidth();
} }
@ -251,8 +197,8 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform, bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform,
wellPathClipBoundingBox, wellPathClipBoundingBox,
planeAngle(curveCollection, rim3dWellLogCurve), rim3dWellLogCurve->drawPlaneAngle(),
wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve), wellPathCenterToPlotStartOffset(rim3dWellLogCurve),
planeWidth(), planeWidth(),
gridIntervalSize); gridIntervalSize);
if (!gridCreated) return; if (!gridCreated) return;

View File

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

View File

@ -28,17 +28,6 @@
CAF_PDM_SOURCE_INIT(Rim3dWellLogCurveCollection, "Rim3dWellLogCurveCollection"); 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", "", "", ""); CAF_PDM_InitField(&m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", "");
m_showPlot.uiCapability()->setUiHidden(true); 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", "", "", ""); CAF_PDM_InitField(&m_planeWidthScaling, "PlaneWidthScaling", 1.0f, "Width Scaling", "", "", "");
m_planeWidthScaling.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName()); m_planeWidthScaling.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", ""); CAF_PDM_InitField(&m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", "");
@ -121,22 +108,6 @@ bool Rim3dWellLogCurveCollection::isShowingBackground() const
return m_showBackground; 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) void Rim3dWellLogCurveCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{ {
caf::PdmUiGroup* settingsGroup = uiOrdering.addNewGroup("Draw Plane Configuration"); caf::PdmUiGroup* settingsGroup = uiOrdering.addNewGroup("Draw Plane Configuration");
settingsGroup->add(&m_planePositionVertical);
settingsGroup->add(&m_planePositionHorizontal);
settingsGroup->add(&m_planeWidthScaling); settingsGroup->add(&m_planeWidthScaling);
caf::PdmUiGroup* appearanceSettingsGroup = uiOrdering.addNewGroup("Draw Plane Appearance"); caf::PdmUiGroup* appearanceSettingsGroup = uiOrdering.addNewGroup("Draw Plane Appearance");

View File

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

View File

@ -44,8 +44,10 @@ namespace caf
void AppEnum< Rim3dWellLogCurve::DrawPlane >::setUp() void AppEnum< Rim3dWellLogCurve::DrawPlane >::setUp()
{ {
addItem(Rim3dWellLogCurve::VERTICAL_ABOVE, "VERTICAL_ABOVE", "Above"); addItem(Rim3dWellLogCurve::VERTICAL_ABOVE, "VERTICAL_ABOVE", "Above");
addItem(Rim3dWellLogCurve::VERTICAL_CENTER, "VERTICAL_CENTER", "Centered - Vertical");
addItem(Rim3dWellLogCurve::VERTICAL_BELOW, "VERTICAL_BELOW", "Below"); addItem(Rim3dWellLogCurve::VERTICAL_BELOW, "VERTICAL_BELOW", "Below");
addItem(Rim3dWellLogCurve::HORIZONTAL_LEFT, "HORIZONTAL_LEFT", "Left"); addItem(Rim3dWellLogCurve::HORIZONTAL_LEFT, "HORIZONTAL_LEFT", "Left");
addItem(Rim3dWellLogCurve::HORIZONTAL_CENTER, "HORIZONTAL_CENTER", "Centered - Horizontal");
addItem(Rim3dWellLogCurve::HORIZONTAL_RIGHT, "HORIZONTAL_RIGHT", "Right"); addItem(Rim3dWellLogCurve::HORIZONTAL_RIGHT, "HORIZONTAL_RIGHT", "Right");
setDefault(Rim3dWellLogCurve::VERTICAL_ABOVE); setDefault(Rim3dWellLogCurve::VERTICAL_ABOVE);
} }
@ -96,6 +98,28 @@ Rim3dWellLogCurve::DrawPlane Rim3dWellLogCurve::drawPlane() const
return m_drawPlane(); 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); 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 enum DrawPlane
{ {
VERTICAL_ABOVE, VERTICAL_ABOVE,
VERTICAL_BELOW, VERTICAL_CENTER,
VERTICAL_BELOW,
HORIZONTAL_LEFT, HORIZONTAL_LEFT,
HORIZONTAL_RIGHT HORIZONTAL_CENTER,
HORIZONTAL_RIGHT
}; };
typedef caf::AppEnum<DrawPlane> DrawPlaneEnum; typedef caf::AppEnum<DrawPlane> DrawPlaneEnum;
public: public:
@ -56,7 +58,10 @@ public:
virtual QString name() const = 0; virtual QString name() const = 0;
virtual QString resultPropertyString() const = 0; virtual QString resultPropertyString() const = 0;
DrawPlane drawPlane() const; DrawPlane drawPlane() const;
double drawPlaneAngle() const;
cvf::Color3f color() const; cvf::Color3f color() const;
bool isShowingCurve() const; bool isShowingCurve() const;
@ -79,7 +84,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;
void configurationUiOrdering(caf::PdmUiOrdering& uiOrdering); 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 defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
virtual void initAfterRead(); virtual void initAfterRead();
private: private:

View File

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

View File

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

View File

@ -213,6 +213,8 @@ void Rim3dWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
m_nameConfig()->createUiGroup(uiConfigName, uiOrdering);
uiOrdering.skipRemainingFields(true); 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()) if (changedField == &m_isUsingAutoName && !isUsingAutoName())
{ {
m_customName = m_configHolder->createCurveAutoName(); m_customName = m_configHolder->createCurveAutoName();
m_customName.uiCapability()->updateConnectedEditors();
} }
updateAllSettings(); 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");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///