Skip to content

Commit

Permalink
#1040 - pre-proto - Converting facture coordinates to display coordin…
Browse files Browse the repository at this point in the history
…ates for visualization. Fractures not yet shown at correct possition.
  • Loading branch information
astridkbjorke committed Jan 6, 2017
1 parent 9e933a9 commit 3f05297
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "RicSimWellFracturesDeleteAllFeature.h"

#include "RimSimWellFractureCollection.h"
#include "RimEclipseView.h"

#include "cafSelectionManager.h"

Expand Down Expand Up @@ -61,6 +62,10 @@ void RicSimWellFracturesDeleteAllFeature::onActionTriggered(bool isChecked)
fractureCollection = objects[0];
fractureCollection->deleteFractures();
fractureCollection->uiCapability()->updateConnectedEditors();

RimEclipseView* mainView = nullptr;
fractureCollection->firstAncestorOrThisOfType(mainView);
if (mainView) mainView->scheduleCreateDisplayModelAndRedraw();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "RicWellPathFracturesDeleteAllFeature.h"

#include "RimWellPathFractureCollection.h"
#include "RimEclipseView.h"

#include "cafSelectionManager.h"

Expand Down Expand Up @@ -59,11 +60,15 @@ void RicWellPathFracturesDeleteAllFeature::onActionTriggered(bool isChecked)
if (objects.size() > 0)
{
fractureCollection = objects[0];
}

fractureCollection->deleteFractures();
fractureCollection->deleteFractures();

fractureCollection->uiCapability()->updateConnectedEditors();
fractureCollection->uiCapability()->updateConnectedEditors();

RimEclipseView* mainView = nullptr;
fractureCollection->firstAncestorOrThisOfType(mainView);
if (mainView) mainView->scheduleCreateDisplayModelAndRedraw();

}
}

//--------------------------------------------------------------------------------------------------
Expand Down
31 changes: 27 additions & 4 deletions ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "RivWellFracturesPartMgr.h"

#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimFracture.h"

Expand All @@ -28,6 +29,7 @@
#include "cvfPart.h"
#include "cvfPrimitiveSet.h"
#include "cvfPrimitiveSetIndexedUInt.h"
#include "cafDisplayCoordTransform.h"


//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -63,23 +65,44 @@ void RivWellFracturesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicL
fracture->computeGeometry();
}
}

if (fractures.size() > 0)
{
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(fractures.at(0));
if (!objHandle) return;

RimEclipseView* mainView = nullptr;
objHandle->firstAncestorOrThisOfType(mainView);
if (!mainView) return;

cvf::ref<caf::DisplayCoordTransform> transForm = mainView->displayCoordTransform();

appendFracturePartsToModel(fractures, model, transForm.p());
}

appendFracturePartsToModel(fractures, model);
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturesPartMgr::appendFracturePartsToModel(std::vector<RimFracture*> fractures, cvf::ModelBasicList* model)
void RivWellFracturesPartMgr::appendFracturePartsToModel(std::vector<RimFracture*> fractures, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform)
{
for (RimFracture* fracture : fractures)
{
if (fracture->hasValidGeometry())
{
const std::vector<cvf::Vec3f>& nodeCoords = fracture->nodeCoords();
const std::vector<cvf::uint>& polygonIndices = fracture->polygonIndices();

cvf::ref<cvf::DrawableGeo> geo = createGeo(polygonIndices, nodeCoords);
std::vector<cvf::Vec3f> displayCoords;

for (int i = 0; i < nodeCoords.size(); i++)
{
cvf::Vec3d nodeCoordsDouble = static_cast<cvf::Vec3d>(nodeCoords[i]);
cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble);
displayCoords.push_back(static_cast<cvf::Vec3f>(displayCoordsDouble));
}

cvf::ref<cvf::DrawableGeo> geo = createGeo(polygonIndices, displayCoords);

cvf::ref<cvf::Part> part = new cvf::Part;
part->setDrawable(geo.p());
Expand Down
7 changes: 6 additions & 1 deletion ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ namespace cvf
class ModelBasicList;
class DrawableGeo;
}
namespace caf
{
class DisplayCoordTransform;
}


class RimEclipseWell;
class RimFracture;
Expand All @@ -47,7 +52,7 @@ class RivWellFracturesPartMgr : public cvf::Object

void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);

static void appendFracturePartsToModel(std::vector<RimFracture*> fractures, cvf::ModelBasicList* model);
static void appendFracturePartsToModel(std::vector<RimFracture*> fractures, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform);

private:
static cvf::ref<cvf::DrawableGeo> createGeo(const std::vector<cvf::uint>& polygonIndices, const std::vector<cvf::Vec3f>& nodeCoords);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RivWellPathPartMgr.h"
#include "cafDisplayCoordTransform.h"


//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -67,7 +68,8 @@ void RivWellPathCollectionPartMgr::setScaleTransform(cvf::Transform * scaleTrans
///
//--------------------------------------------------------------------------------------------------
void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox)
cvf::Transform* scaleTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform)
{
setScaleTransform(scaleTransform);

Expand All @@ -78,7 +80,7 @@ void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBa
{
RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
partMgr->setScaleTransform(scaleTransform);
partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ namespace cvf
class ModelBasicList;
}

namespace caf
{
class DisplayCoordTransform;
}


class RivWellPathCollectionPartMgr : public cvf::Object
{
Expand All @@ -54,7 +59,8 @@ class RivWellPathCollectionPartMgr : public cvf::Object
cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform,
double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox);
cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform);

private:
caf::PdmPointer<RimWellPathCollection> m_wellPathCollection;
Expand Down
9 changes: 5 additions & 4 deletions ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "RivWellPathPartMgr.h"
#include "RivWellPathSourceInfo.h"

#include "cafDisplayCoordTransform.h"
#include "cafEffectGenerator.h"

#include "cvfDrawableGeo.h"
Expand Down Expand Up @@ -87,7 +88,7 @@ RivWellPathPartMgr::~RivWellPathPartMgr()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model)
void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform)
{
// Append well path fractures
std::vector<RimFracture*> fractures;
Expand All @@ -101,7 +102,7 @@ void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model)
fractures.push_back(f);
}

RivWellFracturesPartMgr::appendFracturePartsToModel(fractures, model);
RivWellFracturesPartMgr::appendFracturePartsToModel(fractures, model, displayCoordTransform);
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -254,7 +255,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox)
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform)
{
RimWellPathCollection* wellPathCollection = NULL;
m_rimWellPath->firstAncestorOrThisOfType(wellPathCollection);
Expand Down Expand Up @@ -289,7 +290,7 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
model->addPart(m_wellLabelPart.p());
}

appendFracturePartsToModel(model);
appendFracturePartsToModel(model, displayCoordTransform);
}

//--------------------------------------------------------------------------------------------------
Expand Down
10 changes: 8 additions & 2 deletions ApplicationCode/ModelVisualization/RivWellPathPartMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace cvf
class ScalarMapper;
}

namespace caf
{
class DisplayCoordTransform;
}

class RivPipeGeometryGenerator;
class RimProject;
class RimWellPath;
Expand All @@ -48,12 +53,13 @@ class RivWellPathPartMgr : public cvf::Object
void scheduleGeometryRegen() { m_needsTransformUpdate = true; }//printf("R"); }

void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform);


size_t segmentIndexFromTriangleIndex(size_t triangleIndex);

private:
void appendFracturePartsToModel(cvf::ModelBasicList* model);
void appendFracturePartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform);

private:
caf::PdmPointer<RimWellPath> m_rimWellPath;
Expand Down
4 changes: 4 additions & 0 deletions ApplicationCode/ProjectDataModel/RimFracture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ void RimFracture::computeGeometry()
}

// TODO: Modify coords by fracture center and orientation
for (int i = 0; i < nodeCoords.size(); i++ )
{
nodeCoords[i] = nodeCoords[i] + static_cast<cvf::Vec3f>(center);
}

m_rigFracture->setGeometry(polygonIndices, nodeCoords);
}
Expand Down
26 changes: 12 additions & 14 deletions ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@

#include "RiaApplication.h"

#include "RigCaseData.h"
#include "RigMainGrid.h"
#include "RigTesselatorTools.h"

#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h"
#include "RimFractureDefinition.h"
#include "RimFractureDefinitionCollection.h"
#include "RimOilField.h"
Expand All @@ -29,17 +36,12 @@
#include "cafPdmFieldHandle.h"
#include "cafPdmObject.h"
#include "cafPdmUiItem.h"
#include "cafDisplayCoordTransform.h"

#include "QToolBox"
#include "QList"
#include "cvfVector3.h"
#include "RigTesselatorTools.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseCase.h"
#include "RigCaseData.h"
#include "RigMainGrid.h"
#include "cafDisplayCoordTransform.h"

#include <QToolBox>
#include <QList>



Expand Down Expand Up @@ -121,11 +123,7 @@ cvf::Vec3d RimSimWellFracture::centerPointForFracture()
size_t gridCellIndex = mainGrid->cellIndexFromIJK(m_i, m_j, m_k);
const RigCell& rigCell = mainGrid->cell(gridCellIndex);
cvf::Vec3d center = rigCell.center();

cvf::ref<caf::DisplayCoordTransform> transForm = mainView->displayCoordTransform();
cvf::Vec3d displayCoord = transForm->transformToDisplayCoord(center);

return displayCoord;
return center;
}

//--------------------------------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion ApplicationCode/ProjectDataModel/RimView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,16 @@ void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
RimWellPathCollection* wellPathCollection = oilFields ? oilFields->wellPathCollection() : NULL;
RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = wellPathCollection ? wellPathCollection->wellPathCollectionPartMgr() : NULL;

cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();

if (wellPathCollectionPartMgr)
{
wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(wellPathModelBasicList,
displayModelOffset,
scaleTransform,
characteristicCellSize,
wellPathClipBoundingBox);
wellPathClipBoundingBox,
transForm.p());
}

wellPathModelBasicList->updateBoundingBoxesRecursive();
Expand Down
8 changes: 5 additions & 3 deletions ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include "RiaApplication.h"

#include "RigTesselatorTools.h"

#include "RimFractureDefinition.h"
#include "RimFractureDefinitionCollection.h"
#include "RimOilField.h"
Expand All @@ -30,10 +32,10 @@
#include "cafPdmObject.h"
#include "cafPdmUiItem.h"

#include "QToolBox"
#include "QList"
#include "cvfVector3.h"
#include "RigTesselatorTools.h"

#include <QToolBox>
#include <QList>



Expand Down
2 changes: 1 addition & 1 deletion ApplicationCode/ReservoirDataModel/RigFracture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const std::vector<cvf::uint>& RigFracture::polygonIndices() const
}

//--------------------------------------------------------------------------------------------------
///
/// Returns node coordinates in domain coordinate system
//--------------------------------------------------------------------------------------------------
const std::vector<cvf::Vec3f>& RigFracture::nodeCoords() const
{
Expand Down

0 comments on commit 3f05297

Please sign in to comment.