-
- if ( anObj->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
- Handle(GEOM_InteractiveObject) GObject =
- Handle(GEOM_InteractiveObject)::DownCast(anObj);
-
- GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( GObject->getIOR() );
- if ( aShape->_is_nil() )
- return false;
-
- TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape );
- if ( Shape.IsNull() )
- return false;
-
- MESSAGE ( " myKind = " << myKind );
- MESSAGE ( " Shape.ShapeType = " << Shape.ShapeType() );
- if ( myKind == TopAbs_SHAPE )
- return true;
-
- if ( Shape.ShapeType() == myKind )
- return true;
- else
- return false;
- }
- return false;
+ return aReturnObject._retn();
+}
+
+//=======================================================================
+// function : ShapeTypeFilter
+// purpose :
+//=======================================================================
+GEOM_ShapeTypeFilter::GEOM_ShapeTypeFilter( const TopAbs_ShapeEnum theShapeType,
+ const bool theIsAll )
+{
+ myIsAll = theIsAll;
+ myShapeTypes.Add( theShapeType );
+ myTypeFilter = new SALOME_TypeFilter( "GEOM" );
+}
+
+//=======================================================================
+// function : ShapeTypeFilter
+// purpose :
+//=======================================================================
+GEOM_ShapeTypeFilter::GEOM_ShapeTypeFilter( const TColStd_MapOfInteger& theShapeTypes,
+ const bool theIsAll )
+{
+ myIsAll = theIsAll;
+ myShapeTypes = theShapeTypes;
+ myTypeFilter = new SALOME_TypeFilter( "GEOM" );
+}
+
+//=======================================================================
+// function : IsOk
+// purpose :
+//=======================================================================
+Standard_Boolean GEOM_ShapeTypeFilter::IsOk(
+ const Handle(SALOME_InteractiveObject)& anObj ) const
+{
+ if ( !myTypeFilter->IsOk(anObj) )
+ return Standard_False;
+
+ Standard_Boolean aResult = Standard_False;
+ GEOM::GEOM_Object_ptr aGeomObj = convertIOinGEOMObject( anObj, aResult );
+ if ( !CORBA::is_nil( aGeomObj ) && aResult && aGeomObj->IsShape() )
+ {
+ if ( myIsAll )
+ return true;
+ TopoDS_Shape aShape;
+ if ( getShape( aGeomObj, aShape ) )
+ {
+ if ( myShapeTypes.Contains( aShape.ShapeType() ) )
+ return IsShapeOk( aShape );
+ }
+ }
+ return Standard_False;