+//purpose : return true for a ready-to-compute mesh
+//=======================================================================
+
+bool SMESHGUI_Selection::isComputable( int ind ) const
+{
+ if ( ind >= 0 && ind < myTypes.count() && ( myTypes[ind] == "Mesh" ||
+ myTypes[ind].startsWith("Mesh " )))
+ {
+ QMap<int,int> modeMap;
+ _PTR(SObject) meshSO = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+
+ _PTR(SComponent) component = meshSO->GetFatherComponent();
+ if ( meshSO->Depth() - component->Depth() > 1 ) // sub-mesh, get a mesh
+ while ( meshSO->Depth() - component->Depth() > 1 )
+ meshSO = meshSO->GetFather();
+
+ SMESHGUI_PrecomputeOp::getAssignedAlgos( meshSO, modeMap );
+ return modeMap.size() > 0;
+ }
+ return false;
+}
+
+//=======================================================================
+//function : isPreComputable
+//purpose : returns true for a mesh with algorithms
+//=======================================================================
+
+bool SMESHGUI_Selection::isPreComputable( int ind ) const
+{
+ if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Mesh" )
+ {
+ int maxDim = dim( ind );
+ if ( maxDim < 2 ) // we can preview 1D or 2D
+ {
+ QMap<int,int> modeMap;
+ _PTR(SObject) pMesh = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+ SMESHGUI_PrecomputeOp::getAssignedAlgos( pMesh, modeMap );
+ if ( modeMap.size() > 1 )
+ return (( modeMap.contains( SMESH::DIM_3D )) ||
+ ( modeMap.contains( SMESH::DIM_2D ) && maxDim < 1 ));
+ }
+ }
+ return false;
+}
+
+//=======================================================================
+//function : hasGeomReference
+//purpose : returns true for a mesh or sub-mesh on geometry