From: skv Date: Tue, 14 Oct 2014 14:12:28 +0000 (+0400) Subject: Implement Check intersection level in Engine and TUI X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8499f032ecbd124c9993c62c0d961f37954a8c4e;p=modules%2Fgeom.git Implement Check intersection level in Engine and TUI --- diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 076f4fed4..daec2d388 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -187,6 +187,20 @@ module GEOM FDT_String }; + /** + * This enumeration represents the level of checking shape on + * self-interference. It defines which interferferences will be checked. + */ + enum si_check_level + { + SI_V_V, // only V/V interferences + SI_V_E, // V/V and V/E interferences + SI_E_E, // V/V, V/E and E/E interferences + SI_V_F, // V/V, V/E, E/E and V/F interferences + SI_E_F, // V/V, V/E, E/E, V/F and E/F interferences + SI_ALL // all interferences + }; + /*! * \brief Object creation parameters @@ -4080,10 +4094,12 @@ module GEOM /*! * \brief Check a topology of the given shape on self-intersections presence. * \param theShape Shape to check validity of. + * \param theCheckLevel the level of self-interference check. * \param theIntersections Output. List of intersected sub-shapes IDs, it contains pairs of IDs. * \return TRUE, if the shape does not have any self-intersections. */ boolean CheckSelfIntersections (in GEOM_Object theShape, + in long theCheckLevel, out ListOfLong theIntersections); /*! diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index 0764495dc..fb2320ea5 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -1501,6 +1501,7 @@ TCollection_AsciiString GEOMImpl_IMeasureOperations::PrintShapeErrors //============================================================================= bool GEOMImpl_IMeasureOperations::CheckSelfIntersections (Handle(GEOM_Object) theShape, + const SICheckLevel theCheckLevel, Handle(TColStd_HSequenceOfInteger)& theIntersections) { SetErrorCode(KO); @@ -1534,6 +1535,7 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections // BOPAlgo_CheckerSI aCSI; // checker of self-interferences aCSI.SetArguments(aLCS); + aCSI.SetLevelOfCheck(theCheckLevel); // 1. Launch the checker aCSI.Perform(); diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx index 86d0a9c7b..3b8ae3d42 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx @@ -85,6 +85,20 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { SK_ADVANCED, // all advanced shapes (temporary implementation) }; + /** + * This enumeration represents the level of checking shape on + * self-interference. It defines which interferferences will be checked. + */ + enum SICheckLevel + { + SI_V_V = 0, // only V/V interferences + SI_V_E, // V/V and V/E interferences + SI_E_E, // V/V, V/E and E/E interferences + SI_V_F, // V/V, V/E, E/E and V/F interferences + SI_E_F, // V/V, V/E, E/E, V/F and E/F interferences + SI_ALL // all interferences + }; + Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape, Handle(TColStd_HSequenceOfInteger)& theIntegers, Handle(TColStd_HSequenceOfReal)& theDoubles); @@ -141,6 +155,7 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { const std::list &theErrors); Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape, + const SICheckLevel theCheckLevel, Handle(TColStd_HSequenceOfInteger)& theIntersections); Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape); diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.cc b/src/GEOM_I/GEOM_IMeasureOperations_i.cc index b6785bda9..0d4a89eff 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.cc +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.cc @@ -706,6 +706,7 @@ char* GEOM_IMeasureOperations_i::PrintShapeErrors */ //============================================================================= CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theCheckLevel, GEOM::ListOfLong_out theIntersections) { // Set a not done flag @@ -720,10 +721,35 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Obj Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (!aShape.IsNull()) { + GEOMImpl_IMeasureOperations::SICheckLevel aCheckLevel; + + switch(theCheckLevel) { + case GEOM::SI_V_V: + aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_V; + break; + case GEOM::SI_V_E: + aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_E; + break; + case GEOM::SI_E_E: + aCheckLevel = GEOMImpl_IMeasureOperations::SI_E_E; + break; + case GEOM::SI_V_F: + aCheckLevel = GEOMImpl_IMeasureOperations::SI_V_F; + break; + case GEOM::SI_E_F: + aCheckLevel = GEOMImpl_IMeasureOperations::SI_E_F; + break; + case GEOM::SI_ALL: + default: + aCheckLevel = GEOMImpl_IMeasureOperations::SI_ALL; + break; + } + Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger; // Detect self-intersections - isGood = GetOperations()->CheckSelfIntersections(aShape, anIntegers); + isGood = GetOperations()->CheckSelfIntersections + (aShape, aCheckLevel, anIntegers); int nbInts = anIntegers->Length(); diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.hh b/src/GEOM_I/GEOM_IMeasureOperations_i.hh index 690ac5390..391de3f48 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.hh +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.hh @@ -97,6 +97,7 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i : const GEOM::GEOM_IMeasureOperations::ShapeErrors &theErrors); CORBA::Boolean CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theCheckLevel, GEOM::ListOfLong_out theIntersections); char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape); diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index c0cd25a60..f42182432 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -10562,22 +10562,38 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): ## Detect self-intersections in the given shape. # @param theShape Shape to check. + # @param theCheckLevel is the level of self-intersection check. + # Possible input values are: + # - GEOM.SI_V_V(0) - only V/V interferences + # - GEOM.SI_V_E(1) - V/V and V/E interferences + # - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences + # - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences + # - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences + # - GEOM.SI_ALL(5) - all interferences. # @return TRUE, if the shape contains no self-intersections. # # @ref tui_measurement_tools_page "Example" @ManageTransactions("MeasuOp") - def CheckSelfIntersections(self, theShape): + def CheckSelfIntersections(self, theShape, theCheckLevel = GEOM.SI_ALL): """ Detect self-intersections in the given shape. Parameters: theShape Shape to check. - + theCheckLevel is the level of self-intersection check. + Possible input values are: + - GEOM.SI_V_V(0) - only V/V interferences + - GEOM.SI_V_E(1) - V/V and V/E interferences + - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences + - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences + - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences + - GEOM.SI_ALL(5) - all interferences. + Returns: TRUE, if the shape contains no self-intersections. """ # Example: see GEOM_TestMeasures.py - (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape) + (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape, EnumToLong(theCheckLevel)) RaiseIfFailed("CheckSelfIntersections", self.MeasuOp) return IsValid diff --git a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx index bc0d93325..d099efeca 100644 --- a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx @@ -291,7 +291,7 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections int nbPairs = 0; try { - HasSelfInte = !anOper->CheckSelfIntersections(myObj, myInters); + HasSelfInte = !anOper->CheckSelfIntersections(myObj, GEOM::SI_ALL, myInters); nbPairs = myInters->length()/2; if (nbPairs*2 != myInters->length()) { @@ -384,12 +384,10 @@ void MeasureGUI_CheckSelfIntersectionsDlg::onInteListSelectionChanged() { erasePreview(); int aCurItem = myGrp->ListBox1->currentRow(); - int aNbItems = myGrp->ListBox1->count(); + if (aCurItem < 0) return; - //int nbPairs = myInters->length()/2; - QStringList aSubShapeList; TopoDS_Shape aSelShape; if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) {