X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_HypoFilter.cxx;h=1f6685d15184a21bce84479e16b2cd81e86c1644;hb=84e136e74b2bc729df20617a9968439919337a55;hp=783547bb103973f060c842abbec89e45f68a0c11;hpb=5ed94063027146b16c20021ccea58880c4f9f33f;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_HypoFilter.cxx b/src/SMESH/SMESH_HypoFilter.cxx index 783547bb1..1f6685d15 100644 --- a/src/SMESH/SMESH_HypoFilter.cxx +++ b/src/SMESH/SMESH_HypoFilter.cxx @@ -1,30 +1,30 @@ -// SMESH SMESH : implementaion of SMESH idl descriptions +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_HypoFilter.cxx // Module : SMESH // $Header$ - +// #include "SMESH_HypoFilter.hxx" #include "SMESH_Hypothesis.hxx" @@ -75,6 +75,17 @@ bool SMESH_HypoFilter::ApplicablePredicate::IsOk(const SMESH_Hypothesis* aHyp, return SMESH_subMesh::IsApplicableHypotesis( aHyp, (TopAbs_ShapeEnum)_shapeType ); }; +//======================================================================= +//function : IsAuxiliaryPredicate::IsOk +//purpose : +//======================================================================= + +bool SMESH_HypoFilter::IsAuxiliaryPredicate::IsOk(const SMESH_Hypothesis* aHyp, + const TopoDS_Shape& /*aShape*/) const +{ + return aHyp->IsAuxiliary(); +}; + //======================================================================= //function : ApplicablePredicate::ApplicablePredicate //purpose : @@ -97,16 +108,27 @@ bool SMESH_HypoFilter::InstancePredicate::IsOk(const SMESH_Hypothesis* aHyp, } //======================================================================= -//function : IsGlobalPredicate::IsOk +//function : IsAssignedToPredicate::IsOk //purpose : //======================================================================= -bool SMESH_HypoFilter::IsGlobalPredicate::IsOk(const SMESH_Hypothesis* aHyp, +bool SMESH_HypoFilter::IsAssignedToPredicate::IsOk(const SMESH_Hypothesis* aHyp, const TopoDS_Shape& aShape) const { return ( !_mainShape.IsNull() && !aShape.IsNull() && _mainShape.IsSame( aShape )); } +//======================================================================= +//function : IsMoreLocalThanPredicate::IsOk +//purpose : +//======================================================================= + +bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aHyp, + const TopoDS_Shape& aShape) const +{ + return ( aShape.ShapeType() > _shapeType ); +} + //======================================================================= //function : SMESH_HypoFilter //purpose : @@ -131,9 +153,10 @@ SMESH_HypoFilter::SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNag //purpose : //======================================================================= -void SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate ) +SMESH_HypoFilter & SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate ) { add( AND, aPredicate ); + return *this; } //======================================================================= @@ -141,9 +164,10 @@ void SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate ) //purpose : //======================================================================= -void SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate ) +SMESH_HypoFilter & SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate ) { add( AND_NOT, aPredicate ); + return *this; } //======================================================================= @@ -151,9 +175,10 @@ void SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate ) //purpose : //======================================================================= -void SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate ) +SMESH_HypoFilter & SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate ) { add( OR, aPredicate ); + return *this; } //======================================================================= @@ -161,9 +186,10 @@ void SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate ) //purpose : Return predicates //======================================================================= -void SMESH_HypoFilter::OrNot( SMESH_HypoPredicate* aPredicate ) +SMESH_HypoFilter & SMESH_HypoFilter::OrNot( SMESH_HypoPredicate* aPredicate ) { add( OR_NOT, aPredicate ); + return *this; } //======================================================================= @@ -186,6 +212,17 @@ SMESH_HypoPredicate* SMESH_HypoFilter::IsAlgo() return new TypePredicate( MORE, SMESHDS_Hypothesis::PARAM_ALGO ); } +//======================================================================= +//function : IsAuxiliary +//purpose : +//======================================================================= + +SMESH_HypoPredicate* SMESH_HypoFilter::IsAuxiliary() +{ + return new IsAuxiliaryPredicate(); +} + + //======================================================================= //function : IsGlobal //purpose : @@ -193,7 +230,17 @@ SMESH_HypoPredicate* SMESH_HypoFilter::IsAlgo() SMESH_HypoPredicate* SMESH_HypoFilter::IsGlobal(const TopoDS_Shape& theMainShape) { - return new IsGlobalPredicate( theMainShape ); + return new IsAssignedToPredicate( theMainShape ); +} + +//======================================================================= +//function : IsAssignedTo +//purpose : +//======================================================================= + + SMESH_HypoPredicate* SMESH_HypoFilter::IsAssignedTo(const TopoDS_Shape& theShape) +{ + return new IsAssignedToPredicate( theShape ); } //======================================================================= @@ -226,6 +273,16 @@ SMESH_HypoPredicate* SMESH_HypoFilter::IsApplicableTo(const TopoDS_Shape& theSha return new ApplicablePredicate( theShape ); } +//======================================================================= +//function : IsMoreLocalThan +//purpose : +//======================================================================= + +SMESH_HypoPredicate* SMESH_HypoFilter::IsMoreLocalThan(const TopoDS_Shape& theShape) +{ + return new IsMoreLocalThanPredicate( theShape ); +} + //======================================================================= //function : HasType //purpose : @@ -268,13 +325,15 @@ bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp, //purpose : //======================================================================= -void SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNagate ) +SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNagate ) { list::const_iterator pred = myPredicates.begin(); for ( ; pred != myPredicates.end(); ++pred ) delete *pred; + myPredicates.clear(); add( notNagate ? AND : AND_NOT, aPredicate ); + return *this; }