// enable push button and line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- // after setFocus(), because it will be setDown(false) then loses focus
+ // after setFocus(), because it will be setDown(false) when loses focus
aSender->setDown(true);
globalSelection(); // close local contexts, if any
myEditCurrentArgument->setFocus();
// enable push button
- // after setFocus(), because it will be setDown(false) then loses focus
+ // after setFocus(), because it will be setDown(false) when loses focus
aSender->setDown(true);
activateSelection();
myEditCurrentArgument->setFocus();
// enable push button
- // after setFocus(), because it will be setDown(false) then loses focus
+ // after setFocus(), because it will be setDown(false) when loses focus
aSender->setDown(true);
activateSelection();
// 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
-//
-// 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
-//
+// 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
//
// File : BooleanGUI_Dialog.cxx
#include <GeometryGUI.h>
#include <GEOMBase.h>
-#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-BooleanGUI_Dialog::BooleanGUI_Dialog( const int theOperation, GeometryGUI* theGeometryGUI,
- QWidget* parent, bool modal, Qt::WindowFlags fl )
- : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
- myOperation( theOperation )
+BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGeometryGUI,
+ QWidget* parent, bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+ myOperation(theOperation)
{
QPixmap image0;
QString aTitle, aCaption;
- switch ( myOperation ) {
+ switch (myOperation) {
case BooleanGUI::COMMON:
- image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_COMMON" ) ) );
- aTitle = tr( "GEOM_COMMON" );
- aCaption = tr( "GEOM_COMMON_TITLE" );
- setHelpFileName( "common_operation_page.html" );
+ image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_COMMON")));
+ aTitle = tr("GEOM_COMMON");
+ aCaption = tr("GEOM_COMMON_TITLE");
+ setHelpFileName("common_operation_page.html");
break;
case BooleanGUI::CUT:
- image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CUT" ) ) );
- aTitle = tr( "GEOM_CUT" );
- aCaption = tr( "GEOM_CUT_TITLE" );
- setHelpFileName( "cut_operation_page.html" );
+ image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_CUT")));
+ aTitle = tr("GEOM_CUT");
+ aCaption = tr("GEOM_CUT_TITLE");
+ setHelpFileName("cut_operation_page.html");
break;
case BooleanGUI::FUSE:
- image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FUSE" ) ) );
- aTitle = tr( "GEOM_FUSE" );
- aCaption = tr( "GEOM_FUSE_TITLE" );
- setHelpFileName( "fuse_operation_page.html" );
+ image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FUSE")));
+ aTitle = tr("GEOM_FUSE");
+ aCaption = tr("GEOM_FUSE_TITLE");
+ setHelpFileName("fuse_operation_page.html");
break;
case BooleanGUI::SECTION:
- image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SECTION" ) ) );
- aTitle = tr( "GEOM_SECTION" );
- aCaption = tr( "GEOM_SECTION_TITLE" );
- setHelpFileName( "section_opeartion_page.html" );
+ image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SECTION")));
+ aTitle = tr("GEOM_SECTION");
+ aCaption = tr("GEOM_SECTION_TITLE");
+ setHelpFileName("section_opeartion_page.html");
break;
}
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
- setWindowTitle( aCaption );
+ setWindowTitle(aCaption);
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( aTitle );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->GroupConstructors->setTitle(aTitle);
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
- mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
- myGroup = new DlgRef_2Sel( centralWidget() );
+ myGroup = new DlgRef_2Sel(centralWidget());
- myGroup->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- if ( myOperation != BooleanGUI::CUT ) {
- myGroup->TextLabel1->setText( tr( "GEOM_OBJECT_I" ).arg( 1 ) );
- myGroup->TextLabel2->setText( tr( "GEOM_OBJECT_I" ).arg( 2 ) );
+ myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ if (myOperation != BooleanGUI::CUT) {
+ myGroup->TextLabel1->setText(tr("GEOM_OBJECT_I").arg(1));
+ myGroup->TextLabel2->setText(tr("GEOM_OBJECT_I").arg(2));
}
else {
- myGroup->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
- myGroup->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) );
+ myGroup->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
+ myGroup->TextLabel2->setText(tr("GEOM_TOOL_OBJECT"));
}
-
- myGroup->PushButton1->setIcon( image1 );
- myGroup->PushButton2->setIcon( image1 );
- myGroup->LineEdit1->setReadOnly( true );
- myGroup->LineEdit2->setReadOnly( true );
-
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( myGroup );
+
+ myGroup->PushButton1->setIcon(image1);
+ myGroup->PushButton2->setIcon(image1);
+ myGroup->LineEdit1->setReadOnly(true);
+ myGroup->LineEdit2->setReadOnly(true);
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(myGroup);
/***************************************************************/
- /* Initialisation */
+ // Initialisation
Init();
}
-
//=================================================================================
// function : ~BooleanGUI_Dialog()
// purpose : Destroys the object and frees any allocated resources
{
}
-
//=================================================================================
// function : Init()
// purpose :
{
mainFrame()->GroupBoxPublish->show();
- /* init variables */
+ // init variables
myEditCurrentArgument = myGroup->LineEdit1;
- /* signals and slots connections */
- connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ myGroup->LineEdit1->setText("");
+ myGroup->LineEdit2->setText("");
+ myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
+
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect( myGroup->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( myGroup->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect(myGroup->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(myGroup->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect( myGroup->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( myGroup->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- initName( mainFrame()->GroupConstructors->title() );
+ initName(mainFrame()->GroupConstructors->title());
- setTabOrder( mainFrame()->GroupConstructors, mainFrame()->GroupBoxName );
- setTabOrder( mainFrame()->GroupBoxName, mainFrame()->GroupMedium );
- setTabOrder( mainFrame()->GroupMedium, mainFrame()->GroupButtons );
+ setTabOrder(mainFrame()->GroupConstructors, mainFrame()->GroupBoxName);
+ setTabOrder(mainFrame()->GroupBoxName, mainFrame()->GroupMedium);
+ setTabOrder(mainFrame()->GroupMedium, mainFrame()->GroupButtons);
mainFrame()->RadioButton1->setFocus();
- globalSelection( GEOM_ALLSHAPES );
-}
+ globalSelection(GEOM_ALLSHAPES);
+ myGroup->PushButton1->click();
+ SelectionIntoArgument();
+}
//=================================================================================
// function : ClickOnOk()
//=================================================================================
void BooleanGUI_Dialog::ClickOnOk()
{
- if ( ClickOnApply() )
+ if (ClickOnApply())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool BooleanGUI_Dialog::ClickOnApply()
{
- if ( !onAccept() )
- return false;
+ if (!onAccept())
+ return false;
initName();
+ // activate selection and connect selection manager
+ myGroup->PushButton1->click();
return true;
}
//=================================================================================
// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
+// purpose : Called when selection is changed or on dialog initialization or activation
//=================================================================================
void BooleanGUI_Dialog::SelectionIntoArgument()
{
- myEditCurrentArgument->setText( "" );
+ myEditCurrentArgument->setText("");
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
// nbSel == 1
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
- if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject)) {
+ if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject))
+ {
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
- if (myEditCurrentArgument == myGroup->LineEdit1) myObject1 = aSelectedObject;
- else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2 = aSelectedObject;
+
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ if (myEditCurrentArgument == myGroup->LineEdit1) {
+ myObject1 = aSelectedObject;
+ if (myObject2->_is_nil())
+ myGroup->PushButton2->click();
+ }
+ else if (myEditCurrentArgument == myGroup->LineEdit2) {
+ myObject2 = aSelectedObject;
+ if (myObject1->_is_nil())
+ myGroup->PushButton1->click();
+ }
}
}
{
QPushButton* send = (QPushButton*)sender();
- if ( send == myGroup->PushButton1 ) myEditCurrentArgument = myGroup->LineEdit1;
- else if ( send == myGroup->PushButton2 ) myEditCurrentArgument = myGroup->LineEdit2;
+ if (send == myGroup->PushButton1) {
+ myEditCurrentArgument = myGroup->LineEdit1;
+
+ myGroup->PushButton2->setDown(false);
+ myGroup->LineEdit2->setEnabled(false);
+ }
+ else if (send == myGroup->PushButton2) {
+ myEditCurrentArgument = myGroup->LineEdit2;
+ myGroup->PushButton1->setDown(false);
+ myGroup->LineEdit1->setEnabled(false);
+ }
+
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- SelectionIntoArgument();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void BooleanGUI_Dialog::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
- if ( send == myGroup->LineEdit1 || send == myGroup->LineEdit2 ) {
+ if (send == myGroup->LineEdit1 || send == myGroup->LineEdit2) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BooleanGUI_Dialog::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- globalSelection( GEOM_ALLSHAPES );
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-}
+ // reinit, because some selected objects could be removed
+ Init();
+}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
-void BooleanGUI_Dialog::enterEvent( QEvent* )
+void BooleanGUI_Dialog::enterEvent (QEvent*)
{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
+ if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
// function : isValid
// purpose :
//=================================================================================
-bool BooleanGUI_Dialog::isValid (QString& msg)
+bool BooleanGUI_Dialog::isValid (QString&)
{
//Handle(SALOME_InteractiveObject) IO = firstIObject();
//Standard_Boolean testResult;
// function : execute
// purpose :
//=================================================================================
-bool BooleanGUI_Dialog::execute( ObjectList& objects )
+bool BooleanGUI_Dialog::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj;
-
- anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )->
- MakeBoolean( myObject1, myObject2, myOperation );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
+
+ anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())->
+ MakeBoolean(myObject1, myObject2, myOperation);
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
return true;
}
// function : restoreSubShapes
// purpose :
//=================================================================================
-void BooleanGUI_Dialog::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject )
+void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
+ SALOMEDS::SObject_ptr theSObject)
{
- if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
+ if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
// empty list of arguments means that all arguments should be restored
- getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
- /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame
- /*theInheritFirstArg=*/myOperation == BooleanGUI::CUT ); // ? false
+ getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
+ /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame
+ /*theInheritFirstArg=*/myOperation == BooleanGUI::CUT); // ? false
}
}
// 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
-//
-// 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
-//
+// 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
//
// File : BuildGUI_EdgeDlg.cxx
#include <GeometryGUI.h>
#include <GEOMBase.h>
-#include <GEOMImpl_Types.hxx>
-
-#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <GEOMImpl_Types.hxx>
+
//=================================================================================
// class : BuildGUI_EdgeDlg()
-// purpose : Constructs a BuildGUI_EdgeDlg which is a child of 'parent', with the
+// purpose : Constructs a BuildGUI_EdgeDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-BuildGUI_EdgeDlg::BuildGUI_EdgeDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
- : GEOMBase_Skeleton( theGeometryGUI, parent )
+BuildGUI_EdgeDlg::BuildGUI_EdgeDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
+ : GEOMBase_Skeleton(theGeometryGUI, parent)
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_EDGE" ) ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE")));
+ QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
- setWindowTitle( tr( "GEOM_EDGE_TITLE" ) );
+ setWindowTitle(tr("GEOM_EDGE_TITLE"));
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( tr( "GEOM_EDGE" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_EDGE"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
- mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
- GroupPoints = new DlgRef_2Sel( centralWidget() );
+ GroupPoints = new DlgRef_2Sel(centralWidget());
+
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg(1));
+ GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg(2));
+ GroupPoints->PushButton1->setIcon(image1);
+ GroupPoints->PushButton2->setIcon(image1);
- GroupPoints->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
- GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
- GroupPoints->PushButton1->setIcon( image1 );
- GroupPoints->PushButton2->setIcon( image1 );
-
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( GroupPoints );
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(GroupPoints);
/***************************************************************/
setHelpFileName("create_edge_page.html");
- /* Initialisations */
+ // Initialisation
Init();
}
-
//=================================================================================
// function : ~BuildGUI_EdgeDlg()
// purpose : Destroys the object and frees any allocated resources
// no need to delete child widgets, Qt does it all for us
}
-
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void BuildGUI_EdgeDlg::Init()
{
- /* init variables */
- myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
+ // init variables
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
+ GroupPoints->LineEdit1->setText("");
+ GroupPoints->LineEdit2->setText("");
+ myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
myOkPoint1 = myOkPoint2 = false;
- globalSelection( GEOM_POINT );
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- /* signals and slots connections */
- connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ 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( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ initName(tr("GEOM_EDGE"));
- initName( tr( "GEOM_EDGE" ) );
+ GroupPoints->PushButton1->click();
+ SelectionIntoArgument();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void BuildGUI_EdgeDlg::ClickOnOk()
{
- if ( ClickOnApply() )
+ if (ClickOnApply())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool BuildGUI_EdgeDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
+ // activate selection and connect selection manager
+ GroupPoints->PushButton1->click();
return true;
}
//=================================================================================
// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
+// purpose : Called when selection is changed or on dialog initialization or activation
//=================================================================================
void BuildGUI_EdgeDlg::SelectionIntoArgument()
{
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
- if (!testResult)
+ if (!testResult || aSelectedObject->_is_nil())
return;
+ myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
+
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myPoint1 = aSelectedObject;
myOkPoint1 = true;
+ if (!myOkPoint2)
+ GroupPoints->PushButton2->click();
}
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
myPoint2 = aSelectedObject;
myOkPoint2 = true;
+ if (!myOkPoint1)
+ GroupPoints->PushButton1->click();
}
- myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
-
displayPreview();
}
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose :
-//=================================================================================
-void BuildGUI_EdgeDlg::LineEditReturnPressed()
-{
- QLineEdit* send = (QLineEdit*)sender();
- if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) {
- myEditCurrentArgument = send;
- GEOMBase_Skeleton::LineEditReturnPressed();
- }
-}
-
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void BuildGUI_EdgeDlg::SetEditCurrentArgument()
{
-
QPushButton* send = (QPushButton*)sender();
- globalSelection();
+ //globalSelection();//??
- if ( send == GroupPoints->PushButton1 ) {
+ if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_POINT );
+ GroupPoints->PushButton2->setDown(false);
+ GroupPoints->LineEdit2->setEnabled(false);
}
- else if ( send == GroupPoints->PushButton2 ) {
+ else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_POINT );
+ GroupPoints->PushButton1->setDown(false);
+ GroupPoints->LineEdit1->setEnabled(false);
}
-
+
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- SelectionIntoArgument();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ globalSelection(GEOM_POINT);
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview();
}
+//=================================================================================
+// function : LineEditReturnPressed()
+// purpose :
+//=================================================================================
+void BuildGUI_EdgeDlg::LineEditReturnPressed()
+{
+ QLineEdit* send = (QLineEdit*)sender();
+ if (send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) {
+ myEditCurrentArgument = send;
+ GEOMBase_Skeleton::LineEditReturnPressed();
+ }
+}
//=================================================================================
// function : ActivateThisDialog()
void BuildGUI_EdgeDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- globalSelection( GEOM_POINT );
- displayPreview();
-}
+ // reinit, because some selected objects could be removed
+ Init();
+}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
-void BuildGUI_EdgeDlg::enterEvent( QEvent* )
+void BuildGUI_EdgeDlg::enterEvent (QEvent*)
{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
+ if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
//=================================================================================
GEOM::GEOM_IOperations_ptr BuildGUI_EdgeDlg::createOperation()
{
- return getGeomEngine()->GetIShapesOperations( getStudyId() );
+ return getGeomEngine()->GetIShapesOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool BuildGUI_EdgeDlg::isValid( QString& )
+bool BuildGUI_EdgeDlg::isValid (QString&)
{
return myOkPoint1 && myOkPoint2;
}
// function : execute
// purpose :
//=================================================================================
-bool BuildGUI_EdgeDlg::execute( ObjectList& objects )
+bool BuildGUI_EdgeDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj;
- anObj = GEOM::GEOM_IShapesOperations::_narrow( getOperation() )->MakeEdge( myPoint1, myPoint2 );
+ anObj = GEOM::GEOM_IShapesOperations::_narrow(getOperation())->MakeEdge(myPoint1, myPoint2);
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
return true;
}
// 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
-//
-// 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
-//
+// 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
//
// File : GenerationGUI_PipeDlg.cxx
#include <GeometryGUI.h>
#include <GEOMBase.h>
-#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
//=================================================================================
// class : GenerationGUI_PipeDlg()
-// purpose : Constructs a GenerationGUI_PipeDlg which is a child of 'parent', with the
+// purpose : Constructs a GenerationGUI_PipeDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GenerationGUI_PipeDlg::GenerationGUI_PipeDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
- bool modal, Qt::WindowFlags fl )
- : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
+GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PIPE" ) ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE")));
+ QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
- setWindowTitle( tr( "GEOM_PIPE_TITLE" ) );
+ setWindowTitle(tr("GEOM_PIPE_TITLE"));
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PIPE" ) );
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE"));
mainFrame()->RadioButton1->setIcon(image0);
- mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
- mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
- GroupPoints = new DlgRef_2Sel( centralWidget() );
+ GroupPoints = new DlgRef_2Sel(centralWidget());
- GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_BASE_OBJECT" ) );
- GroupPoints->TextLabel2->setText( tr( "GEOM_PATH_OBJECT" ) );
- GroupPoints->PushButton1->setIcon( image1 );
- GroupPoints->PushButton2->setIcon( image1 );
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT"));
+ GroupPoints->PushButton1->setIcon(image1);
+ GroupPoints->PushButton2->setIcon(image1);
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( GroupPoints );
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(GroupPoints);
/***************************************************************/
- setHelpFileName( "create_extrusion_alongpath_page.html" );
+ setHelpFileName("create_extrusion_alongpath_page.html");
- /* Initialisations */
+ // Initialisation
Init();
}
-
//=================================================================================
// function : ~GenerationGUI_PipeDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GenerationGUI_PipeDlg::~GenerationGUI_PipeDlg()
{
- /* no need to delete child widgets, Qt does it all for us */
+ // no need to delete child widgets, Qt does it all for us
}
-
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GenerationGUI_PipeDlg::Init()
{
- /* init variables */
- myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
+ // init variables
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
+ GroupPoints->LineEdit1->setText("");
+ GroupPoints->LineEdit2->setText("");
+ myBase = myPath = GEOM::GEOM_Object::_nil();
myOkBase = myOkPath = false;
- /* signals and slots connections */
- connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- 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( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- initName( tr( "GEOM_PIPE" ) );
+ initName(tr("GEOM_PIPE"));
- //globalSelection( GEOM_ALLSHAPES );
+ GroupPoints->PushButton1->click();
+ SelectionIntoArgument();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GenerationGUI_PipeDlg::ClickOnOk()
{
- if ( ClickOnApply() )
+ if (ClickOnApply())
ClickOnCancel();
}
-
//=================================================================================
-// function : ClickOnAply()
+// function : ClickOnApply()
// purpose :
//=================================================================================
bool GenerationGUI_PipeDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
+ // activate selection and connect selection manager
+ GroupPoints->PushButton1->click();
return true;
}
-
//=================================================================================
// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
+// purpose : Called when selection is changed or on dialog initialization or activation
//=================================================================================
void GenerationGUI_PipeDlg::SelectionIntoArgument()
{
erasePreview();
- myEditCurrentArgument->setText( "" );
+ myEditCurrentArgument->setText("");
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
- if (aSelList.Extent() != 1) {
- if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
- else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false;
+ if (aSelList.Extent() != 1)
return;
- }
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
- if (!testResult)
+ if (!testResult || aSelectedObject->_is_nil())
return;
TopoDS_Shape S;
+ if (!GEOMBase::GetShape(aSelectedObject, S))
+ return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
- myOkBase = false;
-
- if (!GEOMBase::GetShape(aSelectedObject, S) ||
- S.ShapeType() == TopAbs_COMPSOLID ||
+ if (S.ShapeType() == TopAbs_COMPSOLID ||
S.ShapeType() == TopAbs_COMPOUND ||
S.ShapeType() == TopAbs_SOLID ||
S.ShapeType() == TopAbs_SHAPE)
myBase = aSelectedObject;
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
myOkBase = true;
+ if (!myOkPath)
+ GroupPoints->PushButton2->click();
}
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
- myOkPath = false;
-
- if (!GEOMBase::GetShape(aSelectedObject, S))
- return;
-
QString aName = GEOMBase::GetName(aSelectedObject);
- if (testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase) {
+ if (aSelectedObject != myBase) {
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(aSelList.First(), aMap);
if (aMap.Extent() == 1) {
- int anIndex = aMap(1);
- aName.append(":edge_" + QString::number(anIndex));
-
- //Find SubShape Object in Father
- GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
- if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations(getStudyId());
- myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- myOkPath = true;
- }
- else { // get Object from study
- myPath = aFindedObject;
- myOkPath = true;
- }
+ int anIndex = aMap(1);
+ aName.append(":edge_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ myOkPath = true;
+ }
+ else { // get Object from study
+ myPath = aFindedObject;
+ myOkPath = true;
+ }
}
else {
- myOkPath = true;
- if (S.ShapeType() != TopAbs_EDGE) {
- aSelectedObject = GEOM::GEOM_Object::_nil();
- aName = "";
- myOkPath = false;
- }
- myPath = aSelectedObject;
+ myOkPath = true;
+ if (S.ShapeType() != TopAbs_EDGE) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOkPath = false;
+ }
+ myPath = aSelectedObject;
}
}
myEditCurrentArgument->setText(aName);
+ if (myOkPath && !myOkBase)
+ GroupPoints->PushButton1->click();
}
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
displayPreview();
}
void GenerationGUI_PipeDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
- globalSelection();
- if ( send == GroupPoints->PushButton1 ) {
- GroupPoints->LineEdit1->setFocus();
- globalSelection( GEOM_ALLSHAPES );
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ globalSelection(GEOM_ALLSHAPES);
+ if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->PushButton2->setDown(false);
+ GroupPoints->LineEdit2->setEnabled(false);
}
- else if ( send == GroupPoints->PushButton2 ) {
- GroupPoints->LineEdit2->setFocus();
+ else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection();
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ GroupPoints->PushButton1->setDown(false);
+ GroupPoints->LineEdit1->setEnabled(false);
+
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
}
- SelectionIntoArgument();
-}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setFocus();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview();
+}
//=================================================================================
// function : LineEditReturnPressed()
void GenerationGUI_PipeDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
- if ( send == GroupPoints->LineEdit1 ||
- send == GroupPoints->LineEdit2 ) {
+ if (send == GroupPoints->LineEdit1 ||
+ send == GroupPoints->LineEdit2) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
-
-//=================================================================================
-// function : enterEvent()
-// purpose : when mouse enter onto the QWidget
-//=================================================================================
-void GenerationGUI_PipeDlg::enterEvent( QEvent* )
-{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
- ActivateThisDialog();
-}
-
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void GenerationGUI_PipeDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- globalSelection( GEOM_ALLSHAPES );
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) );
- displayPreview();
+
+ // reinit, because some selected objects could be removed
+ Init();
}
+//=================================================================================
+// function : enterEvent()
+// purpose : when mouse enter onto the QWidget
+//=================================================================================
+void GenerationGUI_PipeDlg::enterEvent (QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
//=================================================================================
// function : createOperation
//=================================================================================
GEOM::GEOM_IOperations_ptr GenerationGUI_PipeDlg::createOperation()
{
- return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
+ return getGeomEngine()->GetI3DPrimOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool GenerationGUI_PipeDlg::isValid( QString& )
+bool GenerationGUI_PipeDlg::isValid (QString&)
{
return myOkBase && myOkPath;
}
// function : execute
// purpose :
//=================================================================================
-bool GenerationGUI_PipeDlg::execute( ObjectList& objects )
+bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj;
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
- getOperation() )->MakePipe( myBase, myPath );
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakePipe(myBase, myPath);
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
return true;
}
-
//=================================================================================
// function : addSubshapeToStudy
// purpose : virtual method to add new SubObjects if local selection
objMap[GroupPoints->LineEdit2->text()] = myPath;
- addSubshapesToFather( objMap );
+ addSubshapesToFather(objMap);
}
-
// 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
-//
-// 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
-//
+// 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
//
// File : GenerationGUI_PrismDlg.cxx
#include <GeometryGUI.h>
#include <GEOMBase.h>
-#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
+// OCCT Includes
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS.hxx>
//=================================================================================
// class : GenerationGUI_PrismDlg()
-// purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the
+// purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GenerationGUI_PrismDlg::GenerationGUI_PrismDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
- bool modal, Qt::WindowFlags fl )
- : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
+GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+ myInitial(true)
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM" ) ) );
- QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
- QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM_2P" ) ) );
- QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM_DXDYDZ" ) ) );
+ QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM")));
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_2P")));
+ QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_DXDYDZ")));
- setWindowTitle( tr( "GEOM_EXTRUSION_TITLE" ) );
+ setWindowTitle(tr("GEOM_EXTRUSION_TITLE"));
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( tr( "GEOM_EXTRUSION" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setIcon( image2 );
- mainFrame()->RadioButton3->setIcon( image3 );
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_EXTRUSION"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setIcon(image2);
+ mainFrame()->RadioButton3->setIcon(image3);
- mainFrame()->RadioButton1->setChecked( true );
+ mainFrame()->RadioButton1->setChecked(true);
myBothway = myBothway2 = myBothway3 = false;
- GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
- GroupPoints->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_BASE" ) );
- GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
- GroupPoints->TextLabel3->setText( tr( "GEOM_HEIGHT" ) );
- GroupPoints->PushButton1->setIcon( image1 );
- GroupPoints->PushButton2->setIcon( image1 );
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
- GroupPoints->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
- GroupPoints->CheckButton1->setChecked( myBothway );
- GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) );
-
- GroupPoints2 = new DlgRef_3Sel1Check( centralWidget() );
- GroupPoints2->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV_2P" ) );
- GroupPoints2->TextLabel1->setText( tr( "GEOM_BASE" ) );
- GroupPoints2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
- GroupPoints2->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
- GroupPoints2->PushButton1->setIcon( image1 );
- GroupPoints2->PushButton2->setIcon( image1 );
- GroupPoints2->PushButton3->setIcon( image1 );
- GroupPoints2->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
- GroupPoints2->CheckButton1->setChecked( myBothway2 );
-
- GroupPoints3 = new DlgRef_1Sel3Spin1Check( centralWidget() );
+ GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_BASE"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
+ GroupPoints->TextLabel3->setText(tr("GEOM_HEIGHT"));
+ GroupPoints->PushButton1->setIcon(image1);
+ GroupPoints->PushButton2->setIcon(image1);
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
+ GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY"));
+ GroupPoints->CheckButton1->setChecked(myBothway);
+ GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
+
+ GroupPoints2 = new DlgRef_3Sel1Check(centralWidget());
+ GroupPoints2->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P"));
+ GroupPoints2->TextLabel1->setText(tr("GEOM_BASE"));
+ GroupPoints2->TextLabel2->setText(tr("GEOM_POINT_I").arg(1));
+ GroupPoints2->TextLabel3->setText(tr("GEOM_POINT_I").arg(2));
+ GroupPoints2->PushButton1->setIcon(image1);
+ GroupPoints2->PushButton2->setIcon(image1);
+ GroupPoints2->PushButton3->setIcon(image1);
+ GroupPoints2->CheckButton1->setText(tr("GEOM_BOTHWAY"));
+ GroupPoints2->CheckButton1->setChecked(myBothway2);
+
+ GroupPoints3 = new DlgRef_1Sel3Spin1Check(centralWidget());
GroupPoints3->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ"));
GroupPoints3->TextLabel1->setText(tr("GEOM_BASE"));
GroupPoints3->PushButton1->setIcon(image1);
GroupPoints3->TextLabel2->setText(tr("GEOM_DX"));
GroupPoints3->TextLabel3->setText(tr("GEOM_DY"));
GroupPoints3->TextLabel4->setText(tr("GEOM_DZ"));
- GroupPoints3->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
- GroupPoints3->CheckButton1->setChecked( myBothway3 );
-
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( GroupPoints );
- layout->addWidget( GroupPoints2 );
- layout->addWidget( GroupPoints3);
+ GroupPoints3->CheckButton1->setText(tr("GEOM_BOTHWAY"));
+ GroupPoints3->CheckButton1->setChecked(myBothway3);
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(GroupPoints);
+ layout->addWidget(GroupPoints2);
+ layout->addWidget(GroupPoints3);
/***************************************************************/
- setHelpFileName( "create_extrusion_page.html" );
+ setHelpFileName("create_extrusion_page.html");
Init();
}
-
//=================================================================================
// function : ~GenerationGUI_PrismDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
-{
+{
// no need to delete child widgets, Qt does it all for us
}
-
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GenerationGUI_PrismDlg::Init()
{
- /* init variables */
+ // Get setting of step value from file configuration
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+
+ // min, max, step and decimals for spin boxes & initial values
+ initSpinBox(GroupPoints3->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3); // VSR:TODO : DBL_DIGITS_DISPLAY
+ initSpinBox(GroupPoints3->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3); // VSR:TODO : DBL_DIGITS_DISPLAY
+ initSpinBox(GroupPoints3->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3); // VSR:TODO : DBL_DIGITS_DISPLAY
+ GroupPoints3->SpinBox_DX->setValue(0.0);
+ GroupPoints3->SpinBox_DY->setValue(0.0);
+ GroupPoints3->SpinBox_DZ->setValue(0.0);
+
+ initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
+ GroupPoints->SpinBox_DX->setValue(100.0);
+
+ // init variables
myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
- GroupPoints2->LineEdit1->setReadOnly( true );
- GroupPoints2->LineEdit2->setReadOnly( true );
- GroupPoints2->LineEdit3->setReadOnly( true );
+ GroupPoints2->LineEdit1->setReadOnly(true);
+ GroupPoints2->LineEdit2->setReadOnly(true);
+ GroupPoints2->LineEdit3->setReadOnly(true);
- GroupPoints3->LineEdit1->setReadOnly( true );
+ GroupPoints3->LineEdit1->setReadOnly(true);
- myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
- myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
-
- /* Get setting of step value from file configuration */
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
+ GroupPoints->LineEdit1->setText("");
+ GroupPoints->LineEdit2->setText("");
- /* min, max, step and decimals for spin boxes & initial values */
- initSpinBox( GroupPoints3->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
- initSpinBox( GroupPoints3->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
- initSpinBox( GroupPoints3->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
- GroupPoints3->SpinBox_DX->setValue( 0.0 );
- GroupPoints3->SpinBox_DY->setValue( 0.0 );
- GroupPoints3->SpinBox_DZ->setValue( 0.0 );
+ GroupPoints2->LineEdit1->setText("");
+ GroupPoints2->LineEdit2->setText("");
+ GroupPoints2->LineEdit3->setText("");
- initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
- GroupPoints->SpinBox_DX->setValue( 100.0 );
+ GroupPoints3->LineEdit1->setText("");
- /* signals and slots connections */
- connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
+ myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
- connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
- connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
- connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
- connect( GroupPoints->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) );
+ connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
- connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupPoints2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupPoints2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupPoints2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
+ connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
+ connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
- connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( GroupPoints2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( GroupPoints2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints2->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
- connect( GroupPoints3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupPoints3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( GroupPoints3->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
- connect( GroupPoints3->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
- connect( GroupPoints3->SpinBox_DZ, SIGNAL( valueChanged ( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
- connect( GroupPoints3->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
+ connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ connect(GroupPoints3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPoints3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPoints3->SpinBox_DZ, SIGNAL(valueChanged (double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPoints3->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
- initName( tr( "GEOM_EXTRUSION" ) );
+ initName(tr("GEOM_EXTRUSION"));
- ConstructorsClicked( 0 );
+ ConstructorsClicked(0);
}
//=================================================================================
// function : SetDoubleSpinBoxStep()
// purpose : Double spin box management
//=================================================================================
-void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep( double step )
+void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep (double step)
{
GroupPoints->SpinBox_DX->setSingleStep(step);
GroupPoints3->SpinBox_DX->setSingleStep(step);
GroupPoints3->SpinBox_DZ->setSingleStep(step);
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId )
+void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
{
- erasePreview();
- disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
- switch ( constructorId ) {
+ switch (constructorId) {
case 0:
{
- globalSelection( GEOM_ALLSHAPES );
-
GroupPoints2->hide();
GroupPoints3->hide();
GroupPoints->show();
-
- myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setText( GroupPoints2->LineEdit1->text() ); // keep base
- GroupPoints->LineEdit2->setText( "" );
+
+ GroupPoints->LineEdit1->setText(GroupPoints2->LineEdit1->text()); // keep base
+ GroupPoints->LineEdit2->setText("");
myVec = GEOM::GEOM_Object::_nil();
myOkVec = false;
-
+
+ GroupPoints->PushButton1->click();
break;
}
case 1:
{
- globalSelection( GEOM_ALLSHAPES );
-
GroupPoints->hide();
GroupPoints2->show();
GroupPoints3->hide();
-
- myEditCurrentArgument = GroupPoints2->LineEdit1;
- GroupPoints2->LineEdit1->setText( GroupPoints->LineEdit1->text() ); // keep base
- GroupPoints2->LineEdit2->setText( "" );
- GroupPoints2->LineEdit3->setText( "" );
+
+ GroupPoints2->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
+ GroupPoints2->LineEdit2->setText("");
+ GroupPoints2->LineEdit3->setText("");
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
myOkPnt1 = myOkPnt2 = false;
-
+
+ GroupPoints2->PushButton1->click();
break;
}
case 2:
{
- globalSelection( GEOM_ALLSHAPES );
-
GroupPoints->hide();
GroupPoints2->hide();
GroupPoints3->show();
- myEditCurrentArgument = GroupPoints3->LineEdit1;
- GroupPoints3->LineEdit1->setText( GroupPoints->LineEdit1->text() ); // keep base
+ GroupPoints3->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
+
+ GroupPoints3->PushButton1->click();
+ break;
}
}
qApp->processEvents();
updateGeometry();
- resize( minimumSize() );
+ resize(minimumSize());
- myEditCurrentArgument->setFocus();
- connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-
- if ( !myOkBase )
+ if (myInitial) {
+ myInitial = false;
SelectionIntoArgument();
+ }
+ else {
+ displayPreview();
+ }
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GenerationGUI_PrismDlg::ClickOnOk()
{
- if ( ClickOnApply() )
+ if (ClickOnApply())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool GenerationGUI_PrismDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
+ // activate selection and connect selection manager
+ ConstructorsClicked(getConstructorId());
return true;
}
-
//=================================================================================
// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
+// purpose : Called when selection is changed or on dialog initialization or activation
//=================================================================================
void GenerationGUI_PrismDlg::SelectionIntoArgument()
{
erasePreview();
- myEditCurrentArgument->setText( "" );
+ myEditCurrentArgument->setText("");
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
- if (!testResult)
+ if (!testResult || CORBA::is_nil(aSelectedObject))
return;
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
+ // Get Selected object if selected subshape
bool myOk = true;
TopoDS_Shape aShape;
- QString aName = GEOMBase::GetName( aSelectedObject );
- if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(aSelList.First(), aMap);
if (aMap.Extent() == 1) {
- int anIndex = aMap(1);
- aName.append( ":edge_" + QString::number( anIndex ) );
-
- //Find SubShape Object in Father
- GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
-
- if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
- aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
- }
- else {
- aSelectedObject = aFindedObject; // get Object from study
- }
+ int anIndex = aMap(1);
+ aName.append(":edge_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else {
+ aSelectedObject = aFindedObject; // get Object from study
+ }
}
- else {
- if ( aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2 ) {
- aSelectedObject = GEOM::GEOM_Object::_nil();
- aName = "";
- myOk = false;
- }
+ else { // Global Selection
+ if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOk = false;
+ }
}
}
-
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
+
+ myEditCurrentArgument->setText(aName);
+
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myBase = aSelectedObject;
myOkBase = true;
+ if (!myOkVec)
+ GroupPoints->PushButton2->click();
}
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && myOk ) {
- myOkVec = true;
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) {
+ myOkVec = true;
myVec = aSelectedObject;
+ if (!myOkBase)
+ GroupPoints->PushButton1->click();
}
- myEditCurrentArgument->setText( aName );
}
else if (getConstructorId() == 1) { // getConstructorId()==1 - extrusion using 2 points
if (aSelList.Extent() != 1) {
if (myEditCurrentArgument == GroupPoints2->LineEdit1)
myOkBase = false;
else if (myEditCurrentArgument == GroupPoints2->LineEdit2) {
- myPoint1 = GEOM::GEOM_Object::_nil();
+ myPoint1 = GEOM::GEOM_Object::_nil();
myOkPnt1 = false;
}
else if (myEditCurrentArgument == GroupPoints2->LineEdit3) {
- myPoint2 = GEOM::GEOM_Object::_nil();
+ myPoint2 = GEOM::GEOM_Object::_nil();
myOkPnt2 = false;
}
return;
bool myOk = true;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes(aSelList.First(), aMap );
+ aSelMgr->GetIndexes(aSelList.First(), aMap);
if (aMap.Extent() == 1) {
- int anIndex = aMap(1);
- aName.append( ":vertex_" + QString::number( anIndex ) );
-
- //Find SubShape Object in Father
- GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
-
- if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
- aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
- }
- else {
- aSelectedObject = aFindedObject;
- }
+ int anIndex = aMap(1);
+ aName.append(":vertex_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else {
+ aSelectedObject = aFindedObject;
+ }
}
else {
- if ( ( aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2 ) ||
- ( aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3 ) ) {
- aSelectedObject = GEOM::GEOM_Object::_nil();
- aName = "";
- myOk = false;
- }
+ if ((aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2) ||
+ (aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3)) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOk = false;
+ }
}
}
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
- if ( myEditCurrentArgument == GroupPoints2->LineEdit1 ) {
+ if (myEditCurrentArgument == GroupPoints2->LineEdit1) {
myOkBase = true;
myBase = aSelectedObject;
+ if (!myOkPnt1)
+ GroupPoints2->PushButton2->click();
}
- else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk ) {
+ else if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) {
myOkPnt1 = true;
myPoint1 = aSelectedObject;
+ if (!myOkPnt2)
+ GroupPoints2->PushButton3->click();
}
- else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk ) {
+ else if (myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk) {
myOkPnt2 = true;
myPoint2 = aSelectedObject;
+ if (!myOkBase)
+ GroupPoints2->PushButton1->click();
}
}
else if (getConstructorId() == 2) { // extrusion using dx dy dz
myEditCurrentArgument->setText(aName);
}
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
displayPreview();
}
void GenerationGUI_PrismDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
- globalSelection( GEOM_ALLSHAPES );
- if ( send == GroupPoints->PushButton1 ) {
- GroupPoints->LineEdit1->setFocus();
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ globalSelection(GEOM_ALLSHAPES);
+ if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->PushButton2->setDown(false);
+ GroupPoints->LineEdit2->setEnabled(false);
}
- else if ( send == GroupPoints->PushButton2 ) {
- GroupPoints->LineEdit2->setFocus();
+ else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ GroupPoints->PushButton1->setDown(false);
+ GroupPoints->LineEdit1->setEnabled(false);
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
}
- else if ( send == GroupPoints2->PushButton1 ) {
- GroupPoints2->LineEdit1->setFocus();
+ else if (send == GroupPoints2->PushButton1) {
myEditCurrentArgument = GroupPoints2->LineEdit1;
+ GroupPoints2->PushButton2->setDown(false);
+ GroupPoints2->PushButton3->setDown(false);
+ GroupPoints2->LineEdit2->setEnabled(false);
+ GroupPoints2->LineEdit3->setEnabled(false);
}
- else if ( send == GroupPoints2->PushButton2 ) {
- GroupPoints2->LineEdit2->setFocus();
+ else if (send == GroupPoints2->PushButton2) {
myEditCurrentArgument = GroupPoints2->LineEdit2;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ GroupPoints2->PushButton1->setDown(false);
+ GroupPoints2->PushButton3->setDown(false);
+ GroupPoints2->LineEdit1->setEnabled(false);
+ GroupPoints2->LineEdit3->setEnabled(false);
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
}
- else if ( send == GroupPoints2->PushButton3 ) {
- GroupPoints2->LineEdit3->setFocus();
+ else if (send == GroupPoints2->PushButton3) {
myEditCurrentArgument = GroupPoints2->LineEdit3;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ GroupPoints2->PushButton1->setDown(false);
+ GroupPoints2->PushButton2->setDown(false);
+ GroupPoints2->LineEdit1->setEnabled(false);
+ GroupPoints2->LineEdit2->setEnabled(false);
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
}
- else if ( send == GroupPoints3->PushButton1 ) {
- GroupPoints3->LineEdit1->setFocus();
+ else if (send == GroupPoints3->PushButton1) {
myEditCurrentArgument = GroupPoints3->LineEdit1;
}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- SelectionIntoArgument();
-}
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview();
+}
//=================================================================================
// function : LineEditReturnPressed()
void GenerationGUI_PrismDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
- if ( send == GroupPoints->LineEdit1 ||
- send == GroupPoints->LineEdit2 ||
- send == GroupPoints2->LineEdit1 ||
- send == GroupPoints2->LineEdit2 ||
- send == GroupPoints2->LineEdit3 ||
- send == GroupPoints3->LineEdit1) {
+ if (send == GroupPoints->LineEdit1 ||
+ send == GroupPoints->LineEdit2 ||
+ send == GroupPoints2->LineEdit1 ||
+ send == GroupPoints2->LineEdit2 ||
+ send == GroupPoints2->LineEdit3 ||
+ send == GroupPoints3->LineEdit1) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
-//=================================================================================
-// function : enterEvent()
-// purpose : when mouse enter onto the QWidget
-//=================================================================================
-void GenerationGUI_PrismDlg::enterEvent( QEvent* )
-{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
- ActivateThisDialog();
-}
-
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-
- ConstructorsClicked( getConstructorId() );
+ // reinit, because some selected objects could be removed
+ Init();
}
+//=================================================================================
+// function : enterEvent()
+// purpose : when mouse enter onto the QWidget
+//=================================================================================
+void GenerationGUI_PrismDlg::enterEvent (QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
//=================================================================================
// function : ValueChangedInSpinBox()
displayPreview();
}
-
//=================================================================================
// function : getHeight()
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
{
- return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
+ return getGeomEngine()->GetI3DPrimOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool GenerationGUI_PrismDlg::isValid( QString& )
+bool GenerationGUI_PrismDlg::isValid (QString&)
{
- if ( getConstructorId() == 0 )
- return ( myOkBase && myOkVec ); // by vector and height
- else if ( getConstructorId() == 1 )
- return ( myOkBase && myOkPnt1 && myOkPnt2 ); // by two points
- else if ( getConstructorId() == 2 )
+ if (getConstructorId() == 0)
+ return (myOkBase && myOkVec); // by vector and height
+ else if (getConstructorId() == 1)
+ return (myOkBase && myOkPnt1 && myOkPnt2); // by two points
+ else if (getConstructorId() == 2)
return true;
+
+ return false;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
-bool GenerationGUI_PrismDlg::execute( ObjectList& objects )
+bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj;
- switch ( getConstructorId() ) {
- case 0 :
- if ( !myBothway ) {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
- MakePrismVecH( myBase, myVec, getHeight() );
+ switch (getConstructorId()) {
+ case 0:
+ if (!myBothway) {
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismVecH(myBase, myVec, getHeight());
}
else {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
- MakePrismVecH2Ways( myBase, myVec, getHeight() );
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismVecH2Ways(myBase, myVec, getHeight());
}
break;
- case 1 :
- if ( !myBothway2 ) {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
- MakePrismTwoPnt( myBase, myPoint1, myPoint2 );
+ case 1:
+ if (!myBothway2) {
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismTwoPnt(myBase, myPoint1, myPoint2);
}
else {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
- MakePrismTwoPnt2Ways( myBase, myPoint1, myPoint2 );
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2);
}
break;
- case 2 :
+ case 2:
double dx = GroupPoints3->SpinBox_DX->value();
double dy = GroupPoints3->SpinBox_DY->value();
double dz = GroupPoints3->SpinBox_DZ->value();
- if ( !myBothway3 ) {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
- MakePrismDXDYDZ( myBase, dx, dy, dz );
+ if (!myBothway3) {
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismDXDYDZ(myBase, dx, dy, dz);
}
else {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
- MakePrismDXDYDZ2Ways( myBase, dx, dy, dz );
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismDXDYDZ2Ways(myBase, dx, dy, dz);
}
break;
}
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
+
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
return true;
}
-
//=================================================================================
-// function : onReverse()
+// function : onReverse()
// purpose :
//=================================================================================
void GenerationGUI_PrismDlg::onReverse()
{
double anOldValue = GroupPoints->SpinBox_DX->value();
- GroupPoints->SpinBox_DX->setValue( -anOldValue );
+ GroupPoints->SpinBox_DX->setValue(-anOldValue);
}
//=================================================================================
-// function : onBothway()
-// purpose :
+// function : onBothway()
+// purpose :
//=================================================================================
void GenerationGUI_PrismDlg::onBothway()
{
bool anOldValue;
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case 0:
anOldValue = myBothway;
myBothway = !anOldValue;
- GroupPoints->CheckButton2->setEnabled( !myBothway );
+ GroupPoints->CheckButton2->setEnabled(!myBothway);
displayPreview();
break;
case 1:
{
QMap<QString, GEOM::GEOM_Object_var> objMap;
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case 0:
objMap[GroupPoints->LineEdit2->text()] = myVec;
break;
objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
break;
}
- addSubshapesToFather( objMap );
+ addSubshapesToFather(objMap);
}
bool myBothway2;
bool myBothway3;
+ // to initialize the first selection field with a selected object on the dialog creation
+ bool myInitial;
+
DlgRef_2Sel1Spin2Check* GroupPoints;
DlgRef_3Sel1Check* GroupPoints2; // for second layout for extrusion using 2 points
DlgRef_1Sel3Spin1Check* GroupPoints3;
// 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
-//
-// 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
-//
+// 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
//
// File : GenerationGUI_RevolDlg.cxx
#include <GeometryGUI.h>
#include <GEOMBase.h>
-#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
//=================================================================================
// class : GenerationGUI_RevolDlg()
-// purpose : Constructs a GenerationGUI_RevolDlg which is a child of 'parent', with the
+// purpose : Constructs a GenerationGUI_RevolDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-GenerationGUI_RevolDlg::GenerationGUI_RevolDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
- bool modal, Qt::WindowFlags fl )
- : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
+GenerationGUI_RevolDlg::GenerationGUI_RevolDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REVOL" ) ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_REVOL")));
+ QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
- setWindowTitle( tr( "GEOM_REVOLUTION_TITLE" ) );
+ setWindowTitle(tr("GEOM_REVOLUTION_TITLE"));
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( tr( "GEOM_REVOLUTION" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_REVOLUTION"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
- mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
myBothway = false;
- GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
- GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
- GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
- GroupPoints->TextLabel3->setText( tr( "GEOM_ANGLE" ) );
- GroupPoints->PushButton1->setIcon( image1 );
- GroupPoints->PushButton2->setIcon( image1 );
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
- GroupPoints->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
- GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) );
-
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( GroupPoints );
+ GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
+ GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE"));
+ GroupPoints->PushButton1->setIcon(image1);
+ GroupPoints->PushButton2->setIcon(image1);
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
+ GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY"));
+ GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(GroupPoints);
/***************************************************************/
- setHelpFileName( "create_revolution_page.html" );
+ setHelpFileName("create_revolution_page.html");
- /* Initialisations */
+ // Initialisation
Init();
}
-
//=================================================================================
// function : ~GenerationGUI_RevolDlg()
// purpose : Destroys the object and frees any allocated resources
// no need to delete child widgets, Qt does it all for us
}
-
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GenerationGUI_RevolDlg::Init()
{
- /* init variables */
- myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
-
- myOkBase = myOkAxis = false;
-
+ // min, max, step and decimals for spin boxes & initial values
double SpecificStep = 5;
- /* min, max, step and decimals for spin boxes & initial values */
- //initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
- // 05.06.2008 skl for IPAL12958
- initSpinBox( GroupPoints->SpinBox_DX, 0.0, 360.0, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
- GroupPoints->SpinBox_DX->setValue( 45.0 );
+ initSpinBox(GroupPoints->SpinBox_DX, 0.0, 360.0, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
+ GroupPoints->SpinBox_DX->setValue(45.0);
- /* signals and slots connections */
- connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ // init variables
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
- connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ GroupPoints->LineEdit1->setText("");
+ GroupPoints->LineEdit2->setText("");
+ myBase = myAxis = GEOM::GEOM_Object::_nil();
+ myOkBase = myOkAxis = false;
+
+ // signals and slots connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
- connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
- connect( GroupPoints->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) );
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
+ connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
+ connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
- initName( tr( "GEOM_REVOLUTION" ) );
+ initName(tr("GEOM_REVOLUTION"));
- globalSelection( GEOM_ALLSHAPES );
+ GroupPoints->PushButton1->click();
+ SelectionIntoArgument();
}
//=================================================================================
// function : SetDoubleSpinBoxStep()
// purpose : Double spin box management
//=================================================================================
-void GenerationGUI_RevolDlg::SetDoubleSpinBoxStep( double step )
+void GenerationGUI_RevolDlg::SetDoubleSpinBoxStep (double step)
{
GroupPoints->SpinBox_DX->setSingleStep(step);
}
-
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GenerationGUI_RevolDlg::ClickOnOk()
{
- if ( ClickOnApply() )
+ if (ClickOnApply())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool GenerationGUI_RevolDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
+ // activate selection and connect selection manager
+ GroupPoints->PushButton1->click();
return true;
}
//function : isAcceptableBase
//purpose : return true if theBase can be used as algo argument
//=======================================================================
-
-static bool isAcceptableBase( const TopoDS_Shape& theBase )
+static bool isAcceptableBase (const TopoDS_Shape& theBase)
{
- switch ( theBase.ShapeType() ) {
+ switch (theBase.ShapeType()) {
case TopAbs_VERTEX:
case TopAbs_EDGE:
case TopAbs_WIRE:
case TopAbs_COMPSOLID:
return false;
case TopAbs_COMPOUND: {
- TopExp_Explorer exp( theBase, TopAbs_SOLID );
+ TopExp_Explorer exp(theBase, TopAbs_SOLID);
return !exp.More();
}
default:
//=================================================================================
// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
+// purpose : Called when selection is changed or on dialog initialization or activation
//=================================================================================
void GenerationGUI_RevolDlg::SelectionIntoArgument()
{
erasePreview();
- myEditCurrentArgument->setText( "" );
-
+ myEditCurrentArgument->setText("");
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkAxis = false;
+
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
- if (aSelList.Extent() != 1) {
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
- myOkBase = false;
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
- myOkAxis = false;
+ if (aSelList.Extent() != 1)
return;
- }
-
+
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
- QString aName = GEOMBase::GetName( aSelectedObject );
-
- if ( !testResult )
+
+ if (!testResult || aSelectedObject->_is_nil())
return;
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
- TopoDS_Shape S;
- myOkBase = false;
-
- if ( !GEOMBase::GetShape(aSelectedObject, S) || !isAcceptableBase( S ) )
+ TopoDS_Shape S;
+ if (!GEOMBase::GetShape(aSelectedObject, S) || S.IsNull())
+ return;
+
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) {
+ if (!isAcceptableBase(S))
return;
-
+
myBase = aSelectedObject;
myOkBase = true;
+ myEditCurrentArgument->setText(aName);
+ if (!myOkAxis)
+ GroupPoints->PushButton2->click();
}
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
- if ( testResult && !aSelectedObject->_is_nil() ) {
- TopoDS_Shape aShape;
-
- if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
- TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes(aSelList.First(), aMap);
- if ( aMap.Extent() == 1 ) {
-
- int anIndex = aMap( 1 );
- aName.append( ":edge_" + QString::number( anIndex ) );
-
- //Find SubShape Object in Father
- GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
-
- if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
- myAxis = aShapesOp->GetSubShape( aSelectedObject, anIndex );
- myOkAxis = true;
- }
- else {
- myAxis = aFindedObject;
- myOkAxis = true;
- }
- }
- else {
- myOkAxis = true;
- if ( aShape.ShapeType() != TopAbs_EDGE ) {
- aSelectedObject = GEOM::GEOM_Object::_nil();
- aName = "";
- myOkAxis = false;
- }
- myAxis = aSelectedObject;
- }
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(aSelList.First(), aMap);
+ if (aMap.Extent() == 1) {
+ int anIndex = aMap(1);
+ aName.append(":edge_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ myOkAxis = true;
+ }
+ else {
+ myAxis = aFindedObject;
+ myOkAxis = true;
}
}
+ else {
+ myOkAxis = true;
+ if (S.ShapeType() != TopAbs_EDGE) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOkAxis = false;
+ }
+ myAxis = aSelectedObject;
+ }
+ myEditCurrentArgument->setText(aName);
+ if (myOkAxis && !myOkBase)
+ GroupPoints->PushButton1->click();
}
- myEditCurrentArgument->setText( aName );
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
displayPreview();
}
void GenerationGUI_RevolDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
- globalSelection( GEOM_ALLSHAPES );
- if ( send == GroupPoints->PushButton1 ) {
- GroupPoints->LineEdit1->setFocus();
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ globalSelection(GEOM_ALLSHAPES);
+ if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->PushButton2->setDown(false);
+ GroupPoints->LineEdit2->setEnabled(false);
}
- else if ( send == GroupPoints->PushButton2 ) {
- GroupPoints->LineEdit2->setFocus();
+ else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ GroupPoints->PushButton1->setDown(false);
+ GroupPoints->LineEdit1->setEnabled(false);
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
}
- SelectionIntoArgument();
-}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setFocus();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview();
+}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GenerationGUI_RevolDlg::LineEditReturnPressed()
-{
+{
QLineEdit* send = (QLineEdit*)sender();
- if ( send == GroupPoints->LineEdit1 ||
- send == GroupPoints->LineEdit2 ) {
+ if (send == GroupPoints->LineEdit1 ||
+ send == GroupPoints->LineEdit2) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void GenerationGUI_RevolDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- globalSelection( GEOM_ALLSHAPES );
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) );
- GroupPoints->LineEdit1->setFocus();
- myEditCurrentArgument = GroupPoints->LineEdit1;
- displayPreview();
-}
+ // reinit, because some selected objects could be removed
+ Init();
+}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
-void GenerationGUI_RevolDlg::enterEvent( QEvent* )
+void GenerationGUI_RevolDlg::enterEvent (QEvent*)
{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
+ if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
-
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
displayPreview();
}
-
//=================================================================================
// function : getAngle()
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr GenerationGUI_RevolDlg::createOperation()
{
- return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
+ return getGeomEngine()->GetI3DPrimOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool GenerationGUI_RevolDlg::isValid( QString& )
+bool GenerationGUI_RevolDlg::isValid (QString&)
{
return myOkBase && myOkAxis;
}
// function : execute
// purpose :
//=================================================================================
-bool GenerationGUI_RevolDlg::execute( ObjectList& objects )
+bool GenerationGUI_RevolDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj;
- if ( !myBothway ) {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
- getOperation() )->MakeRevolutionAxisAngle( myBase, myAxis, getAngle() * PI180 );
+ if (!myBothway) {
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakeRevolutionAxisAngle(myBase, myAxis, getAngle() * PI180);
}
else {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
- getOperation() )->MakeRevolutionAxisAngle2Ways( myBase, myAxis, getAngle() * PI180 );
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakeRevolutionAxisAngle2Ways(myBase, myAxis, getAngle() * PI180);
}
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
return true;
}
-
//=================================================================================
// function : onReverse()
// purpose :
void GenerationGUI_RevolDlg::onReverse()
{
double anOldValue = GroupPoints->SpinBox_DX->value();
- GroupPoints->SpinBox_DX->setValue( -anOldValue );
+ GroupPoints->SpinBox_DX->setValue(-anOldValue);
}
-
//=================================================================================
// function : onBothway()
// purpose :
{
bool anOldValue = myBothway;
myBothway = !anOldValue;
- GroupPoints->CheckButton2->setEnabled( !myBothway );
+ GroupPoints->CheckButton2->setEnabled(!myBothway);
displayPreview();
}
objMap[GroupPoints->LineEdit2->text()] = myAxis;
- addSubshapesToFather( objMap );
+ addSubshapesToFather(objMap);
}
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- // after setFocus(), because it will be setDown(false) then loses focus
+ // after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
+
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview();
}
//=================================================================================
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- // after setFocus(), because it will be setDown(false) then loses focus
+ // after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
+
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview();
}
//=================================================================================
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- // after setFocus(), because it will be setDown(false) then loses focus
+ // after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
+
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview();
}
//=================================================================================
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- // after setFocus(), because it will be setDown(false) then loses focus
+ // after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
// seems we need it only to avoid preview disappearing, caused by selection mode change
initSpinBox(GroupDimensions->SpinBox_DY, 0.001, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
// init variables
- myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setReadOnly(true);
GroupPoints->LineEdit2->setReadOnly(true);
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
+ 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()));
erasePreview();
myEditCurrentArgument->setText("");
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir = GEOM::GEOM_Object::_nil();
+
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
- if (aSelList.Extent() != 1) {
- if (myEditCurrentArgument == GroupPoints->LineEdit1)
- myPoint = GEOM::GEOM_Object::_nil();
- else if (myEditCurrentArgument == GroupPoints->LineEdit2)
- myDir = GEOM::GEOM_Object::_nil();
+ if (aSelList.Extent() != 1)
return;
- }
// nbSel == 1
Standard_Boolean testResult = Standard_False;
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- // after setFocus(), because it will be setDown(false) then loses focus
+ // after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
// seems we need it only to avoid preview disappearing, caused by selection mode change
// 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
-//
-// 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
-//
+// 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
//
// File : TransformationGUI_TranslationDlg.cxx
#include <GeometryGUI.h>
#include <GEOMBase.h>
-#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
+// OCCT Includes
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS.hxx>
//=================================================================================
// class : TransformationGUI_TranslationDlg()
-// purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the
+// purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
-( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
- : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
+(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+ myInitial(true)
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
- QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_DXYZ" ) ) );
- QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_POINTS" ) ) );
- QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_VECTOR" ) ) );
- QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_DXYZ")));
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_POINTS")));
+ QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_VECTOR")));
+ QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
- setWindowTitle( tr( "GEOM_TRANSLATION_TITLE" ) );
+ setWindowTitle(tr("GEOM_TRANSLATION_TITLE"));
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( tr( "GEOM_TRANSLATION" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setIcon( image1 );
- mainFrame()->RadioButton3->setIcon( image2 );
- mainFrame()->RadioButton1->setChecked( true );
-
- GroupPoints = new DlgRef_3Sel3Spin2Check( centralWidget() );
- GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
- GroupPoints->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
- GroupPoints->TextLabel4->setText( tr( "GEOM_DX" ) );
- GroupPoints->TextLabel5->setText( tr( "GEOM_DY" ) );
- GroupPoints->TextLabel6->setText( tr( "GEOM_DZ" ) );
- GroupPoints->PushButton1->setIcon( image3 );
- GroupPoints->PushButton2->setIcon( image3 );
- GroupPoints->PushButton3->setIcon( image3 );
- GroupPoints->CheckBox1->setText( tr( "Activate Distance" ) );
- GroupPoints->CheckBox2->setText( tr( "GEOM_CREATE_COPY" ) );
-
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( GroupPoints );
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_TRANSLATION"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setIcon(image1);
+ mainFrame()->RadioButton3->setIcon(image2);
+ mainFrame()->RadioButton1->setChecked(true);
+
+ GroupPoints = new DlgRef_3Sel3Spin2Check(centralWidget());
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
+ GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg(2));
+ GroupPoints->TextLabel4->setText(tr("GEOM_DX"));
+ GroupPoints->TextLabel5->setText(tr("GEOM_DY"));
+ GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
+ GroupPoints->PushButton1->setIcon(image3);
+ GroupPoints->PushButton2->setIcon(image3);
+ GroupPoints->PushButton3->setIcon(image3);
+ GroupPoints->CheckBox1->setText(tr("Activate Distance"));
+ GroupPoints->CheckBox2->setText(tr("GEOM_CREATE_COPY"));
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(GroupPoints);
/***************************************************************/
-
- setHelpFileName( "translation_operation_page.html" );
-
+
+ setHelpFileName("translation_operation_page.html");
+
+ // Activate Create a Copy mode
+ GroupPoints->CheckBox2->setChecked(true);
+ CreateCopyModeChanged(true);
+
Init();
}
-
//=================================================================================
// function : ~TransformationGUI_TranslationDlg()
// purpose : Destroys the object and frees any allocated resources
// no need to delete child widgets, Qt does it all for us
}
-
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void TransformationGUI_TranslationDlg::Init()
{
- /* init variables */
- myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setReadOnly( true );
- GroupPoints->LineEdit2->setReadOnly( true );
- GroupPoints->LineEdit3->setReadOnly( true );
-
+ // Get setting of step value from file configuration
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+
+ // min, max, step and decimals for spin boxes & initial values
+ initSpinBox(GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
+ initSpinBox(GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
+ initSpinBox(GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
+
+ GroupPoints->SpinBox1->setValue(0.0);
+ GroupPoints->SpinBox2->setValue(0.0);
+ GroupPoints->SpinBox3->setValue(0.0);
+
+ // init variables
+ GroupPoints->LineEdit1->setReadOnly(true);
+ GroupPoints->LineEdit2->setReadOnly(true);
+ GroupPoints->LineEdit3->setReadOnly(true);
+
+ GroupPoints->LineEdit1->setText("");
+ GroupPoints->LineEdit2->setText("");
+ GroupPoints->LineEdit3->setText("");
+
myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
-
- // Activate Create a Copy mode
- GroupPoints->CheckBox2->setChecked( true );
- CreateCopyModeChanged( true );
-
+
mainFrame()->GroupBoxPublish->show();
- /* Get setting of step value from file configuration */
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
-
- /* min, max, step and decimals for spin boxes & initial values */
- initSpinBox( GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
- initSpinBox( GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
- initSpinBox( GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
-
- GroupPoints->SpinBox1->setValue( 0.0 );
- GroupPoints->SpinBox2->setValue( 0.0 );
- GroupPoints->SpinBox3->setValue( 0.0 );
-
- /* signals and slots connections */
- 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->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
-
- connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); //@ Delete ?
-
- connect( GroupPoints->SpinBox1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
- connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
- connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
-
- connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
-
- connect( GroupPoints->CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( ActivateDistanceChanged( bool ) ) );
- connect( GroupPoints->CheckBox2, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
-
- connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-
- initName( tr( "GEOM_TRANSLATION" ) );
-
- ConstructorsClicked( 0 );
-}
+ // signals and slots connections
+ 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->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ?
+
+ connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
+ connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged(bool)));
+ connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
+
+ initName(tr("GEOM_TRANSLATION"));
+
+ ConstructorsClicked(0);
+}
//=================================================================================
// function : SetDoubleSpinBoxStep()
// purpose : Double spin box management
//=================================================================================
-void TransformationGUI_TranslationDlg::SetDoubleSpinBoxStep( double step )
+void TransformationGUI_TranslationDlg::SetDoubleSpinBoxStep (double step)
{
GroupPoints->SpinBox1->setSingleStep(step);
GroupPoints->SpinBox2->setSingleStep(step);
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void TransformationGUI_TranslationDlg::ConstructorsClicked( int constructorId )
+void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
{
- erasePreview();
- disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
-
- myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection();
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+
+ switch (constructorId) {
+ case 0: // translation an object by dx, dy, dz
+ {
+ GroupPoints->ShowRows(1, 2, false);
+ GroupPoints->ShowRows(3, 5, true);
+
+ GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
+ GroupPoints->SpinBox3->setEnabled(true);
- switch ( constructorId ) {
- case 0: /* translation an object by dx, dy, dz */
- {
- GroupPoints->ShowRows( 1, 2, false );
- GroupPoints->ShowRows( 3, 5, true );
- GroupPoints->TextLabel6->setText( tr( "GEOM_DZ" ) );
GroupPoints->CheckBox1->hide();
- GroupPoints->SpinBox3->setEnabled( true );
+
+ GroupPoints->PushButton1->click();
break;
}
- case 1: /* translation an object by 2 points */
+ case 1: // translation an object by 2 points
{
- GroupPoints->ShowRows( 3, 5, false );
- GroupPoints->ShowRows( 0, 2, true );
- GroupPoints->CheckBox1->hide();
- GroupPoints->TextLabel6->setText( tr( "GEOM_DZ" ) );
- GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
+ GroupPoints->ShowRows(3, 5, false);
+ GroupPoints->ShowRows(0, 2, true);
+
+ GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg(1));
GroupPoints->LineEdit2->clear();
GroupPoints->LineEdit3->clear();
- GroupPoints->SpinBox3->setEnabled( true );
+ GroupPoints->SpinBox3->setEnabled(true);
+
+ GroupPoints->CheckBox1->hide();
+
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
+
+ GroupPoints->PushButton1->click();
break;
- }
- case 2: /* translation an object by vector */
+ }
+ case 2: // translation an object by vector
{
- GroupPoints->ShowRows( 0, 1, true );
- GroupPoints->ShowRows( 2, 4, false );
- GroupPoints->ShowRows( 5, 5, true );
- GroupPoints->CheckBox1->show();
- GroupPoints->TextLabel6->setText( tr( "GEOM_DISTANCE" ) );
- GroupPoints->SpinBox3->setValue( 0.0 );
- GroupPoints->SpinBox3->setEnabled( false );
- GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
+ GroupPoints->ShowRows(0, 1, true);
+ GroupPoints->ShowRows(2, 4, false);
+ GroupPoints->ShowRows(5, 5, true);
+
+ GroupPoints->TextLabel6->setText(tr("GEOM_DISTANCE"));
+ GroupPoints->SpinBox3->setValue(0.0);
+ GroupPoints->SpinBox3->setEnabled(false);
+ GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupPoints->LineEdit2->clear();
+
+ GroupPoints->CheckBox1->show();
+
myVector = GEOM::GEOM_Object::_nil();
- ActivateDistanceChanged( GroupPoints->CheckBox1->isChecked() );
+ ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
+
+ GroupPoints->PushButton1->click();
break;
}
}
-
+
qApp->processEvents();
updateGeometry();
- resize( minimumSize() );
+ resize(minimumSize());
- myEditCurrentArgument->setFocus();
- connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ if (myInitial) {
+ myInitial = false;
+ SelectionIntoArgument();
+ }
+ else {
+ displayPreview();
+ }
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void TransformationGUI_TranslationDlg::ClickOnOk()
{
- if ( ClickOnApply() )
+ if (ClickOnApply())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool TransformationGUI_TranslationDlg::ClickOnApply()
{
- if ( !onAccept(GroupPoints->CheckBox2->isChecked()) )
+ if (!onAccept(GroupPoints->CheckBox2->isChecked()))
return false;
-
- initName();
+ initName();
+ // activate selection and connect selection manager
+ ConstructorsClicked(getConstructorId());
return true;
}
-
//=================================================================================
// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
+// purpose : Called when selection is changed or on dialog initialization or activation
//=================================================================================
void TransformationGUI_TranslationDlg::SelectionIntoArgument()
{
- myEditCurrentArgument->setText( "" );
- QString aName;
-
+ erasePreview();
+ myEditCurrentArgument->setText("");
+
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
+ myObjects.length(0);
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
+ myPoint1 = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
+ myVector = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit3)
+ myPoint2 = GEOM::GEOM_Object::_nil();
+
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
+ QString aName;
+
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
-
- if (aNbSel < 1) {
- myObjects.length(0);
- return;
- }
+ if (aNbSel < 1)
+ return;
+
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
if (!myObjects.length())
return;
+ else {
+ myEditCurrentArgument->setText(aName);
+
+ // here we do not switch to the next field, because multiple objects can be selected
+ /*
+ if (getConstructorId() == 1) {
+ if (myPoint1->_is_nil())
+ GroupPoints->PushButton2->click();
+ }
+ else if (getConstructorId() == 2) {
+ if (myVector->_is_nil())
+ GroupPoints->PushButton2->click();
+ }
+ */
+ }
}
else {
- if (aSelList.Extent() != 1 ) {
- if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
- myPoint1 = GEOM::GEOM_Object::_nil();
- else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
- myVector = GEOM::GEOM_Object::_nil();
- else if (myEditCurrentArgument == GroupPoints->LineEdit3)
- myPoint2 = GEOM::GEOM_Object::_nil();
+ if (aSelList.Extent() != 1)
return;
- }
+ // nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
-
+
if (!testResult || CORBA::is_nil(aSelectedObject))
return;
-
+
+ aName = GEOMBase::GetName(aSelectedObject);
+
+ // Get Selected object if selected subshape
TopoDS_Shape aShape;
- aName = GEOMBase::GetName( aSelectedObject );
- if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
{
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
- if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 )
+ if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
aNeedType = TopAbs_EDGE;
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(aSelList.First(), aMap);
- if ( aMap.Extent() == 1 )
+ if (aMap.Extent() == 1)
{
- int anIndex = aMap( 1 );
- if ( aNeedType == TopAbs_EDGE )
- aName += QString( ":edge_%1" ).arg( anIndex );
+ int anIndex = aMap(1);
+ if (aNeedType == TopAbs_EDGE)
+ aName += QString(":edge_%1").arg(anIndex);
else
- aName += QString( ":vertex_%1" ).arg( anIndex );
+ aName += QString(":vertex_%1").arg(anIndex);
//Find SubShape Object in Father
- GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
-
- if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
- aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
}
- else
+ else {
aSelectedObject = aFindedObject;
+ }
}
else // Global Selection
{
- if ( aShape.ShapeType() != aNeedType ) {
+ if (aShape.ShapeType() != aNeedType) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
}
}
-
- if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
+
+ myEditCurrentArgument->setText(aName);
+
+ if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
myPoint1 = aSelectedObject;
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 )
+ if (!myPoint1->_is_nil() && myPoint2->_is_nil())
+ GroupPoints->PushButton3->click();
+ }
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) {
myVector = aSelectedObject;
- else if ( myEditCurrentArgument == GroupPoints->LineEdit3 )
+ if (!myVector->_is_nil() && !myObjects.length())
+ GroupPoints->PushButton1->click();
+ }
+ else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
myPoint2 = aSelectedObject;
+ if (!myPoint2->_is_nil() && !myObjects.length())
+ GroupPoints->PushButton1->click();
+ }
}
-
- myEditCurrentArgument->setText( aName );
-
- displayPreview();
-}
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose :
-//=================================================================================
-void TransformationGUI_TranslationDlg::LineEditReturnPressed()
-{
- QLineEdit* send = (QLineEdit*)sender();
- if ( send == GroupPoints->LineEdit1 ) {
- myEditCurrentArgument = send;
- GEOMBase_Skeleton::LineEditReturnPressed();
- }
-}
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ displayPreview();
+}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
-{
+{
QPushButton* send = (QPushButton*)sender();
+
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection();
-
- if ( send == GroupPoints->PushButton1 ) {
+
+ if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
+
+ GroupPoints->PushButton2->setDown(false);
+ GroupPoints->PushButton3->setDown(false);
+ GroupPoints->LineEdit2->setEnabled(false);
+ GroupPoints->LineEdit3->setEnabled(false);
}
- else if ( send == GroupPoints->PushButton2 ) {
+ else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- if ( getConstructorId() == 1 )
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
- else
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+
+ GroupPoints->PushButton1->setDown(false);
+ GroupPoints->PushButton3->setDown(false);
+ GroupPoints->LineEdit1->setEnabled(false);
+ GroupPoints->LineEdit3->setEnabled(false);
+
+ if (getConstructorId() == 1)
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ else
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
}
- else if ( send == GroupPoints->PushButton3 ) {
+ else if (send == GroupPoints->PushButton3) {
myEditCurrentArgument = GroupPoints->LineEdit3;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+
+ GroupPoints->PushButton1->setDown(false);
+ GroupPoints->PushButton2->setDown(false);
+ GroupPoints->LineEdit1->setEnabled(false);
+ GroupPoints->LineEdit2->setEnabled(false);
+
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
}
-
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
- SelectionIntoArgument();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview();
}
+//=================================================================================
+// function : LineEditReturnPressed()
+// purpose :
+//=================================================================================
+void TransformationGUI_TranslationDlg::LineEditReturnPressed()
+{
+ QLineEdit* send = (QLineEdit*)sender();
+ if (send == GroupPoints->LineEdit1) {
+ myEditCurrentArgument = send;
+ GEOMBase_Skeleton::LineEditReturnPressed();
+ }
+}
//=================================================================================
// function : ActivateThisDialog()
void TransformationGUI_TranslationDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
-
- connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- ConstructorsClicked( getConstructorId() );
+ // reinit, because some selected objects could be removed
+ Init();
}
-
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
-void TransformationGUI_TranslationDlg::enterEvent( QEvent* )
+void TransformationGUI_TranslationDlg::enterEvent (QEvent*)
{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
+ if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
-
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
displayPreview();
}
-
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
{
- return getGeomEngine()->GetITransformOperations( getStudyId() );
+ return getGeomEngine()->GetITransformOperations(getStudyId());
}
-
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool TransformationGUI_TranslationDlg::isValid( QString& /*msg*/ )
+bool TransformationGUI_TranslationDlg::isValid (QString& /*msg*/)
{
int aConstructorId = getConstructorId();
+ if (myObjects.length() < 1) return false;
+
switch (aConstructorId) {
- case 0:
- {
- //LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- //SALOME_ListIO aSelList;
- //aSelMgr->selectedObjects(aSelList);
- //
- //Handle(SALOME_InteractiveObject) IO = aSelList.First();
- //Standard_Boolean testResult;
- //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult);
- //if (!testResult || anObject->_is_nil())
- // return false;
-
- return !(myObjects.length() == 0);
- }
- case 1:
- return !(myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil());
- case 2:
- return !( myObjects.length() == 0 || myVector->_is_nil());
- default:
+ case 0:
+ return true;
+ case 1:
+ return !(myPoint1->_is_nil() || myPoint2->_is_nil());
+ case 2:
+ return !(myVector->_is_nil());
+ default:
break;
}
return false;
// function : execute
// purpose :
//=================================================================================
-bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
+bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
{
bool res = false;
bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
-
+
GEOM::GEOM_Object_var anObj;
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case 0:
{
double dx = GroupPoints->SpinBox1->value();
double dy = GroupPoints->SpinBox2->value();
double dz = GroupPoints->SpinBox3->value();
-
- if ( toCreateCopy ) {
- for ( int i = 0; i < myObjects.length(); i++ ) {
- myCurrObject = myObjects[i];
- anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
- TranslateDXDYDZCopy( myObjects[i], dx, dy, dz );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
- }
+
+ if (toCreateCopy) {
+ for (int i = 0; i < myObjects.length(); i++) {
+ myCurrObject = myObjects[i];
+ anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
+ TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+ }
}
else {
- for ( int i = 0; i < myObjects.length(); i++ ) {
- myCurrObject = myObjects[i];
- anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
- TranslateDXDYDZ( myObjects[i], dx, dy, dz );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
- }
+ for (int i = 0; i < myObjects.length(); i++) {
+ myCurrObject = myObjects[i];
+ anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
+ TranslateDXDYDZ(myObjects[i], dx, dy, dz);
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+ }
}
res = true;
break;
}
case 1:
{
- if ( toCreateCopy ) {
- for ( int i = 0; i < myObjects.length(); i++ ) {
- myCurrObject = myObjects[i];
- anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
- TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
- }
+ if (toCreateCopy) {
+ for (int i = 0; i < myObjects.length(); i++) {
+ myCurrObject = myObjects[i];
+ anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
+ TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2);
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+ }
}
else {
- for ( int i = 0; i < myObjects.length(); i++ ) {
- myCurrObject = myObjects[i];
- anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
- TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
- }
+ for (int i = 0; i < myObjects.length(); i++) {
+ myCurrObject = myObjects[i];
+ anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
+ TranslateTwoPoints(myObjects[i], myPoint1, myPoint2);
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+ }
}
res = true;
break;
case 2:
{
bool byDistance = GroupPoints->CheckBox1->isChecked();
- if ( byDistance ) {
- double aDistance = GroupPoints->SpinBox3->value();
- for ( int i = 0; i < myObjects.length(); i++ ) {
- myCurrObject = myObjects[i];
- anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
- TranslateVectorDistance( myObjects[i], myVector, aDistance, toCreateCopy );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
- }
+ if (byDistance) {
+ double aDistance = GroupPoints->SpinBox3->value();
+ for (int i = 0; i < myObjects.length(); i++) {
+ myCurrObject = myObjects[i];
+ anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
+ TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+ }
}
else {
- if ( toCreateCopy ) {
- for ( int i = 0; i < myObjects.length(); i++ ) {
- myCurrObject = myObjects[i];
- anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
- TranslateVectorCopy( myObjects[i], myVector );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
-
- }
- }
- else {
- for (int i = 0; i < myObjects.length(); i++) {
- myCurrObject = myObjects[i];
- anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
- TranslateVector( myObjects[i], myVector );
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
- }
- }
+ if (toCreateCopy) {
+ for (int i = 0; i < myObjects.length(); i++) {
+ myCurrObject = myObjects[i];
+ anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
+ TranslateVectorCopy(myObjects[i], myVector);
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+ }
+ }
+ else {
+ for (int i = 0; i < myObjects.length(); i++) {
+ myCurrObject = myObjects[i];
+ anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
+ TranslateVector(myObjects[i], myVector);
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+ }
+ }
}
res = true;
break;
// function : restoreSubShapes
// purpose :
//=================================================================================
-void TransformationGUI_TranslationDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject )
+void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
+ SALOMEDS::SObject_ptr theSObject)
{
- if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
+ if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
// we pass here the first operation argument (object) through the list of arguments
// because the rotation operation place its arguments in the data structure in another order,
// and we need to point the first argument directly
GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
- anArgs->length( 1);
+ anArgs->length(1);
anArgs[0] = myCurrObject;
- getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, anArgs,
- /*theFindMethod=*/GEOM::FSM_Transformed,
- /*theInheritFirstArg=*/true );
+ getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
+ /*theFindMethod=*/GEOM::FSM_Transformed,
+ /*theInheritFirstArg=*/true);
}
}
// function : CreateCopyModeChanged()
// purpose :
//=================================================================================
-void TransformationGUI_TranslationDlg::CreateCopyModeChanged( bool isCreateCopy )
+void TransformationGUI_TranslationDlg::CreateCopyModeChanged (bool isCreateCopy)
{
- mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
+ mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
}
//=================================================================================
// function : ActivateDistanceChanged()
// purpose :
//=================================================================================
-void TransformationGUI_TranslationDlg::ActivateDistanceChanged( bool theEnable )
+void TransformationGUI_TranslationDlg::ActivateDistanceChanged (bool theEnable)
{
- GroupPoints->SpinBox3->setEnabled( theEnable );
+ GroupPoints->SpinBox3->setEnabled(theEnable);
displayPreview();
}
void TransformationGUI_TranslationDlg::addSubshapesToStudy()
{
bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
- if ( toCreateCopy ) {
+ if (toCreateCopy) {
QMap<QString, GEOM::GEOM_Object_var> objMap;
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case 0:
return;
case 1:
objMap[GroupPoints->LineEdit2->text()] = myVector;
break;
}
- addSubshapesToFather( objMap );
+ addSubshapesToFather(objMap);
}
}
GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myCurrObject;
GEOM::GEOM_Object_var myVector, myPoint1, myPoint2;
- double myTranslateDistance;
+
+ // to initialize the first selection field with a selected object on the dialog creation
+ bool myInitial;
DlgRef_3Sel3Spin2Check* GroupPoints;