1 #include "SMESH_TypeFilter.hxx"
3 #include <SUIT_Session.h>
5 #include <SalomeApp_Study.h>
6 #include <SalomeApp_DataOwner.h>
8 SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType)
13 SMESH_TypeFilter::~SMESH_TypeFilter()
17 bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
21 const SalomeApp_DataOwner* owner =
22 dynamic_cast<const SalomeApp_DataOwner*>(theDataOwner);
23 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
24 (SUIT_Session::session()->activeApplication()->activeStudy());
26 if (owner && appStudy) {
27 _PTR(Study) study = appStudy->studyDS();
28 QString entry = owner->entry();
30 _PTR(SObject) obj (study->FindObjectID(entry.latin1()));
31 if (!obj) return false;
33 _PTR(SObject) objFather = obj->GetFather();
34 _PTR(SComponent) objComponent = obj->GetFatherComponent();
36 int aLevel = obj->Depth() - objComponent->Depth();
38 // Max level under the component is 4:
45 // |- Applied Hypotheses
46 // |- Applied Algorithms
47 // |- Submeshes on Face
49 // 4 | |- Applied algorithms ( selectable in Use Case Browser )
59 if ( aLevel == 2 && ( objFather->Tag() == 1 ))
65 if ( aLevel == 2 && ( objFather->Tag() == 2 ))
71 if ( aLevel == 1 && ( obj->Tag() >= 3 ))
77 // see SMESH_Gen_i.cxx for tag numbers
78 if ( aLevel == 3 && ( objFather->Tag() >= 4 && objFather->Tag() <= 10 ))
84 if ( aLevel == 1 && ( obj->Tag() >= 3 ))
86 else if ( aLevel == 3 && ( objFather->Tag() >= 4 && objFather->Tag() <= 10 ))
90 case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
92 if ( aLevel == 3 && ( objFather->Tag() == 4 ))
98 if ( aLevel == 3 && ( objFather->Tag() == 5 ))
104 if ( aLevel == 3 && ( objFather->Tag() == 7 ))
110 if ( aLevel == 3 && ( objFather->Tag() == 9 ))
114 case SUBMESH_COMPOUND:
116 if ( aLevel == 3 && ( objFather->Tag() == 10 ))
122 if ( aLevel == 3 && ( objFather->Tag() > 10 ))
131 MeshObjectType SMESH_TypeFilter::type() const