+ if (owner && appStudy) {
+ _PTR(Study) study = appStudy->studyDS();
+ QString entry = owner->entry();
+
+ _PTR(SObject) obj (study->FindObjectID(entry.toLatin1().data())), aRefSO;
+ if( extractReference && obj && obj->ReferencedObject( aRefSO ) )
+ obj = aRefSO;
+ if (!obj) return false;
+
+ _PTR(SObject) objFather = obj->GetFather();
+ _PTR(SComponent) objComponent = obj->GetFatherComponent();
+
+ if( objComponent->ComponentDataType()!="SMESH" )
+ return false;
+
+ int aLevel = obj->Depth() - objComponent->Depth();
+
+ // Max level under the component is 5:
+ //
+ // 0 Mesh Component
+ // 1 |- Hypotheses
+ // 2 | |- Regular 1D
+ // |- Algorithms
+ // |- Mesh 1
+ // |- * Main Shape
+ // |- Applied Hypotheses
+ // |- Applied Algorithms
+ // |- Submeshes on Face
+ // 3 | |- SubmeshFace
+ // 4 | |- * Face 1
+ // 4 | |- Applied algorithms ( selectable in Use Case Browser )
+ // 5 | |- Regular 1D
+ // |- Group Of Nodes
+ // |- Group 1
+
+ if (aLevel <= 0)
+ return false;
+
+ switch (myType)
+ {
+ case SMESH::HYPOTHESIS:
+ {
+ if (aLevel == 2 && (objFather->Tag() == SMESH::Tag_HypothesisRoot))
+ // hypo definition
+ Ok = true;
+ else if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_RefOnAppliedHypothesis))
+ // applied global hypo
+ Ok = true;
+ else if (aLevel == 5 && (objFather->Tag() == SMESH::Tag_RefOnAppliedHypothesis))
+ // applied local hypo
+ Ok = true;
+ break;
+ }
+ case SMESH::ALGORITHM:
+ {
+ if (aLevel == 2 && (objFather->Tag() == SMESH::Tag_AlgorithmsRoot))
+ // algo definition
+ Ok = true;
+ else if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_RefOnAppliedAlgorithms))
+ // applied global algo
+ Ok = true;
+ else if (aLevel == 5 && (objFather->Tag() == SMESH::Tag_RefOnAppliedAlgorithms))
+ // applied local algo
+ Ok = true;
+ break;
+ }
+ case SMESH::MESH:
+ {
+ if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
+ Ok = true;
+ break;
+ }
+ case SMESH::SUBMESH:
+ {
+ // see SMESH_Gen_i.cxx for tag numbers
+ if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstSubMesh &&
+ objFather->Tag() <= SMESH::Tag_LastSubMesh))
+ Ok = true;
+ break;
+ }
+ case SMESH::MESHorSUBMESH:
+ {
+ if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
+ Ok = true; // mesh
+ else if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstSubMesh &&
+ objFather->Tag() <= SMESH::Tag_LastSubMesh))
+ Ok = true;
+ break;
+ }
+ case SMESH::SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnVertex))
+ Ok = true;
+ break;
+ }
+ case SMESH::SUBMESH_EDGE:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnEdge))
+ Ok = true;
+ break;
+ }
+ case SMESH::SUBMESH_FACE:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnFace))
+ Ok = true;
+ break;
+ }
+ case SMESH::SUBMESH_SOLID:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnSolid))
+ Ok = true;
+ break;
+ }
+ case SMESH::SUBMESH_COMPOUND:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnCompound))
+ Ok = true;
+ break;
+ }
+ case SMESH::GROUP:
+ {
+ if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstGroup))
+ Ok = true;
+ break;
+ }
+ case SMESH::GROUP_NODE:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_NodeGroups))
+ Ok = true;
+ break;
+ }
+ case SMESH::GROUP_EDGE:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_EdgeGroups))
+ Ok = true;
+ break;
+ }
+ case SMESH::GROUP_FACE:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_FaceGroups))
+ Ok = true;
+ break;
+ }
+ case SMESH::GROUP_VOLUME:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_VolumeGroups))
+ Ok = true;
+ break;
+ }
+ case SMESH::GROUP_0D:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_0DElementsGroups))
+ Ok = true;
+ break;
+ }
+ case SMESH::GROUP_BALL:
+ {
+ if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_BallElementsGroups))
+ Ok = true;
+ break;
+ }
+ case SMESH::IDSOURCE:
+ {
+ Ok = ( SMESH_TypeFilter(SMESH::MESHorSUBMESH).isOk( theDataOwner ) ||
+ SMESH_TypeFilter(SMESH::GROUP) .isOk( theDataOwner ));
+ break;
+ }
+ case SMESH::IDSOURCE_EDGE:
+ {
+ Ok = isIDSourceOfType( obj, SMESH::EDGE );
+ break;
+ }
+ case SMESH::IDSOURCE_FACE:
+ {
+ Ok = isIDSourceOfType( obj, SMESH::FACE );
+ break;
+ }
+ case SMESH::IDSOURCE_VOLUME:
+ {
+ Ok = isIDSourceOfType( obj, SMESH::VOLUME );
+ break;
+ }
+ default:;
+ }