From: kga Date: Wed, 30 Oct 2013 09:48:10 +0000 (+0000) Subject: 0022289: EDF 2623 GEOM: Make "MakePipeWithDifferentsSections" available from GUI X-Git-Tag: BR_hydro_v_0_3_1~58 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=84a06f4f463e37e4a243803e5b83a645ad0fa561;p=modules%2Fgeom.git 0022289: EDF 2623 GEOM: Make "MakePipeWithDifferentsSections" available from GUI --- diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 937bc6e60..4e4074c29 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -125,6 +125,7 @@ SET( _res_files partitionplane.png pipe.png pipebinormal.png + pipesections.png plane.png planeWorking.png plane3points.png diff --git a/resources/pipesections.png b/resources/pipesections.png new file mode 100644 index 000000000..410282221 Binary files /dev/null and b/resources/pipesections.png differ diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 97faa85cf..90d8f28ee 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -391,6 +391,10 @@ ICON_DLG_PIPE_BINORMAL pipebinormal.png + + ICON_DLG_PIPE_SECTION + pipesections.png + ICON_DLG_PLANE_3PNTS plane3points.png diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 9ab089610..2a878f5ba 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -675,6 +675,10 @@ Please, select face, shell or solid and try again GEOM_LCS Local coordinate system + + GEOM_LOCATIONS + Locations + GEOM_FACES Faces @@ -1216,6 +1220,14 @@ Please, select face, shell or solid and try again GEOM_TARGET_OBJECT Target face + + GEOM_WITH_CONTACT + With contact + + + GEOM_WITH_CORRECTION + With correction + GEOM_OPERATIONS Operations diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 0e6ad23e1..edcad8e0a 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -681,6 +681,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_LCS Système de coordonnées local + + GEOM_LOCATIONS + Locations + GEOM_FACES Faces @@ -1222,6 +1226,14 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_TARGET_OBJECT Face d'objectif + + GEOM_WITH_CONTACT + With contact + + + GEOM_WITH_CORRECTION + With correction + GEOM_OPERATIONS Opérations diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index a5f81be42..76c23f9e0 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -59,6 +59,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE"))); QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE_BINORMAL"))); + QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE_SECTION"))); setWindowTitle(tr("GEOM_PIPE_TITLE")); @@ -66,8 +67,9 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE")); mainFrame()->RadioButton1->setIcon(image0); mainFrame()->RadioButton2->setIcon(image2); - mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); - mainFrame()->RadioButton3->close(); + mainFrame()->RadioButton3->setIcon(image3); + // mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + // mainFrame()->RadioButton3->close(); GroupPoints = new DlgRef_3Sel1Check(centralWidget()); @@ -80,9 +82,28 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg GroupPoints->PushButton3->setIcon(image1); GroupPoints->CheckButton1->setText(tr("GEOM_SELECT_UNPUBLISHED_EDGES")); + GroupMakePoints = new DlgRef_3Sel2Check3Spin(centralWidget()); + + GroupMakePoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupMakePoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT")); + GroupMakePoints->TextLabel2->setText(tr("GEOM_LOCATIONS")); + GroupMakePoints->TextLabel3->setText(tr("GEOM_PATH_OBJECT")); + GroupMakePoints->PushButton1->setIcon(image1); + GroupMakePoints->PushButton2->setIcon(image1); + GroupMakePoints->PushButton3->setIcon(image1); + GroupMakePoints->CheckBox1->setText(tr("GEOM_WITH_CONTACT")); + GroupMakePoints->CheckBox2->setText(tr("GEOM_WITH_CORRECTION")); + GroupMakePoints->SpinBox1->close(); + GroupMakePoints->SpinBox2->close(); + GroupMakePoints->SpinBox3->close(); + GroupMakePoints->TextLabel4->close(); + GroupMakePoints->TextLabel5->close(); + GroupMakePoints->TextLabel6->close(); + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); layout->addWidget(GroupPoints); + layout->addWidget(GroupMakePoints); /***************************************************************/ setHelpFileName("create_extrusion_alongpath_page.html"); @@ -119,6 +140,14 @@ void GenerationGUI_PipeDlg::Init() GroupPoints->CheckButton1->setEnabled(false); + GroupMakePoints->LineEdit1->setReadOnly(true); + GroupMakePoints->LineEdit2->setReadOnly(true); + GroupMakePoints->LineEdit3->setReadOnly(true); + + GroupMakePoints->LineEdit1->setText(""); + GroupMakePoints->LineEdit2->setText(""); + GroupMakePoints->LineEdit3->setText(""); + showOnlyPreviewControl(); // signals and slots connections @@ -133,6 +162,10 @@ void GenerationGUI_PipeDlg::Init() connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked())); + connect(GroupMakePoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupMakePoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupMakePoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + initName(tr("GEOM_PIPE")); resize(100,100); @@ -155,15 +188,25 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId ) switch (constructorId) { case 0: + GroupMakePoints->hide(); + GroupPoints->show(); GroupPoints->TextLabel3->hide(); GroupPoints->PushButton3->hide(); GroupPoints->LineEdit3->hide(); GroupPoints->PushButton1->click(); break; case 1: + GroupMakePoints->hide(); + GroupPoints->show(); GroupPoints->TextLabel3->show(); GroupPoints->PushButton3->show(); GroupPoints->LineEdit3->show(); + GroupPoints->PushButton1->click(); + break; + case 2: + GroupPoints->hide(); + GroupMakePoints->show(); + GroupMakePoints->PushButton1->click(); break; default: break; @@ -224,7 +267,7 @@ bool GenerationGUI_PipeDlg::ClickOnApply() if ( getConstructorId() != 1 ) ConstructorsClicked( getConstructorId() ); // activate selection and connect selection manager - GroupPoints->PushButton1->click(); + // GroupPoints->PushButton1->click(); return true; } @@ -277,6 +320,43 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() GroupPoints->PushButton2->click(); } } + else if ( myEditCurrentArgument == GroupMakePoints->LineEdit1 ) { + myBaseObjects.clear(); + QList objects = getSelected( TopAbs_SHAPE, -1 ); + for ( int i = 0; i < objects.count(); i++ ) { + GEOM::shape_type stype = objects[i]->GetMaxShapeType(); + if ( stype < GEOM::SHELL || stype > GEOM::VERTEX ) + continue; + myBaseObjects << objects[i]; + } + if ( !myBaseObjects.isEmpty() ) { + QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() ); + myEditCurrentArgument->setText( aName ); + } + } + else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) { + myLocations.clear(); + QList objects = getSelected( TopAbs_SHAPE, -1 ); + for ( int i = 0; i < objects.count(); i++ ) { + GEOM::shape_type stype = objects[i]->GetMaxShapeType(); + if ( stype < GEOM::SHELL || stype > GEOM::VERTEX ) + continue; + myLocations << objects[i]; + } + if ( !myLocations.isEmpty() ) { + QString aName = myLocations.count() > 1 ? QString( "%1_objects").arg( myLocations.count() ) : GEOMBase::GetName( myLocations[0].get() ); + myEditCurrentArgument->setText( aName ); + } + } + else if ( myEditCurrentArgument == GroupMakePoints->LineEdit3 ) { + QList types; + types << TopAbs_EDGE << TopAbs_WIRE; + myPath = getSelected( types ); + if ( myPath ) { + QString aName = GEOMBase::GetName( myPath.get() ); + myEditCurrentArgument->setText( aName ); + } + } processPreview(); } @@ -320,6 +400,23 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() GroupPoints->CheckButton1->setEnabled(false); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); } + + GroupMakePoints->PushButton1->setDown(false); + GroupMakePoints->PushButton2->setDown(false); + GroupMakePoints->PushButton3->setDown(false); + GroupMakePoints->LineEdit1->setEnabled(false); + GroupMakePoints->LineEdit2->setEnabled(false); + GroupMakePoints->LineEdit3->setEnabled(false); + if (send == GroupMakePoints->PushButton1) { + myEditCurrentArgument = GroupMakePoints->LineEdit1; + } + else if(send == GroupMakePoints->PushButton2) { + myEditCurrentArgument = GroupMakePoints->LineEdit2; + } + else if (send == GroupMakePoints->PushButton3) { + myEditCurrentArgument = GroupMakePoints->LineEdit3; + } + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -379,6 +476,9 @@ bool GenerationGUI_PipeDlg::isValid (QString&) case 1 : ok = !myBaseObjects.isEmpty() && myPath && myVec; break; + case 2 : + ok = !myBaseObjects.isEmpty() && ( myLocations.isEmpty() || myBaseObjects.count() == myLocations.count() ) && myPath; + break; default: break; } @@ -394,19 +494,41 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); - - for (int i = 0; i < myBaseObjects.count(); i++) { - switch ( getConstructorId() ) { - case 0 : - anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get()); - break; - case 1 : - anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get()); - break; - } + switch( getConstructorId() ) { + case 0: + case 1: + for (int i = 0; i < myBaseObjects.count(); i++) { + switch ( getConstructorId() ) { + case 0 : + anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get()); + break; + case 1 : + anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get()); + break; + } + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + } + break; + case 2: + GEOM::ListOfGO_var myBaseGO = new GEOM::ListOfGO(); + GEOM::ListOfGO_var myLocationsGO = new GEOM::ListOfGO(); + myBaseGO->length( myBaseObjects.count() ); + myLocationsGO->length( myLocations.count() ); + for (int i = 0; i < myBaseObjects.count(); i++) { + myBaseGO[i] = myBaseObjects[i].copy(); + } + for (int i = 0; i < myLocations.count(); i++) { + myLocationsGO[i] = myLocations[i].copy(); + } + + anObj = anOper->MakePipeWithDifferentSections(myBaseGO.in(), myLocationsGO.in(), myPath.get(), GroupMakePoints->CheckBox1->isChecked(), GroupMakePoints->CheckBox2->isChecked()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); + break; + default: + break; } return true; } diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index c776cc359..c6a263e70 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -31,6 +31,7 @@ #include "GEOM_GenericObjPtr.h" class DlgRef_3Sel1Check; +class DlgRef_3Sel2Check3Spin; //================================================================================= // class : GenerationGUI_PipeDlg @@ -60,8 +61,10 @@ private: QList myBaseObjects; /* Base shapes */ GEOM::GeomObjPtr myPath; /* Shape, defining the path */ GEOM::GeomObjPtr myVec; /* Vector, defining the constant binormal direction */ + QList myLocations; /* Locations on the path corresponding specified list of the Base shapes */ DlgRef_3Sel1Check* GroupPoints; + DlgRef_3Sel2Check3Spin* GroupMakePoints; private slots: void ClickOnOk();