#1648 Remove dependency on active view from color generation.

Separate the fracture geometry generation methods from the wellpath methods. Use eclipse View as argument.
Fixed some constness stuff in View
This commit is contained in:
Jacob Støren
2017-06-25 10:36:15 +02:00
parent 50a0dcd499
commit cbb0a58673
12 changed files with 72 additions and 47 deletions

View File

@@ -104,13 +104,12 @@ void RivWellFracturePartMgr::generateSurfacePart(const caf::DisplayCoordTransfor
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturePartMgr::applyFractureUniformColor()
void RivWellFracturePartMgr::applyFractureUniformColor(const RimEclipseView* activeView)
{
if ( m_surfacePart.notNull() )
{
cvf::Color4f fractureColor = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN));
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if ( activeView )
{
fractureColor = cvf::Color4f(activeView->stimPlanColors->defaultColor());
@@ -125,14 +124,13 @@ void RivWellFracturePartMgr::applyFractureUniformColor()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturePartMgr::applyResultTextureColor()
void RivWellFracturePartMgr::applyResultTextureColor(const RimEclipseView* activeView)
{
if (m_surfacePart.isNull()) return;
if (m_rimFracture)
{
RimLegendConfig* legendConfig = nullptr;
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (activeView && activeView->stimPlanColors())
{
if (activeView->stimPlanColors()->isChecked())
@@ -199,7 +197,7 @@ void RivWellFracturePartMgr::applyResultTextureColor()
}
else
{
applyFractureUniformColor();
applyFractureUniformColor(activeView);
}
}
}
@@ -261,7 +259,8 @@ void RivWellFracturePartMgr::generateStimPlanMeshPart(const caf::DisplayCoordTra
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, const caf::DisplayCoordTransform* displayCoordTransform)
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate,
const caf::DisplayCoordTransform* displayCoordTransform)
{
//TODO: This is needed to avoid errors when loading project with stimPlan fractures with multipled timesteps.
//Should probably be moved, since it now is called twice in some cases...
@@ -287,8 +286,10 @@ cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(Ri
return nullptr;
}
cvf::Mat4d m = m_rimFracture->transformMatrix();
std::vector<cvf::Vec3f> stimPlanMeshVerticesDisplayCoords = transfromToFractureDisplayCoords(stimPlanMeshVertices, m, displayCoordTransform);
cvf::Mat4d fractureXf = m_rimFracture->transformMatrix();
std::vector<cvf::Vec3f> stimPlanMeshVerticesDisplayCoords = transfromToFractureDisplayCoords(stimPlanMeshVertices,
fractureXf,
displayCoordTransform);
cvf::Vec3fArray* stimPlanMeshVertexList;
stimPlanMeshVertexList = new cvf::Vec3fArray;
@@ -412,34 +413,35 @@ std::vector<double> RivWellFracturePartMgr::mirrorDataAtSingleDepth(std::vector<
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturePartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform)
void RivWellFracturePartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model,
const RimEclipseView* eclView)
{
clearGeometryCache();
if (!m_rimFracture->isChecked()) return;
RimStimPlanFractureTemplate* stimPlanFracTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->fractureTemplate());
auto displayCoordTransform = eclView->displayCoordTransform();
if (m_surfacePart.isNull())
{
if (m_rimFracture->fractureTemplate())
{
if (stimPlanFracTemplate)
{
generateSurfacePart(displayCoordTransform);
generateFractureOutlinePolygonPart(displayCoordTransform);
generateSurfacePart(displayCoordTransform.p());
generateFractureOutlinePolygonPart(displayCoordTransform.p());
applyResultTextureColor();
applyResultTextureColor(eclView);
if (stimPlanFracTemplate->showStimPlanMesh())
{
generateStimPlanMeshPart(displayCoordTransform);
generateStimPlanMeshPart(displayCoordTransform.p());
}
}
else // Ellipse
{
generateSurfacePart(displayCoordTransform);
applyFractureUniformColor();
generateSurfacePart(displayCoordTransform.p());
applyFractureUniformColor(eclView);
}
}
}
@@ -476,7 +478,8 @@ void RivWellFracturePartMgr::clearGeometryCache()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::buildDrawableGeoFromTriangles(const std::vector<cvf::uint>& triangleIndices, const std::vector<cvf::Vec3f>& nodeCoords)
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::buildDrawableGeoFromTriangles(const std::vector<cvf::uint>& triangleIndices,
const std::vector<cvf::Vec3f>& nodeCoords)
{
CVF_ASSERT(triangleIndices.size() > 0);
CVF_ASSERT(nodeCoords.size() > 0);
@@ -496,7 +499,9 @@ cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::buildDrawableGeoFromTriangles
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivWellFracturePartMgr::stimPlanCellTouchesPolygon(const std::vector<cvf::Vec3f>& polygon, double xMin, double xMax, double yMin, double yMax, float polygonXmin, float polygonXmax, float polygonYmin, float polygonYmax)
bool RivWellFracturePartMgr::stimPlanCellTouchesPolygon(const std::vector<cvf::Vec3f>& polygon,
double xMin, double xMax, double yMin, double yMax,
float polygonXmin, float polygonXmax, float polygonYmin, float polygonYmax)
{
if (static_cast<float>(xMin) > polygonXmin && static_cast<float>(xMax) < polygonXmax)
@@ -507,8 +512,6 @@ bool RivWellFracturePartMgr::stimPlanCellTouchesPolygon(const std::vector<cvf::V
}
}
//std::vector<cvf::Vec3f> polygon = m_rimFracture->attachedFractureDefinition()->fracturePolygon(m_rimFracture->fractureUnit);
for (cvf::Vec3f v : polygon)
{
if (v.x() > xMin && v.x() < xMax)

View File

@@ -41,6 +41,7 @@ namespace caf
class RimFracture;
class RimStimPlanFractureTemplate;
class RimEclipseView;
//--------------------------------------------------------------------------------------------------
///
@@ -52,7 +53,7 @@ public:
~RivWellFracturePartMgr();
void appendGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform);
const RimEclipseView* eclView);
void clearGeometryCache();
static std::vector<double> mirrorDataAtSingleDepth(std::vector<double> depthData);
@@ -60,9 +61,9 @@ public:
private:
void generateSurfacePart(const caf::DisplayCoordTransform* displayCoordTransform);
void applyFractureUniformColor();
void applyFractureUniformColor(const RimEclipseView* activeView);
void applyResultTextureColor();
void applyResultTextureColor(const RimEclipseView* activeView);
void generateFractureOutlinePolygonPart(const caf::DisplayCoordTransform* displayCoordTransform);
void generateStimPlanMeshPart(const caf::DisplayCoordTransform* displayCoordTransform);
@@ -71,7 +72,10 @@ private:
cvf::ref<cvf::DrawableGeo> createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate,
const caf::DisplayCoordTransform* displayCoordTransform);
void getPolygonBB(float &polygonXmin, float &polygonXmax, float &polygonYmin, float &polygonYmax);
void getPolygonBB(float &polygonXmin,
float &polygonXmax,
float &polygonYmin,
float &polygonYmax);
std::vector<cvf::Vec3f> transfromToFractureDisplayCoords(const std::vector<cvf::Vec3f>& polygon,
cvf::Mat4d m,

View File

@@ -101,7 +101,7 @@ RivWellPathPartMgr::~RivWellPathPartMgr()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform)
void RivWellPathPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList* model, const RimEclipseView* eclView)
{
if (!m_rimWellPath || !m_rimWellPath->fractureCollection()->isChecked()) return;
@@ -109,7 +109,7 @@ void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model,
{
CVF_ASSERT(f);
f->fracturePartManager()->appendGeometryPartsToModel(model, displayCoordTransform);
f->fracturePartManager()->appendGeometryPartsToModel(model, eclView);
}
}
@@ -384,12 +384,6 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
buildWellPathParts(displayCoordTransform, characteristicCellSize, wellPathClipBoundingBox);
for (RimWellPathFracture* f : m_rimWellPath->fractureCollection()->fractures())
{
// Always recompute geometry, as the well part can be displayed in more than one view
f->fracturePartManager()->clearGeometryCache();
}
if (m_pipeBranchData.m_surfacePart.notNull())
{
model->addPart(m_pipeBranchData.m_surfacePart.p());
@@ -405,8 +399,6 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
model->addPart(m_wellLabelPart.p());
}
appendFracturePartsToModel(model, displayCoordTransform);
appendFishboneSubsPartsToModel(model, displayCoordTransform, characteristicCellSize);
appendImportedFishbonesToModel(model, displayCoordTransform, characteristicCellSize);
}

View File

@@ -44,6 +44,7 @@ class RimProject;
class RimWellPath;
class RivFishbonesSubsPartMgr;
class RimWellPathCollection;
class RimEclipseView;
class QDateTime;
@@ -58,6 +59,9 @@ public:
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform);
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model,
const RimEclipseView* eclView);
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const QDateTime& timeStamp,
double characteristicCellSize,
@@ -80,8 +84,6 @@ private:
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize);
void appendFracturePartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform);
void buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize,