+/*!
+ * \brief This is a comfort method for Filter dialog
+ */
+void ConnectedElements_i::SetThreshold ( const char* threshold,
+ SMESH::ConnectedElements::ThresholdType type )
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !threshold )
+ THROW_SALOME_CORBA_EXCEPTION( "ConnectedElements_i::SetThreshold(): NULL threshold",
+ SALOME::BAD_PARAM );
+ switch ( type )
+ {
+ case SMESH::ConnectedElements::POINT: // read 3 node coordinates ///////////////////
+ {
+ vector< double > xyz;
+ char* endptr;
+ do
+ {
+ // skip a separator
+ while ( *threshold &&
+ *threshold != '+' &&
+ *threshold != '-' &&
+ !isdigit( *threshold ))
+ ++threshold;
+ if ( !*threshold )
+ break;
+ // read a coordinate
+ xyz.push_back( strtod( threshold, &endptr ));
+ if ( threshold == endptr )
+ {
+ xyz.resize( xyz.size() - 1 );
+ break;
+ }
+ threshold = endptr;
+ }
+ while ( xyz.size() < 3 );
+
+ if ( xyz.size() < 3 )
+ THROW_SALOME_CORBA_EXCEPTION
+ ( "ConnectedElements_i::SetThreshold(): invalid point coordinates", SALOME::BAD_PARAM );
+
+ SetPoint( xyz[0], xyz[1], xyz[2] );
+ break;
+ }
+ case SMESH::ConnectedElements::VERTEX: // get a VERTEX by its entry /////////////////
+ {
+ SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
+ if ( study->_is_nil() )
+ THROW_SALOME_CORBA_EXCEPTION
+ ( "ConnectedElements_i::SetThreshold(): NULL current study", SALOME::BAD_PARAM );
+ SALOMEDS::SObject_wrap sobj = study->FindObjectID( threshold );
+ if ( sobj->_is_nil() )
+ THROW_SALOME_CORBA_EXCEPTION
+ ( "ConnectedElements_i::SetThreshold(): invalid vertex study entry", SALOME::BAD_PARAM );
+ CORBA::Object_var obj = sobj->GetObject();
+ GEOM::GEOM_Object_wrap vertex = GEOM::GEOM_Object::_narrow( obj );
+ if ( vertex->_is_nil() )
+ THROW_SALOME_CORBA_EXCEPTION
+ ( "ConnectedElements_i::SetThreshold(): no GEOM_Object in SObject", SALOME::BAD_PARAM );
+ SetVertex( vertex );
+ break;
+ }
+ case SMESH::ConnectedElements::NODE: // read a node ID ////////////////////////////
+ {
+ char* endptr;
+ int id = strtol( threshold, &endptr, 10 );
+ if ( threshold == endptr )
+ THROW_SALOME_CORBA_EXCEPTION
+ ( "ConnectedElements_i::SetThreshold(): invalid node ID", SALOME::BAD_PARAM );
+ SetNode( id );
+ break;
+ }
+ default:
+ THROW_SALOME_CORBA_EXCEPTION
+ ( "ConnectedElements_i::SetThreshold(): invalid ThresholdType", SALOME::BAD_PARAM );
+ }
+}
+
+char* ConnectedElements_i::GetThreshold ( SMESH::ConnectedElements::ThresholdType& type )
+{
+ std::string threshold;
+ if ( !myVertexID.empty() )
+ {
+ threshold = myVertexID;
+ type = SMESH::ConnectedElements::VERTEX;
+ }
+ else
+ {
+ std::vector<double> xyz = myConnectedElementsPtr->GetPoint();
+ if ( xyz.size() == 3 )
+ {
+ threshold = SMESH_Comment( xyz[0] ) << "; " << xyz[1] << "; " << xyz[2];
+ type = SMESH::ConnectedElements::POINT;
+ }
+ else
+ {
+ threshold = SMESH_Comment( myConnectedElementsPtr->GetNode() );
+ type = SMESH::ConnectedElements::NODE;
+ }
+ }
+ return CORBA::string_dup( threshold.c_str() );
+}
+
+/*
+ Class : Comparator_i
+ Description : Base class for comparators
+*/
+Comparator_i::Comparator_i():
+ myNumericalFunctor( NULL )
+{}
+
+Comparator_i::~Comparator_i()
+{
+ if ( myNumericalFunctor )
+ myNumericalFunctor->UnRegister();
+}
+
+void Comparator_i::SetMargin( CORBA::Double theValue )
+{
+ myComparatorPtr->SetMargin( theValue );
+ TPythonDump()<<this<<".SetMargin("<<theValue<<")";
+}
+
+CORBA::Double Comparator_i::GetMargin()
+{
+ return myComparatorPtr->GetMargin();
+}
+
+void Comparator_i::SetNumFunctor( NumericalFunctor_ptr theFunct )
+{
+ if ( myNumericalFunctor )
+ myNumericalFunctor->UnRegister();
+
+ myNumericalFunctor = DownCast<NumericalFunctor_i*>(theFunct);
+
+ if ( myNumericalFunctor )
+ {
+ myComparatorPtr->SetNumFunctor( myNumericalFunctor->GetNumericalFunctor() );
+ myNumericalFunctor->Register();
+ TPythonDump()<<this<<".SetNumFunctor("<<myNumericalFunctor<<")";
+ }
+}
+
+Controls::ComparatorPtr Comparator_i::GetComparator()
+{
+ return myComparatorPtr;
+}
+
+NumericalFunctor_i* Comparator_i::GetNumFunctor_i()
+{
+ return myNumericalFunctor;
+}
+
+
+/*
+ Class : LessThan_i
+ Description : Comparator "<"
+*/
+LessThan_i::LessThan_i()
+{
+ myComparatorPtr.reset( new Controls::LessThan() );
+ myFunctorPtr = myPredicatePtr = myComparatorPtr;
+}
+
+FunctorType LessThan_i::GetFunctorType()
+{
+ return SMESH::FT_LessThan;
+}
+
+
+/*
+ Class : MoreThan_i
+ Description : Comparator ">"
+*/
+MoreThan_i::MoreThan_i()
+{
+ myComparatorPtr.reset( new Controls::MoreThan() );
+ myFunctorPtr = myPredicatePtr = myComparatorPtr;
+}
+
+FunctorType MoreThan_i::GetFunctorType()
+{
+ return SMESH::FT_MoreThan;
+}
+
+
+/*
+ Class : EqualTo_i
+ Description : Comparator "="
+*/
+EqualTo_i::EqualTo_i()
+: myEqualToPtr( new Controls::EqualTo() )
+{
+ myFunctorPtr = myPredicatePtr = myComparatorPtr = myEqualToPtr;
+}
+
+void EqualTo_i::SetTolerance( CORBA::Double theToler )
+{
+ myEqualToPtr->SetTolerance( theToler );
+ TPythonDump()<<this<<".SetTolerance("<<theToler<<")";
+}
+
+CORBA::Double EqualTo_i::GetTolerance()
+{
+ return myEqualToPtr->GetTolerance();
+}
+
+FunctorType EqualTo_i::GetFunctorType()
+{
+ return SMESH::FT_EqualTo;
+}
+
+/*
+ Class : LogicalNOT_i
+ Description : Logical NOT predicate
+*/
+LogicalNOT_i::LogicalNOT_i()
+: myPredicate( NULL ),
+ myLogicalNOTPtr( new Controls::LogicalNOT() )
+{
+ myFunctorPtr = myPredicatePtr = myLogicalNOTPtr;
+}
+
+LogicalNOT_i::~LogicalNOT_i()
+{
+ if ( myPredicate )
+ myPredicate->UnRegister();
+}
+
+void LogicalNOT_i::SetPredicate( Predicate_ptr thePredicate )
+{
+ if ( myPredicate )
+ myPredicate->UnRegister();
+
+ myPredicate = SMESH::GetPredicate(thePredicate);
+
+ if ( myPredicate ){
+ myLogicalNOTPtr->SetPredicate(myPredicate->GetPredicate());
+ myPredicate->Register();
+ TPythonDump()<<this<<".SetPredicate("<<myPredicate<<")";
+ }
+}
+
+FunctorType LogicalNOT_i::GetFunctorType()
+{
+ return SMESH::FT_LogicalNOT;
+}
+
+Predicate_i* LogicalNOT_i::GetPredicate_i()