From 2620958c225251bef0a09b7910494e0c6375b278 Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 18 Nov 2008 11:09:15 +0000 Subject: [PATCH] 0020044: EDF 866 GEOM: Extrusion along a path : impossible to select a Wire --- src/DlgRef/DlgRef_3Sel1Check_QTD.cxx | 12 +- src/DlgRef/DlgRef_3Sel1Check_QTD.h | 6 +- src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui | 12 +- src/GEOMGUI/GEOM_msg_en.po | 3 + src/GenerationGUI/GenerationGUI_PipeDlg.cxx | 128 +++++++++++++------- src/GenerationGUI/GenerationGUI_PipeDlg.h | 5 +- 6 files changed, 106 insertions(+), 60 deletions(-) diff --git a/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx b/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx index e30a066a7..b87b846b6 100644 --- a/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx +++ b/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx @@ -1,7 +1,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'DlgRef_3Sel1Check_QTD.ui' ** -** Created: Mon Oct 29 18:14:59 2007 +** Created: Tue Nov 18 12:14:50 2008 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -46,7 +46,7 @@ DlgRef_3Sel1Check_QTD::DlgRef_3Sel1Check_QTD( QWidget* parent, const char* name, LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); - GroupBox1Layout->addMultiCellWidget( LineEdit1, 0, 0, 2, 3 ); + GroupBox1Layout->addWidget( LineEdit1, 0, 2 ); TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); @@ -60,7 +60,7 @@ DlgRef_3Sel1Check_QTD::DlgRef_3Sel1Check_QTD( QWidget* parent, const char* name, LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); - GroupBox1Layout->addMultiCellWidget( LineEdit2, 1, 1, 2, 3 ); + GroupBox1Layout->addWidget( LineEdit2, 1, 2 ); TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); @@ -74,14 +74,14 @@ DlgRef_3Sel1Check_QTD::DlgRef_3Sel1Check_QTD( QWidget* parent, const char* name, LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); - GroupBox1Layout->addMultiCellWidget( LineEdit3, 2, 2, 2, 3 ); + GroupBox1Layout->addWidget( LineEdit3, 2, 2 ); TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); GroupBox1Layout->addWidget( TextLabel3, 2, 0 ); Spacer3 = new QSpacerItem( 16, 721, QSizePolicy::Minimum, QSizePolicy::Expanding ); - GroupBox1Layout->addItem( Spacer3, 4, 3 ); + GroupBox1Layout->addItem( Spacer3, 4, 2 ); CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); @@ -89,7 +89,7 @@ DlgRef_3Sel1Check_QTD::DlgRef_3Sel1Check_QTD( QWidget* parent, const char* name, DlgRef_3Sel1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); languageChange(); - resize( QSize(403, 441).expandedTo(minimumSizeHint()) ); + resize( QSize(311, 299).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); // tab order diff --git a/src/DlgRef/DlgRef_3Sel1Check_QTD.h b/src/DlgRef/DlgRef_3Sel1Check_QTD.h index 52a73f98e..b4dbdf74a 100644 --- a/src/DlgRef/DlgRef_3Sel1Check_QTD.h +++ b/src/DlgRef/DlgRef_3Sel1Check_QTD.h @@ -1,7 +1,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'DlgRef_3Sel1Check_QTD.ui' ** -** Created: Mon Oct 29 18:14:59 2007 +** Created: Tue Nov 18 12:14:50 2008 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -10,8 +10,6 @@ #ifndef DLGREF_3SEL1CHECK_QTD_H #define DLGREF_3SEL1CHECK_QTD_H -#include "GEOM_DlgRef.hxx" - #include #include @@ -25,7 +23,7 @@ class QLineEdit; class QLabel; class QCheckBox; -class GEOM_DLGREF_EXPORT DlgRef_3Sel1Check_QTD : public QWidget +class DlgRef_3Sel1Check_QTD : public QWidget { Q_OBJECT diff --git a/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui index b14325d36..021a99a14 100644 --- a/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui +++ b/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui @@ -8,8 +8,8 @@ 0 0 - 403 - 441 + 311 + 299 @@ -74,7 +74,7 @@ - + LineEdit1 @@ -111,7 +111,7 @@ - + LineEdit2 @@ -148,7 +148,7 @@ - + LineEdit3 @@ -169,7 +169,7 @@ TL3 - + Spacer3 diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index b74de7116..6afa4ba0e 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -1205,6 +1205,9 @@ msgstr "<< Set" msgid "GEOM_PIPE_TITLE" msgstr "Pipe Construction" +msgid "GEOM_SELECT_UNPUBLISHED_EDGES" +msgstr "Select unpublished edges" + #: GeometryGUI_PointDlg.cxx:52 msgid "GEOM_POINT_TITLE" msgstr "Point Construction" diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index e660e6819..4fd55bb16 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -34,7 +34,7 @@ #include "LightApp_SelectionMgr.h" #include - +#include #include #include #include @@ -43,6 +43,8 @@ #include #include #include +#include +#include #if OCC_VERSION_MAJOR >= 5 #include #else @@ -77,7 +79,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(GeometryGUI* theGeometryGUI, QWidge RadioButton2->setPixmap(image2); RadioButton3->close(TRUE); - GroupPoints = new DlgRef_3Sel_QTD(this, "GroupPoints"); + GroupPoints = new DlgRef_3Sel1Check_QTD(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT")); GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT")); @@ -85,6 +87,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(GeometryGUI* theGeometryGUI, QWidge GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton2->setPixmap(image1); GroupPoints->PushButton3->setPixmap(image1); + GroupPoints->CheckButton1->setText(tr("GEOM_SELECT_UNPUBLISHED_EDGES")); Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ @@ -119,6 +122,8 @@ void GenerationGUI_PipeDlg::Init() myOkBase = myOkPath = myOkVec = false; + GroupPoints->CheckButton1->setEnabled(false); + /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -131,6 +136,8 @@ void GenerationGUI_PipeDlg::Init() connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked())); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -175,6 +182,22 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId ) displayPreview(); } +//================================================================================= +// function : SelectionBittonClicked() +// purpose : Selection type Radio button management +//================================================================================= +void GenerationGUI_PipeDlg::SelectionTypeButtonClicked() +{ + if ( GroupPoints->CheckButton1->isChecked() ) { + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + } else { + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_WIRE); + aMap.Add(GEOM_LINE); + globalSelection(aMap); + } +} + //================================================================================= // function : ClickOnOk() @@ -258,49 +281,55 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() return; QString aName = GEOMBase::GetName( aSelectedObject ); - - if ( testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase) - { - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - TColStd_IndexedMapOfInteger aMap; - - aSelMgr->GetIndexes( firstIObject(), aMap ); - if ( aMap.Extent() == 1 ) - { - int anIndex = aMap( 1 ); - aName.append( ":edge_" + QString::number( anIndex ) ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - myOk = true; - } - else { // get Object from study + if (myEditCurrentArgument == GroupPoints->LineEdit2 && !GroupPoints->CheckButton1->isChecked() ){ + myPath = aSelectedObject; + myOkPath = true; + } + else + { + if ( testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase) + { + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + TColStd_IndexedMapOfInteger aMap; + + aSelMgr->GetIndexes( firstIObject(), aMap ); + if ( aMap.Extent() == 1 ) + { + int anIndex = aMap( 1 ); + aName.append( ":edge_" + QString::number( anIndex ) ); + + //Find SubShape Object in Father + GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); + + if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + myOk = true; + } + else { // get Object from study aSelectedObject = aFindedObject; myOk = true; + } + } + else { + myOk = true; + if (S.ShapeType() != TopAbs_EDGE) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + myOk = false; } } - else { - myOk = true; - if (S.ShapeType() != TopAbs_EDGE) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - myOk = false; + if (myEditCurrentArgument == GroupPoints->LineEdit2) { + myPath = aSelectedObject; + myOkPath = myOk; + } + else if (myEditCurrentArgument == GroupPoints->LineEdit3) { + myVec = aSelectedObject; + myOkVec = myOk; } } - if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myPath = aSelectedObject; - myOkPath = myOk; - } - else if (myEditCurrentArgument == GroupPoints->LineEdit3) { - myVec = aSelectedObject; - myOkVec = myOk; - } - } + } myEditCurrentArgument->setText( aName ); } @@ -321,18 +350,28 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() GroupPoints->LineEdit1->setFocus(); globalSelection( GEOM_ALLSHAPES ); myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->CheckButton1->setEnabled(false); } else if(send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + + if ( GroupPoints->CheckButton1->isChecked() ) { + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + } else { + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_WIRE); + aMap.Add(GEOM_LINE); + globalSelection(aMap); + } + GroupPoints->CheckButton1->setEnabled(true); } else if(send == GroupPoints->PushButton3) { GroupPoints->LineEdit3->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit3; globalSelection(); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + GroupPoints->CheckButton1->setEnabled(false); } SelectionIntoArgument(); } @@ -352,6 +391,11 @@ void GenerationGUI_PipeDlg::LineEditReturnPressed() myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } + + if (send == GroupPoints->LineEdit2) + GroupPoints->CheckButton1->setEnabled(true); + else + GroupPoints->CheckButton1->setEnabled(false); } @@ -373,7 +417,7 @@ void GenerationGUI_PipeDlg::enterEvent(QEvent* e) void GenerationGUI_PipeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - globalSelection( GEOM_ALLSHAPES ); + // globalSelection( GEOM_ALLSHAPES ); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked(getConstructorId()); diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index ab623ff55..4a1bb5171 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -31,7 +31,7 @@ #include "GenerationGUI.h" #include "GEOMBase_Skeleton.h" -#include "DlgRef_3Sel_QTD.h" +#include "DlgRef_3Sel1Check_QTD.h" //================================================================================= // class : GenerationGUI_PipeDlg @@ -64,7 +64,7 @@ private: bool myOkPath; bool myOkVec; /* to check when arguments are defined */ - DlgRef_3Sel_QTD* GroupPoints; + DlgRef_3Sel1Check_QTD* GroupPoints; private slots: void ClickOnOk(); @@ -74,6 +74,7 @@ private slots: void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked(int constructorId); + void SelectionTypeButtonClicked(); }; #endif // DIALOGBOX_PIPE_H -- 2.39.2