1 // GEOM GEOMGUI : Implementation of selection filters for GEOM module
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 : GEOM_TypeFilter.cxx
25 // Author : Sergey LITONIN
28 #include "GEOM_TypeFilter.hxx"
29 #include "SALOME_InteractiveObject.hxx"
30 #include "GEOM_Client.hxx"
31 #include "QAD_Application.h"
32 #include "QAD_Desktop.h"
33 #include "utilities.h"
35 static GEOM::GEOM_Object_ptr convertIOinGEOMObject(
36 const Handle(SALOME_InteractiveObject)& theIO, Standard_Boolean& theResult )
38 theResult = Standard_False;
39 GEOM::GEOM_Object_var aReturnObject;
40 if ( !theIO.IsNull() )
42 const char* anEntry = theIO->getEntry();
43 SALOMEDS::SObject_var aSObj =
44 QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->FindObjectID( anEntry );
45 if ( !CORBA::is_nil( aSObj ) )
47 aReturnObject = GEOM::GEOM_Object::_narrow( aSObj->GetObject() );
48 theResult = !CORBA::is_nil( aReturnObject );
51 return aReturnObject._retn();
55 Class : GEOM_TypeFilter
56 Description : Filter for combaining several filters with logical operation (OR or AND)
59 IMPLEMENT_STANDARD_HANDLE( GEOM_TypeFilter, SALOME_TypeFilter )
60 IMPLEMENT_STANDARD_RTTIEXT( GEOM_TypeFilter, SALOME_TypeFilter )
62 //=======================================================================
63 // name : GEOM_TypeFilter::GEOM_TypeFilter
64 // Purpose : Constructor
65 //=======================================================================
66 GEOM_TypeFilter::GEOM_TypeFilter( const int theType )
67 : SALOME_TypeFilter( "GEOM" )
72 //=======================================================================
73 // name : GEOM_TypeFilter::~GEOM_TypeFilter
74 // Purpose : Destructor
75 //=======================================================================
76 GEOM_TypeFilter::~GEOM_TypeFilter()
80 //=======================================================================
81 // name : GEOM_TypeFilter::IsOk
82 // Purpose : Verify validity of entry object
83 //=======================================================================
84 Standard_Boolean GEOM_TypeFilter::IsOk( const Handle(SALOME_InteractiveObject)& theIO ) const
86 if ( SALOME_TypeFilter::IsOk( theIO ) )
88 Standard_Boolean aTestRes = Standard_False;
89 GEOM::GEOM_Object_var anObj = convertIOinGEOMObject( theIO, aTestRes );
90 if ( aTestRes && !anObj->_is_nil() )
91 return anObj->GetType() == myType;
97 //=======================================================================
98 // name : GEOM_TypeFilter::SetType
99 // Purpose : Set type of object
100 //=======================================================================
101 void GEOM_TypeFilter::SetType( const int theType )
106 //=======================================================================
107 // name : GEOM_TypeFilter::GetType
108 // Purpose : Get type of object
109 //=======================================================================
110 int GEOM_TypeFilter::GetType() const