mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-24 19:32:04 +05:00
Bugs 16640, 19050: Improve selection mechanism in GEOM dialog boxes.
This commit is contained in:
parent
0c6f0114a9
commit
54666ebd00
@ -38,6 +38,7 @@
|
|||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
#include <OCCViewer_ViewModel.h>
|
#include <OCCViewer_ViewModel.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
|
||||||
#include <GEOMImpl_Types.hxx>
|
#include <GEOMImpl_Types.hxx>
|
||||||
@ -50,16 +51,20 @@
|
|||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
|
OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, false )
|
: GEOMBase_Skeleton(theGeometryGUI, parent, false),
|
||||||
|
myInitial(true)
|
||||||
{
|
{
|
||||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_ALL" ) ) );
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||||
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_EDGE_FROM_FACE" ) ) );
|
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHAMFER_ALL")));
|
||||||
QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_FACE" ) ) );
|
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHAMFER_EDGE_FROM_FACE")));
|
||||||
QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_EDGE" ) ) );
|
QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHAMFER_FACE")));
|
||||||
QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
QPixmap image4 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHAMFER_EDGE")));
|
||||||
|
|
||||||
|
QPixmap iconSelect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||||
|
|
||||||
setWindowTitle(tr("GEOM_CHAMFER_TITLE"));
|
setWindowTitle(tr("GEOM_CHAMFER_TITLE"));
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHAMFER"));
|
mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHAMFER"));
|
||||||
|
|
||||||
mainFrame()->RadioButton1->setIcon(image1);
|
mainFrame()->RadioButton1->setIcon(image1);
|
||||||
@ -136,9 +141,9 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( GeometryGUI* theGeometryGUI, Q
|
|||||||
layout->addWidget(myGrp2);
|
layout->addWidget(myGrp2);
|
||||||
layout->addWidget(myGrp3);
|
layout->addWidget(myGrp3);
|
||||||
layout->addWidget(myGrp4);
|
layout->addWidget(myGrp4);
|
||||||
|
/***************************************************************/
|
||||||
|
|
||||||
// Set range of spinboxes
|
// Set range of spinboxes
|
||||||
|
|
||||||
double SpecificStep = 10.0;
|
double SpecificStep = 10.0;
|
||||||
QMap< int, QDoubleSpinBox* >::iterator anIter;
|
QMap< int, QDoubleSpinBox* >::iterator anIter;
|
||||||
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) {
|
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) {
|
||||||
@ -150,12 +155,11 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( GeometryGUI* theGeometryGUI, Q
|
|||||||
|
|
||||||
setHelpFileName("chamfer_operation_page.html");
|
setHelpFileName("chamfer_operation_page.html");
|
||||||
|
|
||||||
/* Initialisations */
|
// Initialisation
|
||||||
Init();
|
Init();
|
||||||
myRadioButton[ RadioButton21 ]->click();
|
myRadioButton[ RadioButton21 ]->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~OperationGUI_ChamferDlg()
|
// function : ~OperationGUI_ChamferDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -164,17 +168,30 @@ OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_ChamferDlg::Init()
|
void OperationGUI_ChamferDlg::Init()
|
||||||
{
|
{
|
||||||
myConstructorId = -1;
|
// Set Initial values of spinboxes
|
||||||
reset();
|
QMap< int, QDoubleSpinBox* >::iterator anIter;
|
||||||
|
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter)
|
||||||
|
anIter.value()->setValue(5);
|
||||||
|
|
||||||
/* signals and slots connections */
|
// Clear line edits
|
||||||
|
QMap< int, QLineEdit* >::iterator anIterLE;
|
||||||
|
for (anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE)
|
||||||
|
anIterLE.value()->setText("");
|
||||||
|
|
||||||
|
myShape = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
myFaces.Clear();
|
||||||
|
myEdges.Clear();
|
||||||
|
myFace[ Face1 ] = -1;
|
||||||
|
myFace[ Face2 ] = -1;
|
||||||
|
|
||||||
|
// signals and slots connections
|
||||||
|
|
||||||
// main buttons
|
// main buttons
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() ));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() ));
|
||||||
@ -207,16 +224,12 @@ void OperationGUI_ChamferDlg::Init()
|
|||||||
connect(anIterRadio.value(), SIGNAL(clicked()),
|
connect(anIterRadio.value(), SIGNAL(clicked()),
|
||||||
this, SLOT(RadioButtonPressed()));
|
this, SLOT(RadioButtonPressed()));
|
||||||
|
|
||||||
// selection
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
initName(tr("GEOM_CHAMFER"));
|
initName(tr("GEOM_CHAMFER"));
|
||||||
|
|
||||||
|
myConstructorId = -1;
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ConstructorsClicked()
|
// function : ConstructorsClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
@ -233,6 +246,8 @@ void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )
|
|||||||
if (myConstructorId == constructorId)
|
if (myConstructorId == constructorId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
// Get values from previous widget
|
// Get values from previous widget
|
||||||
double D1 = 5, D2 = 5, D = 5, Angle = 5;
|
double D1 = 5, D2 = 5, D = 5, Angle = 5;
|
||||||
if (myConstructorId == 0)
|
if (myConstructorId == 0)
|
||||||
@ -301,29 +316,49 @@ void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( constructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];
|
if (constructorId == 0) mySelBtn[ MainObj1 ]->click();
|
||||||
else if ( constructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];
|
else if (constructorId == 1) mySelBtn[ MainObj2 ]->click();
|
||||||
else if ( constructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ];
|
else if (constructorId == 2) mySelBtn[ MainObj3 ]->click();
|
||||||
else myEditCurrentArgument = mySelName[ MainObj4 ];
|
else mySelBtn[ MainObj4 ]->click();
|
||||||
|
|
||||||
activateSelection();
|
|
||||||
enableWidgets();
|
enableWidgets();
|
||||||
|
|
||||||
if ( !myShape->_is_nil() )
|
if (myInitial) {
|
||||||
{
|
myInitial = false;
|
||||||
|
SelectionIntoArgument();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!myShape->_is_nil()) {
|
||||||
myEditCurrentArgument->setText(GEOMBase::GetName(myShape));
|
myEditCurrentArgument->setText(GEOMBase::GetName(myShape));
|
||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
|
switch (getConstructorId()) {
|
||||||
|
case 1:
|
||||||
|
if (myFace[ Face1 ] == -1)
|
||||||
|
mySelBtn[ Face1 ]->click();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (myFaces.Extent() == 0)
|
||||||
|
mySelBtn[ Faces ]->click();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (myEdges.Extent() == 0)
|
||||||
|
mySelBtn[ Edges ]->click();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
|
}
|
||||||
qApp->processEvents();
|
|
||||||
updateGeometry();
|
|
||||||
resize( minimumSize() );
|
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qApp->processEvents();
|
||||||
|
updateGeometry();
|
||||||
|
resize(minimumSize());
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -345,12 +380,14 @@ bool OperationGUI_ChamferDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate selection and connect selection manager
|
||||||
|
ConstructorsClicked(getConstructorId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection has changed
|
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_ChamferDlg::SelectionIntoArgument()
|
void OperationGUI_ChamferDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
@ -374,6 +411,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
|
|||||||
// If selection of main object is activated
|
// If selection of main object is activated
|
||||||
if (aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 || aCurrFocus == MainObj4)
|
if (aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 || aCurrFocus == MainObj4)
|
||||||
{
|
{
|
||||||
|
myShape = GEOM::GEOM_Object::_nil();
|
||||||
if (aSelList.Extent() == 1) {
|
if (aSelList.Extent() == 1) {
|
||||||
Standard_Boolean aResult = Standard_False;
|
Standard_Boolean aResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var anObj =
|
GEOM::GEOM_Object_var anObj =
|
||||||
@ -381,19 +419,17 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
if (aResult && !anObj->_is_nil()) {
|
if (aResult && !anObj->_is_nil()) {
|
||||||
myShape = anObj;
|
myShape = anObj;
|
||||||
mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) );
|
myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
|
||||||
displayPreview();
|
displayPreview();
|
||||||
enableWidgets();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myShape = GEOM::GEOM_Object::_nil();
|
|
||||||
enableWidgets();
|
enableWidgets();
|
||||||
}
|
}
|
||||||
// If face selection of second tab is activated
|
// If face selection of second tab is activated
|
||||||
else if (aCurrFocus == Face1 || aCurrFocus == Face2)
|
else if (aCurrFocus == Face1 || aCurrFocus == Face2)
|
||||||
{
|
{
|
||||||
|
myFace[ aCurrFocus ] = -1;
|
||||||
if (aSelList.Extent() == 1) {
|
if (aSelList.Extent() == 1) {
|
||||||
Standard_Boolean aResult = Standard_False;
|
Standard_Boolean aResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var anObj =
|
GEOM::GEOM_Object_var anObj =
|
||||||
@ -409,15 +445,14 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
|
|||||||
myEditCurrentArgument->setText(aFaceName.arg(anIndex));
|
myEditCurrentArgument->setText(aFaceName.arg(anIndex));
|
||||||
myFace[ aCurrFocus ] = anIndex;
|
myFace[ aCurrFocus ] = anIndex;
|
||||||
displayPreview();
|
displayPreview();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myFace[ aCurrFocus ] = -1;
|
|
||||||
}
|
}
|
||||||
// If face selection of third or fourth tab is activated
|
// If face selection of third or fourth tab is activated
|
||||||
else if (aCurrFocus == Faces || aCurrFocus == Edges) {
|
else if (aCurrFocus == Faces || aCurrFocus == Edges) {
|
||||||
|
if (aCurrFocus == Faces) myFaces.Clear();
|
||||||
|
else myEdges.Clear();
|
||||||
if (aSelList.Extent() == 1) {
|
if (aSelList.Extent() == 1) {
|
||||||
Standard_Boolean aResult = Standard_False;
|
Standard_Boolean aResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var anObj =
|
GEOM::GEOM_Object_var anObj =
|
||||||
@ -446,80 +481,50 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
|
|||||||
myEdges = anIndexes;
|
myEdges = anIndexes;
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myFaces.Clear();
|
|
||||||
myEdges.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear selection
|
||||||
//=================================================================================
|
if (aCurrFocus != Faces && aCurrFocus != Edges) {
|
||||||
// function : LineEditReturnPressed()
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
// purpose :
|
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||||
//=================================================================================
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
void OperationGUI_ChamferDlg::LineEditReturnPressed()
|
this, SLOT(SelectionIntoArgument()));
|
||||||
{
|
|
||||||
QLineEdit* aSender = ( QLineEdit* )sender();
|
|
||||||
|
|
||||||
QMap< int, QLineEdit* >::iterator anIterLE;
|
|
||||||
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
|
|
||||||
if ( anIterLE.value() == aSender )
|
|
||||||
myEditCurrentArgument = anIterLE.value();
|
|
||||||
|
|
||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (getConstructorId()) {
|
||||||
//=================================================================================
|
case 1:
|
||||||
// function : RadioButtonPressed()
|
if (aCurrFocus == MainObj2) {
|
||||||
// purpose :
|
if (!myShape->_is_nil() && myFace[ Face1 ] == -1)
|
||||||
//=================================================================================
|
mySelBtn[ Face1 ]->click();
|
||||||
void OperationGUI_ChamferDlg::RadioButtonPressed()
|
}
|
||||||
{
|
else if (aCurrFocus == Face1) {
|
||||||
const QObject* s = sender();
|
if (myFace[ Face1 ] != -1 && myFace[ Face2 ] == -1)
|
||||||
bool flag = s == myRadioButton[ RadioButton21 ] ||
|
mySelBtn[ Face2 ]->click();
|
||||||
s == myRadioButton[ RadioButton31 ] ||
|
}
|
||||||
s == myRadioButton[ RadioButton41 ];
|
else if (aCurrFocus == Face2) {
|
||||||
|
if (myFace[ Face2 ] != -1 && myShape->_is_nil())
|
||||||
myRadioButton[ RadioButton21 ]->blockSignals( true );
|
mySelBtn[ MainObj2 ]->click();
|
||||||
myRadioButton[ RadioButton22 ]->blockSignals( true );
|
}
|
||||||
myRadioButton[ RadioButton31 ]->blockSignals( true );
|
break;
|
||||||
myRadioButton[ RadioButton32 ]->blockSignals( true );
|
case 2:
|
||||||
myRadioButton[ RadioButton41 ]->blockSignals( true );
|
if (aCurrFocus == MainObj3) {
|
||||||
myRadioButton[ RadioButton42 ]->blockSignals( true );
|
if (!myShape->_is_nil() && myFaces.Extent() == 0)
|
||||||
|
mySelBtn[ Faces ]->click();
|
||||||
myRadioButton[ RadioButton21 ]->setChecked( flag );
|
}
|
||||||
myRadioButton[ RadioButton31 ]->setChecked( flag );
|
break;
|
||||||
myRadioButton[ RadioButton41 ]->setChecked( flag );
|
case 3:
|
||||||
myRadioButton[ RadioButton22 ]->setChecked( !flag );
|
if (aCurrFocus == MainObj4) {
|
||||||
myRadioButton[ RadioButton32 ]->setChecked( !flag );
|
if (!myShape->_is_nil() && myEdges.Extent() == 0)
|
||||||
myRadioButton[ RadioButton42 ]->setChecked( !flag );
|
mySelBtn[ Edges ]->click();
|
||||||
mySpinBox[ SpinBox21 ]->setEnabled( flag );
|
}
|
||||||
mySpinBox[ SpinBox22 ]->setEnabled( flag );
|
break;
|
||||||
mySpinBox[ SpinBox31 ]->setEnabled( flag );
|
default:
|
||||||
mySpinBox[ SpinBox32 ]->setEnabled( flag );
|
break;
|
||||||
mySpinBox[ SpinBox41 ]->setEnabled( flag );
|
}
|
||||||
mySpinBox[ SpinBox42 ]->setEnabled( flag );
|
|
||||||
mySpinBox[ SpinBox23 ]->setEnabled( !flag );
|
|
||||||
mySpinBox[ SpinBox24 ]->setEnabled( !flag );
|
|
||||||
mySpinBox[ SpinBox33 ]->setEnabled( !flag );
|
|
||||||
mySpinBox[ SpinBox34 ]->setEnabled( !flag );
|
|
||||||
mySpinBox[ SpinBox43 ]->setEnabled( !flag );
|
|
||||||
mySpinBox[ SpinBox44 ]->setEnabled( !flag );
|
|
||||||
|
|
||||||
myRadioButton[ RadioButton21 ]->blockSignals( false );
|
|
||||||
myRadioButton[ RadioButton22 ]->blockSignals( false );
|
|
||||||
myRadioButton[ RadioButton31 ]->blockSignals( false );
|
|
||||||
myRadioButton[ RadioButton32 ]->blockSignals( false );
|
|
||||||
myRadioButton[ RadioButton41 ]->blockSignals( false );
|
|
||||||
myRadioButton[ RadioButton42 ]->blockSignals( false );
|
|
||||||
|
|
||||||
displayPreview();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
@ -527,19 +532,47 @@ void OperationGUI_ChamferDlg::RadioButtonPressed()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_ChamferDlg::SetEditCurrentArgument()
|
void OperationGUI_ChamferDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* aSender = ( QPushButton* )sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
QMap< int, QPushButton* >::iterator anIter;
|
QMap< int, QPushButton* >::iterator anIter;
|
||||||
for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter) {
|
for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter) {
|
||||||
if ( anIter.value() == aSender ) {
|
if (anIter.value() == send) {
|
||||||
mySelName[ anIter.key() ]->setFocus();
|
mySelName[ anIter.key() ]->setFocus();
|
||||||
myEditCurrentArgument = mySelName[ anIter.key() ];
|
myEditCurrentArgument = mySelName[ anIter.key() ];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
anIter.value()->setDown(false);
|
||||||
|
mySelName[ anIter.key() ]->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// enable line edit
|
||||||
|
myEditCurrentArgument->setEnabled(true);
|
||||||
|
myEditCurrentArgument->setFocus();
|
||||||
|
// after setFocus(), because it will be setDown(false) when loses focus
|
||||||
|
send->setDown(true);
|
||||||
|
|
||||||
activateSelection();
|
activateSelection();
|
||||||
|
|
||||||
|
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||||
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : LineEditReturnPressed()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void OperationGUI_ChamferDlg::LineEditReturnPressed()
|
||||||
|
{
|
||||||
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
|
|
||||||
|
QMap< int, QLineEdit* >::iterator anIterLE;
|
||||||
|
for (anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE)
|
||||||
|
if (anIterLE.value() == send)
|
||||||
|
myEditCurrentArgument = anIterLE.value();
|
||||||
|
|
||||||
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
@ -549,14 +582,10 @@ void OperationGUI_ChamferDlg::ActivateThisDialog()
|
|||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
|
|
||||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
// reinit, because some selected objects could be removed
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
Init();
|
||||||
|
|
||||||
activateSelection();
|
|
||||||
displayPreview();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -567,7 +596,6 @@ void OperationGUI_ChamferDlg::enterEvent( QEvent* )
|
|||||||
this->ActivateThisDialog();
|
this->ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -577,7 +605,6 @@ void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double )
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createSelWg()
|
// function : createSelWg()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -624,50 +651,14 @@ void OperationGUI_ChamferDlg::createRadioWg( const QString& theLbl1,
|
|||||||
theLayout->addWidget(mySpinBox[ theSpin2Id ], row, 5);
|
theLayout->addWidget(mySpinBox[ theSpin2Id ], row, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : reset()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void OperationGUI_ChamferDlg::reset()
|
|
||||||
{
|
|
||||||
// Set Initial values of spinboxes
|
|
||||||
QMap< int, QDoubleSpinBox* >::iterator anIter;
|
|
||||||
for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
|
|
||||||
anIter.value()->setValue( 5 );
|
|
||||||
|
|
||||||
// clear line edits
|
|
||||||
QMap< int, QLineEdit* >::iterator anIterLE;
|
|
||||||
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
|
|
||||||
anIterLE.value()->setText( "" );
|
|
||||||
|
|
||||||
// constructor id
|
|
||||||
int aConstructorId = getConstructorId();
|
|
||||||
|
|
||||||
if ( aConstructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];
|
|
||||||
else if ( aConstructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];
|
|
||||||
else if ( aConstructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ];
|
|
||||||
else myEditCurrentArgument = mySelName[ MainObj4 ];
|
|
||||||
|
|
||||||
myShape = GEOM::GEOM_Object::_nil();
|
|
||||||
|
|
||||||
myFaces.Clear();
|
|
||||||
myEdges.Clear();
|
|
||||||
myFace[ Face1 ] = -1;
|
|
||||||
myFace[ Face2 ] = -1;
|
|
||||||
|
|
||||||
erasePreview( true );
|
|
||||||
|
|
||||||
activateSelection();
|
|
||||||
|
|
||||||
enableWidgets();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : activateSelection
|
// function : activateSelection
|
||||||
// purpose : Activate selection in accordance with myEditCurrentArgument
|
// purpose : Activate selection in accordance with myEditCurrentArgument
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_ChamferDlg::activateSelection()
|
void OperationGUI_ChamferDlg::activateSelection()
|
||||||
{
|
{
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
if (!myShape->_is_nil() &&
|
if (!myShape->_is_nil() &&
|
||||||
(myEditCurrentArgument == mySelName[ Face1 ] ||
|
(myEditCurrentArgument == mySelName[ Face1 ] ||
|
||||||
myEditCurrentArgument == mySelName[ Face2 ] ||
|
myEditCurrentArgument == mySelName[ Face2 ] ||
|
||||||
@ -685,7 +676,8 @@ void OperationGUI_ChamferDlg::activateSelection()
|
|||||||
globalSelection(aMap);
|
globalSelection(aMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionIntoArgument();
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -700,8 +692,8 @@ void OperationGUI_ChamferDlg::enableWidgets()
|
|||||||
|
|
||||||
if (anId == 1)
|
if (anId == 1)
|
||||||
{
|
{
|
||||||
mySelName[ Face1 ]->setEnabled( toEnable );
|
//mySelName[ Face1 ]->setEnabled(toEnable);
|
||||||
mySelName[ Face2 ]->setEnabled( toEnable );
|
//mySelName[ Face2 ]->setEnabled(toEnable);
|
||||||
mySelBtn[ Face1 ]->setEnabled(toEnable);
|
mySelBtn[ Face1 ]->setEnabled(toEnable);
|
||||||
mySelBtn[ Face2 ]->setEnabled(toEnable);
|
mySelBtn[ Face2 ]->setEnabled(toEnable);
|
||||||
|
|
||||||
@ -715,18 +707,20 @@ void OperationGUI_ChamferDlg::enableWidgets()
|
|||||||
}
|
}
|
||||||
else if (anId == 2)
|
else if (anId == 2)
|
||||||
{
|
{
|
||||||
mySelName[ Faces ]->setEnabled( toEnable );
|
//mySelName[ Faces ]->setEnabled(toEnable);
|
||||||
|
mySelBtn[ Faces ]->setEnabled(toEnable);
|
||||||
if (!toEnable) {
|
if (!toEnable) {
|
||||||
mySelName[ Faces ]->setText("");
|
mySelName[ Faces ]->setText("");
|
||||||
myFaces = -1;
|
myFaces.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (anId == 3) {
|
else if (anId == 3) {
|
||||||
mySelName[ Edges ]->setEnabled( toEnable );
|
//mySelName[ Edges ]->setEnabled(toEnable);
|
||||||
|
mySelBtn[ Edges ]->setEnabled(toEnable);
|
||||||
|
|
||||||
if (!toEnable) {
|
if (!toEnable) {
|
||||||
mySelName[ Edges ]->setText("");
|
mySelName[ Edges ]->setText("");
|
||||||
myEdges = -1;
|
myEdges.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -741,7 +735,7 @@ GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : isValid()
|
||||||
// purpose : Verify validity of input data
|
// purpose : Verify validity of input data
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool OperationGUI_ChamferDlg::isValid (QString&)
|
bool OperationGUI_ChamferDlg::isValid (QString&)
|
||||||
@ -769,9 +763,8 @@ bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
|
|||||||
|
|
||||||
int anId = getConstructorId();
|
int anId = getConstructorId();
|
||||||
if (anId == 0) {
|
if (anId == 0) {
|
||||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(
|
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||||
getOperation() )->MakeChamferAll( myShape,
|
MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value());
|
||||||
mySpinBox[ SpinBox1 ]->value() );
|
|
||||||
}
|
}
|
||||||
else if (anId == 1) {
|
else if (anId == 1) {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@ -800,14 +793,14 @@ bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
|
|||||||
anArray[ i - 1 ] = myFaces(i);
|
anArray[ i - 1 ] = myFaces(i);
|
||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(
|
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||||
getOperation() )->MakeChamferFaces( myShape,
|
MakeChamferFaces(myShape,
|
||||||
mySpinBox[ SpinBox31 ]->value(),
|
mySpinBox[ SpinBox31 ]->value(),
|
||||||
mySpinBox[ SpinBox32 ]->value(),
|
mySpinBox[ SpinBox32 ]->value(),
|
||||||
anArray);
|
anArray);
|
||||||
else
|
else
|
||||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(
|
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||||
getOperation() )->MakeChamferFacesAD( myShape,
|
MakeChamferFacesAD(myShape,
|
||||||
mySpinBox[ SpinBox33 ]->value(),
|
mySpinBox[ SpinBox33 ]->value(),
|
||||||
mySpinBox[ SpinBox34 ]->value() * PI180,
|
mySpinBox[ SpinBox34 ]->value() * PI180,
|
||||||
anArray);
|
anArray);
|
||||||
@ -819,13 +812,17 @@ bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
|
|||||||
anArray[ i - 1 ] = myEdges(i);
|
anArray[ i - 1 ] = myEdges(i);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||||
MakeChamferEdges( myShape, mySpinBox[ SpinBox41 ]->value(),
|
MakeChamferEdges(myShape,
|
||||||
mySpinBox[ SpinBox42 ]->value(), anArray );
|
mySpinBox[ SpinBox41 ]->value(),
|
||||||
|
mySpinBox[ SpinBox42 ]->value(),
|
||||||
|
anArray);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||||
MakeChamferEdgesAD( myShape, mySpinBox[ SpinBox43 ]->value(),
|
MakeChamferEdgesAD(myShape,
|
||||||
mySpinBox[ SpinBox44 ]->value() * PI180, anArray );
|
mySpinBox[ SpinBox43 ]->value(),
|
||||||
|
mySpinBox[ SpinBox44 ]->value() * PI180,
|
||||||
|
anArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,3 +831,50 @@ bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : RadioButtonPressed()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void OperationGUI_ChamferDlg::RadioButtonPressed()
|
||||||
|
{
|
||||||
|
const QObject* s = sender();
|
||||||
|
bool flag = s == myRadioButton[ RadioButton21 ] ||
|
||||||
|
s == myRadioButton[ RadioButton31 ] ||
|
||||||
|
s == myRadioButton[ RadioButton41 ];
|
||||||
|
|
||||||
|
myRadioButton[ RadioButton21 ]->blockSignals(true);
|
||||||
|
myRadioButton[ RadioButton22 ]->blockSignals(true);
|
||||||
|
myRadioButton[ RadioButton31 ]->blockSignals(true);
|
||||||
|
myRadioButton[ RadioButton32 ]->blockSignals(true);
|
||||||
|
myRadioButton[ RadioButton41 ]->blockSignals(true);
|
||||||
|
myRadioButton[ RadioButton42 ]->blockSignals(true);
|
||||||
|
|
||||||
|
myRadioButton[ RadioButton21 ]->setChecked(flag);
|
||||||
|
myRadioButton[ RadioButton31 ]->setChecked(flag);
|
||||||
|
myRadioButton[ RadioButton41 ]->setChecked(flag);
|
||||||
|
myRadioButton[ RadioButton22 ]->setChecked(!flag);
|
||||||
|
myRadioButton[ RadioButton32 ]->setChecked(!flag);
|
||||||
|
myRadioButton[ RadioButton42 ]->setChecked(!flag);
|
||||||
|
mySpinBox[ SpinBox21 ]->setEnabled(flag);
|
||||||
|
mySpinBox[ SpinBox22 ]->setEnabled(flag);
|
||||||
|
mySpinBox[ SpinBox31 ]->setEnabled(flag);
|
||||||
|
mySpinBox[ SpinBox32 ]->setEnabled(flag);
|
||||||
|
mySpinBox[ SpinBox41 ]->setEnabled(flag);
|
||||||
|
mySpinBox[ SpinBox42 ]->setEnabled(flag);
|
||||||
|
mySpinBox[ SpinBox23 ]->setEnabled(!flag);
|
||||||
|
mySpinBox[ SpinBox24 ]->setEnabled(!flag);
|
||||||
|
mySpinBox[ SpinBox33 ]->setEnabled(!flag);
|
||||||
|
mySpinBox[ SpinBox34 ]->setEnabled(!flag);
|
||||||
|
mySpinBox[ SpinBox43 ]->setEnabled(!flag);
|
||||||
|
mySpinBox[ SpinBox44 ]->setEnabled(!flag);
|
||||||
|
|
||||||
|
myRadioButton[ RadioButton21 ]->blockSignals(false);
|
||||||
|
myRadioButton[ RadioButton22 ]->blockSignals(false);
|
||||||
|
myRadioButton[ RadioButton31 ]->blockSignals(false);
|
||||||
|
myRadioButton[ RadioButton32 ]->blockSignals(false);
|
||||||
|
myRadioButton[ RadioButton41 ]->blockSignals(false);
|
||||||
|
myRadioButton[ RadioButton42 ]->blockSignals(false);
|
||||||
|
|
||||||
|
displayPreview();
|
||||||
|
}
|
||||||
|
@ -81,7 +81,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent( QEvent* );
|
void enterEvent( QEvent* );
|
||||||
void reset();
|
|
||||||
void createSelWg( const QString&, QPixmap&, QWidget*,
|
void createSelWg( const QString&, QPixmap&, QWidget*,
|
||||||
QGridLayout*, const int );
|
QGridLayout*, const int );
|
||||||
void createRadioWg( const QString&, const QString&, QWidget*,
|
void createRadioWg( const QString&, const QString&, QWidget*,
|
||||||
@ -97,6 +96,9 @@ private:
|
|||||||
TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces )
|
TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces )
|
||||||
TColStd_IndexedMapOfInteger myEdges; // indexes of edges from fourth tab (Edges)
|
TColStd_IndexedMapOfInteger myEdges; // indexes of edges from fourth tab (Edges)
|
||||||
|
|
||||||
|
// to initialize the first selection field with a selected object on the dialog creation
|
||||||
|
bool myInitial;
|
||||||
|
|
||||||
QGroupBox* myGrp1;
|
QGroupBox* myGrp1;
|
||||||
QGroupBox* myGrp2;
|
QGroupBox* myGrp2;
|
||||||
QGroupBox* myGrp3;
|
QGroupBox* myGrp3;
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
#include <OCCViewer_ViewModel.h>
|
#include <OCCViewer_ViewModel.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
|
|
||||||
@ -51,7 +52,8 @@
|
|||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
OperationGUI_FilletDlg::OperationGUI_FilletDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
|
OperationGUI_FilletDlg::OperationGUI_FilletDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, false )
|
: GEOMBase_Skeleton(theGeometryGUI, parent, false),
|
||||||
|
myInitial(true)
|
||||||
{
|
{
|
||||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FILLET_ALL")));
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FILLET_ALL")));
|
||||||
@ -106,6 +108,7 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg( GeometryGUI* theGeometryGUI, QWi
|
|||||||
layout->addWidget(Group3);
|
layout->addWidget(Group3);
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
// Set range of spinboxes
|
||||||
double SpecificStep = 10.0;
|
double SpecificStep = 10.0;
|
||||||
initSpinBox(Group1->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
initSpinBox(Group1->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||||
initSpinBox(Group2->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
initSpinBox(Group2->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||||
@ -117,11 +120,10 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg( GeometryGUI* theGeometryGUI, QWi
|
|||||||
|
|
||||||
setHelpFileName("fillet_operation_page.html");
|
setHelpFileName("fillet_operation_page.html");
|
||||||
|
|
||||||
/* Initialisations */
|
// Initialisation
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~OperationGUI_FilletDlg()
|
// function : ~OperationGUI_FilletDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -130,15 +132,34 @@ OperationGUI_FilletDlg::~OperationGUI_FilletDlg()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_FilletDlg::Init()
|
void OperationGUI_FilletDlg::Init()
|
||||||
{
|
{
|
||||||
myConstructorId = -1;
|
// Set Initial values of spinboxes
|
||||||
reset();
|
Group1->SpinBox_DX->setValue(5);
|
||||||
|
Group2->SpinBox_DX->setValue(5);
|
||||||
|
Group2->SpinBox_DY->setValue(5);
|
||||||
|
Group2->SpinBox_DZ->setValue(5);
|
||||||
|
Group3->SpinBox_DX->setValue(5);
|
||||||
|
Group3->SpinBox_DY->setValue(5);
|
||||||
|
Group3->SpinBox_DZ->setValue(5);
|
||||||
|
|
||||||
|
// Clear line edits
|
||||||
|
Group1->LineEdit1->setText("");
|
||||||
|
Group2->LineEdit1->setText("");
|
||||||
|
Group2->LineEdit2->setText("");
|
||||||
|
Group3->LineEdit1->setText("");
|
||||||
|
Group3->LineEdit2->setText("");
|
||||||
|
|
||||||
|
myShape = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
myFaces.Clear();
|
||||||
|
myEdges.Clear();
|
||||||
|
|
||||||
|
// signals and slots connections
|
||||||
|
|
||||||
// main buttons
|
// main buttons
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() ));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() ));
|
||||||
@ -174,23 +195,19 @@ void OperationGUI_FilletDlg::Init()
|
|||||||
connect(Group3->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
|
connect(Group3->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
|
||||||
connect(Group3->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
|
connect(Group3->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
|
||||||
|
|
||||||
// selection
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
initName(tr("GEOM_FILLET"));
|
initName(tr("GEOM_FILLET"));
|
||||||
|
|
||||||
|
myConstructorId = -1;
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ConstructorsClicked()
|
// function : ConstructorsClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId)
|
void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId)
|
||||||
{
|
{
|
||||||
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
|
if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
|
||||||
!= OCCViewer_Viewer::Type()) {
|
!= OCCViewer_Viewer::Type()) {
|
||||||
mainFrame()->RadioButton1->setChecked(true);
|
mainFrame()->RadioButton1->setChecked(true);
|
||||||
return;
|
return;
|
||||||
@ -244,27 +261,43 @@ void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( constructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1;
|
if (constructorId == 0) Group1->PushButton1->click();
|
||||||
else if ( constructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1;
|
else if (constructorId == 1) Group2->PushButton1->click();
|
||||||
else myEditCurrentArgument = Group3->LineEdit1;
|
else Group3->PushButton1->click();
|
||||||
|
|
||||||
activateSelection();
|
|
||||||
enableWidgets();
|
enableWidgets();
|
||||||
|
|
||||||
|
if (myInitial) {
|
||||||
|
myInitial = false;
|
||||||
|
SelectionIntoArgument();
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (!myShape->_is_nil()) {
|
if (!myShape->_is_nil()) {
|
||||||
myEditCurrentArgument->setText(GEOMBase::GetName(myShape));
|
myEditCurrentArgument->setText(GEOMBase::GetName(myShape));
|
||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
|
switch (getConstructorId()) {
|
||||||
|
case 1:
|
||||||
|
if (myEdges.Extent() == 0)
|
||||||
|
Group2->PushButton2->click();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (myFaces.Extent() == 0)
|
||||||
|
Group3->PushButton2->click();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
qApp->processEvents();
|
|
||||||
updateGeometry();
|
|
||||||
resize( minimumSize() );
|
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qApp->processEvents();
|
||||||
|
updateGeometry();
|
||||||
|
resize(minimumSize());
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -276,7 +309,6 @@ void OperationGUI_FilletDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -287,12 +319,14 @@ bool OperationGUI_FilletDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate selection and connect selection manager
|
||||||
|
ConstructorsClicked(getConstructorId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection has changed
|
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_FilletDlg::SelectionIntoArgument()
|
void OperationGUI_FilletDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
@ -308,6 +342,7 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
|
|||||||
myEditCurrentArgument == Group2->LineEdit1 ||
|
myEditCurrentArgument == Group2->LineEdit1 ||
|
||||||
myEditCurrentArgument == Group3->LineEdit1)
|
myEditCurrentArgument == Group3->LineEdit1)
|
||||||
{
|
{
|
||||||
|
myShape = GEOM::GEOM_Object::_nil();
|
||||||
if (aSelList.Extent() == 1) {
|
if (aSelList.Extent() == 1) {
|
||||||
Standard_Boolean aResult = Standard_False;
|
Standard_Boolean aResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var anObj =
|
GEOM::GEOM_Object_var anObj =
|
||||||
@ -317,18 +352,17 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
|
|||||||
myShape = anObj;
|
myShape = anObj;
|
||||||
myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
|
myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
|
||||||
displayPreview();
|
displayPreview();
|
||||||
enableWidgets();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myShape = GEOM::GEOM_Object::_nil();
|
|
||||||
enableWidgets();
|
enableWidgets();
|
||||||
}
|
}
|
||||||
// If face or edge selection is activated
|
// If face or edge selection is activated
|
||||||
else if (myEditCurrentArgument == Group2->LineEdit2 ||
|
else if (myEditCurrentArgument == Group2->LineEdit2 ||
|
||||||
myEditCurrentArgument == Group3->LineEdit2)
|
myEditCurrentArgument == Group3->LineEdit2)
|
||||||
{
|
{
|
||||||
|
if (myEditCurrentArgument == Group2->LineEdit2) myEdges.Clear();
|
||||||
|
else myFaces.Clear();
|
||||||
if (aSelList.Extent() == 1) {
|
if (aSelList.Extent() == 1) {
|
||||||
Standard_Boolean aResult = Standard_False;
|
Standard_Boolean aResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var anObj =
|
GEOM::GEOM_Object_var anObj =
|
||||||
@ -345,8 +379,9 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
aName = QString(GEOMBase::GetName(anObj)) + QString(":%1").arg(anIndex);
|
aName = QString(GEOMBase::GetName(anObj)) + QString(":%1").arg(anIndex);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
aName = tr("GEOM_MEN_POPUP_NAME").arg(anIndexes.Extent());
|
aName = tr("GEOM_MEN_POPUP_NAME").arg(anIndexes.Extent());
|
||||||
|
}
|
||||||
|
|
||||||
myEditCurrentArgument->setText(aName);
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
@ -356,12 +391,80 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
|
|||||||
myFaces = anIndexes;
|
myFaces = anIndexes;
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myFaces.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear selection
|
||||||
|
if (!(myEditCurrentArgument == Group2->LineEdit2 ||
|
||||||
|
myEditCurrentArgument == Group3->LineEdit2)) {
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (getConstructorId()) {
|
||||||
|
case 1:
|
||||||
|
if (myEditCurrentArgument == Group2->LineEdit1) {
|
||||||
|
if (!myShape->_is_nil() && myEdges.Extent() == 0)
|
||||||
|
Group2->PushButton2->click();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (myEditCurrentArgument == Group3->LineEdit1) {
|
||||||
|
if (!myShape->_is_nil() && myFaces.Extent() == 0)
|
||||||
|
Group3->PushButton2->click();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SetEditCurrentArgument()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void OperationGUI_FilletDlg::SetEditCurrentArgument()
|
||||||
|
{
|
||||||
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
if (send == Group1->PushButton1) {
|
||||||
|
myEditCurrentArgument = Group1->LineEdit1;
|
||||||
|
}
|
||||||
|
else if (send == Group2->PushButton1) {
|
||||||
|
myEditCurrentArgument = Group2->LineEdit1;
|
||||||
|
Group2->PushButton2->setDown(false);
|
||||||
|
Group2->LineEdit2->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (send == Group2->PushButton2) {
|
||||||
|
myEditCurrentArgument = Group2->LineEdit2;
|
||||||
|
Group2->PushButton1->setDown(false);
|
||||||
|
Group2->LineEdit1->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (send == Group3->PushButton1) {
|
||||||
|
myEditCurrentArgument = Group3->LineEdit1;
|
||||||
|
Group3->PushButton2->setDown(false);
|
||||||
|
Group3->LineEdit2->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (send == Group3->PushButton2) {
|
||||||
|
myEditCurrentArgument = Group3->LineEdit2;
|
||||||
|
Group3->PushButton1->setDown(false);
|
||||||
|
Group3->LineEdit1->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// enable line edit
|
||||||
|
myEditCurrentArgument->setEnabled(true);
|
||||||
|
myEditCurrentArgument->setFocus();
|
||||||
|
// after setFocus(), because it will be setDown(false) when loses focus
|
||||||
|
send->setDown(true);
|
||||||
|
|
||||||
|
activateSelection();
|
||||||
|
|
||||||
|
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||||
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -384,40 +487,6 @@ void OperationGUI_FilletDlg::LineEditReturnPressed()
|
|||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : SetEditCurrentArgument()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void OperationGUI_FilletDlg::SetEditCurrentArgument()
|
|
||||||
{
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
|
||||||
|
|
||||||
if ( send == Group1->PushButton1 ) {
|
|
||||||
Group1->LineEdit1->setFocus();
|
|
||||||
myEditCurrentArgument = Group1->LineEdit1;
|
|
||||||
}
|
|
||||||
else if ( send == Group2->PushButton1 ) {
|
|
||||||
Group2->LineEdit1->setFocus();
|
|
||||||
myEditCurrentArgument = Group2->LineEdit1;
|
|
||||||
}
|
|
||||||
else if ( send == Group2->PushButton2 ) {
|
|
||||||
Group2->LineEdit2->setFocus();
|
|
||||||
myEditCurrentArgument = Group2->LineEdit2;
|
|
||||||
}
|
|
||||||
else if ( send == Group3->PushButton1 ) {
|
|
||||||
Group3->LineEdit1->setFocus();
|
|
||||||
myEditCurrentArgument = Group3->LineEdit1;
|
|
||||||
}
|
|
||||||
else if ( send == Group3->PushButton2 ) {
|
|
||||||
Group3->LineEdit1->setFocus();
|
|
||||||
myEditCurrentArgument = Group3->LineEdit2;
|
|
||||||
}
|
|
||||||
|
|
||||||
activateSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -426,14 +495,10 @@ void OperationGUI_FilletDlg::ActivateThisDialog()
|
|||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
// reinit, because some selected objects could be removed
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
Init();
|
||||||
|
|
||||||
activateSelection();
|
|
||||||
displayPreview();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -453,52 +518,13 @@ void OperationGUI_FilletDlg::ValueChangedInSpinBox( double )
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : reset()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void OperationGUI_FilletDlg::reset()
|
|
||||||
{
|
|
||||||
// Set Initial values of spinboxes
|
|
||||||
Group1->SpinBox_DX->setValue( 5 );
|
|
||||||
Group2->SpinBox_DX->setValue( 5 );
|
|
||||||
Group2->SpinBox_DY->setValue( 5 );
|
|
||||||
Group2->SpinBox_DZ->setValue( 5 );
|
|
||||||
Group3->SpinBox_DX->setValue( 5 );
|
|
||||||
Group3->SpinBox_DY->setValue( 5 );
|
|
||||||
Group3->SpinBox_DZ->setValue( 5 );
|
|
||||||
|
|
||||||
Group1->LineEdit1->setText( "" );
|
|
||||||
Group2->LineEdit1->setText( "" );
|
|
||||||
Group2->LineEdit2->setText( "" );
|
|
||||||
Group3->LineEdit1->setText( "" );
|
|
||||||
Group3->LineEdit2->setText( "" );
|
|
||||||
|
|
||||||
// constructor id
|
|
||||||
int aConstructorId = getConstructorId();
|
|
||||||
|
|
||||||
if ( aConstructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1;
|
|
||||||
else if ( aConstructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1;
|
|
||||||
else myEditCurrentArgument = Group3->LineEdit1;
|
|
||||||
|
|
||||||
myShape = GEOM::GEOM_Object::_nil();
|
|
||||||
|
|
||||||
myFaces.Clear();
|
|
||||||
myEdges.Clear();
|
|
||||||
|
|
||||||
erasePreview( true );
|
|
||||||
|
|
||||||
activateSelection();
|
|
||||||
|
|
||||||
enableWidgets();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : activateSelection
|
// function : activateSelection
|
||||||
// purpose : Activate selection in accordance with myEditCurrentArgument
|
// purpose : Activate selection in accordance with myEditCurrentArgument
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_FilletDlg::activateSelection()
|
void OperationGUI_FilletDlg::activateSelection()
|
||||||
{
|
{
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
if (!myShape->_is_nil() && myEditCurrentArgument == Group2->LineEdit2)
|
if (!myShape->_is_nil() && myEditCurrentArgument == Group2->LineEdit2)
|
||||||
localSelection(myShape, TopAbs_EDGE);
|
localSelection(myShape, TopAbs_EDGE);
|
||||||
@ -512,7 +538,8 @@ void OperationGUI_FilletDlg::activateSelection()
|
|||||||
globalSelection(aMap);
|
globalSelection(aMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionIntoArgument();
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -526,7 +553,7 @@ void OperationGUI_FilletDlg::enableWidgets()
|
|||||||
bool toEnable = !myShape->_is_nil();
|
bool toEnable = !myShape->_is_nil();
|
||||||
|
|
||||||
if (anId == 1) {
|
if (anId == 1) {
|
||||||
Group2->LineEdit2->setEnabled( toEnable );
|
//Group2->LineEdit2->setEnabled(toEnable);
|
||||||
Group2->PushButton2->setEnabled(toEnable);
|
Group2->PushButton2->setEnabled(toEnable);
|
||||||
|
|
||||||
if (!toEnable) {
|
if (!toEnable) {
|
||||||
@ -535,7 +562,7 @@ void OperationGUI_FilletDlg::enableWidgets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (anId == 2) {
|
else if (anId == 2) {
|
||||||
Group3->LineEdit2->setEnabled( toEnable );
|
//Group3->LineEdit2->setEnabled(toEnable);
|
||||||
Group3->PushButton2->setEnabled(toEnable);
|
Group3->PushButton2->setEnabled(toEnable);
|
||||||
|
|
||||||
if (!toEnable) {
|
if (!toEnable) {
|
||||||
@ -555,7 +582,7 @@ GEOM::GEOM_IOperations_ptr OperationGUI_FilletDlg::createOperation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : isValid()
|
||||||
// purpose : Verify validity of input data
|
// purpose : Verify validity of input data
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool OperationGUI_FilletDlg::isValid (QString&)
|
bool OperationGUI_FilletDlg::isValid (QString&)
|
||||||
@ -579,8 +606,8 @@ bool OperationGUI_FilletDlg::execute( ObjectList& objects )
|
|||||||
|
|
||||||
int anId = getConstructorId();
|
int anId = getConstructorId();
|
||||||
if (anId == 0)
|
if (anId == 0)
|
||||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(
|
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||||
getOperation() )->MakeFilletAll( myShape, getRadius() );
|
MakeFilletAll(myShape, getRadius());
|
||||||
else if (anId == 1) {
|
else if (anId == 1) {
|
||||||
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
|
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
|
||||||
aList->length(myEdges.Extent());
|
aList->length(myEdges.Extent());
|
||||||
@ -639,7 +666,6 @@ double OperationGUI_FilletDlg::getRadius() const
|
|||||||
// function : RadiobuttonClicked
|
// function : RadiobuttonClicked
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
|
||||||
void OperationGUI_FilletDlg::RadioButtonClicked()
|
void OperationGUI_FilletDlg::RadioButtonClicked()
|
||||||
{
|
{
|
||||||
const QObject* s = sender();
|
const QObject* s = sender();
|
||||||
|
@ -65,7 +65,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent( QEvent* );
|
void enterEvent( QEvent* );
|
||||||
void reset();
|
|
||||||
void activateSelection();
|
void activateSelection();
|
||||||
void enableWidgets();
|
void enableWidgets();
|
||||||
double getRadius() const;
|
double getRadius() const;
|
||||||
@ -77,6 +76,9 @@ private:
|
|||||||
TColStd_IndexedMapOfInteger myEdges;
|
TColStd_IndexedMapOfInteger myEdges;
|
||||||
TColStd_IndexedMapOfInteger myFaces;
|
TColStd_IndexedMapOfInteger myFaces;
|
||||||
|
|
||||||
|
// to initialize the first selection field with a selected object on the dialog creation
|
||||||
|
bool myInitial;
|
||||||
|
|
||||||
DlgRef_1Sel1Spin* Group1;
|
DlgRef_1Sel1Spin* Group1;
|
||||||
DlgRef_2Sel3Spin2Rb* Group2;
|
DlgRef_2Sel3Spin2Rb* Group2;
|
||||||
DlgRef_2Sel3Spin2Rb* Group3;
|
DlgRef_2Sel3Spin2Rb* Group3;
|
||||||
|
@ -25,15 +25,15 @@
|
|||||||
|
|
||||||
#include "OperationGUI_GetShapesOnShapeDlg.h"
|
#include "OperationGUI_GetShapesOnShapeDlg.h"
|
||||||
|
|
||||||
|
#include <DlgRef.h>
|
||||||
|
#include <GeometryGUI.h>
|
||||||
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SUIT_ResourceMgr.h>
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
#include <DlgRef.h>
|
|
||||||
#include <GeometryGUI.h>
|
|
||||||
#include <GEOMBase.h>
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// class : OperationGUI_GetShapesOnShapeDlg()
|
// class : OperationGUI_GetShapesOnShapeDlg()
|
||||||
// purpose : Constructs a OperationGUI_GetShapesOnShapeDlg which is a child of
|
// purpose : Constructs a OperationGUI_GetShapesOnShapeDlg which is a child of
|
||||||
@ -51,6 +51,7 @@ OperationGUI_GetShapesOnShapeDlg::OperationGUI_GetShapesOnShapeDlg( GeometryGUI*
|
|||||||
|
|
||||||
setWindowTitle(tr("GEOM_SHAPES_ON_SHAPE_TITLE"));
|
setWindowTitle(tr("GEOM_SHAPES_ON_SHAPE_TITLE"));
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_SHAPES_ON_SHAPE"));
|
mainFrame()->GroupConstructors->setTitle(tr("GEOM_SHAPES_ON_SHAPE"));
|
||||||
mainFrame()->RadioButton1->setIcon(image0);
|
mainFrame()->RadioButton1->setIcon(image0);
|
||||||
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
|
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
@ -73,6 +74,7 @@ OperationGUI_GetShapesOnShapeDlg::OperationGUI_GetShapesOnShapeDlg( GeometryGUI*
|
|||||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||||
layout->setMargin(0); layout->setSpacing(6);
|
layout->setMargin(0); layout->setSpacing(6);
|
||||||
layout->addWidget(GroupPoints);
|
layout->addWidget(GroupPoints);
|
||||||
|
/***************************************************************/
|
||||||
|
|
||||||
setHelpFileName("shapesonshape_page.html");
|
setHelpFileName("shapesonshape_page.html");
|
||||||
|
|
||||||
@ -93,7 +95,7 @@ OperationGUI_GetShapesOnShapeDlg::~OperationGUI_GetShapesOnShapeDlg()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_GetShapesOnShapeDlg::Init()
|
void OperationGUI_GetShapesOnShapeDlg::Init()
|
||||||
{
|
{
|
||||||
/* type for sub shape selection */
|
// type for sub shape selection
|
||||||
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID"));
|
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID"));
|
||||||
// commented by skl for IPAL19949 - finder isn't allowed such type
|
// commented by skl for IPAL19949 - finder isn't allowed such type
|
||||||
//GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL"));
|
//GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL"));
|
||||||
@ -103,7 +105,7 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
|
|||||||
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE"));
|
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE"));
|
||||||
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX"));
|
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX"));
|
||||||
|
|
||||||
/* type for state selection */
|
// type for state selection
|
||||||
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_IN"));
|
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_IN"));
|
||||||
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_OUT"));
|
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_OUT"));
|
||||||
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_ON"));
|
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_ON"));
|
||||||
@ -112,8 +114,9 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
|
|||||||
|
|
||||||
GroupPoints->LineEdit1->clear();
|
GroupPoints->LineEdit1->clear();
|
||||||
GroupPoints->LineEdit2->clear();
|
GroupPoints->LineEdit2->clear();
|
||||||
|
myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
/* signals and slots connections */
|
// signals and slots connections
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
|
||||||
@ -126,10 +129,8 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
|
|||||||
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
||||||
connect(GroupPoints->ComboBox2, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
connect(GroupPoints->ComboBox2, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
globalSelection( GEOM_ALLSHAPES );
|
|
||||||
|
|
||||||
initName(mainFrame()->GroupConstructors->title());
|
initName(mainFrame()->GroupConstructors->title());
|
||||||
|
|
||||||
@ -139,8 +140,10 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
|
|||||||
GroupPoints->ComboBox2->show();
|
GroupPoints->ComboBox2->show();
|
||||||
GroupPoints->ComboBox2->setCurrentIndex(0);
|
GroupPoints->ComboBox2->setCurrentIndex(0);
|
||||||
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
globalSelection(GEOM_ALLSHAPES);
|
||||||
myEditCurrentArgument->setFocus();
|
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -163,37 +166,53 @@ bool OperationGUI_GetShapesOnShapeDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate first line edit
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection has changed
|
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument()
|
void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = "";
|
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit1) myObject1 = GEOM::GEOM_Object::_nil();
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myObject2 = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
SALOME_ListIO aSelList;
|
SALOME_ListIO aSelList;
|
||||||
aSelMgr->selectedObjects(aSelList);
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
|
QString aName = "";
|
||||||
|
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName, true);
|
||||||
|
|
||||||
if (nbSel > 0) {
|
if (nbSel > 0) {
|
||||||
Standard_Boolean aRes = Standard_False;
|
Standard_Boolean aRes = Standard_False;
|
||||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
|
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(aName);
|
||||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) myObject1 = aSelectedObject;
|
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myObject2 = aSelectedObject;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
myEditCurrentArgument->setText( aString );
|
// 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) {
|
||||||
|
myObject1 = aSelectedObject;
|
||||||
|
if (myObject2->_is_nil())
|
||||||
|
GroupPoints->PushButton2->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
|
myObject2 = aSelectedObject;
|
||||||
|
if (myObject1->_is_nil())
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -204,11 +223,24 @@ void OperationGUI_GetShapesOnShapeDlg::SetEditCurrentArgument()
|
|||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
|
if (send == GroupPoints->PushButton1) {
|
||||||
else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
|
GroupPoints->PushButton2->setDown(false);
|
||||||
|
GroupPoints->LineEdit2->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (send == GroupPoints->PushButton2) {
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->setDown(false);
|
||||||
|
GroupPoints->LineEdit1->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// enable line edit
|
||||||
|
myEditCurrentArgument->setEnabled(true);
|
||||||
myEditCurrentArgument->setFocus();
|
myEditCurrentArgument->setFocus();
|
||||||
SelectionIntoArgument();
|
// after setFocus(), because it will be setDown(false) when loses focus
|
||||||
|
send->setDown(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -232,16 +264,16 @@ void OperationGUI_GetShapesOnShapeDlg::LineEditReturnPressed()
|
|||||||
void OperationGUI_GetShapesOnShapeDlg::ActivateThisDialog()
|
void OperationGUI_GetShapesOnShapeDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
globalSelection( GEOM_ALLSHAPES );
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
// reinit, because some selected objects could be removed
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose : when mouse enter onto the QWidget
|
// purpose : when mouse enter onto the QWidget
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void OperationGUI_GetShapesOnShapeDlg::enterEvent(QEvent * e)
|
void OperationGUI_GetShapesOnShapeDlg::enterEvent (QEvent*)
|
||||||
{
|
{
|
||||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
@ -260,7 +292,7 @@ GEOM::GEOM_IOperations_ptr OperationGUI_GetShapesOnShapeDlg::createOperation()
|
|||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool OperationGUI_GetShapesOnShapeDlg::isValid( QString& msg )
|
bool OperationGUI_GetShapesOnShapeDlg::isValid(QString&)
|
||||||
{
|
{
|
||||||
//Handle(SALOME_InteractiveObject) IO = firstIObject();
|
//Handle(SALOME_InteractiveObject) IO = firstIObject();
|
||||||
//Standard_Boolean testResult;
|
//Standard_Boolean testResult;
|
||||||
@ -298,8 +330,9 @@ bool OperationGUI_GetShapesOnShapeDlg::execute( ObjectList& objects )
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::
|
GEOM::GEOM_Object_var anObj =
|
||||||
_narrow( getOperation() )->GetShapesOnShapeAsCompound( myObject2, myObject1,
|
GEOM::GEOM_IShapesOperations::_narrow(getOperation())->
|
||||||
|
GetShapesOnShapeAsCompound(myObject2, myObject1,
|
||||||
(CORBA::Short) aLimit,
|
(CORBA::Short) aLimit,
|
||||||
aState);
|
aState);
|
||||||
|
|
||||||
|
@ -29,11 +29,12 @@
|
|||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <SUIT_ResourceMgr.h>
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
@ -52,12 +53,14 @@
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
|
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||||
bool modal, Qt::WindowFlags fl)
|
bool modal, Qt::WindowFlags fl)
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||||
|
myInitial(true)
|
||||||
{
|
{
|
||||||
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_POINT" ) ) );
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_AXE" ) ) );
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MIRROR_POINT")));
|
||||||
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_PLANE" ) ) );
|
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MIRROR_AXE")));
|
||||||
QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MIRROR_PLANE")));
|
||||||
|
QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||||
|
|
||||||
setWindowTitle(tr("GEOM_MIRROR_TITLE"));
|
setWindowTitle(tr("GEOM_MIRROR_TITLE"));
|
||||||
|
|
||||||
@ -86,40 +89,40 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( GeometryGUI* theGeomet
|
|||||||
|
|
||||||
setHelpFileName("mirror_operation_page.html");
|
setHelpFileName("mirror_operation_page.html");
|
||||||
|
|
||||||
|
// Activate Create a Copy mode
|
||||||
|
GroupPoints->CheckButton1->setChecked(true);
|
||||||
|
CreateCopyModeChanged(true);
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~TransformationGUI_MirrorDlg()
|
// function : ~TransformationGUI_MirrorDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_MirrorDlg::~TransformationGUI_MirrorDlg()
|
TransformationGUI_MirrorDlg::~TransformationGUI_MirrorDlg()
|
||||||
{
|
{
|
||||||
/* 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()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::Init()
|
void TransformationGUI_MirrorDlg::Init()
|
||||||
{
|
{
|
||||||
/* init variables */
|
// init variables
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
||||||
GroupPoints->LineEdit1->setReadOnly(true);
|
GroupPoints->LineEdit1->setReadOnly(true);
|
||||||
GroupPoints->LineEdit2->setReadOnly(true);
|
GroupPoints->LineEdit2->setReadOnly(true);
|
||||||
|
|
||||||
myArgument = GEOM::GEOM_Object::_nil();
|
GroupPoints->LineEdit1->setText("");
|
||||||
|
GroupPoints->LineEdit2->setText("");
|
||||||
|
|
||||||
// Activate Create a Copy mode
|
myArgument = GEOM::GEOM_Object::_nil();
|
||||||
GroupPoints->CheckButton1->setChecked( true );
|
|
||||||
CreateCopyModeChanged( true );
|
|
||||||
|
|
||||||
mainFrame()->GroupBoxPublish->show();
|
mainFrame()->GroupBoxPublish->show();
|
||||||
|
|
||||||
/* signals and slots connections */
|
// signals and slots connections
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
|
||||||
@ -133,15 +136,11 @@ void TransformationGUI_MirrorDlg::Init()
|
|||||||
|
|
||||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
initName(tr("GEOM_MIRROR"));
|
initName(tr("GEOM_MIRROR"));
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ConstructorsClicked()
|
// function : ConstructorsClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
@ -150,28 +149,31 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked( int constructorId )
|
|||||||
{
|
{
|
||||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
globalSelection();
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
||||||
GroupPoints->LineEdit2->clear();
|
GroupPoints->LineEdit2->clear();
|
||||||
myArgument = GEOM::GEOM_Object::_nil();
|
myArgument = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
switch (constructorId) {
|
switch (constructorId) {
|
||||||
case 0: /* mirror an object by point */
|
case 0: // mirror an object by point
|
||||||
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR"));
|
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR"));
|
||||||
break;
|
break;
|
||||||
case 1: /* mirror an object by axe */
|
case 1: // mirror an object by axe
|
||||||
GroupPoints->TextLabel2->setText(tr("GEOM_AXE_MIRROR"));
|
GroupPoints->TextLabel2->setText(tr("GEOM_AXE_MIRROR"));
|
||||||
break;
|
break;
|
||||||
case 2: /* mirror an object by plane */
|
case 2: // mirror an object by plane
|
||||||
GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR"));
|
GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
GroupPoints->PushButton1->click();
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
if (myInitial) {
|
||||||
|
myInitial = false;
|
||||||
|
SelectionIntoArgument();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
displayPreview();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -183,7 +185,6 @@ void TransformationGUI_MirrorDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -194,52 +195,57 @@ bool TransformationGUI_MirrorDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate selection and connect selection manager
|
||||||
ConstructorsClicked(getConstructorId());
|
ConstructorsClicked(getConstructorId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection has changed
|
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::SelectionIntoArgument()
|
void TransformationGUI_MirrorDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aName;
|
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
|
myObjects.length(0);
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
|
myArgument = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
SALOME_ListIO aSelList;
|
SALOME_ListIO aSelList;
|
||||||
aSelMgr->selectedObjects(aSelList);
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
|
QString aName;
|
||||||
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||||
if ( aNbSel < 1 ) {
|
if (aNbSel < 1)
|
||||||
myObjects.length(0);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||||
if (!myObjects.length())
|
if (!myObjects.length())
|
||||||
return;
|
return;
|
||||||
if (aNbSel != 1)
|
else
|
||||||
aName = tr("%1_objects").arg(aNbSel);
|
myEditCurrentArgument->setText(aName);
|
||||||
}
|
}
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
if (aSelList.Extent() != 1) {
|
if (aSelList.Extent() != 1)
|
||||||
myArgument = GEOM::GEOM_Object::_nil();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
// nbSel == 1
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
myArgument = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||||
myArgument = aSelectedObject;
|
|
||||||
if (!testResult || CORBA::is_nil(myArgument))
|
if (!testResult || CORBA::is_nil(myArgument))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aName = GEOMBase::GetName(aSelectedObject);
|
aName = GEOMBase::GetName(myArgument);
|
||||||
|
|
||||||
if (testResult && !aSelectedObject->_is_nil()) {
|
if (testResult && !myArgument->_is_nil()) {
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
|
if (GEOMBase::GetShape(myArgument, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||||
if (getConstructorId() == 1)
|
if (getConstructorId() == 1)
|
||||||
aNeedType = TopAbs_EDGE;
|
aNeedType = TopAbs_EDGE;
|
||||||
@ -256,12 +262,12 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
|
|||||||
aName += QString(":edge_%1").arg(anIndex);
|
aName += QString(":edge_%1").arg(anIndex);
|
||||||
|
|
||||||
//Find SubShape Object in Father
|
//Find SubShape Object in Father
|
||||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
|
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(myArgument, aName);
|
||||||
|
|
||||||
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||||
myArgument = aShapesOp->GetSubShape( aSelectedObject, anIndex );
|
myArgument = aShapesOp->GetSubShape(myArgument, anIndex);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myArgument = aFindedObject; // get Object from study
|
myArgument = aFindedObject; // get Object from study
|
||||||
@ -275,12 +281,68 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
myEditCurrentArgument->setText(aName);
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
if (!myArgument->_is_nil() && !myObjects.length())
|
||||||
|
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();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SetEditCurrentArgument()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
||||||
|
{
|
||||||
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
globalSelection();
|
||||||
|
|
||||||
|
if (send == GroupPoints->PushButton1) {
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
|
GroupPoints->PushButton2->setDown(false);
|
||||||
|
GroupPoints->LineEdit2->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (send == GroupPoints->PushButton2) {
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
|
|
||||||
|
switch (getConstructorId()) {
|
||||||
|
case 0:
|
||||||
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
globalSelection(GEOM_PLANE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->setDown(false);
|
||||||
|
GroupPoints->LineEdit1->setEnabled(false);
|
||||||
|
}
|
||||||
|
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()
|
// function : LineEditReturnPressed()
|
||||||
@ -296,39 +358,6 @@ void TransformationGUI_MirrorDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : SetEditCurrentArgument()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
|
||||||
{
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
|
||||||
globalSelection();
|
|
||||||
|
|
||||||
if ( send == GroupPoints->PushButton1 ) {
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
||||||
}
|
|
||||||
else if ( send == GroupPoints->PushButton2 ) {
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
|
||||||
switch ( getConstructorId() ) {
|
|
||||||
case 0:
|
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
globalSelection( GEOM_PLANE );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -336,11 +365,10 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
|||||||
void TransformationGUI_MirrorDlg::ActivateThisDialog()
|
void TransformationGUI_MirrorDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::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()
|
// function : enterEvent()
|
||||||
@ -352,7 +380,6 @@ void TransformationGUI_MirrorDlg::enterEvent( QEvent* )
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -362,7 +389,6 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation()
|
|||||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -372,7 +398,6 @@ bool TransformationGUI_MirrorDlg::isValid( QString& /*msg*/ )
|
|||||||
return !(myObjects.length() == 0 || myArgument->_is_nil());
|
return !(myObjects.length() == 0 || myArgument->_is_nil());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : execute
|
// function : execute
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -431,14 +456,16 @@ bool TransformationGUI_MirrorDlg::execute( ObjectList& objects )
|
|||||||
{
|
{
|
||||||
if (toCreateCopy) {
|
if (toCreateCopy) {
|
||||||
for (int i = 0; i < myObjects.length(); i++) {
|
for (int i = 0; i < myObjects.length(); i++) {
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument );
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
MirrorPlaneCopy(myObjects[i], myArgument);
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int i = 0; i < myObjects.length(); i++) {
|
for (int i = 0; i < myObjects.length(); i++) {
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument );
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
MirrorPlane(myObjects[i], myArgument);
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,9 @@ private:
|
|||||||
GEOM::GEOM_Object_var myArgument;
|
GEOM::GEOM_Object_var myArgument;
|
||||||
GEOM::ListOfGO myObjects;
|
GEOM::ListOfGO myObjects;
|
||||||
|
|
||||||
|
// to initialize the first selection field with a selected object on the dialog creation
|
||||||
|
bool myInitial;
|
||||||
|
|
||||||
DlgRef_2Sel1Spin2Check* GroupPoints;
|
DlgRef_2Sel1Spin2Check* GroupPoints;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -29,11 +29,12 @@
|
|||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <SUIT_ResourceMgr.h>
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
@ -52,7 +53,8 @@
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
|
TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
|
||||||
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||||
|
myInitial(true)
|
||||||
{
|
{
|
||||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTIROTATION_SIMPLE")));
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTIROTATION_SIMPLE")));
|
||||||
@ -103,7 +105,6 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~TransformationGUI_MultiRotationDlg()
|
// function : ~TransformationGUI_MultiRotationDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -113,20 +114,19 @@ TransformationGUI_MultiRotationDlg::~TransformationGUI_MultiRotationDlg()
|
|||||||
// 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()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MultiRotationDlg::Init()
|
void TransformationGUI_MultiRotationDlg::Init()
|
||||||
{
|
{
|
||||||
/* Get setting of step value from file configuration */
|
// Get setting of step value from file configuration
|
||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||||
|
|
||||||
double SpecificStep1 = 5;
|
double SpecificStep1 = 5;
|
||||||
double SpecificStep2 = 1;
|
double SpecificStep2 = 1;
|
||||||
/* min, max, step and decimals for spin boxes & initial values */
|
// min, max, step and decimals for spin boxes & initial values
|
||||||
initSpinBox(GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 10);
|
initSpinBox(GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 10);
|
||||||
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
|
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
|
||||||
|
|
||||||
@ -139,7 +139,20 @@ void TransformationGUI_MultiRotationDlg::Init()
|
|||||||
GroupDimensions->SpinBox_DX2->setValue(myStep);
|
GroupDimensions->SpinBox_DX2->setValue(myStep);
|
||||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
|
GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
|
||||||
|
|
||||||
/* signals and slots connections */
|
// init variables
|
||||||
|
myAng = 45.0;
|
||||||
|
myStep = 50.0;
|
||||||
|
myNbTimes1 = myNbTimes2 = 2;
|
||||||
|
|
||||||
|
GroupPoints->LineEdit1->setText("");
|
||||||
|
GroupPoints->LineEdit2->setText("");
|
||||||
|
|
||||||
|
GroupDimensions->LineEdit1->setText("");
|
||||||
|
GroupDimensions->LineEdit2->setText("");
|
||||||
|
|
||||||
|
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
// signals and slots connections
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
|
||||||
@ -165,16 +178,11 @@ void TransformationGUI_MultiRotationDlg::Init()
|
|||||||
|
|
||||||
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
|
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
initName(tr("GEOM_MULTIROTATION"));
|
initName(tr("GEOM_MULTIROTATION"));
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetDoubleSpinBoxStep()
|
// function : SetDoubleSpinBoxStep()
|
||||||
// purpose : Double spin box management
|
// purpose : Double spin box management
|
||||||
@ -196,54 +204,52 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked( int constructorId
|
|||||||
{
|
{
|
||||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
myAng = 45.0;
|
|
||||||
myStep = 50.0;
|
|
||||||
myNbTimes1 = myNbTimes2 = 2;
|
|
||||||
|
|
||||||
globalSelection( GEOM_ALLSHAPES );
|
|
||||||
|
|
||||||
switch (constructorId) {
|
switch (constructorId) {
|
||||||
case 0: /* Rotate simple */
|
case 0: // Rotate simple
|
||||||
{
|
{
|
||||||
GroupDimensions->hide();
|
GroupDimensions->hide();
|
||||||
GroupPoints->show();
|
GroupPoints->show();
|
||||||
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
||||||
GroupPoints->LineEdit1->setText("");
|
GroupPoints->LineEdit1->setText("");
|
||||||
GroupPoints->LineEdit2->setText("");
|
GroupPoints->LineEdit2->setText("");
|
||||||
|
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
|
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
|
||||||
|
|
||||||
break;
|
GroupPoints->PushButton1->click();
|
||||||
}
|
}
|
||||||
case 1: /* Rotate double */
|
break;
|
||||||
|
case 1: // Rotate double
|
||||||
{
|
{
|
||||||
GroupPoints->hide();
|
GroupPoints->hide();
|
||||||
GroupDimensions->show();
|
GroupDimensions->show();
|
||||||
|
|
||||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
|
||||||
GroupDimensions->LineEdit1->setText("");
|
GroupDimensions->LineEdit1->setText("");
|
||||||
GroupDimensions->LineEdit2->setText("");
|
GroupDimensions->LineEdit2->setText("");
|
||||||
|
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
GroupDimensions->SpinBox_DX1->setValue(myAng);
|
GroupDimensions->SpinBox_DX1->setValue(myAng);
|
||||||
GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
|
GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
|
||||||
GroupDimensions->SpinBox_DX2->setValue(myStep);
|
GroupDimensions->SpinBox_DX2->setValue(myStep);
|
||||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
|
GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
|
||||||
|
|
||||||
break;
|
GroupDimensions->PushButton1->click();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
resize(minimumSize());
|
resize(minimumSize());
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
if (myInitial) {
|
||||||
myBase = myVector = GEOM::GEOM_Object::_nil();
|
myInitial = false;
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
|
SelectionIntoArgument();
|
||||||
this, SLOT( SelectionIntoArgument() ) );
|
}
|
||||||
|
else {
|
||||||
|
displayPreview();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -255,7 +261,6 @@ void TransformationGUI_MultiRotationDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -266,32 +271,33 @@ bool TransformationGUI_MultiRotationDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate selection and connect selection manager
|
||||||
ConstructorsClicked(getConstructorId());
|
ConstructorsClicked(getConstructorId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// 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_MultiRotationDlg::SelectionIntoArgument()
|
void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
|
||||||
SALOME_ListIO aSelList;
|
|
||||||
aSelMgr->selectedObjects(aSelList);
|
|
||||||
|
|
||||||
if ( aSelList.Extent() != 1 ) {
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||||
myBase = GEOM::GEOM_Object::_nil();
|
myBase = GEOM::GEOM_Object::_nil();
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||||
myEditCurrentArgument == GroupDimensions->LineEdit2)
|
myEditCurrentArgument == GroupDimensions->LineEdit2)
|
||||||
myVector = GEOM::GEOM_Object::_nil();
|
myVector = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
SALOME_ListIO aSelList;
|
||||||
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
|
if (aSelList.Extent() != 1)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// nbSel == 1
|
// nbSel == 1
|
||||||
Standard_Boolean testResult = Standard_False;;
|
Standard_Boolean testResult = Standard_False;;
|
||||||
@ -308,7 +314,6 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
|||||||
myBase = aSelectedObject;
|
myBase = aSelectedObject;
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||||
myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||||
if ( testResult && !aSelectedObject->_is_nil() ) {
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
|
|
||||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||||
@ -339,13 +344,34 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
myEditCurrentArgument->setText(aName);
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
|
if (!myBase->_is_nil() && myVector->_is_nil())
|
||||||
|
GroupPoints->PushButton2->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
|
if (!myVector->_is_nil() && myBase->_is_nil())
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
|
||||||
|
if (!myBase->_is_nil() && myVector->_is_nil())
|
||||||
|
GroupDimensions->PushButton2->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||||
|
if (!myVector->_is_nil() && myBase->_is_nil())
|
||||||
|
GroupDimensions->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();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -353,27 +379,50 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
|||||||
void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
|
void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
globalSelection(GEOM_ALLSHAPES);
|
globalSelection(GEOM_ALLSHAPES);
|
||||||
|
|
||||||
if (send == GroupPoints->PushButton1) {
|
if (send == GroupPoints->PushButton1) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
|
GroupPoints->PushButton2->setDown(false);
|
||||||
|
GroupPoints->LineEdit2->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (send == GroupPoints->PushButton2) {
|
else if (send == GroupPoints->PushButton2) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->setDown(false);
|
||||||
|
GroupPoints->LineEdit1->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (send == GroupDimensions->PushButton1) {
|
else if (send == GroupDimensions->PushButton1) {
|
||||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
||||||
|
|
||||||
|
GroupDimensions->PushButton2->setDown(false);
|
||||||
|
GroupDimensions->LineEdit2->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (send == GroupDimensions->PushButton2) {
|
else if (send == GroupDimensions->PushButton2) {
|
||||||
myEditCurrentArgument = GroupDimensions->LineEdit2;
|
myEditCurrentArgument = GroupDimensions->LineEdit2;
|
||||||
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
}
|
|
||||||
|
|
||||||
|
GroupDimensions->PushButton1->setDown(false);
|
||||||
|
GroupDimensions->LineEdit1->setEnabled(false);
|
||||||
|
}
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
// enable line edit
|
||||||
|
myEditCurrentArgument->setEnabled(true);
|
||||||
myEditCurrentArgument->setFocus();
|
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()
|
// function : LineEditReturnPressed()
|
||||||
@ -389,7 +438,6 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -397,13 +445,11 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
|
|||||||
void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
|
void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::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()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -414,7 +460,6 @@ void TransformationGUI_MultiRotationDlg::enterEvent( QEvent* )
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -435,7 +480,6 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ReverseAngle()
|
// function : ReverseAngle()
|
||||||
// purpose : 'state' not used here
|
// purpose : 'state' not used here
|
||||||
@ -454,17 +498,15 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle()
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
|
GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
|
||||||
{
|
{
|
||||||
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
|
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -62,6 +62,9 @@ private:
|
|||||||
Standard_Real myAng;
|
Standard_Real myAng;
|
||||||
Standard_Real myStep;
|
Standard_Real myStep;
|
||||||
|
|
||||||
|
// to initialize the first selection field with a selected object on the dialog creation
|
||||||
|
bool myInitial;
|
||||||
|
|
||||||
DlgRef_2Sel1Spin* GroupPoints;
|
DlgRef_2Sel1Spin* GroupPoints;
|
||||||
DlgRef_2Sel4Spin1Check* GroupDimensions;
|
DlgRef_2Sel4Spin1Check* GroupDimensions;
|
||||||
|
|
||||||
|
@ -29,11 +29,12 @@
|
|||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <SUIT_ResourceMgr.h>
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
@ -52,7 +53,8 @@
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
|
TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
|
||||||
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||||
|
myInitial(true)
|
||||||
{
|
{
|
||||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_SIMPLE")));
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_SIMPLE")));
|
||||||
@ -109,7 +111,6 @@ TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~TransformationGUI_MultiTranslationDlg()
|
// function : ~TransformationGUI_MultiTranslationDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -119,19 +120,18 @@ TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg()
|
|||||||
// 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()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MultiTranslationDlg::Init()
|
void TransformationGUI_MultiTranslationDlg::Init()
|
||||||
{
|
{
|
||||||
/* Get setting of step value from file configuration */
|
// Get setting of step value from file configuration
|
||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||||
|
|
||||||
double SpecificStep = 1;
|
double SpecificStep = 1;
|
||||||
/* min, max, step and decimals for spin boxes & initial values */
|
// min, max, step and decimals for spin boxes & initial values
|
||||||
initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
|
initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||||
initSpinBox(GroupPoints->SpinBox_DY, 1.0, MAX_NUMBER, SpecificStep, 10);
|
initSpinBox(GroupPoints->SpinBox_DY, 1.0, MAX_NUMBER, SpecificStep, 10);
|
||||||
GroupPoints->SpinBox_DX->setValue(myStepU);
|
GroupPoints->SpinBox_DX->setValue(myStepU);
|
||||||
@ -146,7 +146,20 @@ void TransformationGUI_MultiTranslationDlg::Init()
|
|||||||
GroupDimensions->SpinBox_DX2->setValue(myStepV);
|
GroupDimensions->SpinBox_DX2->setValue(myStepV);
|
||||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
|
GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
|
||||||
|
|
||||||
/* signals and slots connections */
|
// init variables
|
||||||
|
myStepU = myStepV = 50.0;
|
||||||
|
myNbTimesU = myNbTimesV = 2;
|
||||||
|
|
||||||
|
GroupPoints->LineEdit1->setText("");
|
||||||
|
GroupPoints->LineEdit2->setText("");
|
||||||
|
|
||||||
|
GroupDimensions->LineEdit1->setText("");
|
||||||
|
GroupDimensions->LineEdit2->setText("");
|
||||||
|
GroupDimensions->LineEdit3->setText("");
|
||||||
|
|
||||||
|
myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
// signals and slots connections
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
|
||||||
@ -177,15 +190,11 @@ void TransformationGUI_MultiTranslationDlg::Init()
|
|||||||
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
|
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
|
||||||
connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV()));
|
connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV()));
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
initName(tr("GEOM_MULTITRANSLATION"));
|
initName(tr("GEOM_MULTITRANSLATION"));
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetDoubleSpinBoxStep()
|
// function : SetDoubleSpinBoxStep()
|
||||||
// purpose : Double spin box management
|
// purpose : Double spin box management
|
||||||
@ -208,42 +217,38 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked( int constructor
|
|||||||
{
|
{
|
||||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
myStepU = myStepV = 50.0;
|
|
||||||
myNbTimesU = myNbTimesV = 2;
|
|
||||||
|
|
||||||
globalSelection( GEOM_ALLSHAPES );
|
|
||||||
|
|
||||||
switch (constructorId) {
|
switch (constructorId) {
|
||||||
case 0: /* Translate simple */
|
case 0: // Translate simple
|
||||||
{
|
{
|
||||||
GroupDimensions->hide();
|
GroupDimensions->hide();
|
||||||
GroupPoints->show();
|
GroupPoints->show();
|
||||||
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
||||||
GroupPoints->LineEdit1->setText("");
|
GroupPoints->LineEdit1->setText("");
|
||||||
GroupPoints->LineEdit2->setText("");
|
GroupPoints->LineEdit2->setText("");
|
||||||
|
myBase = myVectorU = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
GroupPoints->SpinBox_DX->setValue(myStepU);
|
GroupPoints->SpinBox_DX->setValue(myStepU);
|
||||||
GroupPoints->SpinBox_DY->setValue(myNbTimesU);
|
GroupPoints->SpinBox_DY->setValue(myNbTimesU);
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: /* Translate double */
|
case 1: // Translate double
|
||||||
{
|
{
|
||||||
GroupPoints->hide();
|
GroupPoints->hide();
|
||||||
GroupDimensions->show();
|
GroupDimensions->show();
|
||||||
|
|
||||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
|
||||||
GroupDimensions->LineEdit1->setText("");
|
GroupDimensions->LineEdit1->setText("");
|
||||||
GroupDimensions->LineEdit2->setText("");
|
GroupDimensions->LineEdit2->setText("");
|
||||||
GroupDimensions->LineEdit3->setText("");
|
GroupDimensions->LineEdit3->setText("");
|
||||||
|
myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
GroupDimensions->SpinBox_DX1->setValue(myStepU);
|
GroupDimensions->SpinBox_DX1->setValue(myStepU);
|
||||||
GroupDimensions->SpinBox_DY1->setValue(myNbTimesU);
|
GroupDimensions->SpinBox_DY1->setValue(myNbTimesU);
|
||||||
GroupDimensions->SpinBox_DX2->setValue(myStepV);
|
GroupDimensions->SpinBox_DX2->setValue(myStepV);
|
||||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
|
GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
|
||||||
|
|
||||||
myVectorV = GEOM::GEOM_Object::_nil();
|
GroupDimensions->PushButton1->click();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,12 +257,14 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked( int constructor
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
resize(minimumSize());
|
resize(minimumSize());
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
if (myInitial) {
|
||||||
myBase = myVectorU = GEOM::GEOM_Object::_nil();
|
myInitial = false;
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
SelectionIntoArgument();
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
}
|
||||||
|
else {
|
||||||
|
displayPreview();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -269,7 +276,6 @@ void TransformationGUI_MultiTranslationDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -280,24 +286,20 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate selection and connect selection manager
|
||||||
ConstructorsClicked(getConstructorId());
|
ConstructorsClicked(getConstructorId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// 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_MultiTranslationDlg::SelectionIntoArgument()
|
void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
|
||||||
SALOME_ListIO aSelList;
|
|
||||||
aSelMgr->selectedObjects(aSelList);
|
|
||||||
|
|
||||||
if ( aSelList.Extent() != 1 ) {
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||||
myBase = GEOM::GEOM_Object::_nil();
|
myBase = GEOM::GEOM_Object::_nil();
|
||||||
@ -306,8 +308,13 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
|
|||||||
myVectorU = GEOM::GEOM_Object::_nil();
|
myVectorU = GEOM::GEOM_Object::_nil();
|
||||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||||
myVectorV = GEOM::GEOM_Object::_nil();
|
myVectorV = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
SALOME_ListIO aSelList;
|
||||||
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
|
if (aSelList.Extent() != 1)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// nbSel == 1
|
// nbSel == 1
|
||||||
Standard_Boolean testResult = Standard_False;;
|
Standard_Boolean testResult = Standard_False;;
|
||||||
@ -324,7 +331,6 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
|
|||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||||
myEditCurrentArgument == GroupDimensions->LineEdit2 ||
|
myEditCurrentArgument == GroupDimensions->LineEdit2 ||
|
||||||
myEditCurrentArgument == GroupDimensions->LineEdit3) {
|
myEditCurrentArgument == GroupDimensions->LineEdit3) {
|
||||||
if ( testResult && !aSelectedObject->_is_nil() ) {
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
|
|
||||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||||
@ -364,14 +370,38 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
|
if (!myBase->_is_nil() && myVectorU->_is_nil())
|
||||||
|
GroupPoints->PushButton2->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
|
if (!myVectorU->_is_nil() && myBase->_is_nil())
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
|
||||||
|
if (!myBase->_is_nil() && myVectorU->_is_nil())
|
||||||
|
GroupDimensions->PushButton2->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||||
|
if (!myVectorU->_is_nil() && myVectorV->_is_nil())
|
||||||
|
GroupDimensions->PushButton3->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupDimensions->LineEdit3) {
|
||||||
|
if (!myVectorV->_is_nil() && myBase->_is_nil())
|
||||||
|
GroupDimensions->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();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -379,31 +409,64 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
|
|||||||
void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
|
void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
globalSelection(GEOM_ALLSHAPES);
|
globalSelection(GEOM_ALLSHAPES);
|
||||||
|
|
||||||
if (send == GroupPoints->PushButton1) {
|
if (send == GroupPoints->PushButton1) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
|
GroupPoints->PushButton2->setDown(false);
|
||||||
|
GroupPoints->LineEdit2->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (send == GroupPoints->PushButton2) {
|
else if (send == GroupPoints->PushButton2) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->setDown(false);
|
||||||
|
GroupPoints->LineEdit1->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (send == GroupDimensions->PushButton1) {
|
else if (send == GroupDimensions->PushButton1) {
|
||||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
||||||
|
|
||||||
|
GroupDimensions->PushButton2->setDown(false);
|
||||||
|
GroupDimensions->PushButton3->setDown(false);
|
||||||
|
GroupDimensions->LineEdit2->setEnabled(false);
|
||||||
|
GroupDimensions->LineEdit3->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (send == GroupDimensions->PushButton2) {
|
else if (send == GroupDimensions->PushButton2) {
|
||||||
myEditCurrentArgument = GroupDimensions->LineEdit2;
|
myEditCurrentArgument = GroupDimensions->LineEdit2;
|
||||||
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
|
|
||||||
|
GroupDimensions->PushButton1->setDown(false);
|
||||||
|
GroupDimensions->PushButton3->setDown(false);
|
||||||
|
GroupDimensions->LineEdit1->setEnabled(false);
|
||||||
|
GroupDimensions->LineEdit3->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (send == GroupDimensions->PushButton3) {
|
else if (send == GroupDimensions->PushButton3) {
|
||||||
myEditCurrentArgument = GroupDimensions->LineEdit3;
|
myEditCurrentArgument = GroupDimensions->LineEdit3;
|
||||||
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
}
|
|
||||||
|
|
||||||
|
GroupDimensions->PushButton1->setDown(false);
|
||||||
|
GroupDimensions->PushButton2->setDown(false);
|
||||||
|
GroupDimensions->LineEdit1->setEnabled(false);
|
||||||
|
GroupDimensions->LineEdit2->setEnabled(false);
|
||||||
|
}
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
// enable line edit
|
||||||
|
myEditCurrentArgument->setEnabled(true);
|
||||||
myEditCurrentArgument->setFocus();
|
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()
|
// function : LineEditReturnPressed()
|
||||||
@ -420,7 +483,6 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -428,13 +490,11 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
|
|||||||
void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
|
void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::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()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -445,7 +505,6 @@ void TransformationGUI_MultiTranslationDlg::enterEvent( QEvent* )
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -476,7 +535,6 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newVal
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ReverseStepU()
|
// function : ReverseStepU()
|
||||||
// purpose : 'state' not used here
|
// purpose : 'state' not used here
|
||||||
@ -495,7 +553,6 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU()
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ReverseStepV
|
// function : ReverseStepV
|
||||||
// purpose : 'state' not used here
|
// purpose : 'state' not used here
|
||||||
@ -509,17 +566,15 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepV()
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperation()
|
GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperation()
|
||||||
{
|
{
|
||||||
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
|
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -548,14 +603,16 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
|
|||||||
switch (getConstructorId()) {
|
switch (getConstructorId()) {
|
||||||
case 0:
|
case 0:
|
||||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
|
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU );
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU) &&
|
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU) &&
|
||||||
!CORBA::is_nil(myVectorV)) {
|
!CORBA::is_nil(myVectorV)) {
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU,
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU,
|
||||||
myVectorV, myStepV, myNbTimesV);
|
myVectorV, myStepV, myNbTimesV);
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
@ -568,7 +625,6 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : addSubshapeToStudy
|
// function : addSubshapeToStudy
|
||||||
// purpose : virtual method to add new SubObjects if local selection
|
// purpose : virtual method to add new SubObjects if local selection
|
||||||
|
@ -62,6 +62,9 @@ private:
|
|||||||
Standard_Real myStepU;
|
Standard_Real myStepU;
|
||||||
Standard_Real myStepV;
|
Standard_Real myStepV;
|
||||||
|
|
||||||
|
// to initialize the first selection field with a selected object on the dialog creation
|
||||||
|
bool myInitial;
|
||||||
|
|
||||||
DlgRef_2Sel2Spin1Check* GroupPoints;
|
DlgRef_2Sel2Spin1Check* GroupPoints;
|
||||||
DlgRef_3Sel4Spin2Check* GroupDimensions;
|
DlgRef_3Sel4Spin2Check* GroupDimensions;
|
||||||
|
|
||||||
|
@ -209,6 +209,7 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
|
|||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
if ( send == GroupPoints->PushButton1 ) {
|
if ( send == GroupPoints->PushButton1 ) {
|
||||||
|
GroupPoints->PushButton1->setDown(true);
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
myEditCurrentArgument->setFocus();
|
myEditCurrentArgument->setFocus();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
|
@ -29,11 +29,12 @@
|
|||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <SUIT_ResourceMgr.h>
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
|
||||||
#include <GEOMImpl_Types.hxx>
|
#include <GEOMImpl_Types.hxx>
|
||||||
@ -47,7 +48,8 @@
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
|
TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
|
||||||
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||||
|
myInitial(true)
|
||||||
{
|
{
|
||||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION")));
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION")));
|
||||||
@ -82,46 +84,46 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
|
|||||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||||
layout->setMargin(0); layout->setSpacing(6);
|
layout->setMargin(0); layout->setSpacing(6);
|
||||||
layout->addWidget(Group1);
|
layout->addWidget(Group1);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
setHelpFileName("modify_location_operation_page.html");
|
setHelpFileName("modify_location_operation_page.html");
|
||||||
|
|
||||||
|
// Activate Create a Copy mode
|
||||||
|
Group1->CheckBox1->setChecked(true);
|
||||||
|
CreateCopyModeChanged(true);
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~TransformationGUI_PositionDlg()
|
// function : ~TransformationGUI_PositionDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg()
|
TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg()
|
||||||
{
|
{
|
||||||
/* 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()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_PositionDlg::Init()
|
void TransformationGUI_PositionDlg::Init()
|
||||||
{
|
{
|
||||||
/* init variables */
|
// init variables
|
||||||
Group1->LineEdit1->setReadOnly(true);
|
Group1->LineEdit1->setReadOnly(true);
|
||||||
Group1->LineEdit2->setReadOnly(true);
|
Group1->LineEdit2->setReadOnly(true);
|
||||||
Group1->LineEdit3->setReadOnly(true);
|
Group1->LineEdit3->setReadOnly(true);
|
||||||
|
|
||||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
Group1->LineEdit1->setText("");
|
||||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
Group1->LineEdit2->setText("");
|
||||||
|
Group1->LineEdit3->setText("");
|
||||||
|
|
||||||
// Activate Create a Copy mode
|
myStartLCS = myEndLCS = GEOM::GEOM_Object::_nil();
|
||||||
Group1->CheckBox1->setChecked( true );
|
|
||||||
CreateCopyModeChanged( true );
|
|
||||||
|
|
||||||
mainFrame()->GroupBoxPublish->show();
|
mainFrame()->GroupBoxPublish->show();
|
||||||
|
|
||||||
/* signals and slots connections */
|
// signals and slots connections
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
|
||||||
@ -137,16 +139,11 @@ void TransformationGUI_PositionDlg::Init()
|
|||||||
|
|
||||||
connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
initName(tr("GEOM_POSITION"));
|
initName(tr("GEOM_POSITION"));
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ConstructorsClicked()
|
// function : ConstructorsClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
@ -155,8 +152,6 @@ void TransformationGUI_PositionDlg::ConstructorsClicked( int constructorId )
|
|||||||
{
|
{
|
||||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
globalSelection();
|
|
||||||
myEditCurrentArgument = Group1->LineEdit1;
|
|
||||||
Group1->LineEdit2->clear();
|
Group1->LineEdit2->clear();
|
||||||
Group1->LineEdit3->clear();
|
Group1->LineEdit3->clear();
|
||||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
myStartLCS = GEOM::GEOM_Object::_nil();
|
||||||
@ -164,14 +159,22 @@ void TransformationGUI_PositionDlg::ConstructorsClicked( int constructorId )
|
|||||||
|
|
||||||
switch (constructorId) {
|
switch (constructorId) {
|
||||||
case 0:
|
case 0:
|
||||||
|
{
|
||||||
Group1->LineEdit2->hide();
|
Group1->LineEdit2->hide();
|
||||||
Group1->TextLabel2->hide();
|
Group1->TextLabel2->hide();
|
||||||
Group1->PushButton2->hide();
|
Group1->PushButton2->hide();
|
||||||
|
|
||||||
|
Group1->PushButton1->click();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
{
|
||||||
Group1->LineEdit2->show();
|
Group1->LineEdit2->show();
|
||||||
Group1->TextLabel2->show();
|
Group1->TextLabel2->show();
|
||||||
Group1->PushButton2->show();
|
Group1->PushButton2->show();
|
||||||
|
|
||||||
|
Group1->PushButton1->click();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,11 +182,14 @@ void TransformationGUI_PositionDlg::ConstructorsClicked( int constructorId )
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
resize(minimumSize());
|
resize(minimumSize());
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
if (myInitial) {
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) );
|
myInitial = false;
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
displayPreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -195,7 +201,6 @@ void TransformationGUI_PositionDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -206,69 +211,141 @@ bool TransformationGUI_PositionDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate selection and connect selection manager
|
||||||
ConstructorsClicked(getConstructorId());
|
ConstructorsClicked(getConstructorId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection has changed
|
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aName;
|
|
||||||
|
if (myEditCurrentArgument == Group1->LineEdit1)
|
||||||
|
myObjects.length(0);
|
||||||
|
else if (myEditCurrentArgument == Group1->LineEdit2)
|
||||||
|
myStartLCS = GEOM::GEOM_Object::_nil();
|
||||||
|
else if (myEditCurrentArgument == Group1->LineEdit3)
|
||||||
|
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
SALOME_ListIO aSelList;
|
SALOME_ListIO aSelList;
|
||||||
aSelMgr->selectedObjects(aSelList);
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
|
QString aName;
|
||||||
|
|
||||||
if (myEditCurrentArgument == Group1->LineEdit1) {
|
if (myEditCurrentArgument == Group1->LineEdit1) {
|
||||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||||
if (aNbSel < 1) {
|
if (aNbSel < 1)
|
||||||
myObjects.length(0);
|
|
||||||
displayPreview();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||||
if ( !myObjects.length() ) {
|
if (!myObjects.length())
|
||||||
displayPreview();
|
|
||||||
return;
|
return;
|
||||||
}
|
else
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
}
|
}
|
||||||
else if (myEditCurrentArgument == Group1->LineEdit2) {
|
else if (myEditCurrentArgument == Group1->LineEdit2) {
|
||||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
if (aSelList.Extent() != 1)
|
||||||
if (aSelList.Extent() != 1) {
|
|
||||||
displayPreview();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
// nbSel == 1
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
myStartLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
myStartLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||||
if ( !testResult || CORBA::is_nil( myStartLCS ) ) {
|
if (!testResult || CORBA::is_nil(myStartLCS))
|
||||||
displayPreview();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
aName = GEOMBase::GetName(myStartLCS);
|
aName = GEOMBase::GetName(myStartLCS);
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
if (!myStartLCS->_is_nil() && myEndLCS->_is_nil())
|
||||||
|
Group1->PushButton3->click();
|
||||||
}
|
}
|
||||||
else if (myEditCurrentArgument == Group1->LineEdit3) {
|
else if (myEditCurrentArgument == Group1->LineEdit3) {
|
||||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||||
if ( aSelList.Extent() != 1 ) {
|
if (aSelList.Extent() != 1)
|
||||||
displayPreview();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
myEndLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
myEndLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||||
if ( !testResult || CORBA::is_nil( myEndLCS ) ) {
|
if (!testResult || CORBA::is_nil(myEndLCS))
|
||||||
displayPreview();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
aName = GEOMBase::GetName(myEndLCS);
|
aName = GEOMBase::GetName(myEndLCS);
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
if (!myEndLCS->_is_nil() && !myObjects.length())
|
||||||
|
Group1->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();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SetEditCurrentArgument()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_PositionDlg::SetEditCurrentArgument()
|
||||||
|
{
|
||||||
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
if (send == Group1->PushButton1) {
|
||||||
|
myEditCurrentArgument = Group1->LineEdit1;
|
||||||
|
|
||||||
|
globalSelection();
|
||||||
|
|
||||||
|
Group1->PushButton2->setDown(false);
|
||||||
|
Group1->PushButton3->setDown(false);
|
||||||
|
Group1->LineEdit2->setEnabled(false);
|
||||||
|
Group1->LineEdit3->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (send == Group1->PushButton2) {
|
||||||
|
myEditCurrentArgument = Group1->LineEdit2;
|
||||||
|
|
||||||
|
TColStd_MapOfInteger aMap;
|
||||||
|
aMap.Add(GEOM_PLANE);
|
||||||
|
aMap.Add(GEOM_MARKER);
|
||||||
|
globalSelection(aMap);
|
||||||
|
|
||||||
|
Group1->PushButton1->setDown(false);
|
||||||
|
Group1->PushButton3->setDown(false);
|
||||||
|
Group1->LineEdit1->setEnabled(false);
|
||||||
|
Group1->LineEdit3->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (send == Group1->PushButton3) {
|
||||||
|
myEditCurrentArgument = Group1->LineEdit3;
|
||||||
|
|
||||||
|
TColStd_MapOfInteger aMap;
|
||||||
|
aMap.Add(GEOM_PLANE);
|
||||||
|
aMap.Add(GEOM_MARKER);
|
||||||
|
globalSelection(aMap);
|
||||||
|
|
||||||
|
Group1->PushButton1->setDown(false);
|
||||||
|
Group1->PushButton2->setDown(false);
|
||||||
|
Group1->LineEdit1->setEnabled(false);
|
||||||
|
Group1->LineEdit2->setEnabled(false);
|
||||||
|
}
|
||||||
|
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();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,46 +356,14 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
|||||||
void TransformationGUI_PositionDlg::LineEditReturnPressed()
|
void TransformationGUI_PositionDlg::LineEditReturnPressed()
|
||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
if ( send == Group1->LineEdit1 || send == Group1->LineEdit2 ||
|
if (send == Group1->LineEdit1 ||
|
||||||
|
send == Group1->LineEdit2 ||
|
||||||
send == Group1->LineEdit3) {
|
send == Group1->LineEdit3) {
|
||||||
myEditCurrentArgument = send;
|
myEditCurrentArgument = send;
|
||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : SetEditCurrentArgument()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_PositionDlg::SetEditCurrentArgument()
|
|
||||||
{
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
|
||||||
|
|
||||||
if ( send == Group1->PushButton1 ) {
|
|
||||||
myEditCurrentArgument = Group1->LineEdit1;
|
|
||||||
globalSelection();
|
|
||||||
}
|
|
||||||
else if ( send == Group1->PushButton2 ) {
|
|
||||||
myEditCurrentArgument = Group1->LineEdit2;
|
|
||||||
TColStd_MapOfInteger aMap;
|
|
||||||
aMap.Add( GEOM_PLANE );
|
|
||||||
aMap.Add( GEOM_MARKER );
|
|
||||||
globalSelection( aMap );
|
|
||||||
}
|
|
||||||
else if ( send == Group1->PushButton3 ) {
|
|
||||||
myEditCurrentArgument = Group1->LineEdit3;
|
|
||||||
TColStd_MapOfInteger aMap;
|
|
||||||
aMap.Add( GEOM_PLANE );
|
|
||||||
aMap.Add( GEOM_MARKER );
|
|
||||||
globalSelection( aMap );
|
|
||||||
}
|
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -326,11 +371,10 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
|
|||||||
void TransformationGUI_PositionDlg::ActivateThisDialog()
|
void TransformationGUI_PositionDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::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()
|
// function : enterEvent()
|
||||||
@ -342,7 +386,6 @@ void TransformationGUI_PositionDlg::enterEvent( QEvent* )
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -352,7 +395,6 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation()
|
|||||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -368,7 +410,6 @@ bool TransformationGUI_PositionDlg::isValid( QString& /*msg*/ )
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : execute
|
// function : execute
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -59,6 +59,9 @@ private:
|
|||||||
GEOM::GEOM_Object_var myEndLCS;
|
GEOM::GEOM_Object_var myEndLCS;
|
||||||
GEOM::ListOfGO myObjects;
|
GEOM::ListOfGO myObjects;
|
||||||
|
|
||||||
|
// to initialize the first selection field with a selected object on the dialog creation
|
||||||
|
bool myInitial;
|
||||||
|
|
||||||
DlgRef_3Sel3Spin1Check* Group1;
|
DlgRef_3Sel3Spin1Check* Group1;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -29,11 +29,12 @@
|
|||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <SUIT_ResourceMgr.h>
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
@ -52,7 +53,8 @@
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
|
TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
|
||||||
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||||
|
myInitial(true)
|
||||||
{
|
{
|
||||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_ROTATION")));
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_ROTATION")));
|
||||||
@ -90,21 +92,50 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
|
|||||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||||
layout->setMargin(0); layout->setSpacing(6);
|
layout->setMargin(0); layout->setSpacing(6);
|
||||||
layout->addWidget(GroupPoints);
|
layout->addWidget(GroupPoints);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
double anAngle = 0;
|
|
||||||
double SpecificStep = 5;
|
setHelpFileName("rotation_operation_page.html");
|
||||||
/* 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
|
|
||||||
GroupPoints->SpinBox_DX->setValue( anAngle );
|
|
||||||
|
|
||||||
// Activate Create a Copy mode
|
// Activate Create a Copy mode
|
||||||
GroupPoints->CheckButton1->setChecked(true);
|
GroupPoints->CheckButton1->setChecked(true);
|
||||||
CreateCopyModeChanged(true);
|
CreateCopyModeChanged(true);
|
||||||
|
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ~TransformationGUI_RotationDlg()
|
||||||
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
|
//=================================================================================
|
||||||
|
TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg()
|
||||||
|
{
|
||||||
|
// no need to delete child widgets, Qt does it all for us
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : Init()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_RotationDlg::Init()
|
||||||
|
{
|
||||||
|
double anAngle = 0;
|
||||||
|
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
|
||||||
|
GroupPoints->SpinBox_DX->setValue(anAngle);
|
||||||
|
|
||||||
|
// init variables
|
||||||
|
GroupPoints->LineEdit1->setText("");
|
||||||
|
GroupPoints->LineEdit2->setText("");
|
||||||
|
GroupPoints->LineEdit4->setText("");
|
||||||
|
GroupPoints->LineEdit5->setText("");
|
||||||
|
|
||||||
|
myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
mainFrame()->GroupBoxPublish->show();
|
mainFrame()->GroupBoxPublish->show();
|
||||||
|
|
||||||
/* signals and slots connections */
|
// signals and slots connections
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
|
||||||
@ -119,41 +150,12 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
|
|||||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||||
|
|
||||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||||
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
|
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
setHelpFileName( "rotation_operation_page.html" );
|
|
||||||
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ~TransformationGUI_RotationDlg()
|
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
|
||||||
//=================================================================================
|
|
||||||
TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg()
|
|
||||||
{
|
|
||||||
// no need to delete child widgets, Qt does it all for us
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : Init()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_RotationDlg::Init()
|
|
||||||
{
|
|
||||||
/* init variables */
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
||||||
GroupPoints->LineEdit2->clear();
|
|
||||||
|
|
||||||
myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
|
||||||
|
|
||||||
initName(tr("GEOM_ROTATION"));
|
initName(tr("GEOM_ROTATION"));
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,27 +167,35 @@ void TransformationGUI_RotationDlg::ConstructorsClicked( int constructorId )
|
|||||||
{
|
{
|
||||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
||||||
globalSelection();
|
|
||||||
|
|
||||||
switch (constructorId) {
|
switch (constructorId) {
|
||||||
case 0: /* rotation an object angle and axis */
|
case 0: // rotation an object angle and axis
|
||||||
|
{
|
||||||
GroupPoints->ShowRows(2, 3, false);
|
GroupPoints->ShowRows(2, 3, false);
|
||||||
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
|
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
|
||||||
GroupPoints->LineEdit2->clear();
|
GroupPoints->LineEdit2->clear();
|
||||||
GroupPoints->ShowRows(4, 4, true);
|
GroupPoints->ShowRows(4, 4, true);
|
||||||
|
|
||||||
myAxis = GEOM::GEOM_Object::_nil();
|
myAxis = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1: /* rotation an object by 3 points */
|
case 1: // rotation an object by 3 points
|
||||||
|
{
|
||||||
GroupPoints->ShowRows(4, 4, false);
|
GroupPoints->ShowRows(4, 4, false);
|
||||||
GroupPoints->ShowRows(2, 3, true);
|
GroupPoints->ShowRows(2, 3, true);
|
||||||
GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT"));
|
GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT"));
|
||||||
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg(1));
|
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg(1));
|
||||||
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg(2));
|
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg(2));
|
||||||
|
|
||||||
GroupPoints->LineEdit2->clear();
|
GroupPoints->LineEdit2->clear();
|
||||||
GroupPoints->LineEdit4->clear();
|
GroupPoints->LineEdit4->clear();
|
||||||
GroupPoints->LineEdit5->clear();
|
GroupPoints->LineEdit5->clear();
|
||||||
|
|
||||||
myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,9 +203,13 @@ void TransformationGUI_RotationDlg::ConstructorsClicked( int constructorId )
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
resize(minimumSize());
|
resize(minimumSize());
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
if (myInitial) {
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
myInitial = false;
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
SelectionIntoArgument();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
displayPreview();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -208,7 +222,6 @@ void TransformationGUI_RotationDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -219,37 +232,23 @@ bool TransformationGUI_RotationDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate selection and connect selection manager
|
||||||
ConstructorsClicked(getConstructorId());
|
ConstructorsClicked(getConstructorId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// 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_RotationDlg::SelectionIntoArgument()
|
void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aName;
|
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
SALOME_ListIO aSelList;
|
|
||||||
aSelMgr->selectedObjects(aSelList);
|
|
||||||
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
|
||||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
|
||||||
if (aNbSel < 1) {
|
|
||||||
myObjects.length(0);
|
myObjects.length(0);
|
||||||
return;
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
|
||||||
}
|
|
||||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
|
||||||
if (!myObjects.length())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (aSelList.Extent() != 1) {
|
|
||||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
|
|
||||||
myAxis = GEOM::GEOM_Object::_nil();
|
myAxis = GEOM::GEOM_Object::_nil();
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
|
||||||
myCentPoint = GEOM::GEOM_Object::_nil();
|
myCentPoint = GEOM::GEOM_Object::_nil();
|
||||||
@ -257,24 +256,49 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
|||||||
myPoint1 = GEOM::GEOM_Object::_nil();
|
myPoint1 = GEOM::GEOM_Object::_nil();
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit5)
|
else if (myEditCurrentArgument == GroupPoints->LineEdit5)
|
||||||
myPoint2 = GEOM::GEOM_Object::_nil();
|
myPoint2 = GEOM::GEOM_Object::_nil();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||||
|
if (!myObjects.length())
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (aSelList.Extent() != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// nbSel == 1
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||||
|
|
||||||
if (!testResult || CORBA::is_nil(aSelectedObject))
|
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
aName = GEOMBase::GetName(aSelectedObject);
|
aName = GEOMBase::GetName(aSelectedObject);
|
||||||
|
|
||||||
|
// Get Selected object if selected subshape
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
|
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||||
|
{
|
||||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
|
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
|
||||||
aNeedType = TopAbs_EDGE;
|
aNeedType = TopAbs_EDGE;
|
||||||
|
|
||||||
TColStd_IndexedMapOfInteger aMap;
|
TColStd_IndexedMapOfInteger aMap;
|
||||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||||
if ( aMap.Extent() == 1 ) {
|
if (aMap.Extent() == 1)
|
||||||
|
{
|
||||||
int anIndex = aMap(1);
|
int anIndex = aMap(1);
|
||||||
if (aNeedType == TopAbs_EDGE)
|
if (aNeedType == TopAbs_EDGE)
|
||||||
aName += QString(":edge_%1").arg(anIndex);
|
aName += QString(":edge_%1").arg(anIndex);
|
||||||
@ -293,7 +317,8 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
|||||||
aSelectedObject = aFindedObject; // get Object from study
|
aSelectedObject = aFindedObject; // get Object from study
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else // Global Selection
|
||||||
|
{
|
||||||
if (aShape.ShapeType() != aNeedType) {
|
if (aShape.ShapeType() != aNeedType) {
|
||||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
aName = "";
|
aName = "";
|
||||||
@ -301,21 +326,39 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
|
|
||||||
myAxis = aSelectedObject;
|
|
||||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
|
|
||||||
myCentPoint = aSelectedObject;
|
|
||||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit4 )
|
|
||||||
myPoint1 = aSelectedObject;
|
|
||||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit5 )
|
|
||||||
myPoint2 = aSelectedObject;
|
|
||||||
}
|
|
||||||
myEditCurrentArgument->setText(aName);
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
|
||||||
|
myAxis = aSelectedObject;
|
||||||
|
if (!myAxis->_is_nil() && !myObjects.length())
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
|
||||||
|
myCentPoint = aSelectedObject;
|
||||||
|
if (!myCentPoint->_is_nil() && myPoint1->_is_nil())
|
||||||
|
GroupPoints->PushButton4->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit4) {
|
||||||
|
myPoint1 = aSelectedObject;
|
||||||
|
if (!myPoint1->_is_nil() && myPoint2->_is_nil())
|
||||||
|
GroupPoints->PushButton5->click();
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit5) {
|
||||||
|
myPoint2 = aSelectedObject;
|
||||||
|
if (!myPoint2->_is_nil() && !myObjects.length())
|
||||||
|
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();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -323,13 +366,26 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
|||||||
void TransformationGUI_RotationDlg::SetEditCurrentArgument()
|
void TransformationGUI_RotationDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
globalSelection();
|
globalSelection();
|
||||||
|
|
||||||
if (send == GroupPoints->PushButton1) {
|
if (send == GroupPoints->PushButton1) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
|
GroupPoints->PushButton2->setDown(false);
|
||||||
|
GroupPoints->LineEdit2->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (send == GroupPoints->PushButton2) {
|
else if (send == GroupPoints->PushButton2) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->setDown(false);
|
||||||
|
GroupPoints->PushButton4->setDown(false);
|
||||||
|
GroupPoints->PushButton5->setDown(false);
|
||||||
|
GroupPoints->LineEdit1->setEnabled(false);
|
||||||
|
GroupPoints->LineEdit4->setEnabled(false);
|
||||||
|
GroupPoints->LineEdit5->setEnabled(false);
|
||||||
|
|
||||||
if (getConstructorId() == 0)
|
if (getConstructorId() == 0)
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
else
|
else
|
||||||
@ -337,17 +393,40 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
|
|||||||
}
|
}
|
||||||
else if (send == GroupPoints->PushButton4) {
|
else if (send == GroupPoints->PushButton4) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit4;
|
myEditCurrentArgument = GroupPoints->LineEdit4;
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->setDown(false);
|
||||||
|
GroupPoints->PushButton2->setDown(false);
|
||||||
|
GroupPoints->PushButton5->setDown(false);
|
||||||
|
GroupPoints->LineEdit1->setEnabled(false);
|
||||||
|
GroupPoints->LineEdit2->setEnabled(false);
|
||||||
|
GroupPoints->LineEdit5->setEnabled(false);
|
||||||
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
}
|
}
|
||||||
else if (send == GroupPoints->PushButton5) {
|
else if (send == GroupPoints->PushButton5) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit5;
|
myEditCurrentArgument = GroupPoints->LineEdit5;
|
||||||
|
|
||||||
|
GroupPoints->PushButton1->setDown(false);
|
||||||
|
GroupPoints->PushButton2->setDown(false);
|
||||||
|
GroupPoints->PushButton4->setDown(false);
|
||||||
|
GroupPoints->LineEdit1->setEnabled(false);
|
||||||
|
GroupPoints->LineEdit2->setEnabled(false);
|
||||||
|
GroupPoints->LineEdit4->setEnabled(false);
|
||||||
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
}
|
}
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
// enable line edit
|
||||||
|
myEditCurrentArgument->setEnabled(true);
|
||||||
myEditCurrentArgument->setFocus();
|
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()
|
// function : LineEditReturnPressed()
|
||||||
@ -363,7 +442,6 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -371,13 +449,11 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed()
|
|||||||
void TransformationGUI_RotationDlg::ActivateThisDialog()
|
void TransformationGUI_RotationDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::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()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -388,7 +464,6 @@ void TransformationGUI_RotationDlg::enterEvent( QEvent* )
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -398,7 +473,6 @@ void TransformationGUI_RotationDlg::ValueChangedInSpinBox()
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -408,25 +482,26 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
|
|||||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/)
|
bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/)
|
||||||
{
|
{
|
||||||
|
if (myObjects.length() < 1) return false;
|
||||||
|
|
||||||
switch (getConstructorId()) {
|
switch (getConstructorId()) {
|
||||||
case 0:
|
case 0:
|
||||||
return !( myObjects.length() == 0 || myAxis->_is_nil() );
|
return !(myAxis->_is_nil());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return !( myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() );
|
return !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : execute
|
// function : execute
|
||||||
@ -445,7 +520,8 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
|
|||||||
if (toCreateCopy) {
|
if (toCreateCopy) {
|
||||||
for (int i = 0; i < myObjects.length(); i++) {
|
for (int i = 0; i < myObjects.length(); i++) {
|
||||||
myCurrObject = myObjects[i];
|
myCurrObject = myObjects[i];
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 );
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
}
|
}
|
||||||
@ -453,7 +529,8 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
|
|||||||
else {
|
else {
|
||||||
for (int i = 0; i < myObjects.length(); i++) {
|
for (int i = 0; i < myObjects.length(); i++) {
|
||||||
myCurrObject = myObjects[i];
|
myCurrObject = myObjects[i];
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 );
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
Rotate(myObjects[i], myAxis, GetAngle() * PI180);
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
}
|
}
|
||||||
@ -466,7 +543,8 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
|
|||||||
if (toCreateCopy) {
|
if (toCreateCopy) {
|
||||||
for (int i = 0; i < myObjects.length(); i++) {
|
for (int i = 0; i < myObjects.length(); i++) {
|
||||||
myCurrObject = myObjects[i];
|
myCurrObject = myObjects[i];
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 );
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
RotateThreePointsCopy(myObjects[i], myCentPoint, myPoint1, myPoint2);
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
}
|
}
|
||||||
@ -474,7 +552,8 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
|
|||||||
else {
|
else {
|
||||||
for (int i = 0; i < myObjects.length(); i++) {
|
for (int i = 0; i < myObjects.length(); i++) {
|
||||||
myCurrObject = myObjects[i];
|
myCurrObject = myObjects[i];
|
||||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 );
|
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||||
|
RotateThreePoints(myObjects[i], myCentPoint, myPoint1, myPoint2);
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
}
|
}
|
||||||
@ -536,7 +615,7 @@ void TransformationGUI_RotationDlg::onReverse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : addSubshapeToStudy
|
// function : addSubshapesToStudy
|
||||||
// purpose : virtual method to add new SubObjects if local selection
|
// purpose : virtual method to add new SubObjects if local selection
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::addSubshapesToStudy()
|
void TransformationGUI_RotationDlg::addSubshapesToStudy()
|
||||||
|
@ -61,6 +61,9 @@ private:
|
|||||||
GEOM::GEOM_Object_var myCurrObject;
|
GEOM::GEOM_Object_var myCurrObject;
|
||||||
GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
|
GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
|
||||||
|
|
||||||
|
// to initialize the first selection field with a selected object on the dialog creation
|
||||||
|
bool myInitial;
|
||||||
|
|
||||||
DlgRef_4Sel1Spin2Check* GroupPoints;
|
DlgRef_4Sel1Spin2Check* GroupPoints;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -29,11 +29,12 @@
|
|||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <QtxDoubleSpinBox.h>
|
#include <QtxDoubleSpinBox.h>
|
||||||
#include <SUIT_ResourceMgr.h>
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
@ -51,7 +52,8 @@
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
|
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||||
bool modal, Qt::WindowFlags fl)
|
bool modal, Qt::WindowFlags fl)
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||||
|
myInitial(true)
|
||||||
{
|
{
|
||||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||||
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_SCALE")));
|
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_SCALE")));
|
||||||
@ -120,15 +122,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometry
|
|||||||
layout->setMargin(0); layout->setSpacing(6);
|
layout->setMargin(0); layout->setSpacing(6);
|
||||||
layout->addWidget(GroupBox1);
|
layout->addWidget(GroupBox1);
|
||||||
|
|
||||||
// Min, max, step and decimals for spin boxes & initial values
|
setHelpFileName("scale_operation_page.html");
|
||||||
double aFactor = 2.0;
|
|
||||||
double SpecificStep = 0.5;
|
|
||||||
initSpinBox( SpinBox_FX, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY );
|
|
||||||
initSpinBox( SpinBox_FY, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY );
|
|
||||||
initSpinBox( SpinBox_FZ, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY );
|
|
||||||
SpinBox_FX->setValue( aFactor );
|
|
||||||
SpinBox_FY->setValue( aFactor );
|
|
||||||
SpinBox_FZ->setValue( aFactor );
|
|
||||||
|
|
||||||
// Modification of an existing object by offset is not allowed
|
// Modification of an existing object by offset is not allowed
|
||||||
CheckBoxCopy->hide();
|
CheckBoxCopy->hide();
|
||||||
@ -139,6 +133,40 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometry
|
|||||||
// Allowed inheritance of children and visual properties by the scaling result
|
// Allowed inheritance of children and visual properties by the scaling result
|
||||||
mainFrame()->GroupBoxPublish->show();
|
mainFrame()->GroupBoxPublish->show();
|
||||||
|
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ~TransformationGUI_ScaleDlg()
|
||||||
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
|
//=================================================================================
|
||||||
|
TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : Init()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_ScaleDlg::Init()
|
||||||
|
{
|
||||||
|
// Min, max, step and decimals for spin boxes & initial values
|
||||||
|
double aFactor = 2.0;
|
||||||
|
double SpecificStep = 0.5;
|
||||||
|
|
||||||
|
initSpinBox(SpinBox_FX, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||||
|
initSpinBox(SpinBox_FY, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||||
|
initSpinBox(SpinBox_FZ, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||||
|
SpinBox_FX->setValue(aFactor);
|
||||||
|
SpinBox_FY->setValue(aFactor);
|
||||||
|
SpinBox_FZ->setValue(aFactor);
|
||||||
|
|
||||||
|
// init variables
|
||||||
|
LineEdit1->setText("");
|
||||||
|
LineEdit2->setText("");
|
||||||
|
|
||||||
|
myPoint = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
// Signals and slots connections
|
// Signals and slots connections
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
@ -158,33 +186,6 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometry
|
|||||||
|
|
||||||
connect(CheckBoxCopy, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
connect(CheckBoxCopy, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
setHelpFileName( "scale_operation_page.html" );
|
|
||||||
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ~TransformationGUI_ScaleDlg()
|
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
|
||||||
//=================================================================================
|
|
||||||
TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : Init()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_ScaleDlg::Init()
|
|
||||||
{
|
|
||||||
myEditCurrentArgument = LineEdit1;
|
|
||||||
LineEdit2->clear();
|
|
||||||
|
|
||||||
myPoint = GEOM::GEOM_Object::_nil();
|
|
||||||
|
|
||||||
initName(tr("GEOM_SCALE"));
|
initName(tr("GEOM_SCALE"));
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
@ -196,23 +197,26 @@ void TransformationGUI_ScaleDlg::Init()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::ConstructorsClicked (int constructorId)
|
void TransformationGUI_ScaleDlg::ConstructorsClicked (int constructorId)
|
||||||
{
|
{
|
||||||
erasePreview();
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
switch( constructorId )
|
switch (constructorId) {
|
||||||
{
|
case 0: // translation an object by dx, dy, dz
|
||||||
case 0: /* translation an object by dx, dy, dz */
|
|
||||||
TextLabel3->setText(tr("GEOM_SCALE_FACTOR"));
|
TextLabel3->setText(tr("GEOM_SCALE_FACTOR"));
|
||||||
TextLabel4->hide();
|
TextLabel4->hide();
|
||||||
TextLabel5->hide();
|
TextLabel5->hide();
|
||||||
SpinBox_FY->hide();
|
SpinBox_FY->hide();
|
||||||
SpinBox_FZ->hide();
|
SpinBox_FZ->hide();
|
||||||
|
|
||||||
|
PushButton1->click();
|
||||||
break;
|
break;
|
||||||
case 1: /* translation an object by 2 points */
|
case 1: // translation an object by 2 points
|
||||||
TextLabel3->setText(tr("GEOM_SCALE_FACTOR_X"));
|
TextLabel3->setText(tr("GEOM_SCALE_FACTOR_X"));
|
||||||
TextLabel4->show();
|
TextLabel4->show();
|
||||||
TextLabel5->show();
|
TextLabel5->show();
|
||||||
SpinBox_FY->show();
|
SpinBox_FY->show();
|
||||||
SpinBox_FZ->show();
|
SpinBox_FZ->show();
|
||||||
|
|
||||||
|
PushButton1->click();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -222,8 +226,14 @@ void TransformationGUI_ScaleDlg::ConstructorsClicked( int constructorId )
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
resize(minimumSize());
|
resize(minimumSize());
|
||||||
|
|
||||||
|
if (myInitial) {
|
||||||
|
myInitial = false;
|
||||||
|
SelectionIntoArgument();
|
||||||
|
}
|
||||||
|
else {
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -245,34 +255,42 @@ bool TransformationGUI_ScaleDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName(tr("GEOM_SCALE"));
|
initName(tr("GEOM_SCALE"));
|
||||||
|
// activate selection and connect selection manager
|
||||||
|
ConstructorsClicked(getConstructorId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// 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_ScaleDlg::SelectionIntoArgument()
|
void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
erasePreview();
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aName;
|
|
||||||
|
if (myEditCurrentArgument == LineEdit1)
|
||||||
|
myObjects.length(0);
|
||||||
|
else if (myEditCurrentArgument == LineEdit2)
|
||||||
|
myPoint = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
SALOME_ListIO aSelList;
|
SALOME_ListIO aSelList;
|
||||||
aSelMgr->selectedObjects(aSelList);
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
|
QString aName;
|
||||||
|
|
||||||
if (myEditCurrentArgument == LineEdit1)
|
if (myEditCurrentArgument == LineEdit1)
|
||||||
{
|
{
|
||||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||||
if (aNbSel < 1)
|
if (aNbSel < 1)
|
||||||
{
|
|
||||||
myObjects.length(0);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||||
if (!myObjects.length())
|
if (!myObjects.length())
|
||||||
return;
|
return;
|
||||||
|
else
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
}
|
}
|
||||||
else if (myEditCurrentArgument == LineEdit2)
|
else if (myEditCurrentArgument == LineEdit2)
|
||||||
{
|
{
|
||||||
@ -302,12 +320,11 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
|||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||||
aSelMgr->clearSelected();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
aSelectedObject = aFindedObject; // get Object from study
|
aSelectedObject = aFindedObject; // get Object from study
|
||||||
}
|
}
|
||||||
else
|
else // Global Selection
|
||||||
{
|
{
|
||||||
if (aShape.ShapeType() != TopAbs_VERTEX) {
|
if (aShape.ShapeType() != TopAbs_VERTEX) {
|
||||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
@ -319,9 +336,56 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
|
|
||||||
myPoint = aSelectedObject;
|
myPoint = aSelectedObject;
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
if (!myPoint->_is_nil() && !myObjects.length())
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SetEditCurrentArgument()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
||||||
|
{
|
||||||
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
globalSelection();
|
||||||
|
|
||||||
|
if (send == PushButton1) {
|
||||||
|
myEditCurrentArgument = LineEdit1;
|
||||||
|
|
||||||
|
PushButton2->setDown(false);
|
||||||
|
LineEdit2->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (send == PushButton2) {
|
||||||
|
myEditCurrentArgument = LineEdit2;
|
||||||
|
|
||||||
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
|
|
||||||
|
PushButton1->setDown(false);
|
||||||
|
LineEdit1->setEnabled(false);
|
||||||
|
}
|
||||||
|
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();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,27 +403,6 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : SetEditCurrentArgument()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
|
||||||
{
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
|
||||||
globalSelection();
|
|
||||||
|
|
||||||
if ( send == PushButton1 ) {
|
|
||||||
myEditCurrentArgument = LineEdit1;
|
|
||||||
}
|
|
||||||
else if ( send == PushButton2 ) {
|
|
||||||
myEditCurrentArgument = LineEdit2;
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
|
||||||
}
|
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -367,13 +410,9 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
|||||||
void TransformationGUI_ScaleDlg::ActivateThisDialog()
|
void TransformationGUI_ScaleDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
|
|
||||||
this, SLOT( SelectionIntoArgument() ) );
|
// reinit, because some selected objects could be removed
|
||||||
globalSelection();
|
Init();
|
||||||
myEditCurrentArgument->setFocus();
|
|
||||||
if ( myEditCurrentArgument == LineEdit2 ) {
|
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -412,7 +451,7 @@ void TransformationGUI_ScaleDlg::SetDoubleSpinBoxStep( double step )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
|
GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
|
||||||
{
|
{
|
||||||
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
|
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -66,6 +66,9 @@ private:
|
|||||||
GEOM::ListOfGO myObjects;
|
GEOM::ListOfGO myObjects;
|
||||||
GEOM::GEOM_Object_var myPoint; /* Central Point */
|
GEOM::GEOM_Object_var myPoint; /* Central Point */
|
||||||
|
|
||||||
|
// to initialize the first selection field with a selected object on the dialog creation
|
||||||
|
bool myInitial;
|
||||||
|
|
||||||
QGroupBox* GroupBox1;
|
QGroupBox* GroupBox1;
|
||||||
QLabel* TextLabel1;
|
QLabel* TextLabel1;
|
||||||
QLabel* TextLabel2;
|
QLabel* TextLabel2;
|
||||||
|
@ -196,8 +196,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
|||||||
GroupPoints->CheckBox1->hide();
|
GroupPoints->CheckBox1->hide();
|
||||||
|
|
||||||
GroupPoints->PushButton1->click();
|
GroupPoints->PushButton1->click();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 1: // translation an object by 2 points
|
case 1: // translation an object by 2 points
|
||||||
{
|
{
|
||||||
GroupPoints->ShowRows(3, 5, false);
|
GroupPoints->ShowRows(3, 5, false);
|
||||||
@ -214,8 +214,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
|||||||
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
GroupPoints->PushButton1->click();
|
GroupPoints->PushButton1->click();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 2: // translation an object by vector
|
case 2: // translation an object by vector
|
||||||
{
|
{
|
||||||
GroupPoints->ShowRows(0, 1, true);
|
GroupPoints->ShowRows(0, 1, true);
|
||||||
@ -234,8 +234,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
|||||||
ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
|
ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
|
||||||
|
|
||||||
GroupPoints->PushButton1->click();
|
GroupPoints->PushButton1->click();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user