#1040 - pre-proto - Converting facture coordinates to display coordinates for visualization. Fractures not yet shown at correct possition.

This commit is contained in:
astridkbjorke 2017-01-06 10:26:57 +01:00
parent 9e933a9c1c
commit 3f052976f5
13 changed files with 97 additions and 37 deletions

View File

@ -20,6 +20,7 @@
#include "RicSimWellFracturesDeleteAllFeature.h"
#include "RimSimWellFractureCollection.h"
#include "RimEclipseView.h"
#include "cafSelectionManager.h"
@ -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();
}
}

View File

@ -20,6 +20,7 @@
#include "RicWellPathFracturesDeleteAllFeature.h"
#include "RimWellPathFractureCollection.h"
#include "RimEclipseView.h"
#include "cafSelectionManager.h"
@ -59,11 +60,15 @@ void RicWellPathFracturesDeleteAllFeature::onActionTriggered(bool isChecked)
if (objects.size() > 0)
{
fractureCollection = objects[0];
}
fractureCollection->deleteFractures();
fractureCollection->uiCapability()->updateConnectedEditors();
RimEclipseView* mainView = nullptr;
fractureCollection->firstAncestorOrThisOfType(mainView);
if (mainView) mainView->scheduleCreateDisplayModelAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -18,6 +18,7 @@
#include "RivWellFracturesPartMgr.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimFracture.h"
@ -28,6 +29,7 @@
#include "cvfPart.h"
#include "cvfPrimitiveSet.h"
#include "cvfPrimitiveSetIndexedUInt.h"
#include "cafDisplayCoordTransform.h"
//--------------------------------------------------------------------------------------------------
@ -64,13 +66,26 @@ void RivWellFracturesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicL
}
}
appendFracturePartsToModel(fractures, model);
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());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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)
{
@ -78,8 +93,16 @@ void RivWellFracturesPartMgr::appendFracturePartsToModel(std::vector<RimFracture
{
const std::vector<cvf::Vec3f>& nodeCoords = fracture->nodeCoords();
const std::vector<cvf::uint>& polygonIndices = fracture->polygonIndices();
std::vector<cvf::Vec3f> displayCoords;
cvf::ref<cvf::DrawableGeo> geo = createGeo(polygonIndices, nodeCoords);
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());

View File

@ -31,6 +31,11 @@ namespace cvf
class ModelBasicList;
class DrawableGeo;
}
namespace caf
{
class DisplayCoordTransform;
}
class RimEclipseWell;
class RimFracture;
@ -47,7 +52,7 @@ public:
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);

View File

@ -23,6 +23,7 @@
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RivWellPathPartMgr.h"
#include "cafDisplayCoordTransform.h"
//--------------------------------------------------------------------------------------------------
@ -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);
@ -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);
}
}

View File

@ -38,6 +38,11 @@ namespace cvf
class ModelBasicList;
}
namespace caf
{
class DisplayCoordTransform;
}
class RivWellPathCollectionPartMgr : public cvf::Object
{
@ -54,7 +59,8 @@ public:
cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform,
double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox);
cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform);
private:
caf::PdmPointer<RimWellPathCollection> m_wellPathCollection;

View File

@ -34,6 +34,7 @@
#include "RivWellPathPartMgr.h"
#include "RivWellPathSourceInfo.h"
#include "cafDisplayCoordTransform.h"
#include "cafEffectGenerator.h"
#include "cvfDrawableGeo.h"
@ -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;
@ -101,7 +102,7 @@ void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model)
fractures.push_back(f);
}
RivWellFracturesPartMgr::appendFracturePartsToModel(fractures, model);
RivWellFracturesPartMgr::appendFracturePartsToModel(fractures, model, displayCoordTransform);
}
//--------------------------------------------------------------------------------------------------
@ -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);
@ -289,7 +290,7 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
model->addPart(m_wellLabelPart.p());
}
appendFracturePartsToModel(model);
appendFracturePartsToModel(model, displayCoordTransform);
}
//--------------------------------------------------------------------------------------------------

View File

@ -33,6 +33,11 @@ namespace cvf
class ScalarMapper;
}
namespace caf
{
class DisplayCoordTransform;
}
class RivPipeGeometryGenerator;
class RimProject;
class RimWellPath;
@ -48,12 +53,13 @@ public:
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;

View File

@ -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);
}

View File

@ -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"
@ -29,18 +36,13 @@
#include "cafPdmFieldHandle.h"
#include "cafPdmObject.h"
#include "cafPdmUiItem.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 "cvfVector3.h"
#include <QToolBox>
#include <QList>
CAF_PDM_SOURCE_INIT(RimSimWellFracture, "SimWellFracture");
@ -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;
}
//--------------------------------------------------------------------------------------------------

View File

@ -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();

View File

@ -20,6 +20,8 @@
#include "RiaApplication.h"
#include "RigTesselatorTools.h"
#include "RimFractureDefinition.h"
#include "RimFractureDefinitionCollection.h"
#include "RimOilField.h"
@ -30,10 +32,10 @@
#include "cafPdmObject.h"
#include "cafPdmUiItem.h"
#include "QToolBox"
#include "QList"
#include "cvfVector3.h"
#include "RigTesselatorTools.h"
#include <QToolBox>
#include <QList>

View File

@ -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
{