From: skl Date: Mon, 28 May 2007 12:15:34 +0000 (+0000) Subject: Changed for bug NPAL14892. X-Git-Tag: V3_2_7~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d9f6d20b8199e6e67b4cfd623ff86b9e37067870;p=modules%2Fgeom.git Changed for bug NPAL14892. --- diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 14d89e121..d9c4d61dc 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -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 diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 92e6fc36d..5ba10377c 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -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 index 000000000..b469af6b6 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1List1Check_QTD.cxx @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * 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 index 000000000..14e7875f8 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1List1Check_QTD.h @@ -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 +#include +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 diff --git a/src/DlgRef/Makefile.in b/src/DlgRef/Makefile.in index e25ee41d1..0c25761d9 100644 --- a/src/DlgRef/Makefile.in +++ b/src/DlgRef/Makefile.in @@ -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 \ diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.cdl b/src/GEOMAlgo/GEOMAlgo_Splitter.cdl index a67c8e222..19991027d 100755 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.cdl +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.cdl @@ -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; diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx index 7ea27c32f..bcbf18afe 100755 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx @@ -44,6 +44,10 @@ #include +static + void TreatCompound(const TopoDS_Shape& aC, + TopTools_ListOfShape& aLSX); + //======================================================================= //function : //purpose : @@ -53,6 +57,7 @@ GEOMAlgo_Builder() { myLimit=TopAbs_SHAPE; + myLimitMode=0; } //======================================================================= //function : ~ @@ -112,6 +117,22 @@ 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 : //======================================================================= @@ -168,21 +189,131 @@ 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 diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.hxx b/src/GEOMAlgo/GEOMAlgo_Splitter.hxx index 6ef1e92ac..7f3b69fb7 100644 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.hxx @@ -29,6 +29,9 @@ #ifndef _TopAbs_ShapeEnum_HeaderFile #include #endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif #ifndef _GEOMAlgo_Builder_HeaderFile #include #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
//! shapes of upper level of container shape theShape
//! =====================================================
@@ -108,6 +117,7 @@ Standard_EXPORT virtual void PostTreat() ; TopTools_ListOfShape myTools; TopTools_MapOfShape myMapTools; TopAbs_ShapeEnum myLimit; +Standard_Integer myLimitMode; private: diff --git a/src/GEOMContext/GEOM_msg_en.po b/src/GEOMContext/GEOM_msg_en.po index ae88996a2..7dc8d22ea 100644 --- a/src/GEOMContext/GEOM_msg_en.po +++ b/src/GEOMContext/GEOM_msg_en.po @@ -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" diff --git a/src/GEOMContext/GEOM_msg_fr.po b/src/GEOMContext/GEOM_msg_fr.po index 45c9b0ead..d88c44986 100644 --- a/src/GEOMContext/GEOM_msg_fr.po +++ b/src/GEOMContext/GEOM_msg_fr.po @@ -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" diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 01825cc9d..b3be4b2f2 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -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" diff --git a/src/GEOMGUI/GEOM_msg_fr.po b/src/GEOMGUI/GEOM_msg_fr.po index 8d5b1b24d..d4efd381d 100644 --- a/src/GEOMGUI/GEOM_msg_fr.po +++ b/src/GEOMGUI/GEOM_msg_fr.po @@ -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" diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx index d2753622d..f5c4040a1 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx @@ -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; diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx index fd82587b2..6dc82d7be 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx @@ -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); diff --git a/src/GEOMImpl/GEOMImpl_IPartition.hxx b/src/GEOMImpl/GEOMImpl_IPartition.hxx index 1141f0f0c..bf1ff4d7c 100644 --- a/src/GEOMImpl/GEOMImpl_IPartition.hxx +++ b/src/GEOMImpl/GEOMImpl_IPartition.hxx @@ -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); } diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx index b079521e8..b68177098 100644 --- a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx @@ -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(); diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.cc b/src/GEOM_I/GEOM_IBooleanOperations_i.cc index c7a594259..836451282 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.cc +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.cc @@ -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(); diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.hh b/src/GEOM_I/GEOM_IBooleanOperations_i.hh index 94ab4c876..e8e15fa30 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.hh +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.hh @@ -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, diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 299d9f550..f2c741940 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -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*>(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; } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 298a01ede..db4bd41d6 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -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); diff --git a/src/GEOM_SWIG/GEOM_cyl2complementary.py b/src/GEOM_SWIG/GEOM_cyl2complementary.py index 1190037ab..fd979913d 100755 --- a/src/GEOM_SWIG/GEOM_cyl2complementary.py +++ b/src/GEOM_SWIG/GEOM_cyl2complementary.py @@ -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 # -------- diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 0f91c8c9d..42e9ec5c2 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -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): diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index d99b53dbb..d2c3df8d9 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -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 diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index 12ebfba3c..9649e3a91 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -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; } diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.h b/src/OperationGUI/OperationGUI_PartitionDlg.h index dbfbd4dcc..ba321be37 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.h +++ b/src/OperationGUI/OperationGUI_PartitionDlg.h @@ -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();