X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ExtrusionAlongPathDlg.cxx;h=60e014794ccdb9adcd37475501b8b22d099b496f;hb=c3e2a7b12ebefec0110115c2a571d809d6097d3d;hp=3e84be424a3d3c3957d164cdae29aa3ea8ff6ab5;hpb=b33324fe602b1fe1158c14a866c3802df12370fa;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index 3e84be424..60e014794 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -48,6 +48,9 @@ #include "SUIT_OverrideCursor.h" #include "SUIT_Desktop.h" #include "SUIT_MessageBox.h" +#include "SUIT_Session.h" + +#include "LightApp_Application.h" #include "SVTK_ViewModel.h" #include "SVTK_ViewWindow.h" @@ -85,6 +88,7 @@ // IDL Headers #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(SMESH_Group) +#include CORBA_SERVER_HEADER(SMESH_MeshEditor) using namespace std; @@ -216,10 +220,13 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod SelectBasePointButton->setPixmap(selectImage); XLab = new QLabel(tr("SMESH_X"), BasePointGrp); + XLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); XSpin = new SMESHGUI_SpinBox(BasePointGrp); YLab = new QLabel(tr("SMESH_Y"), BasePointGrp); + YLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); YSpin = new SMESHGUI_SpinBox(BasePointGrp); ZLab = new QLabel(tr("SMESH_Z"), BasePointGrp); + ZLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); ZSpin = new SMESHGUI_SpinBox(BasePointGrp); // layouting @@ -252,6 +259,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod AngleSpin = new SMESHGUI_SpinBox(AnglesGrp); + LinearAnglesCheck = new QCheckBox(tr("LINEAR_ANGLES"), AnglesGrp); + // layouting QVBoxLayout* bLayout = new QVBoxLayout(); bLayout->addWidget(AddAngleButton); @@ -261,8 +270,13 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod AnglesGrpLayout->addMultiCellWidget(AnglesList, 0, 1, 0, 0); AnglesGrpLayout->addMultiCellLayout(bLayout, 0, 1, 1, 1); AnglesGrpLayout->addWidget( AngleSpin, 0, 2 ); + AnglesGrpLayout->addWidget( LinearAnglesCheck, 2, 0 ); AnglesGrpLayout->setRowStretch(1, 10); + // CheckBox for groups generation + MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); + MakeGroupsCheck->setChecked(true); + // layouting GroupArgumentsLayout->addWidget( ElementsLab, 0, 0 ); GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 ); @@ -273,6 +287,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod GroupArgumentsLayout->addMultiCellWidget(BasePointGrp, 3, 4, 1, 2); GroupArgumentsLayout->addWidget( AnglesCheck, 5, 0 ); GroupArgumentsLayout->addMultiCellWidget(AnglesGrp, 5, 6, 1, 2); + GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 7, 7, 0, 2); GroupArgumentsLayout->setRowStretch(6, 10); /***************************************************************/ @@ -285,7 +300,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod GroupButtonsLayout->setAlignment(Qt::AlignTop); GroupButtonsLayout->setSpacing(6); GroupButtonsLayout->setMargin(11); - OkButton = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + OkButton = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); OkButton->setAutoDefault(true); OkButton->setDefault(true); @@ -295,10 +310,14 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod CloseButton = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); CloseButton->setAutoDefault(true); + HelpButton = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + HelpButton->setAutoDefault(true); + // layouting GroupButtonsLayout->addWidget(OkButton, 0, 0); GroupButtonsLayout->addWidget(ApplyButton, 0, 1); GroupButtonsLayout->addWidget(CloseButton, 0, 3); + GroupButtonsLayout->addWidget(HelpButton, 0, 4); GroupButtonsLayout->addColSpacing(2, 10); GroupButtonsLayout->setColStretch(2, 10); @@ -310,10 +329,10 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod /***************************************************************/ // Initialisations - XSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); - YSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); - ZSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); - AngleSpin->RangeStepAndValidator(-999999.999, +999999.999, 5.0, 3); + XSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); + YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); + ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); + AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, 3); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -330,6 +349,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR); myPathMeshFilter = new SMESH_TypeFilter (MESH); + myHelpFileName = "extrusion_along_path_page.html"; + Init(); /***************************************************************/ @@ -337,6 +358,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod connect(OkButton, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(CloseButton, SIGNAL(clicked()), this, SLOT(reject())); connect(ApplyButton, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(HelpButton, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleAdded())); connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved())); @@ -370,10 +392,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod ZSpin->editor()->installEventFilter(this); /***************************************************************/ - // set position and show dialog box - int x, y; - mySMESHGUI->DefineDlgPosition(this, x, y); - this->move(x, y); + this->show(); // displays Dialog } @@ -588,10 +607,21 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() try { SUIT_OverrideCursor wc; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - SMESH::SMESH_MeshEditor::Extrusion_Error retVal = - aMeshEditor->ExtrusionAlongPath(anElementsId.inout(), myPathMesh, myPathShape, aNodeStart, - AnglesCheck->isChecked(), anAngles.inout(), - BasePointCheck->isChecked(), aBasePoint); + if ( LinearAnglesCheck->isChecked() ) + anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles ); + + SMESH::SMESH_MeshEditor::Extrusion_Error retVal; + if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) + SMESH::ListOfGroups_var groups = + aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh, + myPathShape, aNodeStart, + AnglesCheck->isChecked(), anAngles, + BasePointCheck->isChecked(), aBasePoint, retVal); + else + retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh, + myPathShape, aNodeStart, + AnglesCheck->isChecked(), anAngles, + BasePointCheck->isChecked(), aBasePoint); //wc.stop(); wc.suspend(); @@ -639,8 +669,11 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() return false; } - mySelectionMgr->clearSelected(); - SMESH::UpdateView(); + //mySelectionMgr->clearSelected(); + SMESH::Update( myMeshActor->getIO(), myMeshActor->GetVisibility() ); + if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) + mySMESHGUI->updateObjBrowser(true); // new groups may appear + //SMESH::UpdateView(); Init(false); ConstructorsClicked(GetConstructorId()); return true; @@ -656,6 +689,29 @@ void SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk() reject(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void SMESHGUI_ExtrusionAlongPathDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} + //================================================================================= // function : reject() // purpose : Called when dialog box is closed @@ -664,7 +720,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); - mySelectionMgr->clearSelected(); + //mySelectionMgr->clearSelected(); SMESH::SetPickable(); // ??? SMESH::SetPointRepresentation(false); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) @@ -790,6 +846,14 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument() myMesh = SMESH::GetMeshByIO(IO); if (myMesh->_is_nil()) return; + + // MakeGroups is available if there are groups + if ( myMesh->NbGroups() == 0 ) { + MakeGroupsCheck->setChecked(false); + MakeGroupsCheck->setEnabled(false); + } else { + MakeGroupsCheck->setEnabled(true); + } // find actor myMeshActor = SMESH::FindActorByObject(myMesh); if (!myMeshActor) @@ -808,7 +872,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument() // try to get selected elements IDs QString aString; //int aNbUnits = SMESH::GetNameOfSelectedElements(mySelectionMgr, aString); - SMESH::GetNameOfSelectedElements(mySelector, myMeshActor->getIO(), aString); + SMESH::GetNameOfSelectedElements(mySelector, IO, aString); ElementsLineEdit->setText(aString); } } else if (myEditCurrentArgument == PathMeshLineEdit) { @@ -861,8 +925,12 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument() // try to get shape from selection Handle(SALOME_InteractiveObject) IO = aList.First(); + SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh); + if ( !aPathActor ) + return; + QString aString; - int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myMeshActor->getIO(), aString); + int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aPathActor->getIO(), aString); if (aNbUnits == 1) StartPointLineEdit->setText(aString.stripWhiteSpace()); @@ -1167,3 +1235,20 @@ bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter (QObject* object, QEvent* event } return QDialog::eventFilter(object, event); } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + ClickOnHelp(); + } +}