From 341e363240adfbf291dbeeaa6ab989ffe46eb874 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 22 Mar 2019 13:32:28 +0300 Subject: [PATCH] IPAL54521: [TC-9.3.0]: Mesh information: Additinal Info tab: 'Compute' button for size doesn't work Add SMESH_GroupOnFilter::IsUpToDate() Redefine SMESH_GroupOnFilter::IsMeshInfoCorrect() --- idl/SMESH_Group.idl | 3 ++ src/SMESHGUI/SMESHGUI_MeshInfo.cxx | 1 + src/SMESHGUI/SMESHGUI_SelectionProxy.cxx | 2 +- src/SMESH_I/SMESH_Group_i.cxx | 47 +++++++++++++++++++----- src/SMESH_I/SMESH_Group_i.hxx | 4 ++ 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/idl/SMESH_Group.idl b/idl/SMESH_Group.idl index 9011e9f97..b432423d4 100644 --- a/idl/SMESH_Group.idl +++ b/idl/SMESH_Group.idl @@ -178,6 +178,9 @@ module SMESH { void SetFilter( in Filter theFilter) raises (SALOME::SALOME_Exception); Filter GetFilter(); + + //! @return True if group contents is computed + boolean IsUpToDate(); }; }; diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index df43a67f2..192b1440d 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -2338,6 +2338,7 @@ void InfoComputor::compute() if ( myProxy ) { SUIT_OverrideCursor wc; + myProxy.load(); switch ( myOperation ) { case GrpSize: diff --git a/src/SMESHGUI/SMESHGUI_SelectionProxy.cxx b/src/SMESHGUI/SMESHGUI_SelectionProxy.cxx index e359fb8b5..c4ab63629 100644 --- a/src/SMESHGUI/SMESHGUI_SelectionProxy.cxx +++ b/src/SMESHGUI/SMESHGUI_SelectionProxy.cxx @@ -1170,7 +1170,7 @@ int SMESH::SelectionProxy::size( bool autoCompute ) const { if ( type() == GroupFilter ) // for group on filter we check if value is already computed and cached - autoCompute |= group->IsNodeInfoAvailable(); + autoCompute |= group->IsMeshInfoCorrect(); else // for other groups we force autoCompute to true autoCompute = true; diff --git a/src/SMESH_I/SMESH_Group_i.cxx b/src/SMESH_I/SMESH_Group_i.cxx index b9a60ff90..a2dac404c 100644 --- a/src/SMESH_I/SMESH_Group_i.cxx +++ b/src/SMESH_I/SMESH_Group_i.cxx @@ -238,7 +238,7 @@ CORBA::Boolean SMESH_GroupBase_i::IsEmpty() //============================================================================= /* - * Returns \c true if \c this group depends on the \a other via + * Return \c true if \c this group depends on the \a other via * FT_BelongToMeshGroup predicate or vice versa */ //============================================================================= @@ -677,7 +677,7 @@ void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color) //============================================================================= /* - * Returns number of mesh elements of each \a SMESH::EntityType + * Return number of mesh elements of each \a SMESH::EntityType * Result array of number of elements per \a SMESH::EntityType * Inherited from SMESH_IDSource */ @@ -707,7 +707,7 @@ SMESH::long_array* SMESH_GroupBase_i::GetMeshInfo() //============================================================================= /* - * Returns number of mesh elements of each \a ElementType + * Return number of mesh elements of each \a ElementType */ //============================================================================= @@ -728,7 +728,7 @@ SMESH::long_array* SMESH_GroupBase_i::GetNbElementsByType() //======================================================================= //function : GetIDs -//purpose : Returns ids of members +//purpose : Return ids of members //======================================================================= SMESH::long_array* SMESH_GroupBase_i::GetIDs() @@ -738,7 +738,7 @@ SMESH::long_array* SMESH_GroupBase_i::GetIDs() //======================================================================= //function : GetTypes -//purpose : Returns types of elements it contains +//purpose : Return types of elements it contains //======================================================================= SMESH::array_of_ElementType* SMESH_GroupBase_i::GetTypes() @@ -754,7 +754,7 @@ SMESH::array_of_ElementType* SMESH_GroupBase_i::GetTypes() //======================================================================= //function : IsMeshInfoCorrect -//purpose : * Returns false if GetMeshInfo() returns incorrect information that may +//purpose : * Return false if GetMeshInfo() returns incorrect information that may // * happen if mesh data is not yet fully loaded from the file of study. //======================================================================= @@ -849,7 +849,7 @@ void SMESH_GroupOnFilter_i::SetFilter(SMESH::Filter_ptr theFilter) //================================================================================ /*! - * \brief Returns the filter defining group contents + * \brief Return the filter defining group contents */ //================================================================================ @@ -860,9 +860,37 @@ SMESH::Filter_ptr SMESH_GroupOnFilter_i::GetFilter() return f._retn(); } +//================================================================================ +/*! + * @return true if group contents is computed + */ +//================================================================================ + +CORBA::Boolean SMESH_GroupOnFilter_i::IsUpToDate() +{ + if ( myPreMeshInfo ) + return false; + + if ( SMESHDS_GroupOnFilter* grDS = dynamic_cast< SMESHDS_GroupOnFilter*>( GetGroupDS() )) + return grDS->IsUpToDate(); + + return false; +} + +//======================================================================= +//function : IsMeshInfoCorrect +//purpose : Return false in two cases: 1) if mesh not loaded and GetMeshInfo() returns +// incorrect information 2) mesh loaded but group contents is not computed +//======================================================================= + +bool SMESH_GroupOnFilter_i::IsMeshInfoCorrect() +{ + return myPreMeshInfo ? myPreMeshInfo->IsMeshInfoCorrect() : IsUpToDate(); +} + //======================================================================= //function : GetIDs -//purpose : Returns ids of members +//purpose : Return ids of members //======================================================================= SMESH::long_array* SMESH_GroupOnFilter_i::GetListOfID() @@ -887,7 +915,7 @@ SMESH::long_array* SMESH_GroupOnFilter_i::GetListOfID() //============================================================================= /*! - * Returns statistic of mesh elements + * Return statistic of mesh elements * Result array of number enityties * Inherited from SMESH_IDSource */ @@ -1052,3 +1080,4 @@ void SMESH_GroupOnFilter_i::OnBaseObjModified(NotifyerAndWaiter* filter, bool /* if ( SMESHDS_GroupOnFilter* grDS = dynamic_cast< SMESHDS_GroupOnFilter*>( GetGroupDS() )) grDS->SetPredicate( GetPredicate( myFilter )); // group resets its cache } + diff --git a/src/SMESH_I/SMESH_Group_i.hxx b/src/SMESH_I/SMESH_Group_i.hxx index c4e11a1ad..952ac33a4 100644 --- a/src/SMESH_I/SMESH_Group_i.hxx +++ b/src/SMESH_I/SMESH_Group_i.hxx @@ -198,8 +198,12 @@ class SMESH_I_EXPORT SMESH_GroupOnFilter_i: // CORBA interface implementation void SetFilter(SMESH::Filter_ptr theFilter) throw (SALOME::SALOME_Exception); SMESH::Filter_ptr GetFilter(); + virtual CORBA::Boolean IsUpToDate(); virtual SMESH::long_array* GetListOfID(); virtual SMESH::long_array* GetMeshInfo(); + //! @return false in two cases: 1) if mesh not loaded and GetMeshInfo() returns + //! incorrect information 2) mesh loaded but group contents is not computed. + virtual bool IsMeshInfoCorrect(); // method of SMESH::NotifyerAndWaiter to update self when myFilter changes virtual void OnBaseObjModified(NotifyerAndWaiter* filter, bool); -- 2.30.2