X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_CreatePolyhedralVolumeDlg.cxx;h=146ae2d13870e90dc23dfc2746f4adef3c2fd9d6;hp=ffc22ecdbfdd9631aecb99e61681edf005265ee6;hb=6d32f944a0a115b6419184c50b57bf7c4eef5786;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index ffc22ecdb..146ae2d13 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2019 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 @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -49,6 +49,8 @@ #include #include +#include "utilities.h" + #include // OCCT includes @@ -106,7 +108,7 @@ namespace SMESH // Create and display actor myMapper = vtkDataSetMapper::New(); - myMapper->SetInput( myGrid ); + myMapper->SetInputData( myGrid ); myPreviewActor = SALOME_Actor::New(); myPreviewActor->PickableOff(); @@ -114,12 +116,12 @@ namespace SMESH myPreviewActor->SetMapper( myMapper ); myPreviewActor->SetRepresentation( 3 ); - vtkFloatingPointType anRGB[3]; + double anRGB[3]; vtkProperty* aProp = vtkProperty::New(); GetColor( "SMESH", "selection_element_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) ); aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myPreviewActor->SetProperty( aProp ); - vtkFloatingPointType aFactor,aUnits; + double aFactor,aUnits; myPreviewActor->SetResolveCoincidentTopology(true); myPreviewActor->GetPolygonOffsetParameters(aFactor,aUnits); myPreviewActor->SetPolygonOffsetParameters(aFactor,0.2*aUnits); @@ -300,7 +302,7 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI mySMESHGUI->SetActiveDialogBox( (QDialog*)this ); - myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor"; + myHelpFileName = "adding_nodes_and_elements.html#adding-polyhedrons-anchor"; Init(); } @@ -335,7 +337,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL( clicked() ), SLOT( ClickOnOk() ) ); - connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ); + connect(buttonCancel, SIGNAL( clicked() ), SLOT( reject() ) ); connect(buttonApply, SIGNAL( clicked() ), SLOT( ClickOnApply() ) ); connect(buttonHelp, SIGNAL( clicked() ), SLOT( ClickOnHelp() ) ); @@ -351,8 +353,9 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::Init() connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( Preview, SIGNAL(toggled(bool)), this, SLOT(ClickOnPreview(bool))); /* to close dialog if study change */ - connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( reject() ) ); + connect( mySMESHGUI, SIGNAL ( SignalActivatedViewManager() ), this, SLOT( onOpenView() ) ); + connect( mySMESHGUI, SIGNAL ( SignalCloseView() ), this, SLOT( onCloseView() ) ); ConstructorsClicked(0); SelectionIntoArgument(); } @@ -445,7 +448,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply() if( !isValid() ) return; - if ( myNbOkElements>0 && !mySMESHGUI->isActiveStudyLocked()) + if ( myNbOkElements>0 && !SMESHGUI::isStudyLocked()) { if(checkEditLine(false) == -1) {return;} busy = true; @@ -458,12 +461,12 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply() int idx = 0; if( addToGroup ) { aGroupName = ComboBox_GroupName->currentText(); - for ( int i = 1; i < ComboBox_GroupName->count(); i++ ) { + for ( int i = 1; i <= ComboBox_GroupName->count(); i++ ) { QString aName = ComboBox_GroupName->itemText( i ); if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) idx = i; } - if ( idx > 0 && idx < myGroups.count() ) { + if ( idx > 0 && idx <= myGroups.count() ) { SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); if ( !aGeomGroup->_is_nil() ) { int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), @@ -589,15 +592,15 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnOk() { if(checkEditLine(false) == -1) {return;} ClickOnApply(); - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel() +void SMESHGUI_CreatePolyhedralVolumeDlg::reject() { mySelectionMgr->clearFilters(); //SALOME_ListIO aList; @@ -608,7 +611,37 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel() aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); +} + +//================================================================================= +// function : onOpenView() +// purpose : +//================================================================================= +void SMESHGUI_CreatePolyhedralVolumeDlg::onOpenView() +{ + if ( mySelector && mySimulation ) { + mySimulation->SetVisibility(false); + SMESH::SetPointRepresentation(false); + } + else { + mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector(); + mySimulation = new SMESH::TPolySimulation( + dynamic_cast( mySMESHGUI->application() ) ); + ActivateThisDialog(); + } +} + +//================================================================================= +// function : onCloseView() +// purpose : +//================================================================================= +void SMESHGUI_CreatePolyhedralVolumeDlg::onCloseView() +{ + DeactivateActiveDialog(); + mySelector = 0; + delete mySimulation; + mySimulation = 0; } //================================================================================= @@ -684,7 +717,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText) buttonOk->setEnabled( false ); buttonApply->setEnabled( false ); - // check entered ids of faces and hilight them + // check entered ids of faces and highlight them QStringList aListId; if ( aMesh ) { TColStd_MapOfInteger newIndices; @@ -1025,42 +1058,23 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ActivateThisDialog() SelectionIntoArgument(); } - //================================================================================= // function : enterEvent() // purpose : //================================================================================= -void SMESHGUI_CreatePolyhedralVolumeDlg::enterEvent(QEvent* e) -{ - if ( ConstructorsBox->isEnabled() ) - return; - ActivateThisDialog(); -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_CreatePolyhedralVolumeDlg::closeEvent( QCloseEvent* e ) +void SMESHGUI_CreatePolyhedralVolumeDlg::enterEvent (QEvent*) { - /* same than click on cancel button */ - ClickOnCancel(); -} - - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= - -void SMESHGUI_CreatePolyhedralVolumeDlg::hideEvent ( QHideEvent * e ) -{ - if ( !isMinimized() ) - ClickOnCancel(); + if ( !ConstructorsBox->isEnabled() ) { + SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ); + if ( aViewWindow && !mySelector && !mySimulation) { + mySelector = aViewWindow->GetSelector(); + mySimulation = new SMESH::TPolySimulation( + dynamic_cast( mySMESHGUI->application() ) ); + } + ActivateThisDialog(); + } } - //================================================================================= // function : GetConstructorId() // purpose :