From cd081856784cf21de49f4e006285b6ea61e83fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 20 Nov 2019 13:01:25 +0100 Subject: [PATCH] #5019 Use the static methods to color intersections as well Move all the color/texture generation methods into a separate tools class. (Only scope wise) --- .../RivHexGridIntersectionTools.h | 9 + .../RivIntersectionBoxGeometryGenerator.h | 8 - .../RivIntersectionBoxPartMgr.cpp | 150 +++++++------- .../Intersections/RivIntersectionBoxPartMgr.h | 34 +--- .../RivIntersectionGeometryGenerator.h | 4 +- .../Intersections/RivIntersectionPartMgr.cpp | 186 ++---------------- .../Intersections/RivIntersectionPartMgr.h | 102 +++++++--- 7 files changed, 182 insertions(+), 311 deletions(-) diff --git a/ApplicationCode/ModelVisualization/Intersections/RivHexGridIntersectionTools.h b/ApplicationCode/ModelVisualization/Intersections/RivHexGridIntersectionTools.h index 56021577de..8fc94951ea 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivHexGridIntersectionTools.h +++ b/ApplicationCode/ModelVisualization/Intersections/RivHexGridIntersectionTools.h @@ -223,3 +223,12 @@ private: std::array m_weights; int m_count; }; + +class RivIntersectionGeometryGeneratorIF +{ +public: + virtual bool isAnyGeometryPresent() const = 0; + virtual const std::vector& triangleToCellIndex() const = 0; + virtual const std::vector& triangleVxToCellCornerInterpolationWeights() const = 0; + virtual const cvf::Vec3fArray* triangleVxes() const = 0; +}; diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxGeometryGenerator.h b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxGeometryGenerator.h index 389af807e3..c26baeab46 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxGeometryGenerator.h +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxGeometryGenerator.h @@ -37,14 +37,6 @@ class ScalarMapper; class DrawableGeo; } // namespace cvf -class RivIntersectionGeometryGeneratorIF -{ -public: - virtual bool isAnyGeometryPresent() const = 0; - virtual const std::vector& triangleToCellIndex() const = 0; - virtual const std::vector& triangleVxToCellCornerInterpolationWeights() const = 0; - virtual const cvf::Vec3fArray* triangleVxes() const = 0; -}; class RivIntersectionBoxGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorIF { diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp index 8940c31422..ab5c70bdab 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp @@ -83,17 +83,17 @@ void RivIntersectionBoxPartMgr::applySingleColorEffect() //-------------------------------------------------------------------------------------------------- void RivIntersectionBoxPartMgr::updateCellResultColor( size_t timeStepIndex ) { - RivIntersectionBoxPartMgr::updateCellResultColorStatic( timeStepIndex, - m_rimIntersectionBox, - m_intersectionBoxGenerator.p(), - m_intersectionBoxFaces.p(), - m_intersectionBoxFacesTextureCoords.p() ); + RivIntersectionResultsColoringTools::updateCellResultColorStatic( timeStepIndex, + m_rimIntersectionBox, + m_intersectionBoxGenerator.p(), + m_intersectionBoxFaces.p(), + m_intersectionBoxFacesTextureCoords.p() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivIntersectionBoxPartMgr::updateCellResultColorStatic( +void RivIntersectionResultsColoringTools::updateCellResultColorStatic( size_t timeStepIndex, RimIntersectionHandle* rimIntersectionHandle, const RivIntersectionGeometryGeneratorIF* intersectionGeomGenIF, @@ -163,34 +163,35 @@ void RivIntersectionBoxPartMgr::updateCellResultColorStatic( { if ( eclipseResDef->isTernarySaturationSelected() ) { - updateEclipseTernaryCellResultColors( eclipseResDef, - ternaryColorMapper, - timeStepIndex, - isLightingDisabled, - intersectionGeomGenIF->triangleToCellIndex(), - intersectionFacesPart, - intersectionFacesTextureCoords ); + RivIntersectionResultsColoringTools::updateEclipseTernaryCellResultColors( eclipseResDef, + ternaryColorMapper, + timeStepIndex, + isLightingDisabled, + intersectionGeomGenIF + ->triangleToCellIndex(), + intersectionFacesPart, + intersectionFacesTextureCoords ); } else { - updateEclipseCellResultColors( eclipseResDef, - scalarColorMapper, - timeStepIndex, - isLightingDisabled, - intersectionGeomGenIF->triangleToCellIndex(), - intersectionFacesPart, - intersectionFacesTextureCoords ); + RivIntersectionResultsColoringTools::updateEclipseCellResultColors( eclipseResDef, + scalarColorMapper, + timeStepIndex, + isLightingDisabled, + intersectionGeomGenIF->triangleToCellIndex(), + intersectionFacesPart, + intersectionFacesTextureCoords ); } } else if ( geomResultDef ) { - updateGeoMechCellResultColors( geomResultDef, - timeStepIndex, - scalarColorMapper, - isLightingDisabled, - intersectionGeomGenIF, - intersectionFacesPart, - intersectionFacesTextureCoords ); + RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( geomResultDef, + timeStepIndex, + scalarColorMapper, + isLightingDisabled, + intersectionGeomGenIF, + intersectionFacesPart, + intersectionFacesTextureCoords ); return; } } @@ -198,13 +199,14 @@ void RivIntersectionBoxPartMgr::updateCellResultColorStatic( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivIntersectionBoxPartMgr::updateEclipseCellResultColors( const RimEclipseResultDefinition* eclipseResDef, - const cvf::ScalarMapper* scalarColorMapper, - size_t timeStepIndex, - bool isLightingDisabled, - const std::vector& triangleToCellIndexMapping, - cvf::Part* intersectionFacesPart, - cvf::Vec2fArray* intersectionFacesTextureCoords ) +void RivIntersectionResultsColoringTools::updateEclipseCellResultColors( + const RimEclipseResultDefinition* eclipseResDef, + const cvf::ScalarMapper* scalarColorMapper, + size_t timeStepIndex, + bool isLightingDisabled, + const std::vector& triangleToCellIndexMapping, + cvf::Part* intersectionFacesPart, + cvf::Vec2fArray* intersectionFacesTextureCoords ) { RigEclipseCaseData* eclipseCaseData = eclipseResDef->eclipseCase()->eclipseCaseData(); @@ -222,10 +224,10 @@ void RivIntersectionBoxPartMgr::updateEclipseCellResultColors( const RimEclipseR eclipseResDef ); } - RivIntersectionPartMgr::calculateEclipseTextureCoordinates( intersectionFacesTextureCoords, - triangleToCellIndexMapping, - resultAccessor.p(), - scalarColorMapper ); + RivIntersectionResultsColoringTools::calculateEclipseTextureCoordinates( intersectionFacesTextureCoords, + triangleToCellIndexMapping, + resultAccessor.p(), + scalarColorMapper ); RivScalarMapperUtils::applyTextureResultsToPart( intersectionFacesPart, intersectionFacesTextureCoords, @@ -238,13 +240,14 @@ void RivIntersectionBoxPartMgr::updateEclipseCellResultColors( const RimEclipseR //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivIntersectionBoxPartMgr::updateEclipseTernaryCellResultColors( const RimEclipseResultDefinition* eclipseResDef, - const RivTernaryScalarMapper* ternaryColorMapper, - size_t timeStepIndex, - bool isLightingDisabled, - const std::vector& triangleToCellIndexMapping, - cvf::Part* intersectionFacesPart, - cvf::Vec2fArray* intersectionFacesTextureCoords ) +void RivIntersectionResultsColoringTools::updateEclipseTernaryCellResultColors( + const RimEclipseResultDefinition* eclipseResDef, + const RivTernaryScalarMapper* ternaryColorMapper, + size_t timeStepIndex, + bool isLightingDisabled, + const std::vector& triangleToCellIndexMapping, + cvf::Part* intersectionFacesPart, + cvf::Vec2fArray* intersectionFacesTextureCoords ) { RivTernaryTextureCoordsCreator texturer( eclipseResDef, ternaryColorMapper, timeStepIndex ); @@ -261,13 +264,14 @@ void RivIntersectionBoxPartMgr::updateEclipseTernaryCellResultColors( const RimE //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivIntersectionBoxPartMgr::updateGeoMechCellResultColors( const RimGeoMechResultDefinition* geomResultDef, - size_t timeStepIndex, - const cvf::ScalarMapper* scalarColorMapper, - bool isLightingDisabled, - const RivIntersectionGeometryGeneratorIF* geomGenerator, - cvf::Part* intersectionFacesPart, - cvf::Vec2fArray* intersectionFacesTextureCoords ) +void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( + const RimGeoMechResultDefinition* geomResultDef, + size_t timeStepIndex, + const cvf::ScalarMapper* scalarColorMapper, + bool isLightingDisabled, + const RivIntersectionGeometryGeneratorIF* geomGenerator, + cvf::Part* intersectionFacesPart, + cvf::Vec2fArray* intersectionFacesTextureCoords ) { RigGeoMechCaseData* caseData = nullptr; RigFemResultAddress resVarAddress; @@ -289,10 +293,10 @@ void RivIntersectionBoxPartMgr::updateGeoMechCellResultColors( const RimGeoMechR 0, (int)timeStepIndex ); - RivIntersectionPartMgr::calculateElementBasedGeoMechTextureCoords( intersectionFacesTextureCoords, - resultValues, - triangleToCellIdx, - scalarColorMapper ); + RivIntersectionResultsColoringTools::calculateElementBasedGeoMechTextureCoords( intersectionFacesTextureCoords, + resultValues, + triangleToCellIdx, + scalarColorMapper ); } else if ( resVarAddress.resultPosType == RIG_ELEMENT_NODAL_FACE ) { @@ -300,20 +304,20 @@ void RivIntersectionBoxPartMgr::updateGeoMechCellResultColors( const RimGeoMechR if ( resVarAddress.componentName == "Pazi" || resVarAddress.componentName == "Pinc" ) { - RivIntersectionPartMgr::calculatePlaneAngleTextureCoords( intersectionFacesTextureCoords, - triangelVxes, - resVarAddress, - scalarColorMapper ); + RivIntersectionResultsColoringTools::calculatePlaneAngleTextureCoords( intersectionFacesTextureCoords, + triangelVxes, + resVarAddress, + scalarColorMapper ); } else { - RivIntersectionPartMgr::calculateGeoMechTensorXfTextureCoords( intersectionFacesTextureCoords, - triangelVxes, - vertexWeights, - caseData, - resVarAddress, - (int)timeStepIndex, - scalarColorMapper ); + RivIntersectionResultsColoringTools::calculateGeoMechTensorXfTextureCoords( intersectionFacesTextureCoords, + triangelVxes, + vertexWeights, + caseData, + resVarAddress, + (int)timeStepIndex, + scalarColorMapper ); } } else @@ -332,12 +336,12 @@ void RivIntersectionBoxPartMgr::updateGeoMechCellResultColors( const RimGeoMechR RigFemPart* femPart = caseData->femParts()->part( 0 ); bool isElementNodalResult = !( resVarAddress.resultPosType == RIG_NODAL ); - RivIntersectionPartMgr::calculateNodeOrElementNodeBasedGeoMechTextureCoords( intersectionFacesTextureCoords, - vertexWeights, - resultValues, - isElementNodalResult, - femPart, - scalarColorMapper ); + RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMechTextureCoords( intersectionFacesTextureCoords, + vertexWeights, + resultValues, + isElementNodalResult, + femPart, + scalarColorMapper ); } RivScalarMapperUtils::applyTextureResultsToPart( intersectionFacesPart, diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.h b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.h index 2285ec1cb9..5328e9246f 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.h +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.h @@ -44,7 +44,6 @@ class RimGeoMechView; class RimEclipseResultDefinition; class RimGeoMechResultDefinition; - //================================================================================================== /// /// @@ -55,8 +54,8 @@ class RivIntersectionBoxPartMgr : public cvf::Object public: explicit RivIntersectionBoxPartMgr( RimIntersectionBox* intersectionBox ); - void applySingleColorEffect(); - void updateCellResultColor( size_t timeStepIndex ); + void applySingleColorEffect(); + void updateCellResultColor( size_t timeStepIndex ); void appendNativeCrossSectionFacesToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform ); void appendMeshLinePartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform ); @@ -65,35 +64,6 @@ private: void updatePartEffect(); void generatePartGeometry(); - static void updateCellResultColorStatic( size_t timeStepIndex, - RimIntersectionHandle* m_rimIntersectionBox, - const RivIntersectionGeometryGeneratorIF* m_intersectionBoxGenerator, - cvf::Part* m_intersectionBoxFaces, - cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords ); - static void updateEclipseCellResultColors( const RimEclipseResultDefinition* eclipseResDef, - const cvf::ScalarMapper* scalarColorMapper, - size_t timeStepIndex, - bool isLightingDisabled, - const std::vector& triangleToCellIndexMapping, - cvf::Part* m_intersectionBoxFaces, - cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords ); - - static void updateEclipseTernaryCellResultColors( const RimEclipseResultDefinition* eclipseResDef, - const RivTernaryScalarMapper* ternaryColorMapper, - size_t timeStepIndex, - bool isLightingDisabled, - const std::vector& triangleToCellIndexMapping, - cvf::Part* m_intersectionBoxFaces, - cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords ); - - static void updateGeoMechCellResultColors( const RimGeoMechResultDefinition* geomResultDef, - size_t timeStepIndex, - const cvf::ScalarMapper* scalarColorMapper, - bool isLightingDisabled, - const RivIntersectionGeometryGeneratorIF* geomGenerator, - cvf::Part* m_intersectionBoxFaces, - cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords ); - private: RimIntersectionBox* m_rimIntersectionBox; diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.h b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.h index 5c6803e29e..b5fa0287df 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.h +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.h @@ -21,6 +21,8 @@ #include "cafPdmPointer.h" +#include "RivHexGridIntersectionTools.h" + #include "cvfArray.h" #include "cvfBoundingBox.h" @@ -44,7 +46,7 @@ class ScalarMapper; class DrawableGeo; } // namespace cvf -class RivIntersectionGeometryGenerator : public cvf::Object +class RivIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorIF { public: RivIntersectionGeometryGenerator( RimIntersection* crossSection, diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp index 897b4c079b..f7efa84930 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp @@ -152,164 +152,17 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t const cvf::ScalarMapper* scalarColorMapper, const RivTernaryScalarMapper* ternaryColorMapper ) { - if ( !m_crossSectionGenerator->isAnyGeometryPresent() ) return; - - CVF_ASSERT( scalarColorMapper ); - - RimEclipseView* eclipseView = nullptr; - m_rimCrossSection->firstAncestorOrThisOfType( eclipseView ); - - if ( eclipseView ) - { - bool isLightingDisabled = eclipseView->isLightingDisabled(); - - RimEclipseResultDefinition* eclipseResDef = eclipseView->cellResult(); - bool isTernaryResult = eclipseResDef->isTernarySaturationSelected(); - RigEclipseCaseData* eclipseCaseData = eclipseResDef->eclipseCase()->eclipseCaseData(); - - CVF_ASSERT( eclipseResDef ); - - // CrossSections - if ( m_crossSectionFaces.notNull() ) - { - if ( isTernaryResult ) - { - RivTernaryTextureCoordsCreator texturer( eclipseResDef, ternaryColorMapper, timeStepIndex ); - - texturer.createTextureCoords( m_crossSectionFacesTextureCoords.p(), - m_crossSectionGenerator->triangleToCellIndex() ); - - RivScalarMapperUtils::applyTernaryTextureResultsToPart( m_crossSectionFaces.p(), - m_crossSectionFacesTextureCoords.p(), - ternaryColorMapper, - 1.0, - caf::FC_NONE, - isLightingDisabled ); - } - else - { - CVF_ASSERT( m_crossSectionGenerator.notNull() ); - - cvf::ref resultAccessor; - - if ( RiaDefines::isPerCellFaceResult( eclipseResDef->resultVariable() ) ) - { - resultAccessor = new RigHugeValResultAccessor; - } - else - { - resultAccessor = RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData, - 0, - timeStepIndex, - eclipseResDef ); - } - - RivIntersectionPartMgr::calculateEclipseTextureCoordinates( m_crossSectionFacesTextureCoords.p(), - m_crossSectionGenerator->triangleToCellIndex(), - resultAccessor.p(), - scalarColorMapper ); - - RivScalarMapperUtils::applyTextureResultsToPart( m_crossSectionFaces.p(), - m_crossSectionFacesTextureCoords.p(), - scalarColorMapper, - 1.0, - caf::FC_NONE, - isLightingDisabled ); - } - } - } - - RimGeoMechView* geoView; - m_rimCrossSection->firstAncestorOrThisOfType( geoView ); - - if ( geoView ) - { - bool isLightingDisabled = geoView->isLightingDisabled(); - - RigGeoMechCaseData* caseData = nullptr; - RigFemResultAddress resVarAddress; - { - RimGeoMechResultDefinition* geomResultDef = geoView->cellResult(); - caseData = geomResultDef->ownerCaseData(); - resVarAddress = geomResultDef->resultAddress(); - } - - if ( !caseData ) return; - - if ( resVarAddress.resultPosType == RIG_ELEMENT ) - { - const std::vector& resultValues = caseData->femPartResults()->resultValues( resVarAddress, - 0, - (int)timeStepIndex ); - const std::vector& triangleToCellIdx = m_crossSectionGenerator->triangleToCellIndex(); - - RivIntersectionPartMgr::calculateElementBasedGeoMechTextureCoords( m_crossSectionFacesTextureCoords.p(), - resultValues, - triangleToCellIdx, - scalarColorMapper ); - } - else if ( resVarAddress.resultPosType == RIG_ELEMENT_NODAL_FACE ) - { - // Special direction sensitive result calculation - const cvf::Vec3fArray* triangelVxes = m_crossSectionGenerator->triangleVxes(); - - if ( resVarAddress.componentName == "Pazi" || resVarAddress.componentName == "Pinc" ) - { - RivIntersectionPartMgr::calculatePlaneAngleTextureCoords( m_crossSectionFacesTextureCoords.p(), - triangelVxes, - resVarAddress, - scalarColorMapper ); - } - else - { - const std::vector& vertexWeights = - m_crossSectionGenerator->triangleVxToCellCornerInterpolationWeights(); - - RivIntersectionPartMgr::calculateGeoMechTensorXfTextureCoords( m_crossSectionFacesTextureCoords.p(), - triangelVxes, - vertexWeights, - caseData, - resVarAddress, - (int)timeStepIndex, - scalarColorMapper ); - } - } - else - { - // Do a "Hack" to show elm nodal and not nodal POR results - if ( resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar" ) - resVarAddress.resultPosType = RIG_ELEMENT_NODAL; - - const std::vector& resultValues = caseData->femPartResults()->resultValues( resVarAddress, - 0, - (int)timeStepIndex ); - RigFemPart* femPart = caseData->femParts()->part( 0 ); - bool isElementNodalResult = !( resVarAddress.resultPosType == RIG_NODAL ); - const std::vector& vertexWeights = - m_crossSectionGenerator->triangleVxToCellCornerInterpolationWeights(); - - RivIntersectionPartMgr::calculateNodeOrElementNodeBasedGeoMechTextureCoords( m_crossSectionFacesTextureCoords - .p(), - vertexWeights, - resultValues, - isElementNodalResult, - femPart, - scalarColorMapper ); - } - - RivScalarMapperUtils::applyTextureResultsToPart( m_crossSectionFaces.p(), - m_crossSectionFacesTextureCoords.p(), - scalarColorMapper, - 1.0, - caf::FC_NONE, - isLightingDisabled ); - } + RivIntersectionResultsColoringTools::updateCellResultColorStatic( timeStepIndex, + m_rimCrossSection, + m_crossSectionGenerator.p(), + m_crossSectionFaces.p(), + m_crossSectionFacesTextureCoords.p() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivIntersectionPartMgr::calculateNodeOrElementNodeBasedGeoMechTextureCoords( +void RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMechTextureCoords( cvf::Vec2fArray* textureCoords, const std::vector& vertexWeights, const std::vector& resultValues, @@ -364,10 +217,11 @@ void RivIntersectionPartMgr::calculateNodeOrElementNodeBasedGeoMechTextureCoords //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivIntersectionPartMgr::calculateElementBasedGeoMechTextureCoords( cvf::Vec2fArray* textureCoords, - const std::vector& resultValues, - const std::vector& triangleToCellIdx, - const cvf::ScalarMapper* mapper ) +void RivIntersectionResultsColoringTools::calculateElementBasedGeoMechTextureCoords( + cvf::Vec2fArray* textureCoords, + const std::vector& resultValues, + const std::vector& triangleToCellIdx, + const cvf::ScalarMapper* mapper ) { textureCoords->resize( triangleToCellIdx.size() * 3 ); @@ -405,7 +259,7 @@ void RivIntersectionPartMgr::calculateElementBasedGeoMechTextureCoords( cvf::Vec //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivIntersectionPartMgr::calculateGeoMechTensorXfTextureCoords( +void RivIntersectionResultsColoringTools::calculateGeoMechTensorXfTextureCoords( cvf::Vec2fArray* textureCoords, const cvf::Vec3fArray* triangelVertices, const std::vector& vertexWeights, @@ -446,10 +300,10 @@ void RivIntersectionPartMgr::calculateGeoMechTensorXfTextureCoords( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivIntersectionPartMgr::calculatePlaneAngleTextureCoords( cvf::Vec2fArray* textureCoords, - const cvf::Vec3fArray* triangelVertices, - const RigFemResultAddress& resVarAddress, - const cvf::ScalarMapper* mapper ) +void RivIntersectionResultsColoringTools::calculatePlaneAngleTextureCoords( cvf::Vec2fArray* textureCoords, + const cvf::Vec3fArray* triangelVertices, + const RigFemResultAddress& resVarAddress, + const cvf::ScalarMapper* mapper ) { textureCoords->resize( triangelVertices->size() ); cvf::Vec2f* rawPtr = textureCoords->ptr(); @@ -493,10 +347,10 @@ void RivIntersectionPartMgr::calculatePlaneAngleTextureCoords( cvf::Vec2fArray* /// Calculates the texture coordinates in a "nearly" one dimensional texture. /// Undefined values are coded with a y-texturecoordinate value of 1.0 instead of the normal 0.5 //-------------------------------------------------------------------------------------------------- -void RivIntersectionPartMgr::calculateEclipseTextureCoordinates( cvf::Vec2fArray* textureCoords, - const std::vector& triangleToCellIdxMap, - const RigResultAccessor* resultAccessor, - const cvf::ScalarMapper* mapper ) +void RivIntersectionResultsColoringTools::calculateEclipseTextureCoordinates( cvf::Vec2fArray* textureCoords, + const std::vector& triangleToCellIdxMap, + const RigResultAccessor* resultAccessor, + const cvf::ScalarMapper* mapper ) { if ( !resultAccessor ) return; diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.h b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.h index 5a8493cd75..12ba1beed6 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.h +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.h @@ -80,37 +80,6 @@ public: cvf::Mat4d unflattenTransformMatrix( const cvf::Vec3d& intersectionPointFlat ); public: - static void calculateEclipseTextureCoordinates( cvf::Vec2fArray* textureCoords, - const std::vector& triangleToCellIdxMap, - const RigResultAccessor* resultAccessor, - const cvf::ScalarMapper* mapper ); - - static void calculateNodeOrElementNodeBasedGeoMechTextureCoords( - cvf::Vec2fArray* textureCoords, - const std::vector& vertexWeights, - const std::vector& resultValues, - bool isElementNodalResult, - const RigFemPart* femPart, - const cvf::ScalarMapper* mapper ); - - static void calculateElementBasedGeoMechTextureCoords( cvf::Vec2fArray* textureCoords, - const std::vector& resultValues, - const std::vector& triangleToCellIdx, - const cvf::ScalarMapper* mapper ); - - static void calculateGeoMechTensorXfTextureCoords( cvf::Vec2fArray* textureCoords, - const cvf::Vec3fArray* triangelVertices, - const std::vector& vertexWeights, - RigGeoMechCaseData* caseData, - const RigFemResultAddress& resVarAddress, - int timeStepIdx, - const cvf::ScalarMapper* mapper ); - - static void calculatePlaneAngleTextureCoords( cvf::Vec2fArray* textureCoords, - const cvf::Vec3fArray* triangelVertices, - const RigFemResultAddress& resVarAddress, - const cvf::ScalarMapper* mapper ); - private: void generatePartGeometry(); void createFaultLabelParts( const std::vector>& labelAndAnchors ); @@ -144,3 +113,74 @@ private: bool m_isFlattened; }; + +class RimIntersectionHandle; +class RivIntersectionGeometryGeneratorIF; +class RimEclipseResultDefinition; +class RimGeoMechResultDefinition; + +class RivIntersectionResultsColoringTools +{ +public: + static void updateCellResultColorStatic( size_t timeStepIndex, + RimIntersectionHandle* m_rimIntersectionBox, + const RivIntersectionGeometryGeneratorIF* m_intersectionBoxGenerator, + cvf::Part* m_intersectionBoxFaces, + cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords ); + +private: + static void updateEclipseCellResultColors( const RimEclipseResultDefinition* eclipseResDef, + const cvf::ScalarMapper* scalarColorMapper, + size_t timeStepIndex, + bool isLightingDisabled, + const std::vector& triangleToCellIndexMapping, + cvf::Part* m_intersectionBoxFaces, + cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords ); + + static void updateEclipseTernaryCellResultColors( const RimEclipseResultDefinition* eclipseResDef, + const RivTernaryScalarMapper* ternaryColorMapper, + size_t timeStepIndex, + bool isLightingDisabled, + const std::vector& triangleToCellIndexMapping, + cvf::Part* m_intersectionBoxFaces, + cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords ); + + static void updateGeoMechCellResultColors( const RimGeoMechResultDefinition* geomResultDef, + size_t timeStepIndex, + const cvf::ScalarMapper* scalarColorMapper, + bool isLightingDisabled, + const RivIntersectionGeometryGeneratorIF* geomGenerator, + cvf::Part* m_intersectionBoxFaces, + cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords ); + + static void calculateEclipseTextureCoordinates( cvf::Vec2fArray* textureCoords, + const std::vector& triangleToCellIdxMap, + const RigResultAccessor* resultAccessor, + const cvf::ScalarMapper* mapper ); + + static void calculateNodeOrElementNodeBasedGeoMechTextureCoords( + cvf::Vec2fArray* textureCoords, + const std::vector& vertexWeights, + const std::vector& resultValues, + bool isElementNodalResult, + const RigFemPart* femPart, + const cvf::ScalarMapper* mapper ); + + static void calculateElementBasedGeoMechTextureCoords( cvf::Vec2fArray* textureCoords, + const std::vector& resultValues, + const std::vector& triangleToCellIdx, + const cvf::ScalarMapper* mapper ); + + static void calculateGeoMechTensorXfTextureCoords( cvf::Vec2fArray* textureCoords, + const cvf::Vec3fArray* triangelVertices, + const std::vector& vertexWeights, + RigGeoMechCaseData* caseData, + const RigFemResultAddress& resVarAddress, + int timeStepIdx, + const cvf::ScalarMapper* mapper ); + + static void calculatePlaneAngleTextureCoords( cvf::Vec2fArray* textureCoords, + const cvf::Vec3fArray* triangelVertices, + const RigFemResultAddress& resVarAddress, + const cvf::ScalarMapper* mapper ); +}; \ No newline at end of file