2 // File : GEOM_ShapeTypeFilter.cxx
3 // Created : Fri Dec 07 09:57:24 2001
4 // Author : Nicolas REJNERI
7 // Copyright : Open CASCADE
10 #include "GEOM_ShapeTypeFilter.ixx"
11 #include "GEOM_Client.hxx"
13 #include "SALOME_InteractiveObject.hxx"
14 #include "GEOM_InteractiveObject.hxx"
15 #include "SALOME_TypeFilter.hxx"
17 #include "utilities.h"
18 #include "QAD_Application.h"
19 #include "QAD_Desktop.h"
20 #include "QAD_Study.h"
22 static GEOM_Client ShapeReader;
24 GEOM_ShapeTypeFilter::GEOM_ShapeTypeFilter(TopAbs_ShapeEnum ShapeType,
25 GEOM::GEOM_Gen_ptr geom)
28 myComponentGeom = GEOM::GEOM_Gen::_narrow(geom);
31 Standard_Boolean GEOM_ShapeTypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
33 Handle(SALOME_TypeFilter) GeomFilter = new SALOME_TypeFilter( "GEOM" );
34 if ( !GeomFilter->IsOk(anObj) )
36 if ( anObj->hasEntry() ) {
37 QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
38 SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument();
39 SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->getEntry() );
40 SALOMEDS::GenericAttribute_var anAttr;
41 SALOMEDS::AttributeIOR_var anIOR;
42 if ( !obj->_is_nil() ) {
43 if (obj->FindAttribute(anAttr, "AttributeIOR")) {
44 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
45 GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( anIOR->Value() );
46 if ( aShape->_is_nil() )
49 TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape );
53 MESSAGE ( " myKind = " << myKind );
54 MESSAGE ( " Shape.ShapeType = " << Shape.ShapeType() );
55 if ( myKind == TopAbs_SHAPE )
58 if ( Shape.ShapeType() == myKind )
66 if ( anObj->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
67 Handle(GEOM_InteractiveObject) GObject =
68 Handle(GEOM_InteractiveObject)::DownCast(anObj);
70 GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( GObject->getIOR() );
71 if ( aShape->_is_nil() )
74 TopoDS_Shape Shape = ShapeReader.GetShape( myComponentGeom, aShape );
78 MESSAGE ( " myKind = " << myKind );
79 MESSAGE ( " Shape.ShapeType = " << Shape.ShapeType() );
80 if ( myKind == TopAbs_SHAPE )
83 if ( Shape.ShapeType() == myKind )