]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Implement Check intersection level in Engine and TUI
authorskv <skv@opencascade.com>
Tue, 14 Oct 2014 14:12:28 +0000 (18:12 +0400)
committerskv <skv@opencascade.com>
Tue, 14 Oct 2014 14:12:28 +0000 (18:12 +0400)
idl/GEOM_Gen.idl
src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx
src/GEOM_I/GEOM_IMeasureOperations_i.cc
src/GEOM_I/GEOM_IMeasureOperations_i.hh
src/GEOM_SWIG/geomBuilder.py
src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx

index 076f4fed4ce7cbf245c0547fc5105345d7af742d..daec2d3882b29e982f30507575862d1ecc6092da 100644 (file)
@@ -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);
 
     /*!
index 0764495dcd426335f95dc57ab88f9977407d116b..fb2320ea5cef74e4d237a89c1b6be2ba9d7a1005 100644 (file)
@@ -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();
index 86d0a9c7b2b83125f67acb9e36dda8658b4c5ab4..3b8ae3d42279502ae9214b52053417027a80253b 100644 (file)
@@ -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<ShapeError> &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);
index b6785bda922a9edf0836974fa0a7b9698892d460..0d4a89effb2514e7e598e33197b4dbf2eb43b4dd 100644 (file)
@@ -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();
 
index 690ac5390fb0b31d2df461519b7dfbe4321c5b2f..391de3f48e60807d4b2689c1a1daf4b094cb4812 100644 (file)
@@ -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);
index c0cd25a603a1e2946fdd62bc9c395b403650d9fe..f4218243257cb8bf27883c04495f4dc3a1aa5871 100644 (file)
@@ -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
 
index bc0d9332586e32fff8d8ec2bf3e3f929df0f7a3a..d099efeca54654a87f889b2c92ac317ed891258d 100644 (file)
@@ -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)) {