1 // SMESH SMESHFiltersSelection : filter selector for viewer
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_TypeFilter.cxx
25 // Author : Nicolas REJNERI
30 #include "SMESH_TypeFilter.ixx"
32 #include "SALOME_InteractiveObject.hxx"
33 #include "SALOME_TypeFilter.hxx"
35 #include "utilities.h"
36 #include "QAD_Application.h"
37 #include "QAD_Desktop.h"
38 #include "QAD_Study.h"
41 SMESH_TypeFilter::SMESH_TypeFilter(MeshObjectType aType)
46 Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
48 Handle(SALOME_TypeFilter) meshFilter = new SALOME_TypeFilter( "MESH" );
49 if ( !meshFilter->IsOk(anObj) )
52 if ( anObj->hasEntry() ) {
53 QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
54 SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument();
55 SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->getEntry() );
63 SALOMEDS::SObject_var objFather = obj->GetFather();
64 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
65 if (( objFather->Tag() == 1 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
71 SALOMEDS::SObject_var objFather = obj->GetFather();
72 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
73 if (( objFather->Tag() == 2 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
79 SALOMEDS::SObject_var objFather = obj->GetFather();
80 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
82 if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) )
88 SALOMEDS::SObject_var objFather = obj->GetFather();
89 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
91 if (( objFather->Tag() >= 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
97 SALOMEDS::SObject_var objFather = obj->GetFather();
98 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
100 if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) )
103 if (( objFather->Tag() >= 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
110 SALOMEDS::SObject_var objFather = obj->GetFather();
111 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
113 if (( obj->Tag() == 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
119 SALOMEDS::SObject_var objFather = obj->GetFather();
120 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
122 if (( obj->Tag() == 5 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
128 SALOMEDS::SObject_var objFather = obj->GetFather();
129 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
131 if (( obj->Tag() == 6 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
137 SALOMEDS::SObject_var objFather = obj->GetFather();
138 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
140 if (( obj->Tag() == 7 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
144 case SUBMESH_COMPOUND:
146 SALOMEDS::SObject_var objFather = obj->GetFather();
147 SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
149 if (( obj->Tag() == 8 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))