diff --git a/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.cpp b/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.cpp index 19ec726275..9df485506f 100644 --- a/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.cpp +++ b/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.cpp @@ -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(); } } diff --git a/ApplicationCode/Commands/RicWellPathFracturesDeleteAllFeature.cpp b/ApplicationCode/Commands/RicWellPathFracturesDeleteAllFeature.cpp index 47c366582b..ffacb604f3 100644 --- a/ApplicationCode/Commands/RicWellPathFracturesDeleteAllFeature.cpp +++ b/ApplicationCode/Commands/RicWellPathFracturesDeleteAllFeature.cpp @@ -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->deleteFractures(); - fractureCollection->uiCapability()->updateConnectedEditors(); + fractureCollection->uiCapability()->updateConnectedEditors(); + + RimEclipseView* mainView = nullptr; + fractureCollection->firstAncestorOrThisOfType(mainView); + if (mainView) mainView->scheduleCreateDisplayModelAndRedraw(); + + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.cpp index 09348d6659..5e434fcdd4 100644 --- a/ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.cpp @@ -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" //-------------------------------------------------------------------------------------------------- @@ -63,14 +65,27 @@ void RivWellFracturesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicL fracture->computeGeometry(); } } + + if (fractures.size() > 0) + { + caf::PdmObjectHandle* objHandle = dynamic_cast(fractures.at(0)); + if (!objHandle) return; + + RimEclipseView* mainView = nullptr; + objHandle->firstAncestorOrThisOfType(mainView); + if (!mainView) return; + + cvf::ref transForm = mainView->displayCoordTransform(); + + appendFracturePartsToModel(fractures, model, transForm.p()); + } - appendFracturePartsToModel(fractures, model); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellFracturesPartMgr::appendFracturePartsToModel(std::vector fractures, cvf::ModelBasicList* model) +void RivWellFracturesPartMgr::appendFracturePartsToModel(std::vector fractures, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform) { for (RimFracture* fracture : fractures) { @@ -78,8 +93,16 @@ void RivWellFracturesPartMgr::appendFracturePartsToModel(std::vector& nodeCoords = fracture->nodeCoords(); const std::vector& polygonIndices = fracture->polygonIndices(); - - cvf::ref geo = createGeo(polygonIndices, nodeCoords); + std::vector displayCoords; + + for (int i = 0; i < nodeCoords.size(); i++) + { + cvf::Vec3d nodeCoordsDouble = static_cast(nodeCoords[i]); + cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble); + displayCoords.push_back(static_cast(displayCoordsDouble)); + } + + cvf::ref geo = createGeo(polygonIndices, displayCoords); cvf::ref part = new cvf::Part; part->setDrawable(geo.p()); diff --git a/ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.h b/ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.h index 3c5a34366b..42172da41c 100644 --- a/ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.h @@ -31,6 +31,11 @@ namespace cvf class ModelBasicList; class DrawableGeo; } +namespace caf +{ + class DisplayCoordTransform; +} + class RimEclipseWell; class RimFracture; @@ -47,7 +52,7 @@ class RivWellFracturesPartMgr : public cvf::Object void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); - static void appendFracturePartsToModel(std::vector fractures, cvf::ModelBasicList* model); + static void appendFracturePartsToModel(std::vector fractures, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform); private: static cvf::ref createGeo(const std::vector& polygonIndices, const std::vector& nodeCoords); diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp index c3f79c55a8..ee34e401b2 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp @@ -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); } } diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h index 386e83d8f6..9d94cde73b 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h @@ -38,6 +38,11 @@ namespace cvf class ModelBasicList; } +namespace caf +{ + class DisplayCoordTransform; +} + class RivWellPathCollectionPartMgr : public cvf::Object { @@ -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 m_wellPathCollection; diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 9b5ccdc2a3..f785fe2e19 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -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 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); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index 289f2ba888..ae37b227e8 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -33,6 +33,11 @@ namespace cvf class ScalarMapper; } +namespace caf +{ + class DisplayCoordTransform; +} + class RivPipeGeometryGenerator; class RimProject; class RimWellPath; @@ -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 m_rimWellPath; diff --git a/ApplicationCode/ProjectDataModel/RimFracture.cpp b/ApplicationCode/ProjectDataModel/RimFracture.cpp index 04d59afb01..73d8a44931 100644 --- a/ApplicationCode/ProjectDataModel/RimFracture.cpp +++ b/ApplicationCode/ProjectDataModel/RimFracture.cpp @@ -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(center); + } m_rigFracture->setGeometry(polygonIndices, nodeCoords); } diff --git a/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp b/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp index 9946edadc5..2c196d27de 100644 --- a/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp +++ b/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp @@ -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,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 +#include @@ -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 transForm = mainView->displayCoordTransform(); - cvf::Vec3d displayCoord = transForm->transformToDisplayCoord(center); - - return displayCoord; + return center; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index f689702dd0..ac5f8f8b75 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -648,13 +648,16 @@ void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, RimWellPathCollection* wellPathCollection = oilFields ? oilFields->wellPathCollection() : NULL; RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = wellPathCollection ? wellPathCollection->wellPathCollectionPartMgr() : NULL; + cvf::ref transForm = displayCoordTransform(); + if (wellPathCollectionPartMgr) { wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(wellPathModelBasicList, displayModelOffset, scaleTransform, characteristicCellSize, - wellPathClipBoundingBox); + wellPathClipBoundingBox, + transForm.p()); } wellPathModelBasicList->updateBoundingBoxesRecursive(); diff --git a/ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp b/ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp index 333113d44f..06f7451837 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp @@ -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 +#include diff --git a/ApplicationCode/ReservoirDataModel/RigFracture.cpp b/ApplicationCode/ReservoirDataModel/RigFracture.cpp index c459dd220c..c700c872ea 100644 --- a/ApplicationCode/ReservoirDataModel/RigFracture.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFracture.cpp @@ -43,7 +43,7 @@ const std::vector& RigFracture::polygonIndices() const } //-------------------------------------------------------------------------------------------------- -/// +/// Returns node coordinates in domain coordinate system //-------------------------------------------------------------------------------------------------- const std::vector& RigFracture::nodeCoords() const {