mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-25 17:42:04 +05:00
Bugs 16640, 19050: Improve selection mechanism in GEOM dialog boxes.
This commit is contained in:
parent
8cee57a187
commit
f82c26c9c5
@ -402,7 +402,7 @@ void BlocksGUI_BlockDlg::SetEditCurrentArgument()
|
||||
// enable push button and line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) then loses focus
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
aSender->setDown(true);
|
||||
|
||||
globalSelection(); // close local contexts, if any
|
||||
|
@ -407,7 +407,7 @@ void BlocksGUI_QuadFaceDlg::SetEditCurrentArgument()
|
||||
myEditCurrentArgument->setFocus();
|
||||
|
||||
// enable push button
|
||||
// after setFocus(), because it will be setDown(false) then loses focus
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
aSender->setDown(true);
|
||||
|
||||
activateSelection();
|
||||
|
@ -373,7 +373,7 @@ void BlocksGUI_TrsfDlg::SetEditCurrentArgument()
|
||||
myEditCurrentArgument->setFocus();
|
||||
|
||||
// enable push button
|
||||
// after setFocus(), because it will be setDown(false) then loses focus
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
aSender->setDown(true);
|
||||
|
||||
activateSelection();
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
@ -109,11 +109,10 @@ BooleanGUI_Dialog::BooleanGUI_Dialog( const int theOperation, GeometryGUI* theGe
|
||||
layout->addWidget(myGroup);
|
||||
/***************************************************************/
|
||||
|
||||
/* Initialisation */
|
||||
// Initialisation
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~BooleanGUI_Dialog()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -122,7 +121,6 @@ BooleanGUI_Dialog::~BooleanGUI_Dialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
@ -131,10 +129,14 @@ void BooleanGUI_Dialog::Init()
|
||||
{
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
/* init variables */
|
||||
// init variables
|
||||
myEditCurrentArgument = myGroup->LineEdit1;
|
||||
|
||||
/* signals and slots connections */
|
||||
myGroup->LineEdit1->setText("");
|
||||
myGroup->LineEdit2->setText("");
|
||||
myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
@ -156,8 +158,10 @@ void BooleanGUI_Dialog::Init()
|
||||
mainFrame()->RadioButton1->setFocus();
|
||||
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
}
|
||||
|
||||
myGroup->PushButton1->click();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
@ -169,7 +173,6 @@ void BooleanGUI_Dialog::ClickOnOk()
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
@ -180,12 +183,14 @@ bool BooleanGUI_Dialog::ClickOnApply()
|
||||
return false;
|
||||
|
||||
initName();
|
||||
// activate selection and connect selection manager
|
||||
myGroup->PushButton1->click();
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void BooleanGUI_Dialog::SelectionIntoArgument()
|
||||
{
|
||||
@ -204,10 +209,26 @@ void BooleanGUI_Dialog::SelectionIntoArgument()
|
||||
// nbSel == 1
|
||||
Standard_Boolean aRes = Standard_False;
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
|
||||
if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject)) {
|
||||
if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject))
|
||||
{
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
||||
if (myEditCurrentArgument == myGroup->LineEdit1) myObject1 = aSelectedObject;
|
||||
else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2 = aSelectedObject;
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
if (myEditCurrentArgument == myGroup->LineEdit1) {
|
||||
myObject1 = aSelectedObject;
|
||||
if (myObject2->_is_nil())
|
||||
myGroup->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == myGroup->LineEdit2) {
|
||||
myObject2 = aSelectedObject;
|
||||
if (myObject1->_is_nil())
|
||||
myGroup->PushButton1->click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,13 +240,25 @@ void BooleanGUI_Dialog::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
if ( send == myGroup->PushButton1 ) myEditCurrentArgument = myGroup->LineEdit1;
|
||||
else if ( send == myGroup->PushButton2 ) myEditCurrentArgument = myGroup->LineEdit2;
|
||||
if (send == myGroup->PushButton1) {
|
||||
myEditCurrentArgument = myGroup->LineEdit1;
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
myGroup->PushButton2->setDown(false);
|
||||
myGroup->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if (send == myGroup->PushButton2) {
|
||||
myEditCurrentArgument = myGroup->LineEdit2;
|
||||
|
||||
myGroup->PushButton1->setDown(false);
|
||||
myGroup->LineEdit1->setEnabled(false);
|
||||
}
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
@ -240,7 +273,6 @@ void BooleanGUI_Dialog::LineEditReturnPressed()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -248,11 +280,10 @@ void BooleanGUI_Dialog::LineEditReturnPressed()
|
||||
void BooleanGUI_Dialog::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
}
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
@ -277,7 +308,7 @@ GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation()
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool BooleanGUI_Dialog::isValid (QString& msg)
|
||||
bool BooleanGUI_Dialog::isValid (QString&)
|
||||
{
|
||||
//Handle(SALOME_InteractiveObject) IO = firstIObject();
|
||||
//Standard_Boolean testResult;
|
||||
|
@ -29,13 +29,13 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_EdgeDlg()
|
||||
// purpose : Constructs a BuildGUI_EdgeDlg which is a child of 'parent', with the
|
||||
@ -77,11 +77,10 @@ BuildGUI_EdgeDlg::BuildGUI_EdgeDlg( GeometryGUI* theGeometryGUI, QWidget* parent
|
||||
|
||||
setHelpFileName("create_edge_page.html");
|
||||
|
||||
/* Initialisations */
|
||||
// Initialisation
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~BuildGUI_EdgeDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -91,23 +90,22 @@ BuildGUI_EdgeDlg::~BuildGUI_EdgeDlg()
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
// init variables
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
myOkPoint1 = myOkPoint2 = false;
|
||||
|
||||
globalSelection( GEOM_POINT );
|
||||
|
||||
/* signals and slots connections */
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
@ -117,12 +115,11 @@ void BuildGUI_EdgeDlg::Init()
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
initName(tr("GEOM_EDGE"));
|
||||
}
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
@ -134,7 +131,6 @@ void BuildGUI_EdgeDlg::ClickOnOk()
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
@ -145,12 +141,14 @@ bool BuildGUI_EdgeDlg::ClickOnApply()
|
||||
return false;
|
||||
|
||||
initName();
|
||||
// activate selection and connect selection manager
|
||||
GroupPoints->PushButton1->click();
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::SelectionIntoArgument()
|
||||
{
|
||||
@ -172,20 +170,65 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument()
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
if (!testResult)
|
||||
if (!testResult || aSelectedObject->_is_nil())
|
||||
return;
|
||||
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
myPoint1 = aSelectedObject;
|
||||
myOkPoint1 = true;
|
||||
if (!myOkPoint2)
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
myPoint2 = aSelectedObject;
|
||||
myOkPoint2 = true;
|
||||
if (!myOkPoint1)
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
//globalSelection();//??
|
||||
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
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();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection(GEOM_POINT);
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
@ -202,31 +245,6 @@ void BuildGUI_EdgeDlg::LineEditReturnPressed()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::SetEditCurrentArgument()
|
||||
{
|
||||
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
globalSelection();
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
globalSelection( GEOM_POINT );
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton2 ) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
globalSelection( GEOM_POINT );
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -234,12 +252,10 @@ void BuildGUI_EdgeDlg::SetEditCurrentArgument()
|
||||
void BuildGUI_EdgeDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
globalSelection( GEOM_POINT );
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
|
@ -29,8 +29,8 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
@ -83,35 +83,35 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg( GeometryGUI* theGeometryGUI, QWidg
|
||||
|
||||
setHelpFileName("create_extrusion_alongpath_page.html");
|
||||
|
||||
/* Initialisations */
|
||||
// Initialisation
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~GenerationGUI_PipeDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
GenerationGUI_PipeDlg::~GenerationGUI_PipeDlg()
|
||||
{
|
||||
/* no need to delete child widgets, Qt does it all for us */
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GenerationGUI_PipeDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
// init variables
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
myBase = myPath = GEOM::GEOM_Object::_nil();
|
||||
myOkBase = myOkPath = false;
|
||||
|
||||
/* signals and slots connections */
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
@ -121,15 +121,12 @@ void GenerationGUI_PipeDlg::Init()
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
initName(tr("GEOM_PIPE"));
|
||||
|
||||
//globalSelection( GEOM_ALLSHAPES );
|
||||
GroupPoints->PushButton1->click();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
@ -140,9 +137,8 @@ void GenerationGUI_PipeDlg::ClickOnOk()
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnAply()
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool GenerationGUI_PipeDlg::ClickOnApply()
|
||||
@ -151,43 +147,42 @@ bool GenerationGUI_PipeDlg::ClickOnApply()
|
||||
return false;
|
||||
|
||||
initName();
|
||||
// activate selection and connect selection manager
|
||||
GroupPoints->PushButton1->click();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false;
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if (aSelList.Extent() != 1) {
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false;
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
|
||||
if (!testResult)
|
||||
if (!testResult || aSelectedObject->_is_nil())
|
||||
return;
|
||||
|
||||
TopoDS_Shape S;
|
||||
if (!GEOMBase::GetShape(aSelectedObject, S))
|
||||
return;
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
myOkBase = false;
|
||||
|
||||
if (!GEOMBase::GetShape(aSelectedObject, S) ||
|
||||
S.ShapeType() == TopAbs_COMPSOLID ||
|
||||
if (S.ShapeType() == TopAbs_COMPSOLID ||
|
||||
S.ShapeType() == TopAbs_COMPOUND ||
|
||||
S.ShapeType() == TopAbs_SOLID ||
|
||||
S.ShapeType() == TopAbs_SHAPE)
|
||||
@ -196,16 +191,13 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
||||
myBase = aSelectedObject;
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
||||
myOkBase = true;
|
||||
if (!myOkPath)
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
myOkPath = false;
|
||||
|
||||
if (!GEOMBase::GetShape(aSelectedObject, S))
|
||||
return;
|
||||
|
||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
if (testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase) {
|
||||
if (aSelectedObject != myBase) {
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
@ -237,8 +229,16 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aName);
|
||||
if (myOkPath && !myOkBase)
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
@ -249,22 +249,33 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
||||
void GenerationGUI_PipeDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
globalSelection();
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) {
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
GroupPoints->LineEdit2->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
globalSelection();
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
}
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
@ -280,6 +291,17 @@ void GenerationGUI_PipeDlg::LineEditReturnPressed()
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GenerationGUI_PipeDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
@ -291,21 +313,6 @@ void GenerationGUI_PipeDlg::enterEvent( QEvent* )
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GenerationGUI_PipeDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) );
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
@ -332,8 +339,7 @@ bool GenerationGUI_PipeDlg::execute( ObjectList& objects )
|
||||
{
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
|
||||
getOperation() )->MakePipe( myBase, myPath );
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakePipe(myBase, myPath);
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
@ -341,7 +347,6 @@ bool GenerationGUI_PipeDlg::execute( ObjectList& objects )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : addSubshapeToStudy
|
||||
// purpose : virtual method to add new SubObjects if local selection
|
||||
@ -354,4 +359,3 @@ void GenerationGUI_PipeDlg::addSubshapesToStudy()
|
||||
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,12 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@ -52,7 +53,8 @@
|
||||
//=================================================================================
|
||||
GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (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 = SUIT_Session::session()->resourceMgr();
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM")));
|
||||
@ -117,7 +119,6 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg( GeometryGUI* theGeometryGUI, QWi
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~GenerationGUI_PrismDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -127,32 +128,17 @@ GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GenerationGUI_PrismDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupPoints->LineEdit2->setReadOnly( true );
|
||||
|
||||
GroupPoints2->LineEdit1->setReadOnly( true );
|
||||
GroupPoints2->LineEdit2->setReadOnly( true );
|
||||
GroupPoints2->LineEdit3->setReadOnly( true );
|
||||
|
||||
GroupPoints3->LineEdit1->setReadOnly( true );
|
||||
|
||||
myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
|
||||
myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
|
||||
|
||||
/* Get setting of step value from file configuration */
|
||||
// Get setting of step value from file configuration
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
initSpinBox(GroupPoints3->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3); // VSR:TODO : DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupPoints3->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3); // VSR:TODO : DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupPoints3->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3); // VSR:TODO : DBL_DIGITS_DISPLAY
|
||||
@ -163,7 +149,30 @@ void GenerationGUI_PrismDlg::Init()
|
||||
initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
GroupPoints->SpinBox_DX->setValue(100.0);
|
||||
|
||||
/* signals and slots connections */
|
||||
// init variables
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
GroupPoints2->LineEdit1->setReadOnly(true);
|
||||
GroupPoints2->LineEdit2->setReadOnly(true);
|
||||
GroupPoints2->LineEdit3->setReadOnly(true);
|
||||
|
||||
GroupPoints3->LineEdit1->setReadOnly(true);
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
|
||||
GroupPoints2->LineEdit1->setText("");
|
||||
GroupPoints2->LineEdit2->setText("");
|
||||
GroupPoints2->LineEdit3->setText("");
|
||||
|
||||
GroupPoints3->LineEdit1->setText("");
|
||||
|
||||
myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
|
||||
myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
|
||||
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
@ -197,9 +206,6 @@ void GenerationGUI_PrismDlg::Init()
|
||||
connect(GroupPoints3->SpinBox_DZ, SIGNAL(valueChanged (double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
connect(GroupPoints3->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
initName(tr("GEOM_EXTRUSION"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
@ -217,60 +223,54 @@ void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep( double step )
|
||||
GroupPoints3->SpinBox_DZ->setSingleStep(step);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
erasePreview();
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
switch (constructorId) {
|
||||
case 0:
|
||||
{
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
GroupPoints2->hide();
|
||||
GroupPoints3->hide();
|
||||
GroupPoints->show();
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setText(GroupPoints2->LineEdit1->text()); // keep base
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
myVec = GEOM::GEOM_Object::_nil();
|
||||
myOkVec = false;
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
GroupPoints->hide();
|
||||
GroupPoints2->show();
|
||||
GroupPoints3->hide();
|
||||
|
||||
myEditCurrentArgument = GroupPoints2->LineEdit1;
|
||||
GroupPoints2->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
|
||||
GroupPoints2->LineEdit2->setText("");
|
||||
GroupPoints2->LineEdit3->setText("");
|
||||
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
myOkPnt1 = myOkPnt2 = false;
|
||||
|
||||
GroupPoints2->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
GroupPoints->hide();
|
||||
GroupPoints2->hide();
|
||||
GroupPoints3->show();
|
||||
|
||||
myEditCurrentArgument = GroupPoints3->LineEdit1;
|
||||
GroupPoints3->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
|
||||
|
||||
GroupPoints3->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,14 +278,14 @@ void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId )
|
||||
updateGeometry();
|
||||
resize(minimumSize());
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
if ( !myOkBase )
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
else {
|
||||
displayPreview();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
@ -297,7 +297,6 @@ void GenerationGUI_PrismDlg::ClickOnOk()
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
@ -308,13 +307,14 @@ bool GenerationGUI_PrismDlg::ClickOnApply()
|
||||
return false;
|
||||
|
||||
initName();
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
||||
{
|
||||
@ -339,13 +339,16 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
GEOM::GEOM_Object_var aSelectedObject =
|
||||
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
if (!testResult)
|
||||
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||
return;
|
||||
|
||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
// Get Selected object if selected subshape
|
||||
bool myOk = true;
|
||||
TopoDS_Shape aShape;
|
||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||
{
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
@ -364,7 +367,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
||||
aSelectedObject = aFindedObject; // get Object from study
|
||||
}
|
||||
}
|
||||
else {
|
||||
else { // Global Selection
|
||||
if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
@ -373,15 +376,20 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
||||
}
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
myBase = aSelectedObject;
|
||||
myOkBase = true;
|
||||
if (!myOkVec)
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) {
|
||||
myOkVec = true;
|
||||
myVec = aSelectedObject;
|
||||
if (!myOkBase)
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
else if (getConstructorId() == 1) { // getConstructorId()==1 - extrusion using 2 points
|
||||
if (aSelList.Extent() != 1) {
|
||||
@ -442,14 +450,20 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
||||
if (myEditCurrentArgument == GroupPoints2->LineEdit1) {
|
||||
myOkBase = true;
|
||||
myBase = aSelectedObject;
|
||||
if (!myOkPnt1)
|
||||
GroupPoints2->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) {
|
||||
myOkPnt1 = true;
|
||||
myPoint1 = aSelectedObject;
|
||||
if (!myOkPnt2)
|
||||
GroupPoints2->PushButton3->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk) {
|
||||
myOkPnt2 = true;
|
||||
myPoint2 = aSelectedObject;
|
||||
if (!myOkBase)
|
||||
GroupPoints2->PushButton1->click();
|
||||
}
|
||||
}
|
||||
else if (getConstructorId() == 2) { // extrusion using dx dy dz
|
||||
@ -465,6 +479,12 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
||||
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();
|
||||
}
|
||||
|
||||
@ -475,40 +495,58 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
||||
void GenerationGUI_PrismDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
GroupPoints->LineEdit2->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
}
|
||||
else if (send == GroupPoints2->PushButton1) {
|
||||
GroupPoints2->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupPoints2->LineEdit1;
|
||||
GroupPoints2->PushButton2->setDown(false);
|
||||
GroupPoints2->PushButton3->setDown(false);
|
||||
GroupPoints2->LineEdit2->setEnabled(false);
|
||||
GroupPoints2->LineEdit3->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupPoints2->PushButton2) {
|
||||
GroupPoints2->LineEdit2->setFocus();
|
||||
myEditCurrentArgument = GroupPoints2->LineEdit2;
|
||||
GroupPoints2->PushButton1->setDown(false);
|
||||
GroupPoints2->PushButton3->setDown(false);
|
||||
GroupPoints2->LineEdit1->setEnabled(false);
|
||||
GroupPoints2->LineEdit3->setEnabled(false);
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
}
|
||||
else if (send == GroupPoints2->PushButton3) {
|
||||
GroupPoints2->LineEdit3->setFocus();
|
||||
myEditCurrentArgument = GroupPoints2->LineEdit3;
|
||||
GroupPoints2->PushButton1->setDown(false);
|
||||
GroupPoints2->PushButton2->setDown(false);
|
||||
GroupPoints2->LineEdit1->setEnabled(false);
|
||||
GroupPoints2->LineEdit2->setEnabled(false);
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
}
|
||||
else if (send == GroupPoints3->PushButton1) {
|
||||
GroupPoints3->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupPoints3->LineEdit1;
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
@ -528,6 +566,18 @@ void GenerationGUI_PrismDlg::LineEditReturnPressed()
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GenerationGUI_PrismDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose : when mouse enter onto the QWidget
|
||||
@ -538,22 +588,6 @@ void GenerationGUI_PrismDlg::enterEvent( QEvent* )
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GenerationGUI_PrismDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
@ -563,7 +597,6 @@ void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : getHeight()
|
||||
// purpose :
|
||||
@ -594,6 +627,8 @@ bool GenerationGUI_PrismDlg::isValid( QString& )
|
||||
return (myOkBase && myOkPnt1 && myOkPnt2); // by two points
|
||||
else if (getConstructorId() == 2)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -640,13 +675,13 @@ bool GenerationGUI_PrismDlg::execute( ObjectList& objects )
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : onReverse()
|
||||
// purpose :
|
||||
|
@ -69,6 +69,9 @@ private:
|
||||
bool myBothway2;
|
||||
bool myBothway3;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_2Sel1Spin2Check* GroupPoints;
|
||||
DlgRef_3Sel1Check* GroupPoints2; // for second layout for extrusion using 2 points
|
||||
DlgRef_1Sel3Spin1Check* GroupPoints3;
|
||||
|
@ -29,8 +29,8 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
@ -88,11 +88,10 @@ GenerationGUI_RevolDlg::GenerationGUI_RevolDlg( GeometryGUI* theGeometryGUI, QWi
|
||||
|
||||
setHelpFileName("create_revolution_page.html");
|
||||
|
||||
/* Initialisations */
|
||||
// Initialisation
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~GenerationGUI_RevolDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -102,28 +101,27 @@ GenerationGUI_RevolDlg::~GenerationGUI_RevolDlg()
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GenerationGUI_RevolDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupPoints->LineEdit2->setReadOnly( true );
|
||||
|
||||
myOkBase = myOkAxis = false;
|
||||
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
double SpecificStep = 5;
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
//initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
// 05.06.2008 skl for IPAL12958
|
||||
initSpinBox(GroupPoints->SpinBox_DX, 0.0, 360.0, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
GroupPoints->SpinBox_DX->setValue(45.0);
|
||||
|
||||
/* signals and slots connections */
|
||||
// init variables
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
myBase = myAxis = GEOM::GEOM_Object::_nil();
|
||||
myOkBase = myOkAxis = false;
|
||||
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
@ -139,12 +137,10 @@ void GenerationGUI_RevolDlg::Init()
|
||||
|
||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
initName(tr("GEOM_REVOLUTION"));
|
||||
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
GroupPoints->PushButton1->click();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -156,8 +152,6 @@ void GenerationGUI_RevolDlg::SetDoubleSpinBoxStep( double step )
|
||||
GroupPoints->SpinBox_DX->setSingleStep(step);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
@ -168,7 +162,6 @@ void GenerationGUI_RevolDlg::ClickOnOk()
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
@ -179,6 +172,8 @@ bool GenerationGUI_RevolDlg::ClickOnApply()
|
||||
return false;
|
||||
|
||||
initName();
|
||||
// activate selection and connect selection manager
|
||||
GroupPoints->PushButton1->click();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -186,7 +181,6 @@ bool GenerationGUI_RevolDlg::ClickOnApply()
|
||||
//function : isAcceptableBase
|
||||
//purpose : return true if theBase can be used as algo argument
|
||||
//=======================================================================
|
||||
|
||||
static bool isAcceptableBase (const TopoDS_Shape& theBase)
|
||||
{
|
||||
switch (theBase.ShapeType()) {
|
||||
@ -211,52 +205,49 @@ static bool isAcceptableBase( const TopoDS_Shape& theBase )
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void GenerationGUI_RevolDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkAxis = false;
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if (aSelList.Extent() != 1) {
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
|
||||
myOkBase = false;
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
|
||||
myOkAxis = false;
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
||||
|
||||
if ( !testResult )
|
||||
if (!testResult || aSelectedObject->_is_nil())
|
||||
return;
|
||||
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
|
||||
TopoDS_Shape S;
|
||||
myOkBase = false;
|
||||
if (!GEOMBase::GetShape(aSelectedObject, S) || S.IsNull())
|
||||
return;
|
||||
|
||||
if ( !GEOMBase::GetShape(aSelectedObject, S) || !isAcceptableBase( S ) )
|
||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
if (!isAcceptableBase(S))
|
||||
return;
|
||||
|
||||
myBase = aSelectedObject;
|
||||
myOkBase = true;
|
||||
myEditCurrentArgument->setText(aName);
|
||||
if (!myOkAxis)
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
if ( testResult && !aSelectedObject->_is_nil() ) {
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
|
||||
int anIndex = aMap(1);
|
||||
aName.append(":edge_" + QString::number(anIndex));
|
||||
|
||||
@ -276,18 +267,23 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
|
||||
}
|
||||
else {
|
||||
myOkAxis = true;
|
||||
if ( aShape.ShapeType() != TopAbs_EDGE ) {
|
||||
if (S.ShapeType() != TopAbs_EDGE) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
myOkAxis = false;
|
||||
}
|
||||
myAxis = aSelectedObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aName);
|
||||
if (myOkAxis && !myOkBase)
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText( aName );
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
@ -299,20 +295,32 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
|
||||
void GenerationGUI_RevolDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
GroupPoints->LineEdit2->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
}
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
@ -328,7 +336,6 @@ void GenerationGUI_RevolDlg::LineEditReturnPressed()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -336,13 +343,10 @@ void GenerationGUI_RevolDlg::LineEditReturnPressed()
|
||||
void GenerationGUI_RevolDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) );
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
@ -354,7 +358,6 @@ void GenerationGUI_RevolDlg::enterEvent( QEvent* )
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
@ -364,7 +367,6 @@ void GenerationGUI_RevolDlg::ValueChangedInSpinBox()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : getAngle()
|
||||
// purpose :
|
||||
@ -401,12 +403,12 @@ bool GenerationGUI_RevolDlg::execute( ObjectList& objects )
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
if (!myBothway) {
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
|
||||
getOperation() )->MakeRevolutionAxisAngle( myBase, myAxis, getAngle() * PI180 );
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeRevolutionAxisAngle(myBase, myAxis, getAngle() * PI180);
|
||||
}
|
||||
else {
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
|
||||
getOperation() )->MakeRevolutionAxisAngle2Ways( myBase, myAxis, getAngle() * PI180 );
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeRevolutionAxisAngle2Ways(myBase, myAxis, getAngle() * PI180);
|
||||
}
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
@ -415,7 +417,6 @@ bool GenerationGUI_RevolDlg::execute( ObjectList& objects )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : onReverse()
|
||||
// purpose :
|
||||
@ -426,7 +427,6 @@ void GenerationGUI_RevolDlg::onReverse()
|
||||
GroupPoints->SpinBox_DX->setValue(-anOldValue);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : onBothway()
|
||||
// purpose :
|
||||
|
@ -349,7 +349,7 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) then loses focus
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
@ -357,6 +357,9 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -371,8 +371,11 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument()
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) then loses focus
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -367,8 +367,11 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) then loses focus
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -464,7 +464,7 @@ void PrimitiveGUI_DiskDlg::SetEditCurrentArgument()
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) then loses focus
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
|
@ -121,7 +121,6 @@ void PrimitiveGUI_TorusDlg::Init()
|
||||
initSpinBox(GroupDimensions->SpinBox_DY, 0.001, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
|
||||
// init variables
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
@ -254,17 +253,15 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if (aSelList.Extent() != 1) {
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myPoint = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||
myDir = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
@ -367,7 +364,7 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) then loses focus
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
|
@ -29,11 +29,12 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@ -52,7 +53,8 @@
|
||||
//=================================================================================
|
||||
TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
|
||||
(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();
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_DXYZ")));
|
||||
@ -89,10 +91,13 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
|
||||
|
||||
setHelpFileName("translation_operation_page.html");
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckBox2->setChecked(true);
|
||||
CreateCopyModeChanged(true);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~TransformationGUI_TranslationDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -102,32 +107,17 @@ TransformationGUI_TranslationDlg::~TransformationGUI_TranslationDlg()
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupPoints->LineEdit2->setReadOnly( true );
|
||||
GroupPoints->LineEdit3->setReadOnly( true );
|
||||
|
||||
myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckBox2->setChecked( true );
|
||||
CreateCopyModeChanged( true );
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
/* Get setting of step value from file configuration */
|
||||
// Get setting of step value from file configuration
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
initSpinBox(GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
@ -136,7 +126,20 @@ void TransformationGUI_TranslationDlg::Init()
|
||||
GroupPoints->SpinBox2->setValue(0.0);
|
||||
GroupPoints->SpinBox3->setValue(0.0);
|
||||
|
||||
/* signals and slots connections */
|
||||
// init variables
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
GroupPoints->LineEdit3->setReadOnly(true);
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
GroupPoints->LineEdit3->setText("");
|
||||
|
||||
myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
@ -157,15 +160,11 @@ void TransformationGUI_TranslationDlg::Init()
|
||||
connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged(bool)));
|
||||
connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
initName(tr("GEOM_TRANSLATION"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetDoubleSpinBoxStep()
|
||||
// purpose : Double spin box management
|
||||
@ -183,48 +182,58 @@ void TransformationGUI_TranslationDlg::SetDoubleSpinBoxStep( double step )
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
erasePreview();
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
globalSelection();
|
||||
|
||||
switch (constructorId) {
|
||||
case 0: /* translation an object by dx, dy, dz */
|
||||
case 0: // translation an object by dx, dy, dz
|
||||
{
|
||||
GroupPoints->ShowRows(1, 2, false);
|
||||
GroupPoints->ShowRows(3, 5, true);
|
||||
|
||||
GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
|
||||
GroupPoints->CheckBox1->hide();
|
||||
GroupPoints->SpinBox3->setEnabled(true);
|
||||
|
||||
GroupPoints->CheckBox1->hide();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
case 1: /* translation an object by 2 points */
|
||||
case 1: // translation an object by 2 points
|
||||
{
|
||||
GroupPoints->ShowRows(3, 5, false);
|
||||
GroupPoints->ShowRows(0, 2, true);
|
||||
GroupPoints->CheckBox1->hide();
|
||||
|
||||
GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg(1));
|
||||
GroupPoints->LineEdit2->clear();
|
||||
GroupPoints->LineEdit3->clear();
|
||||
GroupPoints->SpinBox3->setEnabled(true);
|
||||
|
||||
GroupPoints->CheckBox1->hide();
|
||||
|
||||
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
case 2: /* translation an object by vector */
|
||||
case 2: // translation an object by vector
|
||||
{
|
||||
GroupPoints->ShowRows(0, 1, true);
|
||||
GroupPoints->ShowRows(2, 4, false);
|
||||
GroupPoints->ShowRows(5, 5, true);
|
||||
GroupPoints->CheckBox1->show();
|
||||
|
||||
GroupPoints->TextLabel6->setText(tr("GEOM_DISTANCE"));
|
||||
GroupPoints->SpinBox3->setValue(0.0);
|
||||
GroupPoints->SpinBox3->setEnabled(false);
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
|
||||
GroupPoints->LineEdit2->clear();
|
||||
|
||||
GroupPoints->CheckBox1->show();
|
||||
|
||||
myVector = GEOM::GEOM_Object::_nil();
|
||||
ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -233,11 +242,14 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked( int constructorId )
|
||||
updateGeometry();
|
||||
resize(minimumSize());
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
else {
|
||||
displayPreview();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
@ -249,7 +261,6 @@ void TransformationGUI_TranslationDlg::ClickOnOk()
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
@ -260,54 +271,74 @@ bool TransformationGUI_TranslationDlg::ClickOnApply()
|
||||
return false;
|
||||
|
||||
initName();
|
||||
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aName;
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
|
||||
if (aNbSel < 1) {
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myObjects.length(0);
|
||||
return;
|
||||
}
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (aSelList.Extent() != 1 ) {
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
|
||||
myPoint1 = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
|
||||
myVector = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit3)
|
||||
myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
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);
|
||||
|
||||
// here we do not switch to the next field, because multiple objects can be selected
|
||||
/*
|
||||
if (getConstructorId() == 1) {
|
||||
if (myPoint1->_is_nil())
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (getConstructorId() == 2) {
|
||||
if (myVector->_is_nil())
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
|
||||
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||
return;
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
// Get Selected object if selected subshape
|
||||
TopoDS_Shape aShape;
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||
{
|
||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||
@ -332,9 +363,10 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else
|
||||
else {
|
||||
aSelectedObject = aFindedObject;
|
||||
}
|
||||
}
|
||||
else // Global Selection
|
||||
{
|
||||
if (aShape.ShapeType() != aNeedType) {
|
||||
@ -344,16 +376,86 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
|
||||
}
|
||||
}
|
||||
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
|
||||
myPoint1 = aSelectedObject;
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 )
|
||||
myVector = aSelectedObject;
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit3 )
|
||||
myPoint2 = aSelectedObject;
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
|
||||
myPoint1 = aSelectedObject;
|
||||
if (!myPoint1->_is_nil() && myPoint2->_is_nil())
|
||||
GroupPoints->PushButton3->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) {
|
||||
myVector = aSelectedObject;
|
||||
if (!myVector->_is_nil() && !myObjects.length())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
|
||||
myPoint2 = aSelectedObject;
|
||||
if (!myPoint2->_is_nil() && !myObjects.length())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
}
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection();
|
||||
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->PushButton3->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
GroupPoints->LineEdit3->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->PushButton3->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
GroupPoints->LineEdit3->setEnabled(false);
|
||||
|
||||
if (getConstructorId() == 1)
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
else
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
}
|
||||
else if (send == GroupPoints->PushButton3) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit3;
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// 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();
|
||||
}
|
||||
|
||||
@ -370,36 +472,6 @@ void TransformationGUI_TranslationDlg::LineEditReturnPressed()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
globalSelection();
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton2 ) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
if ( getConstructorId() == 1 )
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||
else
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton3 ) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit3;
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -408,13 +480,10 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
@ -425,7 +494,6 @@ void TransformationGUI_TranslationDlg::enterEvent( QEvent* )
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
@ -435,7 +503,6 @@ void TransformationGUI_TranslationDlg::ValueChangedInSpinBox()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
@ -445,7 +512,6 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
|
||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
@ -454,25 +520,15 @@ bool TransformationGUI_TranslationDlg::isValid( QString& /*msg*/ )
|
||||
{
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
if (myObjects.length() < 1) return false;
|
||||
|
||||
switch (aConstructorId) {
|
||||
case 0:
|
||||
{
|
||||
//LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
//SALOME_ListIO aSelList;
|
||||
//aSelMgr->selectedObjects(aSelList);
|
||||
//
|
||||
//Handle(SALOME_InteractiveObject) IO = aSelList.First();
|
||||
//Standard_Boolean testResult;
|
||||
//GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult);
|
||||
//if (!testResult || anObject->_is_nil())
|
||||
// return false;
|
||||
|
||||
return !(myObjects.length() == 0);
|
||||
}
|
||||
return true;
|
||||
case 1:
|
||||
return !(myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil());
|
||||
return !(myPoint1->_is_nil() || myPoint2->_is_nil());
|
||||
case 2:
|
||||
return !( myObjects.length() == 0 || myVector->_is_nil());
|
||||
return !(myVector->_is_nil());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -562,7 +618,6 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
|
||||
TranslateVectorCopy(myObjects[i], myVector);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -59,7 +59,9 @@ private:
|
||||
GEOM::ListOfGO myObjects;
|
||||
GEOM::GEOM_Object_var myCurrObject;
|
||||
GEOM::GEOM_Object_var myVector, myPoint1, myPoint2;
|
||||
double myTranslateDistance;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_3Sel3Spin2Check* GroupPoints;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user