From: skl Date: Thu, 2 Nov 2006 05:59:42 +0000 (+0000) Subject: New version of PartitionAlgo. X-Git-Tag: V3_2_3pre1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=25e9c25801f45b24a85566c636ca96deb9fd5fe0;p=modules%2Fgeom.git New version of PartitionAlgo. --- diff --git a/src/DlgRef/DlgRef_2Sel1List_QTD.cxx b/src/DlgRef/DlgRef_2Sel1List_QTD.cxx new file mode 100644 index 000000000..ec428c3fe --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1List_QTD.cxx @@ -0,0 +1,125 @@ +// 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_2Sel1List_QTD.h" + +#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_2Sel1List_QTD::DlgRef_2Sel1List_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel1List_QTD" ); + resize( 129, 175 ); + setCaption( trUtf8( "DlgRef_2Sel1List_QTD" ) ); + DlgRef_2Sel1List_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel1List_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 ); + + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel1List_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_2Sel1List_QTD::~DlgRef_2Sel1List_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel1List_QTD.h b/src/DlgRef/DlgRef_2Sel1List_QTD.h new file mode 100644 index 000000000..404e5bc9f --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1List_QTD.h @@ -0,0 +1,67 @@ +// 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 DlgRef_2Sel1List_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel1List_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel1List_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit2; + QPushButton* PushButton1; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + QComboBox* ComboBox1; + QLabel* TextLabel3; + + +protected: + QGridLayout* DlgRef_2Sel1List_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_2SEL1LIST_QTD_H diff --git a/src/DlgRef/Makefile.in b/src/DlgRef/Makefile.in index 3e942e894..99cb6fb91 100644 --- a/src/DlgRef/Makefile.in +++ b/src/DlgRef/Makefile.in @@ -58,6 +58,7 @@ LIB_SRC = DlgRef_Skeleton_QTD.cxx \ DlgRef_2Sel4Spin1Check_QTD.cxx \ DlgRef_3Sel4Spin2Check_QTD.cxx \ DlgRef_4Sel1List_QTD.cxx \ + DlgRef_2Sel1List_QTD.cxx \ DlgRef_1List1Spin1Btn_QTD.cxx \ DlgRef_4Sel1List1Check_QTD.cxx \ DlgRef_1Spin_QTD.cxx \ @@ -112,6 +113,7 @@ LIB_MOC = \ DlgRef_2Sel4Spin1Check_QTD.h \ DlgRef_3Sel4Spin2Check_QTD.h \ DlgRef_4Sel1List_QTD.h \ + DlgRef_2Sel1List_QTD.h \ DlgRef_1List1Spin1Btn_QTD.h \ DlgRef_4Sel1List1Check_QTD.h \ DlgRef_1Spin_QTD.h \ diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index 5f393aa2e..12ebfba3c 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -67,24 +67,15 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(GeometryGUI* theGeometryGUI RadioButton3->close(TRUE); // Full partition (contains half-space partition) - GroupPoints = new DlgRef_4Sel1List1Check_QTD(this, "GroupPoints"); + GroupPoints = new DlgRef_2Sel1List_QTD(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION")); - GroupPoints->GroupBox2->setTitle(tr("SUPPRESS_RESULT")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT")); GroupPoints->TextLabel3->setText(tr("GEOM_RECONSTRUCTION_LIMIT")); - GroupPoints->TextLabel4->setText(tr("GEOM_SUPPRESS_RESULT_INSIDE")); - GroupPoints->TextLabel5->setText(tr("GEOM_SUPPRESS_RESULT_OUTSIDE")); - GroupPoints->CheckBox1->setText(tr("GEOM_REMOVE_WEBS")); GroupPoints->PushButton1->setPixmap(image2); GroupPoints->PushButton2->setPixmap(image2); - GroupPoints->PushButton3->setPixmap(image2); - GroupPoints->PushButton4->setPixmap(image2); - GroupPoints->PushButton5->setText(tr("GEOM_SET_MATERIALS")); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - GroupPoints->LineEdit3->setReadOnly( true ); - GroupPoints->LineEdit4->setReadOnly( true ); Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ @@ -126,16 +117,9 @@ void OperationGUI_PartitionDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetMaterials())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit4, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onRemoveWebs(bool))); connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); @@ -171,18 +155,14 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) resize(0, 0); GroupPoints->TextLabel3->show(); GroupPoints->ComboBox1->show(); - GroupPoints->GroupBox2->show(); GroupPoints->ComboBox1->setCurrentItem(0); - GroupPoints->LineEdit3->clear(); - GroupPoints->LineEdit4->clear(); break; } case 1: /*Half-space partition */ { GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION_HALFSPACE")); - GroupPoints->GroupBox2->hide(); GroupPoints->TextLabel3->hide(); GroupPoints->ComboBox1->hide(); GroupPoints->TextLabel2->setText(tr("GEOM_PLANE")); @@ -194,7 +174,6 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->clear(); GroupPoints->LineEdit2->clear(); - onRemoveWebs(false); myEditCurrentArgument->setFocus(); connect(myGeomGUI->getApp()->selectionMgr(), @@ -249,10 +228,6 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() } else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myListTools.length( 0 ); - else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) - myListRemoveInside.length( 0 ); - else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) - myListKeepInside.length( 0 ); } // One and only one plane can be selected @@ -276,18 +251,6 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() if ( !myListTools.length() ) return; } - else if(myEditCurrentArgument == GroupPoints->LineEdit3) - { - GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListRemoveInside, true ); - if (!myListRemoveInside.length()) - return; - } - else if(myEditCurrentArgument == GroupPoints->LineEdit4) - { - GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListKeepInside, true ); - if ( !myListKeepInside.length() ) - return; - } myEditCurrentArgument->setText( aString ); } @@ -309,10 +272,6 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument() if( getConstructorId()==1 ) globalSelection( GEOM_PLANE ); } - else if(send == GroupPoints->PushButton3) - myEditCurrentArgument = GroupPoints->LineEdit3; - else if(send == GroupPoints->PushButton4) - myEditCurrentArgument = GroupPoints->LineEdit4; globalSelection( GEOM_ALLSHAPES ); @@ -330,9 +289,7 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed() QLineEdit* send = (QLineEdit*)sender(); if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2 || - send == GroupPoints->LineEdit3 || - send == GroupPoints->LineEdit4 ) + send == GroupPoints->LineEdit2 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); @@ -404,13 +361,11 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) aLimit = GEOM::SHAPE; if (isValid( msg )) { - if (aConstructorId == 0 && !toRemoveWebs()) - myListMaterials.length(0); anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())-> MakePartition(myListShapes, myListTools, myListKeepInside, myListRemoveInside, - aLimit, toRemoveWebs(), myListMaterials); + aLimit, false, myListMaterials); res = true; } @@ -438,47 +393,12 @@ void OperationGUI_PartitionDlg::closeEvent( QCloseEvent* e ) void OperationGUI_PartitionDlg::ComboTextChanged() { bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3; - GroupPoints->LineEdit3->setEnabled(IsEnabled); - GroupPoints->LineEdit4->setEnabled(IsEnabled); - GroupPoints->TextLabel4->setEnabled(IsEnabled); - GroupPoints->TextLabel5->setEnabled(IsEnabled); - GroupPoints->PushButton3->setEnabled(IsEnabled); - GroupPoints->PushButton4->setEnabled(IsEnabled); -} - - -//================================================================================= -// function : SetMaterials() -// purpose : -//================================================================================= -void OperationGUI_PartitionDlg::SetMaterials() -{ - OperationGUI_MaterialDlg* aDlg = - new OperationGUI_MaterialDlg(myGeomGUI, this, "", myListShapes, true); - aDlg->show(); -} - - -//================================================================================= -// function : onRemoveWebs() -// purpose : -//================================================================================= -void OperationGUI_PartitionDlg::onRemoveWebs(bool isChecked) -{ - if (GroupPoints->CheckBox1->isChecked() != isChecked) - GroupPoints->CheckBox1->setChecked(isChecked); - - GroupPoints->PushButton5->setEnabled(isChecked); -} - - -//================================================================================= -// function : toRemoveWebs() -// purpose : -//================================================================================= -bool OperationGUI_PartitionDlg::toRemoveWebs() const -{ - return GroupPoints->CheckBox1->isChecked(); + //GroupPoints->LineEdit3->setEnabled(IsEnabled); + //GroupPoints->LineEdit4->setEnabled(IsEnabled); + //GroupPoints->TextLabel4->setEnabled(IsEnabled); + //GroupPoints->TextLabel5->setEnabled(IsEnabled); + //GroupPoints->PushButton3->setEnabled(IsEnabled); + //GroupPoints->PushButton4->setEnabled(IsEnabled); } diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.h b/src/OperationGUI/OperationGUI_PartitionDlg.h index 5a95b5d9b..dbfbd4dcc 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_4Sel1List1Check_QTD.h" +#include "DlgRef_2Sel1List_QTD.h" //================================================================================= // class : OperationGUI_PartitionDlg @@ -60,7 +60,6 @@ protected: private: void Init(); void enterEvent(QEvent* e); - bool toRemoveWebs() const; int GetLimit() const; GEOM::ListOfGO myListShapes; @@ -69,7 +68,7 @@ private: GEOM::ListOfGO myListRemoveInside; GEOM::ListOfGO myListKeepInside; - DlgRef_4Sel1List1Check_QTD* GroupPoints; + DlgRef_2Sel1List_QTD* GroupPoints; private slots: void ClickOnOk(); @@ -79,8 +78,6 @@ private slots: void SelectionIntoArgument(); void SetEditCurrentArgument(); void ComboTextChanged(); - void onRemoveWebs(bool); - void SetMaterials(); void ConstructorsClicked(int constructorId); };