diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp index da9add2d71..f5d9b2dad8 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp @@ -63,7 +63,8 @@ RivIntersectionBoxPartMgr::RivIntersectionBoxPartMgr(const RimIntersectionBox* i m_intersectionBoxFacesTextureCoords = new cvf::Vec2fArray; - computeData(); + cvf::ref hexGrid = createHexGridInterface(); + m_intersectionBoxGenerator = new RivIntersectionBoxGeometryGenerator(m_rimIntersectionBox, hexGrid.p()); } //-------------------------------------------------------------------------------------------------- @@ -71,8 +72,6 @@ RivIntersectionBoxPartMgr::RivIntersectionBoxPartMgr(const RimIntersectionBox* i //-------------------------------------------------------------------------------------------------- void RivIntersectionBoxPartMgr::applySingleColorEffect() { - if (m_intersectionBoxGenerator.isNull()) return; - m_defaultColor = cvf::Color3f::OLIVE;//m_rimCrossSection->CrossSectionColor(); this->updatePartEffect(); } @@ -82,7 +81,6 @@ void RivIntersectionBoxPartMgr::applySingleColorEffect() //-------------------------------------------------------------------------------------------------- void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex) { - if (m_intersectionBoxGenerator.isNull()) return; if (!m_intersectionBoxGenerator->isAnyGeometryPresent()) return; @@ -280,7 +278,6 @@ const int priMesh = 3; //-------------------------------------------------------------------------------------------------- void RivIntersectionBoxPartMgr::generatePartGeometry() { - if (m_intersectionBoxGenerator.isNull()) return; bool useBufferObjects = true; // Surface geometry @@ -296,7 +293,7 @@ void RivIntersectionBoxPartMgr::generatePartGeometry() } cvf::ref part = new cvf::Part; - part->setName("Cross Section"); + part->setName("Intersection Box"); part->setDrawable(geo.p()); // Set mapping from triangle face index to cell index @@ -322,7 +319,7 @@ void RivIntersectionBoxPartMgr::generatePartGeometry() } cvf::ref part = new cvf::Part; - part->setName("Cross Section mesh"); + part->setName("Intersection box mesh"); part->setDrawable(geoMesh.p()); part->updateBoundingBox(); @@ -342,8 +339,6 @@ void RivIntersectionBoxPartMgr::generatePartGeometry() //-------------------------------------------------------------------------------------------------- void RivIntersectionBoxPartMgr::updatePartEffect() { - if (m_intersectionBoxGenerator.isNull()) return; - // Set deCrossSection effect caf::SurfaceEffectGenerator geometryEffgen(m_defaultColor, caf::PO_1); @@ -402,14 +397,6 @@ void RivIntersectionBoxPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivIntersectionBoxPartMgr::computeData() -{ - cvf::ref hexGrid = createHexGridInterface(); - m_intersectionBoxGenerator = new RivIntersectionBoxGeometryGenerator(m_rimIntersectionBox, hexGrid.p()); -} //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.h b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.h index 5ac278fdcf..637c3ae32c 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.h +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.h @@ -57,7 +57,6 @@ public: private: void updatePartEffect(); void generatePartGeometry(); - void computeData(); static void calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords, const std::vector& triangleToCellIdxMap, diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 6a381af32a..1f3003df00 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -268,6 +268,9 @@ void RimGeoMechView::createDisplayModel() { updateLegends(); m_vizLogic->updateStaticCellColors(-1); + crossSectionCollection->applySingleColorEffect(); + intersectionBoxCollection->applySingleColorEffect(); + m_overlayInfoConfig()->update3DInfo(); } } @@ -316,6 +319,9 @@ void RimGeoMechView::updateCurrentTimeStep() else { m_vizLogic->updateStaticCellColors(-1); + crossSectionCollection->applySingleColorEffect(); + intersectionBoxCollection->applySingleColorEffect(); + m_viewer->animationControl()->slotPause(); // To avoid animation timer spinning in the background } diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionBoxCollection.cpp b/ApplicationCode/ProjectDataModel/RimIntersectionBoxCollection.cpp index ea84daeb15..5de8857b39 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionBoxCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersectionBoxCollection.cpp @@ -66,6 +66,8 @@ caf::PdmFieldHandle* RimIntersectionBoxCollection::objectToggleField() //-------------------------------------------------------------------------------------------------- void RimIntersectionBoxCollection::applySingleColorEffect() { + if (!isActive) return; + for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx) { RimIntersectionBox* cs = m_intersectionBoxes[csIdx]; @@ -81,6 +83,8 @@ void RimIntersectionBoxCollection::applySingleColorEffect() //-------------------------------------------------------------------------------------------------- void RimIntersectionBoxCollection::updateCellResultColor(size_t timeStepIndex) { + if (!isActive) return; + for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx) { RimIntersectionBox* cs = m_intersectionBoxes[csIdx]; diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp index abf95faa84..bee9f7f755 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp @@ -65,6 +65,8 @@ caf::PdmFieldHandle* RimIntersectionCollection::objectToggleField() //-------------------------------------------------------------------------------------------------- void RimIntersectionCollection::applySingleColorEffect() { + if(!this->isActive()) return; + for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx) { RimIntersection* cs = m_crossSections[csIdx]; @@ -80,10 +82,12 @@ void RimIntersectionCollection::applySingleColorEffect() //-------------------------------------------------------------------------------------------------- void RimIntersectionCollection::updateCellResultColor(size_t timeStepIndex) { - for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx) + if(!this->isActive()) return; + + for(size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx) { RimIntersection* cs = m_crossSections[csIdx]; - if (cs->isActive) + if(cs->isActive) { cs->crossSectionPartMgr()->updateCellResultColor(timeStepIndex); }