-// GEOM GEOMGUI : GUI for Geometry component
+// GEOM GEOMGUI : GUI for Geometry component
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003 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 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.
+// 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
+// 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
//
+// File : OperationGUI_PartitionDlg.cxx
+// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
-//
-// File : OperationGUI_PartitionDlg.cxx
-// Author : Lucien PIGNOLONI
-// Module : GEOM
-// $Header$
#include "OperationGUI_PartitionDlg.h"
#include "OperationGUI_MaterialDlg.h"
-#include "GEOMImpl_Types.hxx"
-
-#include "SUIT_Desktop.h"
-#include "SUIT_Session.h"
-#include "SalomeApp_Application.h"
-#include "LightApp_SelectionMgr.h"
+#include <GEOM_DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
-#include <qcheckbox.h>
-#include <qcombobox.h>
-#include <qlabel.h>
+#include <GEOMImpl_Types.hxx>
-#include "utilities.h"
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
//=================================================================================
// class : OperationGUI_PartitionDlg()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(GeometryGUI* theGeometryGUI, QWidget* parent)
- :GEOMBase_Skeleton(theGeometryGUI, parent, "OperationGUI_PartitionDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
+ : GEOMBase_Skeleton( theGeometryGUI, parent, false )
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
- QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PARTITION")));
- QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PARTITION_PLANE")));
- QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION" ) ) );
+ QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION_PLANE" ) ) );
+ QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
- setCaption(tr("GEOM_PARTITION_TITLE"));
+ setWindowTitle( tr( "GEOM_PARTITION_TITLE" ) );
/***************************************************************/
- GroupConstructors->setTitle(tr("GEOM_PARTITION"));
- RadioButton1->setPixmap(image0);
- RadioButton2->setPixmap(image1);
- RadioButton3->close(TRUE);
+ mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) );
+ mainFrame()->RadioButton1->setIcon( image0 );
+ mainFrame()->RadioButton2->setIcon( image1 );
+ mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->close();
// Full partition (contains half-space partition)
- GroupPoints = new DlgRef_2Sel1List_QTD(this, "GroupPoints");
- GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION"));
- GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
- GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT"));
- GroupPoints->TextLabel3->setText(tr("GEOM_RECONSTRUCTION_LIMIT"));
- GroupPoints->PushButton1->setPixmap(image2);
- GroupPoints->PushButton2->setPixmap(image2);
+ GroupPoints = new DlgRef_2Sel1List( centralWidget() );
+ GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
+ GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
+ GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) );
+ GroupPoints->TextLabel3->setText( tr( "GEOM_RECONSTRUCTION_LIMIT" ) );
+ GroupPoints->PushButton1->setIcon( image2 );
+ GroupPoints->PushButton2->setIcon( image2 );
GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true );
- Layout1->addWidget(GroupPoints, 2, 0);
+ QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
+ layout->setMargin( 0 ); layout->setSpacing( 6 );
+ layout->addWidget( GroupPoints );
+
/***************************************************************/
- setHelpFileName("partition.htm");
+ setHelpFileName( "partition.htm" );
Init();
}
// no need to delete child widgets, Qt does it all for us
}
+void OperationGUI_PartitionDlg::SetListMaterials( GEOM::ListOfLong ListMaterials )
+{
+ myListMaterials = ListMaterials;
+}
+
+GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials()
+{
+ return myListMaterials;
+}
//=================================================================================
// function : Init()
void OperationGUI_PartitionDlg::Init()
{
/* type for sub shape selection */
- GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID"));
- GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL"));
- GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_FACE"));
- 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->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SOLID" ) );
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SHELL" ) );
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_FACE" ) );
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_WIRE" ) );
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_EDGE" ) );
+ GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
/* signals and slots connections */
- connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
- connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
+ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+
+ connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
- connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
+ connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
- connect(myGeomGUI->getApp()->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect( myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_PARTITION" ) );
+
ConstructorsClicked( 0 );
}
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId)
+void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
{
- disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
globalSelection();
- myListShapes.length(0);
- myListTools.length(0);
- myListKeepInside.length(0);
- myListRemoveInside.length(0);
- myListMaterials.length(0);
+ myListShapes.length( 0 );
+ myListTools.length( 0 );
+ myListKeepInside.length( 0 );
+ myListRemoveInside.length( 0 );
+ myListMaterials.length( 0 );
- switch (constructorId)
- {
- case 0: /*Full partition */
- {
- GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION"));
- GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT"));
- resize(0, 0);
- GroupPoints->TextLabel3->show();
- GroupPoints->ComboBox1->show();
-
- GroupPoints->ComboBox1->setCurrentItem(0);
- break;
- }
- case 1: /*Half-space partition */
- {
-
- GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION_HALFSPACE"));
- GroupPoints->TextLabel3->hide();
- GroupPoints->ComboBox1->hide();
- GroupPoints->TextLabel2->setText(tr("GEOM_PLANE"));
- resize(0, 0);
- break;
- }
- }
+ switch ( constructorId ) {
+ case 0: /*Full partition */
+ GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
+ GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) );
+ GroupPoints->TextLabel3->show();
+ GroupPoints->ComboBox1->show();
+
+ GroupPoints->ComboBox1->setCurrentIndex( 0 );
+ break;
+ case 1: /*Half-space partition */
+ GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) );
+ GroupPoints->TextLabel3->hide();
+ GroupPoints->ComboBox1->hide();
+ GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) );
+ break;
+ }
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->clear();
GroupPoints->LineEdit2->clear();
+ qApp->processEvents();
+ updateGeometry();
+ resize( minimumSize() );
+
myEditCurrentArgument->setFocus();
- connect(myGeomGUI->getApp()->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- MESSAGE(width()<<" "<<height());
+ connect( myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
}
int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true );
- if ( nbSel < 1 )
- {
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
- {
+ if ( nbSel < 1 ) {
+ if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
myListShapes.length( 0 );
myListMaterials.length( 0 );
}
// One and only one plane can be selected
- if ( getConstructorId() == 1 && myEditCurrentArgument == GroupPoints->LineEdit2 && nbSel != 1 )
- {
+ if ( getConstructorId() == 1 &&
+ myEditCurrentArgument == GroupPoints->LineEdit2 &&
+ nbSel != 1 ) {
myListTools.length( 0 );
return;
}
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
- {
+ if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListShapes, true );
myListMaterials.length( 0 );
if ( !myListShapes.length() )
return;
}
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
- {
+ else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListTools, true );
if ( !myListTools.length() )
return;
{
QPushButton* send = (QPushButton*)sender();
- if(send == GroupPoints->PushButton1)
+ if ( send == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1;
- else if(send == GroupPoints->PushButton2)
- {
+ else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- if( getConstructorId()==1 )
+ if ( getConstructorId() == 1 )
globalSelection( GEOM_PLANE );
}
{
QLineEdit* send = (QLineEdit*)sender();
- if(send == GroupPoints->LineEdit1 ||
- send == GroupPoints->LineEdit2 )
- {
+ if ( send == GroupPoints->LineEdit1 ||
+ send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
- }
+ }
}
void OperationGUI_PartitionDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(myGeomGUI->getApp()->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect( myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() );
}
// function : enterEvent()
// purpose :
//=================================================================================
-void OperationGUI_PartitionDlg::enterEvent(QEvent* e)
+void OperationGUI_PartitionDlg::enterEvent( QEvent* )
{
- if (!GroupConstructors->isEnabled())
+ if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog();
}
// function : isValid
// purpose :
//=================================================================================
-bool OperationGUI_PartitionDlg::isValid( QString& msg )
+bool OperationGUI_PartitionDlg::isValid( QString& )
{
- return (myListShapes.length() || myListTools.length() ||
- myListKeepInside.length() || myListRemoveInside.length());
+ return ( myListShapes.length() || myListTools.length() ||
+ myListKeepInside.length() || myListRemoveInside.length() );
}
int aLimit = GetLimit();
int aConstructorId = getConstructorId();
- if (aConstructorId == 1)
+ if ( aConstructorId == 1 )
aLimit = GEOM::SHAPE;
- if (isValid( msg )) {
-
+ if ( isValid( msg ) ) {
anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())->
MakePartition(myListShapes, myListTools,
myListKeepInside, myListRemoveInside,
res = true;
}
- if (!anObj->_is_nil())
+ if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
return res;
//=======================================================================
void OperationGUI_PartitionDlg::ComboTextChanged()
{
- bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3;
+ //bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3;
//GroupPoints->LineEdit3->setEnabled(IsEnabled);
//GroupPoints->LineEdit4->setEnabled(IsEnabled);
//GroupPoints->TextLabel4->setEnabled(IsEnabled);
//=================================================================================
int OperationGUI_PartitionDlg::GetLimit() const
{
- int aLimit = GroupPoints->ComboBox1->currentItem();
+ int aLimit = GroupPoints->ComboBox1->currentIndex();
- switch(aLimit)
- {
+ switch ( aLimit ) {
case 0: aLimit = GEOM::SOLID ; break;
case 1: aLimit = GEOM::SHELL ; break;
case 2: aLimit = GEOM::FACE ; break;