From 498e8f4fec90f3e034affd2e7350682558ad4b4e Mon Sep 17 00:00:00 2001 From: ouv Date: Mon, 1 Jun 2009 13:28:35 +0000 Subject: [PATCH] Fix of the following issues: - 0019930: EDF 779 VISU : Filter group inactive in animation - 0020090: EDF 889 VISU : Field range on groups selected --- src/CONVERTOR/VISU_MedConvertor.cxx | 169 ++++++++++++++++++++++++- src/CONVERTOR/VISU_MedConvertor.hxx | 4 + src/CONVERTOR/VISU_Structures.hxx | 10 +- src/CONVERTOR/VISU_Structures_impl.cxx | 54 +++++++- src/CONVERTOR/VISU_Structures_impl.hxx | 12 +- src/PIPELINE/VISU_GaussPointsPL.cxx | 17 ++- src/PIPELINE/VISU_GaussPointsPL.hxx | 8 +- src/PIPELINE/VISU_MergedPL.cxx | 40 +++++- src/PIPELINE/VISU_MergedPL.hxx | 23 +++- src/PIPELINE/VISU_ScalarMapPL.cxx | 19 ++- src/PIPELINE/VISU_ScalarMapPL.hxx | 8 +- src/VISUGUI/VisuGUI_InputPane.cxx | 2 +- src/VISU_I/VISU_ColoredPrs3d_i.cc | 4 +- src/VISU_I/VISU_GaussPoints_i.cc | 36 ++++-- src/VISU_I/VISU_ScalarMap_i.cc | 18 ++- 15 files changed, 379 insertions(+), 45 deletions(-) diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 8d0f0e6a..467a4957 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -518,6 +518,7 @@ namespace aMeshOnEntity->myMeshName = aMeshName; aMeshOnEntity->myGeom2Size = aGeom2Size; VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID; INITMSG(MYDEBUG, "- aMEntity = "<myNbCells = theMesh->myNbPoints; aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints; + VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1]; + for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){ TInt aFamId = theNodeInfo->GetFamNum(iElem); if(aFamId != 0) aFamilyID2CellsSize[aFamId] += 2; + anElemID2FamilyID[iElem] = aFamId; } INITMSG(MYDEBUG, @@ -546,6 +550,7 @@ namespace for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first; + VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom]; switch(aMGeom){ case MED::ePOLYGONE: { MED::PPolygoneInfo aPolygoneInfo = theMEDWrapper->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); @@ -563,6 +568,7 @@ namespace TInt aFamId = aPolygoneInfo->GetFamNum(anElemId); if(aFamId != 0) aFamilyID2CellsSize[aFamId] += aNbConn + 1; + anElemID2FamilyID[anElemId] = aFamId; } break; } @@ -589,6 +595,7 @@ namespace TInt aFamId = aPolyedreInfo->GetFamNum(anElemId); if(aFamId != 0) aFamilyID2CellsSize[aFamId] += aCellSize + 1; + anElemID2FamilyID[anElemId] = aFamId; } break; } @@ -611,6 +618,7 @@ namespace TInt aFamId = aCellInfo->GetFamNum(iElem); if(aFamId != 0) aFamilyID2CellsSize[aFamId] += aVNbNodes + 1; + anElemID2FamilyID[iElem] = aFamId; } }} // end switch(...) } @@ -684,6 +692,7 @@ namespace aMeshOnEntity->myMeshName = aMeshName; aMeshOnEntity->myGeom2Size = aGeom2Size; VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID; INITMSG(MYDEBUG, "- aMEntity = "<myNbCells = theGrilleInfo->GetNbNodes(); aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes(); + VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1]; + if((theGrilleInfo->myFamNumNode).size() > 0) for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){ TInt aFamId = theGrilleInfo->GetFamNumNode(iElem); if(aFamId != 0) aFamilyID2CellsSize[aFamId] += 2; + anElemID2FamilyID[iElem] = aFamId; } INITMSG(MYDEBUG, @@ -717,6 +729,8 @@ namespace TInt aNbElem = aGeom2SizeIter->second;//theGrilleInfo->GetNbCells(); aMeshOnEntity->myNbCells += aNbElem; aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1); + + VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom]; INITMSG(MYDEBUG, "- aMGeom = "<GetFamNum(iElem); if(aFamId != 0) aFamilyID2CellsSize[aFamId] += aVNbNodes + 1; + anElemID2FamilyID[iElem] = aFamId; } } } @@ -863,6 +878,7 @@ namespace VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap; if(aFamilyTSizeSet.empty()) continue; @@ -893,7 +909,17 @@ namespace VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId); if(anIter != aFamilyID2CellsSize.end()) aFamily->myCellsSize = anIter->second; - + + const TInt aNbGroup = aFamilyInfo->GetNbGroup(); + VISU::TNames& aGroupNames = aFamily->myGroupNames; + aGroupNames.resize(aNbGroup); + for(TInt i = 0; i < aNbGroup; i++){ + std::string aGroupName = aFamilyInfo->GetGroupName(i); + aGroupNames[i] = aGroupName; + } + + aFamilyIDMap[anId] = aFamily; + INITMSG(MY_FAMILY_DEBUG, "- aFamilyName = '"<second; VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap; VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily()); aFamily->myId = anId; @@ -972,6 +998,16 @@ namespace if(aFam2NbCellsIter != aFam2NbCells.end()) aFamily->myNbCells = aFam2NbCellsIter->second; + const TInt aNbGroup = aFamilyInfo->GetNbGroup(); + VISU::TNames& aGroupNames = aFamily->myGroupNames; + aGroupNames.resize(aNbGroup); + for(TInt i = 0; i < aNbGroup; i++){ + std::string aGroupName = aFamilyInfo->GetGroupName(i); + aGroupNames[i] = aGroupName; + } + + aFamilyIDMap[anId] = aFamily; + INITMSG(MY_FAMILY_DEBUG, "- aFamilyName =|"<myName<<"|" << "; myId = "<myId @@ -1551,12 +1587,18 @@ VISU_MedConvertor template void BuildTimeStampMinMax(MED::SharedPtr theTimeStampValue, + const VISU::PMEDMeshOnEntity theMeshOnEntity, const MED::TGeom2Gauss& theGeom2Gauss, VISU::TMinMaxArr& theMinMaxArr, VISU::TMinMaxArr& theAverageMinMaxArr, + VISU::TGroup2MinMaxArr& theGroup2MinMaxArr, + VISU::TGroup2MinMaxArr& theGroup2AverageMinMaxArr, TInt theNbComp, TInt theNbComp2) { + const VISU::TFamilyIDMap& aFamilyIDMap = theMeshOnEntity->myFamilyIDMap; + VISU::TGeom2ElemID2FamilyID aGeom2ElemID2FamilyID = theMeshOnEntity->myGeom2ElemID2FamilyID; + const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value; typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin(); for(; anIter != aGeom2Value.end(); anIter++){ @@ -1575,6 +1617,8 @@ BuildTimeStampMinMax(MED::SharedPtr theTimeStampValue, "; aNbElem = "<GetType() == MED::eFLOAT64) BuildTimeStampMinMax(CastToFloatTimeStampValue(aTimeStampValue), + aMeshOnEntity, aGeom2Gauss, aMinMaxArr, anAverageMinMaxArr, + aGroup2MinMaxArr, + aGroup2AverageMinMaxArr, aNbComp, aNbComp2); else BuildTimeStampMinMax(CastToIntTimeStampValue(aTimeStampValue), + aMeshOnEntity, aGeom2Gauss, aMinMaxArr, anAverageMinMaxArr, + aGroup2MinMaxArr, + aGroup2AverageMinMaxArr, aNbComp, aNbComp2); @@ -1786,7 +1949,7 @@ VISU_MedConvertor #endif } for(TInt iComp = 0; iComp <= aNbComp; iComp++){ - VISU::TMinMax aMinMax = aField->GetMinMax(iComp); + VISU::TMinMax aMinMax = aField->GetMinMax(iComp, VISU::TNames()); INITMSG(MYDEBUG,"- "< TFamilyID2CellsSize; + typedef std::map TElemID2FamilyID; + typedef std::map TGeom2ElemID2FamilyID; + struct VISU_CONVERTOR_EXPORT TMEDMeshOnEntity: virtual TMeshOnEntityImpl { TFamilyID2CellsSize myFamilyID2CellsSize; + TGeom2ElemID2FamilyID myGeom2ElemID2FamilyID; MED::TGeom2Size myGeom2Size; }; typedef MED::SharedPtr PMEDMeshOnEntity; diff --git a/src/CONVERTOR/VISU_Structures.hxx b/src/CONVERTOR/VISU_Structures.hxx index eaa85245..4e877ccd 100644 --- a/src/CONVERTOR/VISU_Structures.hxx +++ b/src/CONVERTOR/VISU_Structures.hxx @@ -159,6 +159,8 @@ namespace VISU typedef std::map TFamilyMap; typedef std::map TFieldMap; + typedef std::map TFamilyIDMap; + //! Define a basic class which corresponds to MED ENTITY /*! This class in its turn contains map of TGaussMesh and TProfile substructures, @@ -170,6 +172,8 @@ namespace VISU TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it + TFamilyIDMap myFamilyIDMap; //!< Contains map of MED FAMILIES which belongs to it + TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it TName myMeshName; //!< Contains name of the MED MESH where the it belongs to. @@ -227,13 +231,13 @@ namespace VISU */ virtual TMinMax - GetMinMax(vtkIdType theCompID) = 0; + GetMinMax(vtkIdType theCompID, const TNames& theGroupNames) = 0; //! Calculate average min/max values for each of the MED FIELD components among all its timestamps virtual TMinMax - GetAverageMinMax(vtkIdType theCompID) = 0; - + GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames) = 0; + bool myIsMinMaxInitilized; //!< Is the min / max values are calculated TField(); diff --git a/src/CONVERTOR/VISU_Structures_impl.cxx b/src/CONVERTOR/VISU_Structures_impl.cxx index 589435e0..cdb78dbd 100644 --- a/src/CONVERTOR/VISU_Structures_impl.cxx +++ b/src/CONVERTOR/VISU_Structures_impl.cxx @@ -1371,6 +1371,8 @@ namespace VISU myUnitNames.resize(theNbComp); myMinMaxArr.resize(theNbComp + 1); myAverageMinMaxArr.resize(theNbComp + 1); + myGroup2MinMaxArr.resize(theNbComp + 1); + myGroup2AverageMinMaxArr.resize(theNbComp + 1); for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){ TMinMax& aMinMax = myMinMaxArr[iComp]; aMinMax.first = VTK_LARGE_FLOAT; @@ -1390,17 +1392,61 @@ namespace VISU TMinMax TFieldImpl - ::GetMinMax(vtkIdType theCompID) + ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames) { - return myMinMaxArr[theCompID]; + TMinMax aMinMax; + bool anIsMinMaxInitialized = false; + if( !theGroupNames.empty() ) { + aMinMax.first = VTK_LARGE_FLOAT; + aMinMax.second = -VTK_LARGE_FLOAT; + + const TGroup2MinMax& aGroup2MinMax = myGroup2MinMaxArr[theCompID]; + TNames::const_iterator aNameIter = theGroupNames.begin(); + for( ; aNameIter != theGroupNames.end(); aNameIter++ ) { + TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter ); + if( aGroup2MinMaxIter != aGroup2MinMax.end() ) { + const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second; + aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first ); + aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second ); + anIsMinMaxInitialized = true; + } + } + } + + if( !anIsMinMaxInitialized ) + aMinMax = myMinMaxArr[theCompID]; + + return aMinMax; } TMinMax TFieldImpl - ::GetAverageMinMax(vtkIdType theCompID) + ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames) { - return myAverageMinMaxArr[theCompID]; + TMinMax aMinMax; + bool anIsMinMaxInitialized = false; + if( !theGroupNames.empty() ) { + aMinMax.first = VTK_LARGE_FLOAT; + aMinMax.second = -VTK_LARGE_FLOAT; + + const TGroup2MinMax& aGroup2MinMax = myGroup2AverageMinMaxArr[theCompID]; + TNames::const_iterator aNameIter = theGroupNames.begin(); + for( ; aNameIter != theGroupNames.end(); aNameIter++ ) { + TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter ); + if( aGroup2MinMaxIter != aGroup2MinMax.end() ) { + const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second; + aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first ); + aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second ); + anIsMinMaxInitialized = true; + } + } + } + + if( !anIsMinMaxInitialized ) + aMinMax = myAverageMinMaxArr[theCompID]; + + return aMinMax; } //---------------------------------------------------------------------------- diff --git a/src/CONVERTOR/VISU_Structures_impl.hxx b/src/CONVERTOR/VISU_Structures_impl.hxx index 3140245f..eebf3dd1 100644 --- a/src/CONVERTOR/VISU_Structures_impl.hxx +++ b/src/CONVERTOR/VISU_Structures_impl.hxx @@ -727,6 +727,8 @@ namespace VISU TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type + + TNames myGroupNames; //!< Keeps names of groups that refer to the family }; @@ -786,6 +788,9 @@ namespace VISU //--------------------------------------------------------------- typedef TVector TMinMaxArr; + typedef std::map TGroup2MinMax; + typedef TVector TGroup2MinMaxArr; + //! Specialize TField to provide VTK mapping for the entity struct VISU_CONVERTOR_EXPORT TFieldImpl: virtual TField { @@ -803,18 +808,21 @@ namespace VISU //! Implement the TField::GetMinMax virtual TMinMax - GetMinMax(vtkIdType theCompID); + GetMinMax(vtkIdType theCompID, const TNames& theGroupNames); //! Implement the TField::GetAverageMinMax virtual TMinMax - GetAverageMinMax(vtkIdType theCompID); + GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames); vtkIdType myDataSize; //!< Keeps size of the assigned data vtkIdType myDataType; //!< Keeps type idetificator of the mesh data TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD TMinMaxArr myAverageMinMaxArr; //!< Keeps average by Gauss Points min/max values for each component of the MED FIELD //!< If Nb of Gauss Points <=1 myAverageMinMaxArr equal myMinMaxArr + + TGroup2MinMaxArr myGroup2MinMaxArr; + TGroup2MinMaxArr myGroup2AverageMinMaxArr; }; diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 23fa9223..766c910e 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -827,16 +827,18 @@ VISU_GaussPointsPL int VISU_GaussPointsPL -::AddGeometry(vtkDataSet* theGeometry) +::AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName) { + AddGeometryName(theGeomName); myAppendFilter->AddInput(theGeometry); return GetNumberOfGeometry(); } vtkDataSet* VISU_GaussPointsPL -::GetGeometry(int theGeomNumber) +::GetGeometry(int theGeomNumber, VISU::TName& theGeomName) { + theGeomName = GetGeometryName(theGeomNumber); return vtkDataSet::SafeDownCast(myAppendFilter->GetInput(theGeomNumber)); } @@ -858,9 +860,20 @@ void VISU_GaussPointsPL ::ClearGeometry() { + ClearGeometryNames(); myAppendFilter->RemoveAllInputs(); } +void +VISU_GaussPointsPL +::GetSourceRange(vtkFloatingPointType theRange[2]) +{ + if(!IsExternalGeometryUsed()) + Superclass::GetSourceRange(theRange); + else + GetMergedInput()->GetScalarRange( theRange ); +} + vtkPointSet* VISU_GaussPointsPL ::GetMergedInput() diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 2ecb13f0..e86217fa 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -287,11 +287,11 @@ public: virtual int - AddGeometry(vtkDataSet* theGeometry); + AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName); virtual vtkDataSet* - GetGeometry(int theGeomNumber); + GetGeometry(int theGeomNumber, VISU::TName& theGeomName); virtual int @@ -305,6 +305,10 @@ public: void ClearGeometry(); + virtual + void + GetSourceRange(vtkFloatingPointType theRange[2]); + virtual vtkPointSet* GetMergedInput(); diff --git a/src/PIPELINE/VISU_MergedPL.cxx b/src/PIPELINE/VISU_MergedPL.cxx index ca29edeb..d0b2a328 100644 --- a/src/PIPELINE/VISU_MergedPL.cxx +++ b/src/PIPELINE/VISU_MergedPL.cxx @@ -41,9 +41,45 @@ VISU_MergedPL if ( aPipeLine->IsExternalGeometryUsed() ) { ClearGeometry(); int aNbOfGeometry = aPipeLine->GetNumberOfGeometry(); - for ( int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++ ) - AddGeometry( aPipeLine->GetGeometry( aGeomNumber ) ); + for ( int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++ ) { + VISU::TName aGeomName; + AddGeometry( aPipeLine->GetGeometry( aGeomNumber, aGeomName ), aGeomName ); + } }else SetSourceGeometry(); } } + +//---------------------------------------------------------------------------- +void +VISU_MergedPL +::AddGeometryName(const VISU::TName& theGeomName) +{ + myGeometryNames.push_back( theGeomName ); +} + +//---------------------------------------------------------------------------- +VISU::TName +VISU_MergedPL +::GetGeometryName( int theGeomNumber ) const +{ + if( theGeomNumber < myGeometryNames.size() ) + return myGeometryNames[ theGeomNumber ]; + return VISU::TName(); +} + +//---------------------------------------------------------------------------- +const VISU::TNames& +VISU_MergedPL +::GetGeometryNames() const +{ + return myGeometryNames; +} + +//---------------------------------------------------------------------------- +void +VISU_MergedPL +::ClearGeometryNames() +{ + myGeometryNames.clear(); +} diff --git a/src/PIPELINE/VISU_MergedPL.hxx b/src/PIPELINE/VISU_MergedPL.hxx index 7c30a4c3..6d60e9cc 100644 --- a/src/PIPELINE/VISU_MergedPL.hxx +++ b/src/PIPELINE/VISU_MergedPL.hxx @@ -28,6 +28,7 @@ #define VISU_MergedPL_HeaderFile #include "VISUPipeline.hxx" +#include "VISU_Structures.hxx" class vtkDataSet; class vtkPointSet; @@ -43,11 +44,11 @@ struct VISU_PIPELINE_EXPORT VISU_MergedPL virtual int - AddGeometry( vtkDataSet* theGeometry ) = 0; + AddGeometry( vtkDataSet* theGeometry, const VISU::TName& theGeomName ) = 0; virtual vtkDataSet* - GetGeometry( int theGeomNumber ) = 0; + GetGeometry( int theGeomNumber, VISU::TName& theGeomName ) = 0; virtual int @@ -69,6 +70,24 @@ struct VISU_PIPELINE_EXPORT VISU_MergedPL void DoShallowCopy(VISU_PipeLine *thePipeLine, bool theIsCopyInput); + + virtual + void + AddGeometryName(const VISU::TName& theGeomName); + + virtual + VISU::TName + GetGeometryName( int theGeomNumber ) const; + + virtual + const VISU::TNames& + GetGeometryNames() const; + + virtual + void + ClearGeometryNames(); + + VISU::TNames myGeometryNames; }; #endif diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index e32a02aa..9786e6e0 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -180,13 +180,14 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- int VISU_ScalarMapPL -::AddGeometry(vtkDataSet* theGeometry) +::AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName) { // rnv: to fix issue 0020167 (AddMeshOnGroup is not fully taken into account) // clear all inpust of the this->myAppendFilter in case if presentation // constructed on the entire mesh. if(!IsExternalGeometryUsed()) ClearGeometry(); + AddGeometryName(theGeomName); myAppendFilter->AddInput(theGeometry); return GetNumberOfGeometry(); } @@ -195,8 +196,9 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- vtkDataSet* VISU_ScalarMapPL -::GetGeometry(int theGeomNumber) +::GetGeometry(int theGeomNumber, VISU::TName& theGeomName) { + theGeomName = GetGeometryName(theGeomNumber); return vtkDataSet::SafeDownCast(myAppendFilter->GetInput(theGeomNumber)); } @@ -224,10 +226,23 @@ void VISU_ScalarMapPL ::ClearGeometry() { + ClearGeometryNames(); myAppendFilter->RemoveAllInputs(); } +//---------------------------------------------------------------------------- +void +VISU_ScalarMapPL +::GetSourceRange(vtkFloatingPointType theRange[2]) +{ + if(!IsExternalGeometryUsed()) + Superclass::GetSourceRange(theRange); + else + GetMergedInput()->GetScalarRange( theRange ); +} + + //---------------------------------------------------------------------------- vtkDataSet* VISU_ScalarMapPL diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index 06647d30..5db2f3b5 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -65,11 +65,11 @@ public: virtual int - AddGeometry(vtkDataSet* theGeometry); + AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName); virtual vtkDataSet* - GetGeometry(int theGeomNumber); + GetGeometry(int theGeomNumber, VISU::TName& theGeomName); virtual int @@ -82,6 +82,10 @@ public: void ClearGeometry(); + virtual + void + GetSourceRange(vtkFloatingPointType theRange[2]); + //---------------------------------------------------------------------------- virtual vtkPointSet* diff --git a/src/VISUGUI/VisuGUI_InputPane.cxx b/src/VISUGUI/VisuGUI_InputPane.cxx index b5b95490..a4d95eda 100644 --- a/src/VISUGUI/VisuGUI_InputPane.cxx +++ b/src/VISUGUI/VisuGUI_InputPane.cxx @@ -555,7 +555,7 @@ void VisuGUI_InputPane::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs ) const std::string aGroupName = *anIter; mySelectedGroups->insertItem(mySelectedGroups->count(), aGroupName.c_str()); } - myUseGroupsGroupBox->setEnabled(anIsTimeStampFixed); + myUseGroupsGroupBox->setEnabled(true); } myUseGroupsGroupBox->setChecked(mySelectedGroups->count() > 0); } diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index dcf28086..0b984dd0 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -88,9 +88,9 @@ namespace VISU if(!theResult->IsMinMaxDone()) theResult->GetInput()->BuildMinMax(); if(theField->myIsELNO) - return theField->GetMinMax(theCompID); + return theField->GetMinMax(theCompID, VISU::TNames()); else - return theField->GetAverageMinMax(theCompID); + return theField->GetAverageMinMax(theCompID, VISU::TNames()); } //--------------------------------------------------------------- diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 04d52a8b..050e768d 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -733,7 +733,7 @@ VISU::GaussPoints_i if(anIDMapper){ int aNbGroups = myGroupNames.size(); if(myGroupNames.find(theGroupName) == myGroupNames.end()){ - GetSpecificPL()->AddGeometry(anIDMapper->GetOutput()); + GetSpecificPL()->AddGeometry(anIDMapper->GetOutput(), theGroupName); myGroupNames.insert(theGroupName); /* if(aNbGroups == 0) @@ -1160,7 +1160,8 @@ struct TGetSourceMin: public SALOME_Event myColoredPrs3d->GetSpecificPL()->GetSourceRange(aRange); myResult = aRange[0]; }else{ - VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode() ); + VISU::TNames aGroupNames = myColoredPrs3d->GetSpecificPL()->GetGeometryNames(); + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode(), aGroupNames ); myResult = aTMinMax.first; } } @@ -1197,7 +1198,8 @@ struct TGetSourceMax: public SALOME_Event myColoredPrs3d->GetSpecificPL()->GetSourceRange(aRange); myResult = aRange[1]; }else{ - VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode() ); + VISU::TNames aGroupNames = myColoredPrs3d->GetSpecificPL()->GetGeometryNames(); + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode(), aGroupNames ); myResult = aTMinMax.second; } } @@ -1259,7 +1261,7 @@ VISU::GaussPoints_i } //---------------------------------------------------------------------------- -struct TGetComponentMin: public SALOME_Event +struct TGaussGetComponentMin: public SALOME_Event { VISU::ColoredPrs3d_i* myColoredPrs3d; vtkIdType myCompID; @@ -1267,8 +1269,8 @@ struct TGetComponentMin: public SALOME_Event typedef CORBA::Double TResult; TResult myResult; - TGetComponentMin( VISU::ColoredPrs3d_i* theColoredPrs3d, - vtkIdType theCompID ): + TGaussGetComponentMin( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): myColoredPrs3d( theColoredPrs3d ), myCompID( theCompID ) {} @@ -1277,11 +1279,15 @@ struct TGetComponentMin: public SALOME_Event void Execute() { + VISU::TNames aGroupNames; + if(VISU::GaussPoints_i* aPrs3d = dynamic_cast(myColoredPrs3d)) + aGroupNames = aPrs3d->GetSpecificPL()->GetGeometryNames(); + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); if ( aMinMaxController ) { myResult = aMinMaxController->GetComponentMin( myCompID ); } else { - VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); + VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID, aGroupNames ); myResult = aTMinMax.first; } } @@ -1293,11 +1299,11 @@ vtkFloatingPointType VISU::GaussPoints_i ::GetComponentMin(vtkIdType theCompID) { - return ProcessEvent( new TGetComponentMin( this, theCompID ) ); + return ProcessEvent( new TGaussGetComponentMin( this, theCompID ) ); } //---------------------------------------------------------------------------- -struct TGetComponentMax: public SALOME_Event +struct TGaussGetComponentMax: public SALOME_Event { VISU::ColoredPrs3d_i* myColoredPrs3d; vtkIdType myCompID; @@ -1305,8 +1311,8 @@ struct TGetComponentMax: public SALOME_Event typedef CORBA::Double TResult; TResult myResult; - TGetComponentMax( VISU::ColoredPrs3d_i* theColoredPrs3d, - vtkIdType theCompID ): + TGaussGetComponentMax( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): myColoredPrs3d( theColoredPrs3d ), myCompID( theCompID ) {} @@ -1315,11 +1321,15 @@ struct TGetComponentMax: public SALOME_Event void Execute() { + VISU::TNames aGroupNames; + if(VISU::GaussPoints_i* aPrs3d = dynamic_cast(myColoredPrs3d)) + aGroupNames = aPrs3d->GetSpecificPL()->GetGeometryNames(); + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); if ( aMinMaxController ) { myResult = aMinMaxController->GetComponentMax( myCompID ); } else { - VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); + VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID, aGroupNames ); myResult = aTMinMax.second; } } @@ -1331,5 +1341,5 @@ vtkFloatingPointType VISU::GaussPoints_i ::GetComponentMax(vtkIdType theCompID) { - return ProcessEvent( new TGetComponentMax( this, theCompID ) ); + return ProcessEvent( new TGaussGetComponentMax( this, theCompID ) ); } diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 7afea4d4..9c67ac1f 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -320,7 +320,7 @@ VISU::ScalarMap_i if(anIDMapper){ int aNbGroups = myGroupNames.size(); if(myGroupNames.find(theGroupName) == myGroupNames.end()){ - GetSpecificPL()->AddGeometry(anIDMapper->GetOutput()); + GetSpecificPL()->AddGeometry(anIDMapper->GetOutput(), theGroupName); myGroupNames.insert(theGroupName); if(aNbGroups == 0) UpdateIcon(); @@ -540,15 +540,19 @@ struct TGetComponentMin: public SALOME_Event void Execute() { + VISU::TNames aGroupNames; + if(VISU::ScalarMap_i* aPrs3d = dynamic_cast(myColoredPrs3d)) + aGroupNames = aPrs3d->GetSpecificPL()->GetGeometryNames(); + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); if ( aMinMaxController ) { myResult = aMinMaxController->GetComponentMin( myCompID ); } else { VISU::TMinMax aTMinMax; if(myColoredPrs3d->GetScalarField()->myIsELNO) - aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); + aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID, aGroupNames ); else - aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID ); + aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID, aGroupNames ); myResult = aTMinMax.first; } } @@ -582,15 +586,19 @@ struct TGetComponentMax: public SALOME_Event void Execute() { + VISU::TNames aGroupNames; + if(VISU::ScalarMap_i* aPrs3d = dynamic_cast(myColoredPrs3d)) + aGroupNames = aPrs3d->GetSpecificPL()->GetGeometryNames(); + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); if ( aMinMaxController ) { myResult = aMinMaxController->GetComponentMax( myCompID ); } else { VISU::TMinMax aTMinMax; if(myColoredPrs3d->GetScalarField()->myIsELNO) - aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); + aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID, aGroupNames ); else - aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID ); + aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID, aGroupNames ); myResult = aTMinMax.second; } } -- 2.39.2