From: asl Date: Thu, 7 Jul 2005 08:53:20 +0000 (+0000) Subject: Now filter accepts and stores kind of object as qstring (instead char*) and takes... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=388e2dfade6e2ac3cfe69095161f5f79b8a98a62;p=modules%2Fsmesh.git Now filter accepts and stores kind of object as qstring (instead char*) and takes kind into account in method isOK --- diff --git a/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx b/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx index 3f0cd8834..08e1aca48 100644 --- a/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx +++ b/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx @@ -28,14 +28,14 @@ // name : SMESH_NumberFilter::SMESH_NumberFilter // Purpose : Constructor //======================================================================= -SMESH_NumberFilter::SMESH_NumberFilter (const char* theKind, +SMESH_NumberFilter::SMESH_NumberFilter (const QString& theKind, const TopAbs_ShapeEnum theSubShapeType, const int theNumber, const TopAbs_ShapeEnum theShapeType, GEOM::GEOM_Object_ptr theMainObj, const bool theIsClosedOnly) { - myKind = (char*)theKind; + myKind = theKind; mySubShapeType = theSubShapeType; myNumber = theNumber; myIsClosedOnly = theIsClosedOnly; @@ -47,14 +47,14 @@ SMESH_NumberFilter::SMESH_NumberFilter (const char* theKind, // name : SMESH_NumberFilter::SMESH_NumberFilter // Purpose : Constructor //======================================================================= -SMESH_NumberFilter::SMESH_NumberFilter (const char* theKind, +SMESH_NumberFilter::SMESH_NumberFilter (const QString& theKind, const TopAbs_ShapeEnum theSubShapeType, const int theNumber, const TColStd_MapOfInteger& theShapeTypes, GEOM::GEOM_Object_ptr theMainObj, const bool theIsClosedOnly ) { - myKind = (char*)theKind; + myKind = theKind; mySubShapeType = theSubShapeType; myNumber = theNumber; myIsClosedOnly = theIsClosedOnly; @@ -145,6 +145,11 @@ GEOM::GEOM_Object_ptr SMESH_NumberFilter::getGeom if (!aSO) return GEOM::GEOM_Object::_nil(); + _PTR(SComponent) objComponent = aSO->GetFatherComponent(); + if( !objComponent || objComponent->ComponentDataType()!=myKind ) + return GEOM::GEOM_Object::_nil(); + + CORBA::Object_var anObject = _CAST(SObject,aSO)->GetObject(); anObj = GEOM::GEOM_Object::_narrow(anObject); if (!CORBA::is_nil(anObj)) diff --git a/src/SMESHFiltersSelection/SMESH_NumberFilter.hxx b/src/SMESHFiltersSelection/SMESH_NumberFilter.hxx index 6b3411293..a4f911e62 100644 --- a/src/SMESHFiltersSelection/SMESH_NumberFilter.hxx +++ b/src/SMESHFiltersSelection/SMESH_NumberFilter.hxx @@ -6,6 +6,8 @@ #include "SUIT_SelectionFilter.h" +#include + #include #include @@ -29,14 +31,14 @@ class SUIT_DataOwner; class SMESH_NumberFilter : public SUIT_SelectionFilter { public: - SMESH_NumberFilter (const char* theKind, + SMESH_NumberFilter (const QString& theKind, const TopAbs_ShapeEnum theSubShapeType, const int theNumber, const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE, GEOM::GEOM_Object_ptr theMainObj = GEOM::GEOM_Object::_nil(), const bool theIsClosedOnly = false ); - SMESH_NumberFilter (const char* theKind, + SMESH_NumberFilter (const QString& theKind, const TopAbs_ShapeEnum theSubShapeType, const int theNumber, const TColStd_MapOfInteger& theShapeTypes, @@ -58,7 +60,7 @@ class SMESH_NumberFilter : public SUIT_SelectionFilter GEOM::GEOM_Object_ptr getGeom (const SUIT_DataOwner*) const; private: - char* myKind; + QString myKind; TopAbs_ShapeEnum mySubShapeType; int myNumber; bool myIsClosedOnly;