X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ExtrusionDlg.cxx;h=54c18157e8d3d2d1a33d3ca9629c2aa7502eed55;hb=7c801b5b44daa3f75666ecfae8079588aa6f7a48;hp=4c591781a7f494470a0b9878fd6e6980dea21e54;hpb=a0e4f31fde7b677d2c9378d96fb43c1d423e4400;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 4c591781a..54c18157e 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -280,15 +280,22 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) mySMESHGUI->SetActiveDialogBox(this); // Costruction of the logical filter for the elements: mesh/sub-mesh/group - SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); - SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QList aListOfFilters; - if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); - if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); - - myMeshOrSubMeshOrGroupFilter = - new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR); + aListOfFilters.append(new SMESH_TypeFilter (SMESH::MESH)); + aListOfFilters.append(new SMESH_TypeFilter (SMESH::SUBMESH_VERTEX)); + aListOfFilters.append(new SMESH_TypeFilter (SMESH::GROUP_NODE)); + myMeshOrSubMeshOrGroupFilter0D = + new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true); + aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH); + aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_EDGE); + aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_EDGE); + myMeshOrSubMeshOrGroupFilter1D = + new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true); + aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH); + aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_FACE); + aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_FACE); + myMeshOrSubMeshOrGroupFilter2D = + new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true); myHelpFileName = "extrusion_page.html"; @@ -351,6 +358,9 @@ SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg() myFilterDlg->setParent( 0 ); delete myFilterDlg; } + if ( myMeshOrSubMeshOrGroupFilter0D ) delete myMeshOrSubMeshOrGroupFilter0D; + if ( myMeshOrSubMeshOrGroupFilter1D ) delete myMeshOrSubMeshOrGroupFilter1D; + if ( myMeshOrSubMeshOrGroupFilter2D ) delete myMeshOrSubMeshOrGroupFilter2D; } //================================================================================= @@ -429,6 +439,8 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId) hidePreview(); + TextLabelElements->setText(tr( constructorId ? "SMESH_ID_ELEMENTS" : "SMESH_ID_NODES")); + switch (constructorId) { case 0: { @@ -552,10 +564,11 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() aParameters << SpinBox_Dy->text(); aParameters << SpinBox_Dz->text(); } else if ( RadioButton4->isChecked() ) { - aParameters << SpinBox_Vx->text(); - aParameters << SpinBox_Vy->text(); - aParameters << SpinBox_Vz->text(); - aParameters << SpinBox_VDist->text(); + // only 3 coords in a python dump command :( + // aParameters << SpinBox_Vx->text(); + // aParameters << SpinBox_Vy->text(); + // aParameters << SpinBox_Vz->text(); + // aParameters << SpinBox_VDist->text(); } long aNbSteps = (long)SpinBox_NbSteps->value(); @@ -566,6 +579,8 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) { if( CheckBoxMesh->isChecked() ) switch (GetConstructorId() ) { @@ -624,8 +639,6 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps); } - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); - } catch (...) { } @@ -724,7 +737,7 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText) { SMESHType = SMESH::EDGE; SMDSType = SMDSAbs_Edge; - break; + break; } case 2: { @@ -741,7 +754,11 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText) bool validId = false; if ( id > 0 ) { if ( aMesh ) { - const SMDS_MeshElement * e = aMesh->FindElement( id ); + const SMDS_MeshElement * e; + if (SMDSType == SMDSAbs_Node) + e = aMesh->FindNode( id ); + else + e = aMesh->FindElement( id ); validId = ( e && e->GetType() == SMDSType ); } else { validId = ( myMesh->GetElementType( id, true ) == SMESHType ); @@ -891,31 +908,38 @@ void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument() if (send == SelectElementsButton) { myEditCurrentArgument = (QWidget*)LineEditElements; - if (CheckBoxMesh->isChecked()) { + if (CheckBoxMesh->isChecked()) + { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); - mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); - } else { + switch( GetConstructorId() ) { + case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break; + case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break; + case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break; + } + } + else + { int aConstructorId = GetConstructorId(); switch(aConstructorId) { - case 0: - { - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(NodeSelection); - break; - } - case 1: - { - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(EdgeSelection); - break; - } - case 2: - { - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + case 0: + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); + break; + } + case 1: + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeSelection); + break; + } + case 2: + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(FaceSelection); - break; - } + break; + } } } } @@ -1021,13 +1045,20 @@ void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh) mySelectionMgr->clearFilters(); - if (toSelectMesh) { + if (toSelectMesh) + { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); - mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); + switch( GetConstructorId() ) { + case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break; + case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break; + case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break; + } LineEditElements->setReadOnly(true); LineEditElements->setValidator(0); - } else { + } + else + { int aConstructorId = GetConstructorId(); switch(aConstructorId) { case 0: @@ -1183,17 +1214,17 @@ void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview ) { case 0: { aMeshEditor->ExtrusionSweepObject0D(mySelectedObject, aVector, aNbSteps); - break; + break; } case 1: { aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps); - break; + break; } case 2: { aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps); - break; + break; } } } @@ -1232,7 +1263,7 @@ void SMESHGUI_ExtrusionDlg::getExtrusionVector(SMESH::DirStruct& aVector) { aNormale /= aNormale.Modulus(); - long aVDist = (long)SpinBox_VDist->value(); + double aVDist = (double)SpinBox_VDist->value(); aVector.PS.x = aNormale.X()*aVDist; aVector.PS.y = aNormale.Y()*aVDist;