2 // File : SMESH_TypeFilter.cxx
3 // Created : Fri Dec 07 09:57:24 2001
4 // Author : Nicolas REJNERI
7 // Copyright : Open CASCADE
10 #include "SMESH_TypeFilter.ixx"
12 #include "SALOME_InteractiveObject.hxx"
13 #include "SALOME_TypeFilter.hxx"
15 #include "utilities.h"
16 #include "QAD_Application.h"
17 #include "QAD_Desktop.h"
18 #include "QAD_Study.h"
21 SMESH_TypeFilter::SMESH_TypeFilter(MeshObjectType aType)
26 Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
28 Handle(SALOME_TypeFilter) meshFilter = new SALOME_TypeFilter( "MESH" );
29 if ( !meshFilter->IsOk(anObj) )
34 if ( anObj->hasEntry() ) {
35 QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
36 SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument();
37 SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->getEntry() );
39 SALOMEDS::SObject_var objFather = obj->GetFather();
40 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
42 if ( strlen( obj->GetID() ) <= strlen( objComponent->GetID() ) )
49 if (( objFather->Tag() == 1 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
55 if (( objFather->Tag() == 2 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
61 if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) )
67 if (( objFather->Tag() >= 4 && objFather->Tag() < 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
73 if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) )
76 if (( objFather->Tag() >= 4 && objFather->Tag() < 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
81 case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
83 if (( obj->Tag() == 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
89 if (( obj->Tag() == 5 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
95 if (( obj->Tag() == 6 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
101 if (( obj->Tag() == 7 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
105 case SUBMESH_COMPOUND:
107 if (( obj->Tag() == 8 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
113 if (( objFather->Tag() >= 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )