]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Changed for bug NPAL14892.
authorskl <skl@opencascade.com>
Mon, 28 May 2007 12:15:34 +0000 (12:15 +0000)
committerskl <skl@opencascade.com>
Mon, 28 May 2007 12:15:34 +0000 (12:15 +0000)
25 files changed:
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
src/DlgRef/DlgRef_2Sel1List1Check_QTD.cxx [new file with mode: 0644]
src/DlgRef/DlgRef_2Sel1List1Check_QTD.h [new file with mode: 0644]
src/DlgRef/Makefile.in
src/GEOMAlgo/GEOMAlgo_Splitter.cdl
src/GEOMAlgo/GEOMAlgo_Splitter.cxx
src/GEOMAlgo/GEOMAlgo_Splitter.hxx
src/GEOMContext/GEOM_msg_en.po
src/GEOMContext/GEOM_msg_fr.po
src/GEOMGUI/GEOM_msg_en.po
src/GEOMGUI/GEOM_msg_fr.po
src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx
src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx
src/GEOMImpl/GEOMImpl_IPartition.hxx
src/GEOMImpl/GEOMImpl_PartitionDriver.cxx
src/GEOM_I/GEOM_IBooleanOperations_i.cc
src/GEOM_I/GEOM_IBooleanOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/GEOM_cyl2complementary.py
src/GEOM_SWIG/batchmode_geompy.py
src/GEOM_SWIG/geompy.py
src/OperationGUI/OperationGUI_PartitionDlg.cxx
src/OperationGUI/OperationGUI_PartitionDlg.h

index 14d89e12119a74215c6d6276c2d2947fb33a08b9..d9c4d61dc4d0da8032d255da4024eb09ff51da27 100644 (file)
@@ -1690,6 +1690,10 @@ module GEOM
      *  \note  Each compound from ListShapes and ListTools will be exploded in order
      *         to avoid possible intersection between shapes from this compound.
      *  \param theLimit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
+     #  \param KeepNonlimitShapes: if this parameter == 0 - only shapes with
+     #                             type <= Limit are kept in the result,
+     #                             else - shapes with type > Limit are kept
+     #                             also (if they exist)
      *
      *  After implementation new version of PartitionAlgo (October 2006)
      *  other parameters are ignored by current functionality. They are kept
@@ -1710,7 +1714,8 @@ module GEOM
                               in ListOfGO   theRemoveInside,
                               in short      theLimit,
                               in boolean    theRemoveWebs,
-                              in ListOfLong theMaterials);
+                              in ListOfLong theMaterials,
+                              in short      theKeepNonlimitShapes);
 
     /*!
      *  Perform partition operation.
@@ -1731,7 +1736,8 @@ module GEOM
                                                      in ListOfGO   theRemoveInside,
                                                      in short      theLimit,
                                                      in boolean    theRemoveWebs,
-                                                     in ListOfLong theMaterials);
+                                                     in ListOfLong theMaterials,
+                                                     in short      theKeepNonlimitShapes);
 
     /*!
      *  Perform partition of the Shape with the Plane
index 92e6fc36d8695eabdca9fce3f0b0c5168bb96c1a..5ba10377c7fa4236e9ca9e75c9233ae79469afdb 100644 (file)
@@ -198,7 +198,8 @@ module GEOM
                               in GEOM_List   theRemoveInside,
                               in short       theLimit,
                               in boolean     theRemoveWebs,
-                              in GEOM_List   theMaterials) ;
+                              in GEOM_List   theMaterials,
+                              in short       theKeepNonlimitShapes);
     GEOM_Object MakeHalfPartition (in GEOM_Object theShape,
                                   in GEOM_Object thePlane) ;
 
diff --git a/src/DlgRef/DlgRef_2Sel1List1Check_QTD.cxx b/src/DlgRef/DlgRef_2Sel1List1Check_QTD.cxx
new file mode 100644 (file)
index 0000000..b469af6
--- /dev/null
@@ -0,0 +1,130 @@
+// Copyright (C) 2005  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/****************************************************************************
+** Form implementation generated from reading ui file 'DlgRef_4Sel1List_QTD.ui'
+**
+** Created: lun oct 31 17:21:04 2006
+**      by:  The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "DlgRef_2Sel1List1Check_QTD.h"
+
+#include <qvariant.h>
+#include <qcombobox.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qradiobutton.h>
+
+/* 
+ *  Constructs a DlgRef_2Sel1List_QTD which is a child of 'parent', with the 
+ *  name 'name' and widget flags set to 'f'.
+ */
+DlgRef_2Sel1List1Check_QTD::DlgRef_2Sel1List1Check_QTD( QWidget* parent,
+                                                       const char* name,
+                                                       WFlags fl )
+    : QWidget( parent, name, fl )
+{
+    if ( !name )
+       setName( "DlgRef_2Sel1List1Check_QTD" );
+    resize( 129, 175 ); 
+    setCaption( trUtf8( "DlgRef_2Sel1List1Check_QTD" ) );
+    DlgRef_2Sel1List1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel1List1Check_QTDLayout"); 
+
+    GroupBox1 = new QGroupBox( this, "GroupBox1" );
+    GroupBox1->setTitle( trUtf8( "" ) );
+    GroupBox1->setColumnLayout(0, Qt::Vertical );
+    GroupBox1->layout()->setSpacing( 6 );
+    GroupBox1->layout()->setMargin( 11 );
+    GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
+    GroupBox1Layout->setAlignment( Qt::AlignTop );
+
+    Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); 
+
+    TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
+    TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
+    TextLabel1->setText( trUtf8( "TL1" ) );
+
+    Layout1->addWidget( TextLabel1, 0, 0 );
+
+    PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
+    PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
+    PushButton1->setText( trUtf8( "" ) );
+
+    Layout1->addWidget( PushButton1, 0, 1 );
+    
+    LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
+
+    Layout1->addWidget( LineEdit1, 0, 2 );
+   
+
+    TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
+    TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
+    TextLabel2->setText( trUtf8( "TL2" ) );
+
+    Layout1->addWidget( TextLabel2, 1, 0 );
+
+    PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
+    PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
+    PushButton2->setText( trUtf8( "" ) );
+
+    Layout1->addWidget( PushButton2, 1, 1 );
+    
+    LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
+
+    Layout1->addWidget( LineEdit2, 1, 2 );
+
+    
+    TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
+    TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
+    TextLabel3->setText( trUtf8( "TL3" ) );
+
+    Layout1->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
+    
+    ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" );
+    ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) );
+
+    Layout1->addWidget( ComboBox1, 2, 2 );
+   
+    radioButton4 = new QRadioButton( GroupBox1, "radioButton4" );
+    GroupBox1Layout->addMultiCellWidget( radioButton4, 3, 3, 0, 1 );
+
+    GroupBox1Layout->addLayout( Layout1, 0, 0 );
+    
+    DlgRef_2Sel1List1Check_QTDLayout->addWidget( GroupBox1, 0, 0 );
+
+    QSpacerItem* spacer = new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Expanding );
+    Layout1->addItem( spacer, 5, 2 );
+
+}
+
+/*  
+ *  Destroys the object and frees any allocated resources
+ */
+DlgRef_2Sel1List1Check_QTD::~DlgRef_2Sel1List1Check_QTD()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
diff --git a/src/DlgRef/DlgRef_2Sel1List1Check_QTD.h b/src/DlgRef/DlgRef_2Sel1List1Check_QTD.h
new file mode 100644 (file)
index 0000000..14e7875
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright (C) 2005  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/****************************************************************************
+** Form interface generated from reading ui file 'DlgRef_2Sel1List_QTD.ui'
+**
+** Created: lun oct 31 17:21:03 2006
+**      by:  The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef DLGREF_2SEL1LIST_QTD_H
+#define DLGREF_2SEL1LIST_QTD_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+class QVBoxLayout; 
+class QHBoxLayout; 
+class QGridLayout; 
+class QComboBox;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+
+class DlgRef_2Sel1List1Check_QTD : public QWidget
+{ 
+    Q_OBJECT
+
+public:
+    DlgRef_2Sel1List1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+    ~DlgRef_2Sel1List1Check_QTD();
+
+    QGroupBox* GroupBox1;
+    QLineEdit* LineEdit2;
+    QPushButton* PushButton1;
+    QPushButton* PushButton2;
+    QLabel* TextLabel1;
+    QLineEdit* LineEdit1;
+    QLabel* TextLabel2;
+    QComboBox* ComboBox1;
+    QLabel* TextLabel3;
+    QRadioButton* radioButton4;
+
+
+protected:
+    QGridLayout* DlgRef_2Sel1List1Check_QTDLayout;
+    QGridLayout* GroupBox1Layout;
+    QGridLayout* Layout1;
+};
+
+#endif // DLGREF_2SEL1LIST1CHECK_QTD_H
index e25ee41d1178ad277976db8f377138045ffff4d5..0c25761d9ed7ac87d4e053adac0e7b95bfe73df1 100644 (file)
@@ -59,6 +59,7 @@ LIB_SRC =     DlgRef_Skeleton_QTD.cxx \
                DlgRef_3Sel4Spin2Check_QTD.cxx \
                DlgRef_4Sel1List_QTD.cxx \
                DlgRef_2Sel1List_QTD.cxx \
+               DlgRef_2Sel1List1Check_QTD.cxx \
                DlgRef_1List1Spin1Btn_QTD.cxx \
                DlgRef_4Sel1List1Check_QTD.cxx \
                DlgRef_1Spin_QTD.cxx \
@@ -115,6 +116,7 @@ LIB_MOC = \
                DlgRef_3Sel4Spin2Check_QTD.h \
                DlgRef_4Sel1List_QTD.h \
                DlgRef_2Sel1List_QTD.h \
+               DlgRef_2Sel1List1Check_QTD.h \
                DlgRef_1List1Spin1Btn_QTD.h \
                DlgRef_4Sel1List1Check_QTD.h \
                DlgRef_1Spin_QTD.h \
index a67c8e222c1f8b2a4193222e36b60552b8079ee0..19991027d2d72b044d4dbbe285cf04ae3a88ec52 100755 (executable)
@@ -63,6 +63,13 @@ is
         
     Limit(me)  
        returns ShapeEnum from TopAbs;   
+
+    SetLimitMode(me:out; 
+           aLimitMode:Integer from Standard); 
+            
+    LimitMode(me) 
+       returns Integer from Standard;    
+
     -- 
     --    Protected methods  
     --  
@@ -89,5 +96,7 @@ fields
     myTools           : ListOfShape from TopTools is protected; 
     myMapTools        : MapOfShape  from TopTools is protected;        
     myLimit           : ShapeEnum   from TopAbs   is protected;   
+    myLimitMode       : Integer from Standard     is protected;  
+
 end Splitter;
 
index 7ea27c32f1c257c1cb67d189dbcbbe7a83c64ae0..bcbf18afeab0b1a8cec19ac416abddaccb5d4fa7 100755 (executable)
 
 #include <NMTTools_DSFiller.hxx>
 
+static 
+  void TreatCompound(const TopoDS_Shape& aC, 
+                    TopTools_ListOfShape& aLSX);
+
 //=======================================================================
 //function : 
 //purpose  : 
@@ -53,6 +57,7 @@
   GEOMAlgo_Builder()
 {
   myLimit=TopAbs_SHAPE;
+  myLimitMode=0;
 }
 //=======================================================================
 //function : ~
   return myLimit;
 }
 //=======================================================================
+//function : SetLimitMode
+//purpose  : 
+//=======================================================================
+  void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode)
+{
+  myLimitMode=aMode;
+}
+//=======================================================================
+//function : LimitMode
+//purpose  : 
+//=======================================================================
+  Standard_Integer GEOMAlgo_Splitter::LimitMode()const
+{
+  return myLimitMode;
+}
+//=======================================================================
 //function : Clear
 //purpose  : 
 //=======================================================================
     Standard_Integer i, aNbS;
     BRep_Builder aBB;
     TopoDS_Compound aC;
-    TopTools_IndexedMapOfShape aM;
+    TopTools_IndexedMapOfShape aMx;
     //
     aBB.MakeCompound(aC);
     //
-    TopExp::MapShapes(myShape, myLimit, aM);
-    aNbS=aM.Extent();
+    TopExp::MapShapes(myShape, myLimit, aMx);
+    aNbS=aMx.Extent();
     for (i=1; i<=aNbS; ++i) {
-      const TopoDS_Shape& aS=aM(i);
+      const TopoDS_Shape& aS=aMx(i);
       aBB.Add(aC, aS);
     }
+    //modified by NIZNHY-PKV Thu Feb 15 17:09:32 2007f
+    if (myLimitMode) {
+      Standard_Integer iType, iLimit, iTypeX;
+      TopAbs_ShapeEnum aType, aTypeX;
+      TopTools_ListOfShape aLSP, aLSX;
+      TopTools_ListIteratorOfListOfShape aIt, aItX, aItIm;
+      TopTools_MapOfShape  aM;
+      //
+      iLimit=(Standard_Integer)myLimit; 
+      //
+      // 1. Collect the shapes to process aLSP
+      aIt.Initialize(myShapes);
+      for (; aIt.More(); aIt.Next()) {
+       const TopoDS_Shape& aS=aIt.Value();
+       if (myMapTools.Contains(aS)) {
+         continue;
+       }
+       //
+       aType=aS.ShapeType();
+       iType=(Standard_Integer)aType;
+       //
+       if (iType>iLimit) {
+         aLSP.Append(aS);
+       }
+       //
+       else if (aType==TopAbs_COMPOUND) {
+         aLSX.Clear();
+         //
+         TreatCompound(aS, aLSX);
+         //
+         aItX.Initialize(aLSX);
+         for (; aItX.More(); aItX.Next()) {
+           const TopoDS_Shape& aSX=aItX.Value();
+           aTypeX=aSX.ShapeType();
+           iTypeX=(Standard_Integer)aTypeX;
+           //
+           if (iTypeX>iLimit) {
+             aLSP.Append(aSX);
+           }
+         }
+       }
+      }// for (; aIt.More(); aIt.Next()) {
+      //
+      // 2. Add them to aC
+      aIt.Initialize(aLSP);
+      for (; aIt.More(); aIt.Next()) {
+       const TopoDS_Shape& aS=aIt.Value();
+       if (myImages.HasImage(aS)) {
+         const TopTools_ListOfShape& aLSIm=myImages.Image(aS);
+         aItIm.Initialize(aLSIm);
+         for (; aItIm.More(); aItIm.Next()) {
+           const TopoDS_Shape& aSIm=aItIm.Value();
+           if (aM.Add(aSIm)) {
+             aBB.Add(aC, aSIm);
+           }
+         }
+       }
+       else {
+         if (aM.Add(aS)) {
+           aBB.Add(aC, aS);
+         }
+       }
+      }
+    }// if (myLimitMode) {
+    //modified by NIZNHY-PKV Thu Feb 15 17:09:34 2007t
     myShape=aC;
-  }
+  }//if (myLimit!=TopAbs_SHAPE) {
   //
   GEOMAlgo_Builder::PostTreat();
+}
+//=======================================================================
+//function : TreatCompound
+//purpose  : 
+//=======================================================================
+void TreatCompound(const TopoDS_Shape& aC1, 
+                  TopTools_ListOfShape& aLSX)
+{
+  Standard_Integer aNbC1;
+  TopAbs_ShapeEnum aType;
+  TopTools_ListOfShape aLC, aLC1;
+  TopTools_ListIteratorOfListOfShape aIt, aIt1;
+  TopoDS_Iterator aItC;
   //
+  aLC.Append (aC1);
+  while(1) {
+    aLC1.Clear();
+    aIt.Initialize(aLC);
+    for (; aIt.More(); aIt.Next()) {
+      const TopoDS_Shape& aC=aIt.Value(); //C is compound
+      //
+      aItC.Initialize(aC);
+      for (; aItC.More(); aItC.Next()) {
+       const TopoDS_Shape& aS=aItC.Value();
+       aType=aS.ShapeType();
+       if (aType==TopAbs_COMPOUND) {
+         aLC1.Append(aS);
+       }
+       else {
+         aLSX.Append(aS);
+       }
+      }
+    }
+    //
+    aNbC1=aLC1.Extent();
+    if (!aNbC1) {
+      break;
+    }
+    //
+    aLC.Clear();
+    aIt.Initialize(aLC1);
+    for (; aIt.More(); aIt.Next()) {
+      const TopoDS_Shape& aSC=aIt.Value();
+      aLC.Append(aSC);
+    }
+  }// while(1)
 }
 //
 // myErrorStatus
index 6ef1e92ac33141f1630a142bb2b964f7ee461690..7f3b69fb74a037b0cebe40a5c2ee8e1ccb7d8ff9 100644 (file)
@@ -29,6 +29,9 @@
 #ifndef _TopAbs_ShapeEnum_HeaderFile
 #include <TopAbs_ShapeEnum.hxx>
 #endif
+#ifndef _Standard_Integer_HeaderFile
+#include <Standard_Integer.hxx>
+#endif
 #ifndef _GEOMAlgo_Builder_HeaderFile
 #include <GEOMAlgo_Builder.hxx>
 #endif
@@ -82,6 +85,12 @@ Standard_EXPORT   void SetLimit(const TopAbs_ShapeEnum aLimit) ;
 
 Standard_EXPORT   TopAbs_ShapeEnum Limit() const;
 
+
+Standard_EXPORT   void SetLimitMode(const Standard_Integer aLimitMode) ;
+
+
+Standard_EXPORT   Standard_Integer LimitMode() const;
+
 //!  Adds Tool arguments of the operation as <br>
 //!           shapes of upper level of container shape theShape <br>
 //! ===================================================== <br>
@@ -108,6 +117,7 @@ Standard_EXPORT virtual  void PostTreat() ;
 TopTools_ListOfShape myTools;
 TopTools_MapOfShape myMapTools;
 TopAbs_ShapeEnum myLimit;
+Standard_Integer myLimitMode;
 
 
 private: 
index ae88996a29ce1e4133349822e88539af5f3f81c5..7dc8d22eac5cadb4aa684cd28ca3477776dab61a 100644 (file)
@@ -1189,6 +1189,9 @@ msgstr "\nShading"
 msgid "GEOM_RECONSTRUCTION_LIMIT"
 msgstr "Reconstruction Limit"
 
+msgid "GEOM_KEEP_NONLIMIT_SHAPES"
+msgstr "Keep nonlimit shapes"
+
 msgid "GEOM_SUPPRESS_RESULT"
 msgstr "Suppress Result"
 
index 45c9b0ead272283d77d9dbe74706459f848cf72f..d88c449868a1eb8d584d024db6880a46171907db 100644 (file)
@@ -1190,6 +1190,9 @@ msgstr "Ombré"
 msgid "GEOM_RECONSTRUCTION_LIMIT"
 msgstr "Limite de Reconstruction"
 
+msgid "GEOM_KEEP_NONLIMIT_SHAPES"
+msgstr "Keep nonlimit shapes"
+
 msgid "GEOM_SUPPRESS_RESULT"
 msgstr "Supprimer le Resultat"
 
index 01825cc9d326086daf3f46fcdeff1fe9da866c1e..b3be4b2f2a418ebd85047c56ae444cfc55bb9641 100644 (file)
@@ -1312,6 +1312,9 @@ msgstr "\nShading"
 msgid "GEOM_RECONSTRUCTION_LIMIT"
 msgstr "Reconstruction Limit"
 
+msgid "GEOM_KEEP_NONLIMIT_SHAPES"
+msgstr "Keep nonlimit shapes"
+
 msgid "GEOM_SUPPRESS_RESULT"
 msgstr "Suppress Result"
 
index 8d5b1b24dc4eaa5a47621bc073f92906cfddcb4c..d4efd381dcb5c38c266a4611c28e903d74640974 100644 (file)
@@ -1238,6 +1238,9 @@ msgstr "Ombré"
 msgid "GEOM_RECONSTRUCTION_LIMIT"
 msgstr "Limite de Reconstruction"
 
+msgid "GEOM_KEEP_NONLIMIT_SHAPES"
+msgstr "Keep nonlimit shapes"
+
 msgid "GEOM_SUPPRESS_RESULT"
 msgstr "Supprimer le Resultat"
 
index d2753622d2ce7d201bcaa524d4290d87c6c25a97..f5c4040a17a8f10b759d8bfab3b383dc505c66f3 100644 (file)
@@ -148,7 +148,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
                               const Standard_Integer                      theLimit,
                               const Standard_Boolean                      theRemoveWebs,
                               const Handle(TColStd_HArray1OfInteger)&     theMaterials,
-                              const Standard_Boolean                      thePerformSelfIntersections)
+                             const Standard_Integer theKeepNonlimitShapes,
+                              const Standard_Boolean thePerformSelfIntersections)
 {
   SetErrorCode(KO);
 
@@ -251,6 +252,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
 
   // Limit
   aCI.SetLimit(theLimit);
+  aCI.SetKeepNonlimitShapes(theKeepNonlimitShapes);
 
   // Materials
   if (theRemoveWebs) {
@@ -302,7 +304,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
       pd << ", " << theMaterials->Value(i);
     }
   }
-  pd << "])";
+  pd << "], " << theKeepNonlimitShapes <<")";
 
   SetErrorCode(OK);
   return aPartition;
index fd82587b27d7e736f0faeba1dedf6b6eda4531ce..6dc82d7be23d005e30b99069b6e4b5c2730b23c9 100644 (file)
@@ -46,7 +46,8 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
                    const Standard_Integer                      theLimit,
                    const Standard_Boolean                      theRemoveWebs,
                    const Handle(TColStd_HArray1OfInteger)&     theMaterials,
-                   const Standard_Boolean                      thePerformSelfIntersections);
+                  const Standard_Integer theKeepNonlimitShapes,
+                  const Standard_Boolean thePerformSelfIntersections);
 
   Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape,
                                                          Handle(GEOM_Object) thePlane);
index 1141f0f0c5ae44fd46b817067dc03a39e10d24bb..bf1ff4d7c59e3629e81bfb076dbd91c0798095c2 100644 (file)
@@ -36,6 +36,8 @@
 #define PART_ARG_SHAPE 7
 #define PART_ARG_PLANE 8
 
+#define PART_ARG_KEEP_NONLIMIT_SHAPES 9
+
 class GEOMImpl_IPartition
 {
  public:
@@ -44,6 +46,9 @@ class GEOMImpl_IPartition
 
   void SetLimit(int theLimit) { _func->SetInteger(PART_ARG_LIMIT, theLimit); }
 
+  void SetKeepNonlimitShapes(int theKeepNonlimitShapes)
+  { _func->SetInteger(PART_ARG_KEEP_NONLIMIT_SHAPES,theKeepNonlimitShapes ); }
+
   void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes)
   { _func->SetReferenceList(PART_ARG_SHAPES, theShapes); }
 
@@ -62,6 +67,8 @@ class GEOMImpl_IPartition
 
   int GetLimit() { return _func->GetInteger(PART_ARG_LIMIT); }
 
+  int GetKeepNonlimitShapes() { return _func->GetInteger(PART_ARG_KEEP_NONLIMIT_SHAPES); }
+
   Handle(TColStd_HSequenceOfTransient) GetShapes()    { return _func->GetReferenceList(PART_ARG_SHAPES); }
   Handle(TColStd_HSequenceOfTransient) GetTools()     { return _func->GetReferenceList(PART_ARG_TOOLS); }
   Handle(TColStd_HSequenceOfTransient) GetKeepIns()   { return _func->GetReferenceList(PART_ARG_KEEP_IN); }
index b079521e8d52b52f7152fb4e6882f403e8f0ae04..b681770981346109afa803f8a847d5c356b30871 100644 (file)
@@ -206,6 +206,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
       }
     }
 
+    PS.SetLimitMode(aCI.GetKeepNonlimitShapes());
     PS.SetLimit( (TopAbs_ShapeEnum)aCI.GetLimit() );
     PS.Perform();
 
index c7a594259d8ae63c97c649ad2ab0adc87ef9deff..836451282d49f7b6cc464ca4701a8c1d02fe5fff 100644 (file)
@@ -99,7 +99,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
                                       const GEOM::ListOfGO&   theRemoveIns,
                                       CORBA::Short            theLimit,
                                       CORBA::Boolean          theRemoveWebs,
-                                      const GEOM::ListOfLong& theMaterials)
+                                      const GEOM::ListOfLong& theMaterials,
+                                      CORBA::Short theKeepNonlimitShapes)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -166,6 +167,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
                                   theLimit, theRemoveWebs, aMaterials,
+                                  theKeepNonlimitShapes,
                                   /*PerformSelfIntersections*/Standard_True);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -185,7 +187,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
                                       const GEOM::ListOfGO&   theRemoveIns,
                                       CORBA::Short            theLimit,
                                       CORBA::Boolean          theRemoveWebs,
-                                      const GEOM::ListOfLong& theMaterials)
+                                      const GEOM::ListOfLong& theMaterials,
+                                      CORBA::Short theKeepNonlimitShapes)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -252,6 +255,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
                                   theLimit, theRemoveWebs, aMaterials,
+                                  theKeepNonlimitShapes,
                                   /*PerformSelfIntersections*/Standard_False);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
index 94ab4c8763f50e027024dc38c5fca34359e31b73..e8e15fa30793a4a6db7ebce62659bd066059a3fc 100644 (file)
@@ -49,7 +49,8 @@ class GEOM_IBooleanOperations_i :
                                       const GEOM::ListOfGO&   theRemoveInside,
                                       CORBA::Short            theLimit,
                                       CORBA::Boolean          theRemoveWebs,
-                                      const GEOM::ListOfLong& theMaterials);
+                                      const GEOM::ListOfLong& theMaterials,
+                                      CORBA::Short theKeepNonlimitShapes);
 
   GEOM::GEOM_Object_ptr MakePartitionNonSelfIntersectedShape (const GEOM::ListOfGO&   theShapes,
                                                              const GEOM::ListOfGO&   theTools,
@@ -57,7 +58,8 @@ class GEOM_IBooleanOperations_i :
                                                              const GEOM::ListOfGO&   theRemoveInside,
                                                              CORBA::Short            theLimit,
                                                              CORBA::Boolean          theRemoveWebs,
-                                                             const GEOM::ListOfLong& theMaterials);
+                                                             const GEOM::ListOfLong& theMaterials,
+                                                             CORBA::Short theKeepNonlimitShapes);
 
 
   GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape,
index 299d9f55098785b43cfc297fefbef28c0fde426e..f2c741940b33091f48445dcf0458c3419506573c 100644 (file)
@@ -1040,7 +1040,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr   theSha
                                                    GEOM::GEOM_List_ptr   theRemoveInside,
                                                    CORBA::Short      theLimit,
                                                    CORBA::Boolean    theRemoveWebs,
-                                                   GEOM::GEOM_List_ptr theMaterials)
+                                                   GEOM::GEOM_List_ptr theMaterials,
+                                                   CORBA::Short theKeepNonlimitShapes)
 {
   beginService( " GEOM_Superv_i::MakePartition" );
   MESSAGE("GEOM_Superv_i::MakePartition");
@@ -1056,9 +1057,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr   theSha
     dynamic_cast<GEOM_List_i<GEOM::ListOfLong>*>(GetServant(theMaterials, myPOA).in());
   if (aListImplS && aListImplT && aListImplKI && aListImplRI && aListImplM) {
     getBoolOp();
-    GEOM::GEOM_Object_ptr anObj = myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(), 
-                                                         aListImplKI->GetList(), aListImplRI->GetList(),
-                                                         theLimit, theRemoveWebs, aListImplM->GetList());
+    GEOM::GEOM_Object_ptr anObj =
+      myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(), 
+                             aListImplKI->GetList(), aListImplRI->GetList(),
+                             theLimit, theRemoveWebs, aListImplM->GetList(),
+                             theKeepNonlimitShapes);
     endService( " GEOM_Superv_i::MakePartition" );
     return anObj;
   }
index 298a01edeb4df3906db2b849fbca897a58997d13..db4bd41d65461acd3bf17d66fc37ee0382a761aa 100644 (file)
@@ -258,7 +258,8 @@ public:
                                       GEOM::GEOM_List_ptr   theRemoveInside,
                                       CORBA::Short      theLimit,
                                       CORBA::Boolean    theRemoveWebs,
-                                      GEOM::GEOM_List_ptr theMaterials);
+                                      GEOM::GEOM_List_ptr theMaterials,
+                                      CORBA::Short theKeepNonlimitShapes);
   GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape,
                                           GEOM::GEOM_Object_ptr thePlane);
 
index 1190037abb5ef1bc51fb8bd242b80839c33ce045..fd979913d6d3e23bed69c5bd5d1bf7094580e135 100755 (executable)
@@ -97,7 +97,7 @@ p_tools.append(geompy.MakePlane(geompy.MakeVertex(gx+g_rayonPetit, 0, 0), geompy
 
 addToStudy(t_boite, "t_boite")
 
-p_element = geompy.MakePartition([t_boite], p_tools, [], [], 4, 0, [])
+p_element = geompy.MakePartition([t_boite], p_tools, [], [], 4, 0, [], 0)
 
 # Compound
 # --------
index 0f91c8c9dcf4b9e4210e32176a133cf95ea46771..42e9ec5c292f961cb4086fd7a53ccf15f22d3a0c 100644 (file)
@@ -699,19 +699,23 @@ def MakeSection(s1, s2):
     return MakeBoolean(s1, s2, 4)
 
 def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
-                  Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+                  Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
+                  KeepNonlimitShapes=0):
     anObj = BoolOp.MakePartition(ListShapes, ListTools,
                                  ListKeepInside, ListRemoveInside,
-                                 Limit, RemoveWebs, ListMaterials);
+                                 Limit, RemoveWebs, ListMaterials,
+                                 KeepNonlimitShapes);
     if BoolOp.IsDone() == 0:
       print "MakePartition : ", BoolOp.GetErrorCode()
     return anObj
 
 def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
-              Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+              Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
+              KeepNonlimitShapes=0):
     anObj = MakePartition(ListShapes, ListTools,
                           ListKeepInside, ListRemoveInside,
-                          Limit, RemoveWebs, ListMaterials);
+                          Limit, RemoveWebs, ListMaterials,
+                          KeepNonlimitShapes);
     return anObj
 
 def MakeHalfPartition(theShape, thePlane):
index d99b53dbb1a6b9985238af8e64e3f49eab3f6948..d2c3df8d9451a52e50cd3c9f6b665c33ea5dcc55 100644 (file)
@@ -1468,6 +1468,10 @@ def MakeSection(s1, s2):
 #           in order to avoid possible intersection between shapes from
 #           this compound.
 #  @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
+#  @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
+#                             type <= Limit are kept in the result,
+#                             else - shapes with type > Limit are kept
+#                             also (if they exist)
 #
 #  After implementation new version of PartitionAlgo (October 2006)
 #  other parameters are ignored by current functionality. They are kept
@@ -1485,10 +1489,12 @@ def MakeSection(s1, s2):
 #
 #  Example: see GEOM_TestAll.py
 def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
-                  Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+                  Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
+                  KeepNonlimitShapes=0):
     anObj = BoolOp.MakePartition(ListShapes, ListTools,
                                  ListKeepInside, ListRemoveInside,
-                                 Limit, RemoveWebs, ListMaterials);
+                                 Limit, RemoveWebs, ListMaterials,
+                                 KeepNonlimitShapes);
     if BoolOp.IsDone() == 0:
       print "MakePartition : ", BoolOp.GetErrorCode()
     return anObj
@@ -1505,11 +1511,14 @@ def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=
 #
 #  @return New GEOM_Object, containing the result shapes.
 #
-def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
-                  Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[],
+                                         ListKeepInside=[], ListRemoveInside=[],
+                                         Limit=ShapeType["SHAPE"], RemoveWebs=0,
+                                         ListMaterials=[], KeepNonlimitShapes=0):
     anObj = BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
                                                         ListKeepInside, ListRemoveInside,
-                                                        Limit, RemoveWebs, ListMaterials);
+                                                        Limit, RemoveWebs, ListMaterials,
+                                                        KeepNonlimitShapes);
     if BoolOp.IsDone() == 0:
       print "MakePartitionNonSelfIntersectedShape : ", BoolOp.GetErrorCode()
     return anObj
@@ -1518,10 +1527,12 @@ def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[], ListKeepInsid
 #
 #  Example: see GEOM_TestOthers.py
 def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
-              Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+              Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
+              KeepNonlimitShapes=0):
     anObj = MakePartition(ListShapes, ListTools,
                           ListKeepInside, ListRemoveInside,
-                          Limit, RemoveWebs, ListMaterials);
+                          Limit, RemoveWebs, ListMaterials,
+                          KeepNonlimitShapes);
     return anObj
 
 ## Perform partition of the Shape with the Plane
index 12ebfba3c3ff05b8442e3743e909e1ca5fc32c12..9649e3a9174eeb7e9d48ece66d7e89cd9aaf5a87 100644 (file)
@@ -67,7 +67,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(GeometryGUI* theGeometryGUI
   RadioButton3->close(TRUE);
 
   // Full partition (contains half-space partition)
-  GroupPoints = new DlgRef_2Sel1List_QTD(this, "GroupPoints");
+  GroupPoints = new DlgRef_2Sel1List1Check_QTD(this, "GroupPoints");
   GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION"));
   GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
   GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT"));
@@ -76,6 +76,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(GeometryGUI* theGeometryGUI
   GroupPoints->PushButton2->setPixmap(image2);
   GroupPoints->LineEdit1->setReadOnly( true );
   GroupPoints->LineEdit2->setReadOnly( true );
+  GroupPoints->radioButton4->setText(tr("GEOM_KEEP_NONLIMIT_SHAPES"));
 
   Layout1->addWidget(GroupPoints, 2, 0);
   /***************************************************************/
@@ -109,6 +110,7 @@ void OperationGUI_PartitionDlg::Init()
   GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_WIRE"));
   GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE"));
   GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX"));
+  GroupPoints->radioButton4->setChecked(FALSE);
   
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
@@ -123,6 +125,8 @@ void OperationGUI_PartitionDlg::Init()
   
   connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
   
+  connect(GroupPoints->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int)));
+
   connect(myGeomGUI->getApp()->selectionMgr(), 
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   
@@ -145,7 +149,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId)
   myListKeepInside.length(0);
   myListRemoveInside.length(0);
   myListMaterials.length(0);
-  
+
   switch (constructorId)
     {
     case 0: /*Full partition */
@@ -155,8 +159,8 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId)
        resize(0, 0);
        GroupPoints->TextLabel3->show();
        GroupPoints->ComboBox1->show();
-       
        GroupPoints->ComboBox1->setCurrentItem(0);
+       GroupPoints->radioButton4->show();
        break;
       }
     case 1: /*Half-space partition */
@@ -166,6 +170,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId)
        GroupPoints->TextLabel3->hide();
        GroupPoints->ComboBox1->hide();
        GroupPoints->TextLabel2->setText(tr("GEOM_PLANE"));
+       GroupPoints->radioButton4->hide();
        resize(0, 0);
        break;
       } 
@@ -357,15 +362,25 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
   int aLimit = GetLimit();
   int aConstructorId = getConstructorId();
 
-  if (aConstructorId == 1)
+  int aKeepNonlimitShapes = 0;
+  if (aConstructorId == 1) {
     aLimit = GEOM::SHAPE;
+  }
+  else {
+    if(GroupPoints->radioButton4->isChecked()) {
+      aKeepNonlimitShapes = 1;
+    }
+    else {
+      aKeepNonlimitShapes = 0;
+    }
+  }
 
   if (isValid( msg )) {
 
     anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())->
       MakePartition(myListShapes, myListTools,
                     myListKeepInside, myListRemoveInside,
-                   aLimit, false, myListMaterials);
+                   aLimit, false, myListMaterials, aKeepNonlimitShapes);
     res = true;
   }
 
index dbfbd4dcce971025cb62dd6b1777163501178b85..ba321be37033aa2a9188f867f08212fc03768e12 100644 (file)
@@ -29,7 +29,7 @@
 #define DIALOGBOX_PARTITION_H
 
 #include "GEOMBase_Skeleton.h"
-#include "DlgRef_2Sel1List_QTD.h"
+#include "DlgRef_2Sel1List1Check_QTD.h"
 
 //=================================================================================
 // class    : OperationGUI_PartitionDlg
@@ -68,7 +68,7 @@ private:
     GEOM::ListOfGO   myListRemoveInside;
     GEOM::ListOfGO   myListKeepInside;
 
-    DlgRef_2Sel1List_QTD* GroupPoints;
+    DlgRef_2Sel1List1Check_QTD* GroupPoints;
 
 private slots:
     void ClickOnOk();